From e0c6872cf40896c7be36b11dcc744620f10adf1d Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 2 Sep 2019 13:46:59 +0900 Subject: Initial commit --- macros/latex/contrib/emarks/Fingerprint.jpg | Bin 0 -> 183970 bytes macros/latex/contrib/emarks/README | 32 ++ macros/latex/contrib/emarks/emarks-fingerprint.png | Bin 0 -> 773524 bytes macros/latex/contrib/emarks/emarks.dtx | 587 +++++++++++++++++++++ macros/latex/contrib/emarks/emarks.ins | 85 +++ macros/latex/contrib/emarks/emarks.pdf | Bin 0 -> 1452232 bytes 6 files changed, 704 insertions(+) create mode 100644 macros/latex/contrib/emarks/Fingerprint.jpg create mode 100644 macros/latex/contrib/emarks/README create mode 100644 macros/latex/contrib/emarks/emarks-fingerprint.png create mode 100644 macros/latex/contrib/emarks/emarks.dtx create mode 100644 macros/latex/contrib/emarks/emarks.ins create mode 100644 macros/latex/contrib/emarks/emarks.pdf (limited to 'macros/latex/contrib/emarks') diff --git a/macros/latex/contrib/emarks/Fingerprint.jpg b/macros/latex/contrib/emarks/Fingerprint.jpg new file mode 100644 index 0000000000..11d054bd57 Binary files /dev/null and b/macros/latex/contrib/emarks/Fingerprint.jpg differ diff --git a/macros/latex/contrib/emarks/README b/macros/latex/contrib/emarks/README new file mode 100644 index 0000000000..5f6bafe47c --- /dev/null +++ b/macros/latex/contrib/emarks/README @@ -0,0 +1,32 @@ +Package emarks -- e-TeX named marks registers (FC) + +emarks is a small package to make possible the use of named +marks registers with eTeX rather than numbered ones. + + +eTeX provides 32 768 marks registers making the use of them +far more comfortable than LaTeX tricks with + \markright \markboth \leftmark and \rightmark. + + +The package provides two commands for marking: + + \marksthe and \marksthecs + +with star form to disable expansion. +New marks registers are dynamically allocated as needed. +The syntax clearly sticks to the \marks primitive. + +And four commands to get the marks registers content: + + \thefirstmarks \thebotmarks \thetopmarks + + and: \getthemarks + ++ a facility to compare marks registers: \ifmarksequal + + +emarks requires eTeX (the program ;-)) etex (the package) + and nothing else. + +Copyright (C) 2011 by FC diff --git a/macros/latex/contrib/emarks/emarks-fingerprint.png b/macros/latex/contrib/emarks/emarks-fingerprint.png new file mode 100644 index 0000000000..0d1ff6631d Binary files /dev/null and b/macros/latex/contrib/emarks/emarks-fingerprint.png differ diff --git a/macros/latex/contrib/emarks/emarks.dtx b/macros/latex/contrib/emarks/emarks.dtx new file mode 100644 index 0000000000..278a0daf04 --- /dev/null +++ b/macros/latex/contrib/emarks/emarks.dtx @@ -0,0 +1,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 +%<*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 +% +%<*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 + +\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 +% +%<*ignore> +\fi +% +%<*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} +% +% \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} +% +% \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 \ No newline at end of file diff --git a/macros/latex/contrib/emarks/emarks.ins b/macros/latex/contrib/emarks/emarks.ins new file mode 100644 index 0000000000..6e93b219bd --- /dev/null +++ b/macros/latex/contrib/emarks/emarks.ins @@ -0,0 +1,85 @@ +%% +%% This is file `emarks.ins', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% emarks.dtx (with options: `install') +%% +%% 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 +%% +\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 + +\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 +\endinput +%% +%% End of file `emarks.ins'. diff --git a/macros/latex/contrib/emarks/emarks.pdf b/macros/latex/contrib/emarks/emarks.pdf new file mode 100644 index 0000000000..91a2f8e460 Binary files /dev/null and b/macros/latex/contrib/emarks/emarks.pdf differ -- cgit v1.2.3