summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/lwarp/lwarp-parnotes.sty
blob: e8adeeb91dc9c794e923287ba209303e1bd7920b (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
%%
%% This is file `lwarp-parnotes.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% lwarp.dtx  (with options: `parnotes')
%% This is a generated file.
%% Copyright 2016-2020 Brian Dunn
%% 
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%%   http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
\LWR@ProvidesPackagePass{parnotes}[2019/07/23]
\long\def\PN@parnote@real#1#2{%
    \parnotemark{#1}%
    % Unless this is the first parnote in \PN@text, add a separator first
    \unless\ifx\PN@text\@empty\g@addto@macro\PN@text{\parnoteintercmd}\fi
    % Redefine \@currentlabel to the parnote label, so \label works
    \g@addto@macro\PN@text{%
        \def\@currentlabel{#1}%
        \def\cref@currentlabel{%        lwarp
            [parnotemark][\arabic{parnotemark}][]\theparnotemark%
        }%
    }%
    \g@addto@macro\PN@text{%
        \LWR@textcurrentfont{%          lwarp
            \parnotemark{#1}\nolinebreak\thinspace#2%
        }%
    }%
}

\def\PN@parnotes@real{%
\ifPN@inparnotes
\else
    \LWR@stoppars%
    \addtocounter{LWR@spandepth}{1}%
    % We call \par later, so this avoids recursion with \PN@parnotes@auto
    \PN@inparnotestrue
    % Avoid page breaks between a paragraph and its parnotes
    \begin{BlockClass}(note){footnotes}%    lwarp
    \leavevmode\LWR@orignewline%
    {%
        \parnotefmt{\PN@text}%
    }%
    \leavevmode\LWR@orignewline%
    \end{BlockClass}%                       lwarp
    \leavevmode\LWR@orignewline%
    \global\def\PN@text{}%
    %
    % These can be enabled or disabled by package options
    %
    \PN@disable@indent
    \PN@reset@optional
    \PN@inparnotesfalse
    \addtocounter{LWR@spandepth}{-1}%
\fi
}

\newbool{LWR@parnotes@doingauto}
\boolfalse{LWR@parnotes@doingauto}

\def\PN@parnotes@auto{%
    \ifbool{LWR@parnotes@doingauto}{
        \ifx\@currenvir\@PN@autopn
            \unless\ifPN@inparnotes
                \unless\ifx\PN@text\@empty
                    \expandafter\PN@parnotes@real
                \fi
            \fi
        \fi
    }{}%
}
\renewenvironment{autopn}%
    {\booltrue{LWR@parnotes@doingauto}}
    {\PN@parnotes@auto}%
\AtBeginDocument{
    \ifdef{\crefname}{
        \crefname{parnotemark}{paragraph note}{paragraph notes}
        \Crefname{parnotemark}{Paragraph note}{Paragraph notes}
    }{}
}
\apptocmd{\LWR@nullifyfootnotes}{%
    \renewcommand{\parnote}[2][]{}%
    \renewcommand\parnotemark[1]{}%
}{}{}
\begin{warpMathJax}
\providecommand{\parnotename}{parnote}
\appto\LWR@syncnotenumbers{%
    \addtocounter{parnotemark}{-1}% specific to parnotes
    \LWR@synconenotenumber{LWRparnote}{\theparnotemark}%
    \addtocounter{parnotemark}{1}% specific to parnotes
}
\appto\LWR@syncnotenames{\LWR@synconenotename{LWRparnote}{\parnotename}}
\CustomizeMathJax{\def\LWRparnote{1}}
\CustomizeMathJax{\newcommand{\parnote}[2][\LWRparnote]{{}^{\mathrm{#1}}}}
\CustomizeMathJax{\newcommand{\parnotemark}[1][\LWRparnote]{{}^{\mathrm{#1}}}}
\end{warpMathJax}

\endinput
%%
%% End of file `lwarp-parnotes.sty'.