LSSTDESC / start_paper

Make a folder containing everything you need to start writing an LSST DESC paper or Note
BSD 3-Clause "New" or "Revised" License
11 stars 4 forks source link

Line numbers #70

Open aimalz opened 6 years ago

aimalz commented 6 years ago

I know we can splice in the lineno package, but it would be nice to have something easy built into start_paper since it's so important for the Pub. Policy review process. While there is an option for linenumbers in \documentclass for AASTeX, that implementation breaks a lot of other formatting (equations, itemized lists, etc.).

abmantz commented 6 years ago

Can you provide an example of lineno (or some other solution)?

It's hard to see how we can provide a one-size-fits-all solution, given that under the hood many papers will be using one journal format or another, and some of them have their own options for line numbering. From the sound of it, the built-in solution for AASTeX is suboptimal, however.

This issue may be more at home in desc-tex, depending on what flavor the likely solution is.

aimalz commented 6 years ago

To get it to work in the apj format, I had to modify the preamble as follows:

...

\RequirePackage[switch, columnwise, running, displaymath, mathlines]{lineno}

\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}% }

...

\usepackage{enumitem}

...

\begin{document} \linenumbers

...

That of course only covers fixes for screwed up formatting that came up in my document, and those who use other environments might discover other quirks. (I imagine tables could also be problematic)

Ideally the start_paper (or desc-tex) team would similarly fiddle with the docswitch-related preambles to get linenumbers working in all the supported formats and then just have an argument to \documentclass[\docopts]{\docclass} for turning it on and off. Perhaps this could be addressed at Sprint Week?