summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/lineno/source/lineno.tex
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/lineno/source/lineno.tex')
-rw-r--r--macros/latex/contrib/lineno/source/lineno.tex125
1 files changed, 72 insertions, 53 deletions
diff --git a/macros/latex/contrib/lineno/source/lineno.tex b/macros/latex/contrib/lineno/source/lineno.tex
index 7e706e6bec..baed81f1b8 100644
--- a/macros/latex/contrib/lineno/source/lineno.tex
+++ b/macros/latex/contrib/lineno/source/lineno.tex
@@ -1,4 +1,4 @@
-\def\fileversion{v5.0} \def\filedate{2022/07/30}
+\def\fileversion{v5.1} \def\filedate{2023/01/19}
\title{\texttt{\itshape
lineno.sty \ \fileversion\ \filedate
@@ -8,9 +8,9 @@ A \LaTeX\ package to attach
\unskip}\author{%
Stephan I. B\"ottcher
\\ Uwe L\"uck
+\\ Karl Wette
\unskip}\date{%
-boettcher@physik.uni-kiel.de
-\\ http://contact-ednotes.sty.de.vu
+\url{https://github.com/latex-lineno/lineno}
\\}
\documentclass[a4paper,12pt]{article}%D
@@ -103,11 +103,7 @@ changes in documentation. This came about as follows.
Since late 2002, Christian Tapp and Uwe L\"uck have employed
~lineno.sty~ for their ~ednotes.sty~, a package supporting
-critical editions---cf.
-\[\mbox{\tt
-http://ednotes.sty.de.vu
-\unskip}\]
----while you find ~ednotes.sty~ and surrounding files in
+critical editions, while you find ~ednotes.sty~ and surrounding files in
CTAN folder \path{macros/latex/contrib/ednotes}.
Soon, some weaknesses of ~lineno.sty~ showed up, mainly since
@@ -213,13 +209,13 @@ since we need the ~\protected@write~ macro.
(New v4.00) And we use ~\newcommand*~ for
controlling length of user macro arguments, which has been
available since December 1994.
+(/New v4.00)
\begin{code}\begin{verbatim}
\NeedsTeXFormat{LaTeX2e}[1994/12/01]
\ProvidesPackage{lineno}
[\filedate\space line numbers on paragraphs \fileversion]
\end{verbatim}
\end{code}
-(/New v4.00)
\section{%
@@ -2429,14 +2425,14 @@ and (if it is) with which options it is to be called.
(/New v4.1)
\section{%
-Former package extensions
+Package extensions
\label{s:Xt}\unskip}
-The extensions in this section were previously supplied
+Some of the extensions in this section were previously supplied
in separate ~.sty~ files.
\subsection{%
-$display math$
+\texttt{displaymath}
\unskip}\label{ss:display}
(New v4.3) From now on, you no longer need to type
the ~{linenomath}~ environment with the ~\[~, ~{equation}~,
@@ -2712,52 +2708,75 @@ without special height lines. All lines must be
(New v5.0) Patches ~amsmath~ to work with ~lineno~. These patches used to be
supplied by the ~linenoamsmath~ package. See ~linenoamsmathdemo.pdf~ for a
demonstration.
+(/New v5.0)
+
+(/New v5.1) ~lineno~ tries to use \LaTeX's hook management system to patch
+~amsmath~, so that the two packages may be loaded independently. This requires
+the October 2020 release of \LaTeX. As a fallback for older releases, ~lineno~
+tests whether ~amsmath~ had already been loaded (by testing for the presence
+of the ~gather~ command) and if so applies the patches; otherwise if ~amsmath~
+has not been loaded, no patches are applied, and a warning is issued.
+(/New v5.1)
\begin{code}\begin{verbatim}
\RequirePackage{etoolbox}
-\newcommand*\linenoamsmath@patch[1]{%
- \cspreto{#1}{\linenomath}%
- \cspreto{#1*}{\linenomath}%
- \csappto{end#1}{\endlinenomath}%
- \csappto{end#1*}{\endlinenomath}%
-}
-\newcount\linenoamsmath@ams@eqpen
-\cspreto{math@cr@}{\global\@eqpen\numexpr\@eqpen+\linenoamsmath@ams@eqpen\relax}
-\newcommand*\linenoamsmath@patch@ams[1]{%
- \cspreto{#1}{%
- \linenomath%
- \postdisplaypenalty=0%
- \global\linenoamsmath@ams@eqpen\interdisplaylinepenalty%
- }%
- \cspreto{#1*}{%
- \linenomath%
- \postdisplaypenalty=0%
- \global\linenoamsmath@ams@eqpen\interdisplaylinepenalty%
- }%
- \csappto{end#1}{%
- \global\linenoamsmath@ams@eqpen\z@%
- \endlinenomath%
- }%
- \csappto{end#1*}{%
+\ifdefined\AddToHook
+ \def\linenoamsmath@patches#1{\AddToHook{package/amsmath/after}{#1}}
+\else
+ \ifdefined\endgather
+ \def\linenoamsmath@patches#1{#1}
+ \else
+ \PackageWarning{lineno}{%
+ `amsmath' must be loaded before `lineno' for patches to be applied}
+ \def\linenoamsmath@patches#1{\relax}
+ \fi
+\fi
+
+\linenoamsmath@patches{
+ \newcommand*\linenoamsmath@patch[1]{%
+ \cspreto{#1}{\linenomath}%
+ \cspreto{#1*}{\linenomath}%
+ \csappto{end#1}{\endlinenomath}%
+ \csappto{end#1*}{\endlinenomath}%
+ }
+ \newcount\linenoamsmath@ams@eqpen
+ \cspreto{math@cr@}{\global\@eqpen\numexpr\@eqpen+\linenoamsmath@ams@eqpen\relax}
+ \newcommand*\linenoamsmath@patch@ams[1]{%
+ \cspreto{#1}{%
+ \linenomath%
+ \postdisplaypenalty=0%
+ \global\linenoamsmath@ams@eqpen\interdisplaylinepenalty%
+ }%
+ \cspreto{#1*}{%
+ \linenomath%
+ \postdisplaypenalty=0%
+ \global\linenoamsmath@ams@eqpen\interdisplaylinepenalty%
+ }%
+ \csappto{end#1}{%
+ \global\linenoamsmath@ams@eqpen\z@%
+ \endlinenomath%
+ }%
+ \csappto{end#1*}{%
+ \global\linenoamsmath@ams@eqpen\z@%
+ \endlinenomath%
+ }%
+ }
+ \linenoamsmath@patch{equation}
+ \linenoamsmath@patch@ams{multline}
+ \linenoamsmath@patch@ams{gather}
+ \linenoamsmath@patch@ams{align}
+ \linenoamsmath@patch@ams{alignat}
+ \linenoamsmath@patch@ams{flalign}
+ \let\linenoamsmath@ams@mmeasure\mmeasure@
+ \def\mmeasure@#1{%
\global\linenoamsmath@ams@eqpen\z@%
- \endlinenomath%
- }%
-}
-\linenoamsmath@patch{equation}
-\linenoamsmath@patch@ams{multline}
-\linenoamsmath@patch@ams{gather}
-\linenoamsmath@patch@ams{align}
-\linenoamsmath@patch@ams{alignat}
-\linenoamsmath@patch@ams{flalign}
-\let\linenoamsmath@ams@mmeasure\mmeasure@
-\def\mmeasure@#1{%
- \global\linenoamsmath@ams@eqpen\z@%
- \begingroup%
- \interdisplaylinepenalty=0%
- \linenoamsmath@ams@mmeasure{#1\\}%
- \endgroup%
- \global\linenoamsmath@ams@eqpen\interdisplaylinepenalty%
+ \begingroup%
+ \interdisplaylinepenalty=0%
+ \linenoamsmath@ams@mmeasure{#1\\}%
+ \endgroup%
+ \global\linenoamsmath@ams@eqpen\interdisplaylinepenalty%
+ }
}
\end{verbatim}
\end{code}