aboutsummaryrefslogtreecommitdiff
path: root/tex/src/journal/linenoaa.sty
blob: 44a7f49152fb2ccbe74cdae906c1486aca3c96af (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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
\NeedsTeXFormat{LaTeX2e}[2003/12/01]
\ProvidesPackage{linenoaa}[2023/03/12 v0.02]

\providecommand{\addto}[2]{%
  \ifx#1\@undefined
    \def#1{#2}%
  \else
    \ifx#1\relax
      \def#1{#2}%
    \else
      {\toks@\expandafter{#1#2}%
        \xdef#1{\the\toks@}}%
    \fi
  \fi
}

\newif\ifGPL@lineno@desactivate
\GPL@lineno@desactivatefalse

\DeclareOption{desactivate}{
	\providecommand{\@LN}{\@gobbletwo}
	\providecommand{\@LN@col}{\@gobble}
	\GPL@lineno@desactivatetrue	
}
\DeclareOption*{
	\PassOptionsToPackage{\CurrentOption}{lineno}
}
\ProcessOptions\relax

\ifGPL@lineno@desactivate
	\endinput
\fi

\RequirePackage{lineno}[2005/11/02 v4.41]

\addto\maketitle{\linenumbers\relax}

\def\linenumberfont{\normalfont\scriptsize\sffamily}

\modulolinenumbers[10]

\@namedef{eqnarray*}{\def\@eqncr{\nonumber\@seqncr}\linenomath\eqnarray}
\@namedef{endeqnarray*}{\nonumber\endeqnarray\endlinenomath}

\@ifpackageloaded{amsmath}{%
\renewenvironment{multline}{\linenomathNonumbers\start@multline\st@rredfalse}{%
	\iftagsleft@ \@xp\lendmultline@ \else \@xp\rendmultline@ \fi
	\endlinenomath\ignorespacesafterend}

\renewenvironment{multline*}{\linenomath\start@multline\st@rredtrue}{\endmultline\endlinenomath}


\renewenvironment{gather}{\linenomathNonumbers\start@gather\st@rredfalse}{%
  \math@cr \black@\totwidth@ \egroup
  $$\endlinenomath\ignorespacesafterend}

\renewenvironment{gather*}{\linenomath\start@gather\st@rredtrue}{\endgather\endlinenomath}

\renewenvironment{alignat}{\linenomathNonumbers\start@align\z@\st@rredfalse}{%
\endalign\endlinenomath}

\renewenvironment{alignat*}{\linenomath\start@align\z@\st@rredtrue}{\endalign\endlinenomath}

\renewenvironment{xalignat}{\linenomathNonumbers\start@align\@ne\st@rredfalse}{%
\endalign\endlinenomath}

\renewenvironment{xalignat*}{\linenomath\start@align\@ne\st@rredtrue}{\endalign\endlinenomath}

\renewenvironment{xxalignat}{\linenomath\start@align\tw@\st@rredtrue}{\endalign\endlinenomath}

\renewenvironment{align}{\linenomathNonumbers\start@align\@ne\st@rredfalse\m@ne}{%
  \math@cr \black@\totwidth@
  \egroup
  \ifingather@
    \restorealignstate@
    \egroup
    \nonumber
    \ifnum0=`{\fi\iffalse}\fi
  \else
    $$%
  \fi
  \endlinenomath
  \ignorespacesafterend}
  
\renewenvironment{align*}{\linenomath\start@align\@ne\st@rredtrue\m@ne}{\endalign\endlinenomath}

\renewenvironment{flalign}{\linenomathNonumbers\start@align\tw@\st@rredfalse\m@ne}{%
\endalign\endlinenomath}

\renewenvironment{flalign*}{\linenomath\start@align\tw@\st@rredtrue\m@ne}{\endalign\endlinenomath}

\renewenvironment{equation}{%
  \linenomathNonumbers\incr@eqnum
  \mathdisplay@push
  \st@rredfalse \global\@eqnswtrue
  \mathdisplay{equation}%
}{%
  \endmathdisplay{equation}%
  \mathdisplay@pop
  \endlinenomath
  \ignorespacesafterend}
    
\renewenvironment{equation*}{%
  \linenomath\mathdisplay@push
  \st@rredtrue \global\@eqnswfalse
  \mathdisplay{equation*}%
}{%
  \endmathdisplay{equation*}%
  \mathdisplay@pop
  \endlinenomath
  \ignorespacesafterend}}{%
\def\equation{\linenomathNonumbers$$\refstepcounter{equation}}
\def\endequation{\eqno \hbox{\@eqnnum}$$\endlinenomath\@ignoretrue}}

\@ifpackagewith{amsmath}{fleqn}{%
\renewenvironment{eqnarray}{%
    \stepcounter{equation}%
    \def\@currentlabel{\p@equation\theequation}%
    \global\@eqnswtrue\m@th
    \global\@eqcnt\z@
    \tabskip\mathindent
    \let\\=\@eqncr
    \setlength\abovedisplayskip{\topsep}%
    \ifvmode
      \addtolength\abovedisplayskip{\partopsep}%
    \fi
    \addtolength\abovedisplayskip{\parskip}%
    \setlength\belowdisplayskip{\abovedisplayskip}%
    \setlength\belowdisplayshortskip{\abovedisplayskip}%
    \setlength\abovedisplayshortskip{\abovedisplayskip}%
    \linenomathNonumbers$$\everycr{}\halign to\linewidth% $$
    \bgroup
      \hskip\@centering
      $\displaystyle\tabskip\z@skip{##}$\@eqnsel&%
      \global\@eqcnt\@ne \hskip \tw@\arraycolsep \hfil${##}$\hfil&%
      \global\@eqcnt\tw@ \hskip \tw@\arraycolsep
        $\displaystyle{##}$\hfil \tabskip\@centering&%
      \global\@eqcnt\thr@@
        \hb@xt@\z@\bgroup\hss##\egroup\tabskip\z@skip\cr}%
      {\@@eqncr
    \egroup
    \global\advance\c@equation\m@ne$$% $$
    \endlinenomath
    \@ignoretrue}}{}