% % Copyright (C) 2002-2019 Javier Bezos http://www.texnia.com % % This file may be distributed and/or modified under the conditions of % the MIT License. A version can be found at the end of this file. % % Usage % ~~~~~ % When an environment is left open, LaTeX gives an error at the % end of the document. However it only informs about the first % of them, while the rest are shown with meaningless errors: % % (\end occurred inside a group at level N) % % This package replaces them with more useful messages % which show which environments (in reverse order) were % not closed. % % That's all. There are no user macros. Just use the package. % % Code % ~~~~ \def\fileversion{1.1} \def\filedate{2002/04/20} \ProvidesPackage{checkend}[2002/04/20 v1.0 Environment checking] \def\chkend@checkend{% \def\@tempa{document}% \ifx\@currenvir\@tempa \else \count@\errorcontextlines \errorcontextlines\z@ \PackageError{checkend}{% \@currenvir \@currenvline \space open at \string\end{document}}% {The package has detected an open environment at the end\MessageBreak of the document}% \errorcontextlines\count@ \csname end\@currenvir\endcsname \endgroup \chkend@checkend \fi} \AtEndDocument{\chkend@checkend} \endinput MIT License ----------- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.