summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/emarks/emarks.dtx
blob: 278a0daf0440481e370448bcf28c3fda21107db0 (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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
% \iffalse meta-comment
% 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
% end               emarks.pdf
%
% Unpacking:
%    (a) Without emarks.ins:            etex emarks.dtx
%    (b) If emarks.ins is present:      etex emarks.ins
%    (c) If you insist on using LaTeX
%           latex \let\install=y\input{emarks.dtx}
%        (quote the arguments according to the demands of your shell)
%
% Documentation:                        pdflatex emarks.dtx
% Copyright (C) 2011 by FC <florent.chervet @t free.fr>
%<*ignore>
\begingroup
  \def\x{LaTeX2e}%
\expandafter\endgroup
\ifcase 0\ifx\install y1\fi\expandafter
         \ifx\csname processbatchFile\endcsname\relax\else1\fi
         \ifx\fmtname\x\else 1\fi\relax
\else\csname fi\endcsname
%</ignore>
%<*install>
\input docstrip.tex
\Msg{************************************************************************}
\Msg{* Installation                                                         *}
\Msg{* Package emarks: 2011/03/26 v1.0 - e-TeX named marks registers (FC)   *}
\Msg{************************************************************************}

\keepsilent
\askforoverwritefalse

\let\MetaPrefix\relax
\preamble

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>

\endpreamble
\let\MetaPrefix\DoubleperCent

\generate{%
   \file{emarks.ins}{\from{emarks.dtx}{install}}%
   \file{emarks.sty}{\from{emarks.dtx}{package}}%
}

\askforoverwritefalse
\generate{%
   \file{emarks.drv}{\from{emarks.dtx}{driver}}%
}

\obeyspaces
\Msg{************************************************************************}
\Msg{*                                                                      *}
\Msg{* To finish the installation you have to move the following            *}
\Msg{* file into a directory searched by TeX:                               *}
\Msg{*                                                                      *}
\Msg{*                        emarks.sty                                    *}
\Msg{*                                                                      *}
\Msg{* To produce the documentation run the file `emarks.dtx'               *}
\Msg{*                     through pdfLaTeX.                                *}
\Msg{*                                                                      *}
\Msg{************************************************************************}
\endbatchfile
%</install>
%<*ignore>
\fi
%</ignore>
%<*driver>
\def\thisinfo {e-TeX named marks registers (FC)}
\def\thisversion {1.0}
\PassOptionsToPackage {full}{tabu}
\RequirePackage [\detokenize{§§},hyperlistings]{fcltxdoc}
\AtBeginDocument{\embedfile{README}}
%%\CheckDates{interfaces=2011/02/12,tabu=2011/02/25}
\documentclass[a4paper,11pt,twoside,american,latin1,T1]{ltxdoc}     \usetikz{full}
\usepackage [latin1]{inputenc}
\usepackage [T1]{fontenc}
\usepackage {numprint}
\usepackage {pdfcomment}
\usepackage {ragged2e}   % general tools
\usepackage {arial,bbding,relsize,moresize,manfnt,pifont,upgreek} % fonts
\csname endofdump\endcsname
\usepackage {emarks}
\RequirePackage [full]{tabu}
\usepackage {geometry}
\AtBeginDocument {\let\setkeys \kvsetkeys }
\let\microtypeYN=n
\ifx y\microtypeYN                                                          %
   \usepackage[expansion=all,stretch=20,shrink=60]{microtype}\fi            % font (microtype)
\CodelineNumbered\lastlinefit999
\lstset{backgroundcolor=\color{LightYellow},
texcsstyle=\color{blue},
moretexcs=[1]{
    lstdefinestyle,
    lstinputlisting,lstset,tikzlabel,tikzrefXY,
    color,
    geometry,lasthline,firsthline,
    cmidrule,toprule,bottomrule,tabusetup*,tabusetup,
    everyrow,tabulinestyle,tabureset,savetabu,usetabu,preamble,
    taburulecolor,taburowcolors},
keywordstyle=[3]{\color{black}\bfseries},
morekeywords=[3]{&},
keywordstyle=[4]{\color{red}\bfseries},
morekeywords=[4]{\linegoal,$},
keywordstyle=[5]{\color{blue}\bfseries},
keywordstyle=[6]{\color{green}\bfseries},
keywordstyle=[7]{\color{yellow}\bfseries},
%extendedchars={true},
alsoletter={&},alsoletter={*},alsoletter={$},
morekeywords=[5]{blue},
morekeywords=[6]{green},
morekeywords=[7]{yellow},
}
\hypersetup {%
  pdfauthor=Florent CHERVET,
  pdfkeywords={TeX, LaTeX, e-TeX, marks, firstmarks, botmarks, topmarks, package },
}
\geometry {top=0mm,headheight=8mm,includehead,reversemarginpar,asymmetric,headsep=3mm,bottom=14mm,footskip=5mm,inner=35mm,outer=20mm }
\begin{document}
   \DocInput{\jobname.dtx}
\end{document}
%</driver>
% \fi
%
% \CheckSum{219}
% \CharacterTable
%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%   Digits        \0\1\2\3\4\5\6\7\8\9
%   Exclamation   \!     Double quote  \"     Hash (number) \#
%   Dollar        \$     Percent       \%     Ampersand     \&
%   Acute accent  \'     Left paren    \(     Right paren   \)
%   Asterisk      \*     Plus          \+     Comma         \,
%   Minus         \-     Point         \.     Solidus       \/
%   Colon         \:     Semicolon     \;     Less than     \<
%   Equals        \=     Greater than  \>     Question mark \?
%   Commercial at \@     Left bracket  \[     Backslash     \\
%   Right bracket \]     Circumflex    \^     Underscore    \_
%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%   Right brace   \}     Tilde         \~}
%
% \DoNotIndex{\globcount,\globdimen,\if,\fi,\else,\def,\the,\gdef,\global,\relax}
% \makeatletter
% \def\ThisInfo {\ifdefvoid\lsstyle {\scalebox{1.35}[1]{\eTeX}\stretchwith\,{\ named\ marks\ registers}}
%                                                                  {\lsstyle \eTeX{} named marks registers }}
% \def\ttdefault{lmvtt}         \colorlet{pkgcolor}{LimeGreen!50!Black}
% \parindent\z@\parskip.4\baselineskip\topsep\parskip\partopsep\z@
% \newrobustcmd*\FC {{\leavevmode\color{copper}\usefont{T1}{fts}xn FC}}
% \colorlet{linkcolor}{DarkSlateBlue}   \colorlet{csrefcolor}{linkcolor}^^ARoyalBlue!70!Indigo!50!Black}
% \definecolor{macrocode}{rgb}{0.08,0.00,0.15}
% \providerobustcmd*\csred{\cs[\colorlet{csrefcolor}{red}]}
% \def\MacroFont{\ttfamily\bfseries }
% \def\macro@font {\def\Cr@scale{.87}\changefont{fam=pcrs,siz=10pt,ser=m,color=macrocode,spread=1}\let\AltMacroFont\macro@font }
% \AtBeginEnvironment {declcs}{\tabusetup* {font=\bfseries,everyrow=\rowbackground{fill=Snow!220,cell fading=-+{70}{0}{30}},line style=\heavyrulewidth,linesep=1mm}}
% \AtBeginEnvironment {lstlisting}{\Needspace{7\baselineskip}}
% \tikzAtEveryShipout {\ifnum \value{page}>\@ne  \fill [fill=Lime,very nearly transparent] (0,0) rectangle (\paperwidth,-\headheight);\fi }
%  \sectionformat\section[hang]{
%       left=\declmarginwidth,
%       font=\bfseries\Large,
%       bookmark={color=pkgcolor},
%       bottom=\smallskipamount,top=\medskipamount,
%  }
%  \sectionformat\subsection{
%       font=\large\bfseries,
%       bookmark={color=MidnightBlue},
%  }
% \pagesetup [corpus]{norule,
%       font=\footnotesize,
%       head/left=\noindent\raise1.5mm\hbox{\thispackage},
%       head/font+=\mdseries\sffamily,
%       head/right=\noindent\raise1.5mm\hbox{\ThisInfo},
%       foot/left/font=\scriptsize\color{gray!80},
%       foot/left=\vbox to\baselineskip{\vss{{\rotatebox[origin=l]{90}{\thispackage\,[rev.\thisversion]\,\CopyRight2011\,\lower.4ex\hbox{\pkgcolor\NibRight}\,\FC}}}},
%       offset=15mm,
%       left/offset+=15mm,
%       foot/right=\oldstylenums{\arabic{page}}/\oldstylenums{\pageref{LastPage}},
%  }
% \pagesetup [plain]{%
%     norules,font=\scriptsize,
%     offset=15mm,
%     left/offset+=15mm,
%     foot/font=\scriptsize\color[gray]{.55},
%     foot/right=\oldstylenums{\arabic{page}}/\oldstylenums{\pageref{LastPage}},
%     foot/left=\vbox to\baselineskip{\vss{{\rotatebox[origin=l]{90}{\thispackage\,[rev.\thisversion]\,\CopyRight2011\,\lower.4ex\hbox{\pkgcolor\NibRight}\,\FC\quad \xemail{florent.chervet at free.fr}}}}},
% }
% \bookmarksetup{openlevel=3}
%
% \newrobustcmd\IMPLEMENTATION{\bigskip
%       \par \tabubox { X[c] }{ \background {cell fading=fuzzy ring 15 percent,fill=Silver,semitransparent}
%               \tabubox {  *2X[c]  } {\includegraphics [width=20mm,keepaspectratio]{emarks-fingerprint.png}
%                   & \indent\tikz{\fill [decorate,decoration={footprints,foot of=felis silvestris}] (\paperwidth-25mm,-32mm) circle (+8mm);}
%       \\[^2mm _8mm]}
%       \\ \LARGE\thispackage }
%       \clearpage
%       \bookmarksetup {bold*,openlevel=1}
%       \sectionformat \section{bookmark={color=black}} \sectionformat \subsection{bookmark={color=gray}}
%       \section(Implementation)[\lsstyle\textsc{\bfseries Implementation}]{\larger\lsstyle\textsc{\bfseries Implementation}}\label{sec:implementation}\parindent1em
%  }
%
% \tikzAtFirstShipout{\fill [decorate,decoration={footprints,foot of=felis silvestris}] (\paperwidth-25mm,-32mm) circle (+5mm);
%                     \node[anchor=south] at (+41mm,-40mm) {\includegraphics [width=15mm,keepaspectratio] {emarks-fingerprint.png}};}
%
% \title  {\vspace*{-28pt}\Huge\bfseries \CTANhref[emarks]{\pkgcolor emarks}\Footnotemark{*}
%          \tabusetup* {linesep=3mm ,font=\large\changefont{fam=txr}}
%   \tabubox { X[c] }{ \ThisInfo \\
%                       \small\FC   \\
%                       \small\mdseries\thisdate~--~\hyperref[\thisversion]{version \thisversion }
%                    }\vspace*{-12pt}}
% \author {}
% \date   {}
% \makeatother
%
% \maketitle            
%
% \pdftikzcomment [author=interfaces-pdfcomment] {TikZ decorations.footprint library}
%   [semithick,color=pkgcolor,->>] ($(current page.north east)-(7mm,7mm)$) -- ++ (-1.5,-1.5);
%
% \bookmark[bold,view=FitH 0,named=FirstPage,color=pkgcolor]{emarks}
% 
% \Footnotetext{\rlap{*}\kern2em}{\parindent0pt\noindent
% This documentation is produced with the \textt{DocStrip} utility.\par
% \begin{tabu}{X[-3]X[-1] >\ttfamily X}
% \smex To get the package,                   &run:          & etex \thisfile.dtx                  \\
% \smex To get the documentation              &run (thrice): & pdflatex \thisfile.dtx               \\
% \leavevmode\hphantom\smex To get the index, &run:          & makeindex -s gind.ist \thisfile.idx
% \end{tabu}\par
% The \xext{dtx}* is embedded into this \xext{pdf}* thank to \Xpackage{embedfile} by H. Oberdiek.}
%
% \vspace*{-16mm}
% \begin{Abstract}[\leftmargin=6mm\parindent0pt\listparindent0pt\parskip\smallskipamount\parsep\smallskipamount]
%
% \shorttabubox { X }{\eTeX{} defines \numprint {32768} marks registers while \TeX{} provided only one \emph!\\ \cbackground {fill=pkgcolor,cell fading=*,nearly transparent}-}
%
% So small, this package provides commands to access \eTeX{} marks registers by their name rather than by their number.
% This makes the use of them far more comfortable than ``old \LaTeX{}'' tricks with \cs\markright, \cs\markboth \etc.
%
% \thispackage requires \eTeX{} and the generic package \CTANhref[etex-pkg]{\xfile{etex.sty}} for allocation.
%
%  Presently designed to be loaded by \textt\LaTeX{}, a \textt{plain \TeX} version might be provided later...
%
% \end{Abstract}
%
% \tocsetup{
%  before+=\hypersetup {linkcolor=black},
%  section/skip=4pt plus2pt minus2pt,
%  subsection/skip=0pt plus2pt minus2pt,
%  section/dotsep=,
%  subsection/dotsep=,
%  subsection/pagenumbers=off,
%  dotsep=1.5mu,
%  title/top = 12pt,
%  dot=\hbox{$\scriptscriptstyle\cdotp$},
%  title={\pkgcolor\leaders\vrule height3.4pt depth-3pt\hfill\null}\quad Contents of \textsfbf{\pkgcolor emarks}\quad{\pkgcolor\leaders\vrule height3.4pt depth-3pt\hfill\null},
%  title/bottom=4pt,
%  multicols/beforeend=\aftergroup\tocrule,
%  columns=2,columns/rule color=pkgcolor,no columns rule,
%  }
%  \def\tocrule{\leavevmode{\pkgcolor\hrule}}
%
% \tableofcontents  \pagestyle{corpus}
%
% \listofsetup {lol}{pagestyle=,
%       title/font=\large\bfseries,
%       title={\pkgcolor\leaders\vrule height3.4pt depth-3pt\hfill\null}\quad List of the listings / examples\quad{\pkgcolor\leaders\vrule height3.4pt depth-3pt\hfill\null},
%       after=\tocrule,
%       twocolumns=false,
%       label=lol,bookmark={text=Listings},
%       lstlisting/dotsep=,
%       lstlisting/pagenumbers=off,
%       lstlisting/leaders=,
%       lstlisting/font=\hfil,
%       lstlisting/number/width=0pt,
% }
%
% \addcontentsline{lol}{lstlisting}{To be done !}
%
% \listoflstlisting
%
% \bookmarksetup{bold*}
%
% \section{The \hologo{eTeX} marks registers}
% \label{userinterface}
%
%
% \begin{declcs}[{ | *2X[-1] | }] \marksthe\M{named-mark}\M{content} & \csanchor\marksthecs\M{named-mark}\M{cs-name} \\
%                        \cs\marksthe*\M{named-mark}\M{content}      &       \cs\marksthecs*\M{named-mark}\M{cs-name}
% \end{declcs}\declcsbookmark\marksthe\declcsbookmark\marksthecs
%
%
% \tabusetup* { extra sep = .5\parskip }
% \declmargin\begin{tabu*}to\dimexpr\linewidth-\declmarginwidth {X[-1]X @{} }
%   \cs\marksthe\M*{section}\M{content} & Marks the \meta{content} into the named mark register \meta{section} in the same way as the \eTeX{} primitive \cs\marks:
%                                         in particular the \meta{content} is immediately expanded. \par
%                                         If the mark register does not exist, it is created (or allocated) with \cs\newmarks (in \xfile{etex.sty}).
%  \\
%  \cs\marksthe*\M*{section}\M{content} & does the same but the \meta{content} is not expanded. The current values of counters, \cs\thesection \etc. will be wrong:
%                                         they will expand to the value they have at the time the mark register is read, not at the time of \cs\marksthe*.\par
%                                         Yet \cs\marksthe* is useful to mark a title only like in§
%                                         \shorttabubox* {X}{ \cs\def\cs\sectionmark \#1\M*{\cs\marksthe*\M*{section}\M{\#1}}}§
%                                         or to control the expansion (the \meta{content} can be expanded before marking in a way and with the protections desired by the user).
% \end{tabu*}
%
% Similarly \cs\marksthecs\M{subsubsection}\M{cs-name} marks the content of \cs{cs-name} by the mean of the named mark
% register \meta{subsubsection}. \meta{cs-name} is really the \emph{name of the control sequence} and not the control sequence itself:
% it does not start with \textttbf{\csname @backslashchar\endcsname}.§
% If \cs{cs-name} is empty the mark is empty, but if it is undefined or \cs\relax: nothing is marked: at reading time, the mark register never expands
% to \cs\undefined nor to \cs\relax.
%
% The syntax follows \eTeX{} \cs\marks primitive (a token-like syntax): braces are mandatory around the \M{content} to be marked, even if it is made of one single token.
%
%   \begin{declcs}[{ | *2X[-1] |}]\thefirstmarks&\M{named-mark}\textsuperscript{\textsc{expandable}} \\
%                \csanchor\thebotmarks  &\M{named-mark}\textsuperscript{\textsc{expandable}} \\
%                \csanchor\thetopmarks  &\M{named-mark}\textsuperscript{\textsc{expandable}}
% \end{declcs}\declcsbookmark\thefirstmarks\declcsbookmark\thebotmarks\declcsbookmark\thetopmarks
%
% Those commands are expandable in exactly one step of expansion. If the \meta{named-mark} mark register does not exists,
% the expansion is null (\ie nothing is done nor printed).
%
% \tabusetup* {colsep=3pt}
% \begin{tabu*}{ @{} X[-1] X @{} }
% \cs\thefirstmarks\M{chapter}  &expands to the content of the first invocation of \cs\marksthe\M{chapter}
%   on the current page if \cs\marksthe\M*{chapter} was used on the current page,
%   or the last invocation of \cs\marksthe\M*{chapter} if no marks occured on the current page.
% \\
%   \hfill\small \TeX nically this is &\cs\firstmarks \cs\marks@chapter
% \\[1mm]
% \cs\thebotmarks\M{chapter}    &expands to the content of the last invocation of \cs\marksthe\M{chapter} (the most recent \cs\marks). \\
%   \hfill\small \TeX nically this is &\cs\botmarks \cs\marks@chapter
% \\[1mm]
% \cs\thetopmarks\M{chapter}    &expands to the content of \cs\botmarks at the time \TeX{} shipped out the last page. \\
%  \hfill\small \TeX nically this is  &\cs\topmarks\cs\marks@chapter
% \end{tabu*}
%
% \def\OR{\stform|}
% \begin{declcs}[{ | X | }]\getthemarks  \cs\firstmarks \OR \cs\botmarks \OR \cs\topmarks \M{named-mark} \M*{\cs{control-sequence}} \\
%      \csanchor\getthefirstmarks \M{named-mark} \M*{\cs{control-sequence}} \\
%      \csanchor\getthebotmarks \M{named-mark} \M*{\cs{control-sequence}} \\
%      \csanchor\getthetopmarks \M{named-mark} \M*{\cs{control-sequence}}
% \end{declcs}\declcsbookmark\getthemarks\declcsbookmark[rellevel=2]\getthefirstmarks\declcsbookmark[rellevel=2]\getthebotmarks\declcsbookmark[rellevel=2]\getthetopmarks
%
% \cs\thefirstmarks, \cs\thebotmarks and \cs\thetopmarks expand the content of the mark. To get it in a macro
% \cs\getthemarks can be used: \cs{control-sequence} is defined as a parameterless macro whose replacement text is
% the content of the given mark register.
%
% If the \meta{named-mark} mark register does not exist, the meaning of\, \cs{control-sequence}\, is
% \textt{undefined}.
%
% \begin{declcs}\ifmarksvoid \M*{\cs\firstmarks}\M*{named-mark}\M{true}\M{false} \\
%            \cs\ifmarksvoid \M*{\cs\botmarks}\M*{named-mark}\M{true}\M{false} \\
%            \cs\ifmarksvoid \M*{\cs\topmarks}\M*{named-mark}\M{true}\M{false} \\
% \end{declcs}\declcsbookmark\ifmaksvoid
%
% \cs\ifmarksvoid expands the \M{true} part if either: ^^A\loggingall
% \begin{itemize}^^A[topsep=0pt,itemsep=0pt]
% \item The requested mark register is empty,
% \item The requested mark register is \cs\undefined,
% \item The requested mark register is \cs\relax,
% \item The \meta{named-mark} mark register does not exist.
% \end{itemize}
%
%
%
% \begin{declcs}\ifmarksequal\M*{\cs\firstmarks}\M*{\cs\topmarks}\M*{named-mark}\M{true}\M{false}   \\
%            \cs\ifmarksequal\M*{\cs\firstmarks}\M*{\cs\botmarks}\M*{named-mark}\M{true}\M{false}
% \end{declcs}\declcsbookmark\ifmarksequal
%
% Pretty often we want to compare the botmarks against the firstmarks or the topmarks, to adapt the header and/or footer
% in case those marks are equal or different, \ie in case the page contains a new section title or not:
%
% \cs\ifmarksequal expands the code in the \M{true} or the \M{false} part if the extraction of the marks are equal
% (in the sense of \cs\ifx) or different.
%
% If any of the marks register\, \cs{marks@\meta{named-mark}}\, does not exist the \M{false} part is expanded.
%
% If marks are used both at \cs\sectionmark \textbf{and at} \cs\sectionbreak then the following assertions are true:§
% \begin{shorttabu}{ !\textbullet  l  @{\,=\,}  l  !{$\Leftrightarrow$} l  }
% \cs\firstmarks &\cs\botmarks &there is at most one section title on the current page; \\
% \cs\topmarks   &\cs\botmarks &there is no section title on the current page;          \\
% \cs\firstmarks &\cs\topmarks &the last section title continues on the current page.
% \end{shorttabu}
%
%
% \begin{declcs}\showthemarks \M{named-mark}
% \end{declcs}\declcsbookmark\showthemarks
%
% \cs\showthemarks is for debugging purpose: it prints a message in the \xext{log}* and the ``standard error'' with
% the contents of the marks \cs\firstmarks, \cs\botmarks and \cs\topmarks for the \meta{named-mark} register given.
% Then it executes \cs\show on the extracted content of \cs\firstmarks in order to stop compilation at that point:
% the console displays the contents of \cs\firstmarks, \cs\botmarks and \cs\topmarks.
%
% ^^A\loggingall
% ^^A\showthemarks{section}
%
% \StopEventually{ }
%
% \IMPLEMENTATION
%
% \subsection*{Identification}       \makeatletter
%
% The package namespace is \cs\em@rks
%
%    \begin{macrocode}
%<*package>
\NeedsTeXFormat{LaTeX2e}[2005/12/01]
\ProvidesPackage{emarks}
         [2011/03/26 v1.0 - e-TeX named marks registers (FC)]
\RequirePackage {etex}
%    \end{macrocode}
%
%    \begin{macro}{\emarks@newmarks}
%
%    allocates a new marks register if it does not exists.
%
%    \begin{macrocode}
\def\emarks@newmarks #1{\PackageInfo {emarks}{New marks register `#1'}%
                        \newmarks #1% \newmarks is global !!
}% \emarks@newmarks
%    \end{macrocode}
%    \end{macro}
%
%    \begin{macro}{\marksthe}
%    \begin{macro}{\marksthecs}
%
%   \noindent\shorttabubox* { X } { \lstinline! \marksthe   { named-mark }{ general text } ! \\
%                          \lstinline! \marksthe*  { named-mark }{ general text } ! \\
%                          \lstinline! \marksthe   { named-mark }{ named control sequence } ! \\
%                          \lstinline! \marksthecs*{ named-mark }{ named control sequence } ! \\
%                        }
%
%    \begin{macrocode}
\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 }
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%
%    \begin{macro}{\thefirstmarks}
%    \begin{macro}{\thebotmarks}
%    \begin{macro}{\thetopmarks}
%
%   \cs\thefirstmarks extract the \cs\firstmarks from a named mark register.
%
%   The macros are purely expandable in exactly one step of expansion.
%
%    \begin{macrocode}
\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
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%    \begin{macro}{\getthemarks}
%    \begin{macro}{\getthefirstmarks}
%    \begin{macro}{\getthebotmarks}
%    \begin{macro}{\getthetopmarks}
%
%    Extract the marks and store in a parameterless macro.
%
%    \begin{macrocode}
\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   }
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%    \begin{macro}{\ifmarksvoid}
%
%   Test if a marks is defined, not empty and not \cs\relax.
%
%    \begin{macrocode}
\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
%    \end{macrocode}
%    \end{macro}
%
%    \begin{macro}{\ifmarksequal}
%
%   Test with \cs\ifx if two marks are equal:§
%   \shorttabubox* {X} { \lstinline ! \ifmarksequal \firstmarks \botmarks { named-mark } ! }
%
%
%    \begin{macrocode}
\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
%    \end{macrocode}
%    \end{macro}
%
%    \begin{macro}{\showthemarks}
%
%    Shows the contents of the marks registers
%
%    \begin{macrocode}
\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
%    \end{macrocode}
%    \end{macro}
%
%    \begin{macrocode}
%</package>
%    \end{macrocode}
%
%
% \begin{History}
%   \sectionformat\subsection{font=\normalsize\pkgcolor,bottom=0pt,top=\smallskipamount }\makeatletter
%
%   \begin{Version}{2011/03/26}{1.0}
%   \item First version. \\
%   \end{Version}
%
% \end{History}
%
% \begin{thebibliography}{9}
%
% \bibitem{etex} The \xpackage{etex} package by Peter Breitenlohner \\
%       \getpackageinfo{etex} \\
%       \CTANhref[etex-pkg]{\nolinkurl{CTAN:help/Catalogue/entries/etex-pkg.html}}
%
% \end{thebibliography}
%
% \clearpage
% \PrintIndex
%
% \Finale