I have an external .tex file that stores all of my custom commands, and I also wanted that .tex file to include \newtheorem lines. The structure of this input file is of the form:

\newcommand{\im}{\text{im}} \
\newcommand{\id}{\text{id}} \
\newcommand{\rref}{\text{rref}} \
\newtheorem{axiom}{Axiom} \
\newtheorem{lemma}{Lemma} \


I'm not sure if my syntax is correct, but all of my \newtheorem lines are of that form. When I import the external .tex file everything works except the \newtheorem{} components. An error pops up stating:

"Undefined control sequence. LaTeX error: Missing \begin{document}."

  • 2
    Welcome to SE. It's going to be difficult to suggest anything if you neither show the code nor show the exact error message. Please always provide a Minimal Working Example.
    – Miyase
    Jun 21, 2022 at 21:42
  • The line before "Undefined control sequence" will end with the undefined control sequence. It's possibly the backslash-endofline, which you shouldn't have.
    – Teepeemm
    Jun 21, 2022 at 21:53
  • 1
    If command1, etc., are meant literally to correspond to \command1, etc., that ordinarily conflicts with the rules for command names, which can contain only letters, nothing non-alphabetic like digits. Jun 21, 2022 at 22:54


You must log in to answer this question.

Browse other questions tagged .