# Why does command window say “use of \end does not match definition”?

Having successfully compiled about 200 files for my website www.earlymoderntexts.com, I have run into four that won't compile, and I can't find out why. With each of them, the command window's complaints start with "use of \end doesn't match its definition", and I am bewildered by this; I can't find anything unusual in the use of \end in these files. Can someone help me? A plea from an 87-year-old retired philosophy professor!

• Without seeing some code, there is not much that can be said. – Steven B. Segletes Nov 1 '17 at 18:31
• you have something that has redefined \end add \show\end to your document then tex will stop and show the definition, as if for an error message. add the message from the log file to your question and someone can help... – David Carlisle Nov 1 '17 at 18:31
• Welcome to TeX.SX! – Skillmon Nov 1 '17 at 18:37
• Welcome to TeX.SX!! Can you please try and cut down one of your files to a minimal working example. A MWE should start with a \documentclass command, have a minimal preamble and then \begin{document}...\end{document}. The code should be as small as possible to demonstrate your problem. If you start with one of the problematic files, make a copy, and then keep deleting things until the problem goes away. This way you can home in on the real problem and produce a MWE and some one might be able to help. – Andrew Nov 1 '17 at 18:42
• @DavidCarlisle That being the case, I deleted my comments, so as to not distract from the question. – user139954 Nov 2 '17 at 0:55

You should not look at the use of \end within the document but at a (probably accidental) redefinition of it, perhaps in the preamble.

For example this document produces the error shown

\documentclass{article}

\def\end oops{}

\begin{document}

\begin{quote}
zzzz
\end{quote}
\end{document}


with error:

! Use of \end doesn't match its definition.
l.10 \end{
quote}
?


The use of \end \end{quote} and \end{document} look OK but \end has been redefined in a way that it must always be followed by oops.

To see this (assuming the redefinition is in some package code) modify the docuemnt as follows:

\show\end

\documentclass{article}

\show\end

\def\end oops{}

\show\end

\begin{document}

\begin{quote}
zzzz
\end{quote}
\end{document}


Now the log shows:

LaTeX2e <2017-04-15>
Babel <3.14> and hyphenation patterns for 84 language(s) loaded.
> \end=macro:
#1->\csname end#1\endcsname \@checkend {#1}\expandafter \endgroup \if@endpe \@d
oendpe \fi \if@ignore \@ignorefalse \ignorespaces \fi .
l.2 \show\end

?
(/usr/local/texlive/2017/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/local/texlive/2017/texmf-dist/tex/latex/base/size10.clo))
> \end=macro:
#1->\csname end#1\endcsname \@checkend {#1}\expandafter \endgroup \if@endpe \@d
oendpe \fi \if@ignore \@ignorefalse \ignorespaces \fi .
l.6 \show\end

?
> \end=macro:
oops->.
l.10 \show\end

?

! Use of \end doesn't match its definition.
l.17 \end{
quote}
?


Which tells you that \end had its normal definition on lines 2 and 6 but on line 10 it had a changed definition.

By adding a few \show\end in your document you should be able to find at what point \end got changed.