My code:
\documentclass{article}
\usepackage{amsmath}
\usepackage{verbatim}
\begin{document}
\begin{align}
1 + 1 & = 2 \\
e^{i \pi} + 1 & = 0
\begin{comment}
comment
\end{comment}
\end{align}
\end{document}
Error I get:
$ pdflatex foo.tex
This is pdfTeX, Version 3.14159265-2.6-1.40.21 (TeX Live 2020) (preloaded format=pdflatex)
restricted \write18 enabled.
entering extended mode
(./foo.tex
LaTeX2e <2020-02-02> patch level 5
L3 programming layer <2020-03-06>
(/usr/local/texlive/2020basic/texmf-dist/tex/latex/base/article.cls
Document Class: article 2019/12/20 v1.4l Standard LaTeX document class
(/usr/local/texlive/2020basic/texmf-dist/tex/latex/base/size10.clo))
(/usr/local/texlive/2020basic/texmf-dist/tex/latex/amsmath/amsmath.sty
For additional information on amsmath, use the `?' option.
(/usr/local/texlive/2020basic/texmf-dist/tex/latex/amsmath/amstext.sty
(/usr/local/texlive/2020basic/texmf-dist/tex/latex/amsmath/amsgen.sty))
(/usr/local/texlive/2020basic/texmf-dist/tex/latex/amsmath/amsbsy.sty)
(/usr/local/texlive/2020basic/texmf-dist/tex/latex/amsmath/amsopn.sty))
(/usr/local/texlive/2020basic/texmf-dist/tex/latex/tools/verbatim.sty)
(/usr/local/texlive/2020basic/texmf-dist/tex/latex/l3backend/l3backend-pdfmode.
def) (./foo.aux)
! Argument of \verbatim@ has an extra }.
<inserted text>
\par
l.11 \end{align}
?
- Why can't I use the
comment
environment inside thealign
environment? - How can I put a multi-line comment block inside
align
environment?
align
and other multi-line displaymath environments operate in a two-stage process: Stage 1 serves to measure various things and to figure out which alignment points fit together across rows. Only in stage 2 do all things come together in the form of typeset output. Processing of non-math material during stage 1 is very limited. The presence of\begin{comment}
completely wrecksalign
's stage-1 operations, mainly because it doesn't process\end{comment}
meaningfully and hence never gets to "see"\end{align}
.