summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/linenoamsmath/linenoamsmath.sty
blob: 5915e6c0237e7f9eedbed86227e8374a0c3d6be0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
%%
%% This is file `linenoamsmath.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% linenoamsmath.dtx  (with options: `package')
%% 
%% IMPORTANT NOTICE:
%% 
%% For the copyright see the source file.
%% 
%% Any modified versions of this file must be renamed
%% with new filenames distinct from linenoamsmath.sty.
%% 
%% For distribution of the original source see the terms
%% for copying and modification in the file linenoamsmath.dtx.
%% 
%% This generated file may be distributed as long as the
%% original source files, as listed above, are part of the
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{linenoamsmath}
    [2021/09/29 v1.0 Make the amsmath package work with the lineno package]
\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{lineno}}
\ProcessOptions\relax
\RequirePackage{amsmath}
\RequirePackage{lineno}
\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*}{%
    \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%
}
\endinput
%%
%% End of file `linenoamsmath.sty'.