# How can I distinguish between error in code and bug in package? [closed]

I keep getting an error upon compilation, but cannot find an error, even with a tiny reproducible example (below). I am exporting from Emacs org-mode to LaTeX and then PDF, I am receiving the well known error message:

(\end occurred inside a group at level 1)

### simple group (level 1) entered at line 1061 ({)
### bottom level


The issue is that line 1061 is stated as the problem, regardless of the length of my org-file and the actual .tex file. I can reproduce the error with the following part of code, down to which I have narrowed the problem. The intermediary .tex file being only 56 lines long and the error message persisting as above!

I cannot find any errors (at least regarding syntax!). Here it is in directly from the LaTeX source that is compiled:

\begin{document}

\maketitle
\tableofcontents

\begin{algorithm}[H]
\KwIn{input}
\Repeat{something} {
scroll to bottom of page\;
}
\caption{a caption}
\end{algorithm}
\end{document}


And here it is in the org file (no errors are produced from org mode to .tex file, only at the compilation stage, exporting to PDF):

#+latex_header: \usepackage[linesnumbered,ruled,lined,end]{algorithm2e}
#+begin_src latex
\begin{algorithm}[H]
\KwIn{input}
\Repeat{something} {
scroll to bottom of page\;
}
\Return{something else}
\caption{a caption}
\end{algorithm}
#+end_src


I have tried removing all the options specified in the #+latex-header, but that didn't make a difference - same error message pointing to line 1061.

The PDF output actually looks ok (Emacs at least doesn't halt the export procedure), which I apologise for if you have read this far - but the error messages are bugging me.

Could this be a bug in the {algorithm2e} package? How can I get to the root of this?

## Edit 1:

I just found a mailing list where somebody mentions the error (only last week) and the next update of TexLive on Debian should fix it. I am not on Debian though... will a fix still work for me using TeX on OSX?

• Can you repeat it with just the {algorithm} environment you have (inserted in a MWE)? It sounds like you have an extra \end{stuff} in your exported document. Mar 17 '16 at 15:12
• First of all as Sean mentions, please post a full example such that users can test this. I just had one in a manuscript where the author had forgotten a { in the text. Mar 17 '16 at 15:16
• @DexterMorgan Please, make it into a compilable example. Not everybody uses Org mode. I don't, for instance. Mar 17 '16 at 15:22
• I'm not sure what you mean by "included everything from the tex" the tex you show has no \documentclass line at the start so will generate errors if anyone tries to test it. Mar 17 '16 at 16:08
• I'm voting to close this question as off-topic because this is a bug in a package already reported. Apr 21 '16 at 8:08