From a9f975064a3557008a31a98222c475e3d4e4ccdf Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 4 Nov 2011 23:29:33 +0000 Subject: new latex package emarks (1nov11) git-svn-id: svn://tug.org/texlive/trunk@24504 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/emarks/emarks.sty | 83 +++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 Master/texmf-dist/tex/latex/emarks/emarks.sty (limited to 'Master/texmf-dist/tex/latex/emarks') diff --git a/Master/texmf-dist/tex/latex/emarks/emarks.sty b/Master/texmf-dist/tex/latex/emarks/emarks.sty new file mode 100644 index 00000000000..4f528be2b2f --- /dev/null +++ b/Master/texmf-dist/tex/latex/emarks/emarks.sty @@ -0,0 +1,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 +%% +\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'. -- cgit v1.2.3