| « Webcam with Skype 2.1.0.81 in Ubuntu 9.10 | Installing rhythmbox in Arch » |
Line number and amsmath
Line numbering is difficult for LaTeX because the line numbers are only known after the text has been typeset. The lineno package does a pretty good job, but it sometimes gets confused and can leave seemingly random sections of the document without numbers. I recently had this problem when submitting a paper for Biometrics using the provided style file. I then stumbled upon this great fix. Simply copy the following text and place it in your LaTeX file before the \begin{document} command:
\newcommand*\patchAmsMathEnvironmentForLineno[1]{%
\expandafter\let\csname old#1\expandafter\endcsname\csname #1\endcsname
\expandafter\let\csname oldend#1\expandafter\endcsname\csname end#1\endcsname
\renewenvironment{#1}%
{\linenomath\csname old#1\endcsname}%
{\csname oldend#1\endcsname\endlinenomath}}%
\newcommand*\patchBothAmsMathEnvironmentsForLineno[1]{%
\patchAmsMathEnvironmentForLineno{#1}%
\patchAmsMathEnvironmentForLineno{#1*}}%
\AtBeginDocument{%
\patchBothAmsMathEnvironmentsForLineno{equation}%
\patchBothAmsMathEnvironmentsForLineno{align}%
\patchBothAmsMathEnvironmentsForLineno{flalign}%
\patchBothAmsMathEnvironmentsForLineno{alignat}%
\patchBothAmsMathEnvironmentsForLineno{gather}%
\patchBothAmsMathEnvironmentsForLineno{multline}%
}
Worked like a charm for me!