summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/emarks/emarks.sty
blob: 4f528be2b2ff3e90c218318d1cab91d1d7789ae3 (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
%%
%% This is file `emarks.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% emarks.dtx  (with options: `package')
%% 
%% This is a generated file.
%% 
%% emarks : 2011/03/26 v1.0 - e-TeX named marks registers (FC)
%% 
%% 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
%% 
%% This work consists of the main source file emarks.dtx
%% and the derived files:
%%                 emarks.sty, emarks.ins, emarks.drv,
%%         and:                emarks.pdf
%% 
%% emarks : 2011/03/26 v1.0 - e-TeX named marks registers (FC)
%% Copyright (C) 2011 by FC <florent.chervet @t free.fr>
%% 
\NeedsTeXFormat{LaTeX2e}[2005/12/01]
\ProvidesPackage{emarks}
         [2011/03/26 v1.0 - e-TeX named marks registers (FC)]
\RequirePackage {etex}
\def\emarks@newmarks #1{\PackageInfo {emarks}{New marks register `#1'}%
                        \newmarks #1% \newmarks is global !!
}% \emarks@newmarks
\protected\def\marksthe   {\emarks@setmarks {}}
\protected\def\marksthecs {\emarks@setmarks {\toks@\expandafter{\csname\the\toks@\endcsname}}}
\def\emarks@setmarks #1{\begingroup \@ifstar {\emarks@ {#1}\def  }
                                             {\emarks@ {#1}\edef }%
}% \emarks@setmarks
\def\emarks@ #1#2#3{\def\@tempa
      {#1#2\@tempa {\the\toks@ }\expandafter\emarks@marks \csname marks@#3\endcsname }%
                                                \afterassignment \@tempa \toks@ =
}% \emarks@
\def\emarks@marks #1{\ifx \relax#1\emarks@newmarks #1\fi \marks #1{\@tempa }\endgroup }
\newcommand*\thefirstmarks {\romannumeral \emarks@themarks \firstmarks  }
\newcommand*\thebotmarks   {\romannumeral \emarks@themarks \botmarks    }
\newcommand*\thetopmarks   {\romannumeral \emarks@themarks \topmarks    }
\def\emarks@themarks #1#2{\expandafter \ifx
    \csname\ifcsname marks@#2\endcsname marks@#2\else relax\fi\endcsname\relax
            \expandafter \z@
    \else   \expandafter \z@ #1\csname marks@#2\expandafter \endcsname  \fi
}% \emarks@themarks
\protected\def\getthemarks #1#2#3{\ifcsname marks@#2\endcsname
          \expandafter \def \expandafter #3\expandafter {#1\csname marks@#2\endcsname}%
    \else                           \let #3=\@undefined    \fi
}% \getthemarks
\protected\def\getthefirstmarks {\getthemarks   \firstmarks }
\protected\def\getthebotmarks   {\getthemarks   \botmarks   }
\protected\def\getthetopmarks   {\getthemarks   \topmarks   }
\protected\def\ifmarksvoid #1#2{\begingroup \getthemarks {#1}{#2}\x
    \ifodd \ifdefined\x \ifx \x\relax 0 \fi \ifx \x\@empty 0 \fi \else 0 \fi
           1 \endgroup\expandafter\@secondoftwo
    \else    \endgroup\expandafter\@firstoftwo      \fi
}% \ifmarksvoid
\protected\def\ifmarksequal #1#2#3{\begingroup \getthemarks{#1}{#3}\x \getthemarks{#2}{#3}\y
        \expandafter \endgroup \ifodd \ifdefined\x \ifdefined\y \ifx \x\y 0 \fi\fi\fi
                                      1 \expandafter\@secondoftwo
                               \else    \expandafter\@firstoftwo     \fi
}% \ifmarksequal
\protected\def\showthemarks #1{\begingroup  \emarks@showthemarks 0{#1}\firstmarks
                                            \emarks@showthemarks 2{#1}\botmarks
                                            \emarks@showthemarks 4{#1}\topmarks
    \message{firstmarks "#1": \the\toks0^^J%
             botmarks   "#1": \the\toks2^^J%
             topmarks   "#1": \the\toks4^^J}\show\@tempa
    \endgroup
}% \showthemarks
\def\emarks@showthemarks #1#2#3{\getthemarks #3{#2}\@tempa \toks #1 = \ifdefined\@tempa
    \expandafter\ifx \noexpand\@tempa\@tempa {}\else \expandafter {\@tempa }\fi
                                                                      \else {}\fi
}% \emarks@showthemarks
\endinput
%%
%% End of file `emarks.sty'.