10

I just removed the default Ubuntu TexLive 2009 installation and installed TexLive 2011 using install-tl. However, now I am facing problems with the amsart and algorithm2e packages. Specifically, when I compile a file with the following text:

\documentclass[twoside]{amsart}
\usepackage{algorithm2e}
\begin{document} 
   This is a test document.
\end{document}

rather than

\documentclass{article}
\usepackage{algorithm2e}
\begin{document} 
   This is a test document.
\end{document}

then the PDF output produced by pdflatex (or the dvi output produced by latex) contains the following text on the first page (and half of the first page disappears: it is as if this text pushes everything on the first page down).

La-TeX Error:Missing document See the LaTeX manual or LaTeX Companion for >explanation.You’re in trouble here. Try typing ¡re-turn¿ to proceed.If that doesn’t work, type X ¡return¿ to quit.1111111

This text disappears if I use the article style instead, or if I remove the algorithm2e package with amsart. Notice that this text does not appear as a console error message: the compilation shows no errors. This actually occurs at the top of the first page of the output pdf (or dvi) file. In fact, although I put the message in a more human readable form above, it actually contains several line breaks in between words; in particular, almost all the hyphens in the output above are followed by a line break.

Is this a documented problem with TexLive? What could be the reasons for this happening? Is there a workaround?

Piyush
  • 421
  • 2
  • 8
  • Welcome to TeX.SE. It is always best to compose a MWE that illustrates the problem including the \documentclass so that those trying to help don't have to recreate it. – Peter Grill Oct 09 '11 at 03:58
  • Do you perhaps have any .aux files from a previous run? Try deleting those and rerunning. – Peter Grill Oct 09 '11 at 04:00
  • Hi Peter Grill, Thanks for your advice. I had tried deleting the aux files before, and that does not work. However, in trying to create an MWE, I think I isolated the cause of the problem. The Text I quoted above appears only when I use the algorithm2e package. I am editing the question to reflect this. – Piyush Oct 09 '11 at 04:09
  • Great. Often problems can be solved as you create a MWE. Remove all the code you can which still exhibits the problem and it will be easier to help you. – Peter Grill Oct 09 '11 at 04:11
  • I added the minimal amount of code with which I can produce the error to the question. Thanks. – Piyush Oct 09 '11 at 04:15
  • Just tried your amsart version and it compiles for me. Are you perhaps also loading natbib (as that has to be loaded before the algorithm2e package). – Peter Grill Oct 09 '11 at 04:15
  • No I am not loading natbib. I compiled a file with exactly the text in my amsart example. It compiled without error, but the PDF output contained an error message. The article example, or the amsart example with the algorithm2e package removed produces correct output. Also, I thing I did not emphasize enough that this problem was not present in Texlive 2009 (which ships with Ubuntu) and it occurred only when I shifted to Texlive 2011. – Piyush Oct 09 '11 at 04:16
  • "...amsart example with the algorithm2e..." in my post above should be "...amsart example without the algorithm2e..." – Piyush Oct 09 '11 at 04:24
  • Yes, BOTH your examples compile fine for me. But, I am not on Ubuntu. – Peter Grill Oct 09 '11 at 04:32
  • This problem is not just specific to Ubuntu, nor using the twoside documentclass option; similar problem on Windows for me. – Werner Oct 09 '11 at 04:32

2 Answers2

10

The problem here is that algorithm2e, from v4.00 started using the relsize package to scale the size of the algorithm line numbers. However, this clashes with some document class, as stated in the release notes for algorithm2e:

OPTION norelsize: Starting from this release (v4.00), algorithm2e package uses relsize package in order to get relative size for lines numbers; but it seems that some rare classes (such as inform1.cls) are not compatible with relsize; to have algorithm2e working, this option makes algorithm2e not to load relsize package and go back to previous definition by using \scriptsize font for lines numbers.

This seems to also clash with amsart. However, this is fixed using the above package option:

\documentclass[twoside]{amsart}
\usepackage[norelsize]{algorithm2e}% http://ctan.org/pkg/algorithm2e
\begin{document} 
   This is a test document.
\end{document}
Werner
  • 603,163
  • Thanks Werner. I actually changed my algorithm code (There was not much of it) to algorithmicx (which is apparently newer) and it compiled. I hope your reply would be useful for others though (searching for "algorithm2e and amsart" on Google brings this reply up as the first link :). – Piyush Oct 09 '11 at 04:46
0

When using TexLive 2011 (on the arXiv) with amsart, I had the same error message:

LaTeX Error: Missing document See the La- TeX manual or LaTeX Companion for explanation.You’re in trouble here. Try typing return to pro- ceed.If that doesn’t work, type X return to quit.

and half of the first page disappeared.

Removing the line

\usepackage{relsize}

solved the problem.

(The problem didn't show up with TexLive 2009, and has been fixed with TexLive 2013.)

Pittet
  • 1