Login Register
Back to Help Center

Begin Document Validator

Understand why \begin{document} is not allowed at the start of your LaTeX file and how to fix it.

What It Does

The Begin Document Validator checks whether your LaTeX file starts with a \begin{document} environment. In the context of Kattis problem statements, the \begin{document} and \end{document} wrappers should be omitted — the system handles this automatically when compiling.

When This Error Occurs

You will see this error if the very first node in your LaTeX file is a \begin{document} environment:

\begin{document} found at the beginning of the document.

This typically happens when you copy a full LaTeX document (including the preamble and document wrapper) instead of providing only the content body.

How to Fix It

Remove the \begin{document} and \end{document} lines from your file. Your LaTeX file should contain only the content — no preamble, no document environment wrapper.

Before (incorrect):

\begin{document}
This is my problem statement.
\end{document}

After (correct):

This is my problem statement.

Further Reading

For more details on the expected format, see the Kattis Problem Package Format specification.