From e0c6872cf40896c7be36b11dcc744620f10adf1d Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 2 Sep 2019 13:46:59 +0900 Subject: Initial commit --- .../latex/contrib/enumitem-zref/enumitem-zref.dtx | 2215 ++++++++++++++++++++ 1 file changed, 2215 insertions(+) create mode 100644 macros/latex/contrib/enumitem-zref/enumitem-zref.dtx (limited to 'macros/latex/contrib/enumitem-zref/enumitem-zref.dtx') diff --git a/macros/latex/contrib/enumitem-zref/enumitem-zref.dtx b/macros/latex/contrib/enumitem-zref/enumitem-zref.dtx new file mode 100644 index 0000000000..992d35712d --- /dev/null +++ b/macros/latex/contrib/enumitem-zref/enumitem-zref.dtx @@ -0,0 +1,2215 @@ +% \iffalse meta-comment +% enumitem-zref : 2011/02/18 v1.8 - Extended references for enumitem pkg] +% +% 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 enumitem-zref.dtx +% and the derived files +% enumitem-zref.sty, enumitem-zref.pdf, enumitem-zref.ins, +% enumitem-zexample.tex +% +% Unpacking: +% (a) If enumitem-zref.ins is present: +% etex enumitem-zref.ins +% (b) Without enumitem-zref.ins: +% etex enumitem-zref.dtx +% (c) If you insist on using LaTeX +% latex \let\install=y\input{enumitem-zref.dtx} +% (quote the arguments according to the demands of your shell) +% +% Documentation: +% (pdf)latex enumitem-zref.dtx +% Copyright (C) 2010 by Florent Chervet +%<*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 +\tracingonline=0 +\Msg{************************************************************************} +\Msg{* Installation} +\Msg{* Package: 2011/02/18 v1.8 - Extended references to items for enumitem package and hyperref} +\Msg{************************************************************************} + +\keepsilent +\askforoverwritefalse + +\let\MetaPrefix\relax +\preamble + +This is a generated file. + +enumitem-zref : 2011/02/18 v1.8 - Extended references to items for enumitem package and hyperref + +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 enumitem-zref.dtx +and the derived files + enumitem-zref.sty, enumitem-zref.pdf, enumitem-zref.ins, + enumitem-zexample.tex + +enumitem-zref : Extended references to items for enumitem package and hyperref +Copyright (C) 2010 by Florent Chervet + +\endpreamble +\let\MetaPrefix\DoubleperCent + +\generate{% + \file{enumitem-zref.ins}{\from{enumitem-zref.dtx}{install}}% + \file{enumitem-zref.sty}{\from{enumitem-zref.dtx}{package}}% + \file{enumitem-zexample.tex}{\from{enumitem-zref.dtx}{example}}% +} + +\askforoverwritefalse +\generate{% + \file{enumitem-zref.drv}{\from{enumitem-zref.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{* enumitem-zref.sty} +\Msg{*} +\Msg{* To produce the documentation run the file `enumitem-zref.dtx'} +\Msg{* through LaTeX.} +\Msg{*} +\Msg{* Happy TeXing!} +\Msg{*} +\Msg{************************************************************************} + +\endbatchfile +% +%<*ignore> +\fi +% +%<*driver> +\edef\thisfile{\jobname} +\def\thisinfo{Extended references to items for enumitem package} +\def\thisdate{2011/02/18} +\def\thisversion{1.8} +\PassOptionsToPackage{svgnames,dvipsnames}{xcolor} +\PassOptionsToPackage{hyperfootnotes,verbose}{hyperref} +\def\CTANbaseurl{http://www.ctan.org/tex-archive/} +\def\CTANhref#1{\href{\CTANbaseurl help/Catalogue/entries/#1.html}{\nolinkurl{CTAN:help/Catalogue/entries/#1.html}}} +\let\loadclass \LoadClass +\def\LoadClass#1{\loadclass[abstracton]{scrartcl}\let\scrmaketitle\maketitle\AtEndOfClass{\let\maketitle\scrmaketitle}} +{\makeatletter{\endlinechar`\^^J\obeyspaces + \gdef\ErrorUpdate#1=#2,{\@ifpackagelater{#1}{#2}{}{\let\CheckDate\errmessage\toks@\expandafter{\the\toks@ + \thisfile-documentation: updates required ! + package #1 must be later than #2 + to compile this documentation.}}}}% + \gdef\CheckDate#1{{\let\CheckDate\relax\toks@{}\@for\x:=\thisfile=\thisdate,#1\do{\expandafter\ErrorUpdate\x,}\CheckDate\expandafter{\the\toks@}}}} +\AtBeginDocument{\CheckDate{interfaces=2011/02/12,tabu=2011/02/17}} +\documentclass[a4paper,oneside]{ltxdoc} +\AtBeginDocument{\DeleteShortVerb{\|}} +\usepackage[latin1]{inputenc} +\usepackage[american]{babel} +\usepackage[T1]{fontenc} +\usepackage{ltxnew,etoolbox,geometry,graphicx,xcolor,needspace,calc} % general tools +\usepackage{lmodern,bbding,hologo,relsize,moresize,manfnt,pifont,upgreek} % fonts +\usepackage[official]{eurosym} % font +\usepackage{xspace,tocloft,titlesec,fancyhdr,lastpage,enumitem,marginnote} % paragraphs & pages management +\usepackage{holtxdoc,bookmark,hypbmsec} % hyper-links +\usepackage{array,delarray,longtable,colortbl,multirow,makecell,booktabs} % tabulars +\usepackage{tabu}[2011/02/17]\tracingtabu=2 % tabulars +\usepackage{pifont,engrec,amsmath,wasysym} +\usepackage{embedfile,framed,atveryend,catchfile} +\usepackage[expansion=all,protrusion=all,shrink=30]{microtype} +\usepackage{interfaces}[2011/02/12] +\usetikz{basic,chains} +\RequirePackage{grffile,eso-pic}% to include the example +\csname endofdump\endcsname +\CodelineNumbered +\usepackage[greek]{enumitem-zref} +\usepackage{fancyvrb}\fvset{gobble=1,listparameters={\topsep=0pt}} +\lastlinefit999 +\geometry{top=0pt,includeheadfoot,headheight=.6cm,headsep=.6cm,bottom=.6cm,footskip=.5cm,left=3cm,right=1.2cm} +\hypersetup{% + pdftitle={The enumitem-zref package}, + pdfsubject={Extended references to items for enumitem package}, + pdfauthor={Florent CHERVET}, + colorlinks,linkcolor=reflink, + pdfstartview={FitH}, + pdfkeywords={tex, e-tex, latex, package, enumitem, zref, enumerate, itemize, description, lists, pdftex}, + bookmarksopen=true,bookmarksopenlevel=3} +\embedfile{\thisfile.dtx} +\begin{document} + \DocInput{\thisfile.dtx} +\end{document} +% +% \fi +% +% \CheckSum{1718} +% +% \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{\begin,\CodelineIndex,\CodelineNumbered,\def,\DisableCrossrefs,\~,\@ifpackagelater,\z@,\@ne,\linebreak,\maxdimen,\newrobustcmd} +% \DoNotIndex{\DocInput,\documentclass,\EnableCrossrefs,\end,\GetFileInfo,\tw@,\thr@@,\TMP@EnsureCode,\sloppy,\SetupKeyvalOptions,\sep,\scriptsize,\reset@font} +% \DoNotIndex{\NeedsTeXFormat,\OnlyDescription,\RecordChanges,\usepackage} +% \DoNotIndex{\ProvidesClass,\ProvidesPackage,\ProvidesFile,\RequirePackage} +% \DoNotIndex{\filename,\fileversion,\filedate,\let} +% \DoNotIndex{\@listctr,\@nameuse,\csname,\else,\endcsname,\expandafter,\catcode,\@M,\@eha,\@firstofone,\@ifnextchar,\@nil,\@nnil,\@spaces,\@sptoken,\@undefined} +% \DoNotIndex{\gdef,\global,\if,\item,\newcommand,\nobibliography,\@unknownoptionerror,\bfseries,\psi,\ifnum,\ifcase,\unless,\unexpanded,\zen@AtEnd} +% \DoNotIndex{\par,\providecommand,\relax,\renewcommand,\renewenvironment} +% \DoNotIndex{\stepcounter,\usecounter,\nocite,\fi} +% \DoNotIndex{\@fileswfalse,\@gobble,\@ifstar,\@unexpandable@protect} +% \DoNotIndex{\AtBeginDocument,\AtEndDocument,\begingroup,\endgroup} +% \DoNotIndex{\frenchspacing,\MessageBreak,\newif,\PackageWarningNoLine} +% \DoNotIndex{\protect,\string,\xdef,\ifx,\texttt,\@biblabel,\bibitem} +% \DoNotIndex{\z@,\wd,\wheremsg,\vrule,\voidb@x,\verb,\bibitem} +% \DoNotIndex{\FrameCommand,\MakeFramed,\FrameRestore,\hskip,\hfil,\hfill,\hsize,\hspace,\hss,\hbox,\hb@xt@,\endMakeFramed,\escapechar} +% \DoNotIndex{\do,\date,\if@tempswa,\@tempdima,\@tempboxa,\@tempswatrue,\@tempswafalse,\ifdefined,\ifhmode,\ifmmode,\cr} +% \DoNotIndex{\box,\author,\advance,\multiply,\Command,\outer,\next,\leavevmode,\kern,\title,\toks@,\trcg@where,\tt} +% \DoNotIndex{\the,\width,\star,\space,\section,\subsection,\textasteriskcentered,\textwidth} +% \DoNotIndex{\",\:,\@empty,\@for,\@gtempa,\@latex@error,\@namedef,\@nameuse,\@tempa,\@testopt,\@width,\\,\m@ne,\makeatletter,\makeatother} +% \DoNotIndex{\maketitle,\parindent,\setbox,\x,\kernel@ifnextchar} +% \DoNotIndex{\KVS@CommaComma,\KVS@CommaSpace,\KVS@EqualsSpace,\KVS@Equals,\KVS@Global,\KVS@SpaceEquals,\KVS@SpaceComma,\KVS@Comma} +% \DoNotIndex{\DefineShortVerb,\DeleteShortVerb,\UndefineShortVerb,\MakeShortVerb,\endinput,\protected,\gappto,\g@addto@macro,\globcount} +% \makeatletter\DeleteShortVerb{\|} +% \newrobustcmd*\ClearPage{\@ifstar\clearpage{}} +% \newrobustcmd*\FC{{\color{copper}\usefont{T1}{fts}xn FC}} +% \providecommand\lsstyle{}^^A if no microtype +% \catcode`\§ \active \def§{\@ifnextchar §{\par\nobreak\vskip-2\parskip\nobreak}{\par\nobreak\vskip-\parskip\nobreak}} +% \colorlet{pkgcolor}{teal} \protected\def\pkgcolor{\color{pkgcolor}} +% \newcommand\texorpdf[2]{\texorpdfstring{#1{#2}}{#2}} +% \def\thispackage{\@ifstar{\xpackage{\thisfile}\xspace}{\xpackage{{\pkgcolor\thisfile}}\xspace}} +% \def\ThisPackage{\Xpackage{\thisfile}\xspace} +% \def\Xpackage{\@dblarg\X@package} +% \def\X@package[#1]#2{\@testopt{\X@@package{#1}{#2}}{}} +% \def\X@@package#1#2[#3]{\xpackage{#2\footnote{\noindent\xpackage{#2}: \CTANhref{#1}#3}}\xspace} +% \def\Underbrace#1_#2{$\underbrace{\vtop to2ex{}\hbox{#1}}_{\footnotesize\hbox{#2}}$} +% +% \def\thisfootinfo{{\let\@thefnmark\@empty\let\@makefntext\@firstofone +% \footnotetext{\par\vskip-\baselineskip\smallskip\noindent +% This documentation is produced with the \textt{DocStrip} utility.\par +% \begin{tabu}{X[-3]X[-1]X} +% \smex To get the package, &run: &\texttt{etex \thisfile.dtx} \\ +% \smex To get the documentation &run (thrice): &\textt{pdflatex \thisfile.dtx} \\ +% \leavevmode\hphantom\smex To get the index, &run: &\texttt{makeindex -s gind.ist \thisfile.idx} +% \end{tabu}§ +% The \xext{dtx} file is embedded into this pdf file thank to \xpackage{embedfile} by H. Oberdiek.}}} +% +% \parindent\z@\parskip.4\baselineskip\topsep\parskip\partopsep\z@\leftmargini=2cm\clubpenalty20000\widowpenalty\clubpenalty +% \def\smex{\leavevmode\hb@xt@2em{\hfil$\longrightarrow$\hfil}} +% \def\ttdefault{lmvtt} +% \newrobustcmd\verbfont{\usefont{T1}{\ttdefault}{\f@series}{n}} \let\vb\verbfont +% \newrobustcmd\vbbf{\usefont{T1}{\ttdefault}bn} +% \renewrobustcmd\#[1]{{\usefont{T1}{pcr}{bx}{n}\char`\##1}} +% \newrobustcmd*\grabcs{\leavevmode\hbox\bgroup\bgroup\makeatletter\aftergroup\endgrabcs} +% \def\endgrabcs{\egroup\xspaceverb} +% \renewrobustcmd*\cs{\grabcs\cs@} +% \newrobustcmd*\cs@[2][]{\begingroup\escapechar\m@ne\def\x ##1{\endgroup\@maybehyperlink{##1}{\texttt{#1{\@backslashchar##1}}}}\expandafter\x\expandafter{\string#2}\egroup} +% \newcommand*\cs@pdf[1]{\@backslashchar\if\@backslashchar\string#1 \else\string#1\fi} +% \newrobustcmd*\csbf{\cs[\textbf]} +% \newrobustcmd*\csref[2][]{{\escapechar\m@ne\edef\my@tempa{\string#2}\edef\x ##1{\noexpand\hyperref{}{declcs}{\my@tempa}{\noexpand\cs[{##1}]{\my@tempa}}}\expandafter}\x{#1}} +% \newcommand\env{\texorpdfstring \env@ \env@pdf} +% \newcommand*\env@pdf[1]{#1} +% \newrobustcmd*\env@{\@ifstar {\env@starsw[environment]}{\env@starsw[]}} +% \def\env@starsw[#1]#2{\textt{#2}\ifblank{#1}{}{ #1}\Xspace} +% \newrobustcmd*\@maybehyperlink [2]{\ifcsname zen@declcs.\detokenize{#1}\endcsname \hyperref{}{declcs}{#1}{#2}\else #2\fi} +% \newrobustcmd\csred[1]{\textcolor{red}{\cs{#1}}} +% \newrobustcmd\CSbf[1]{\textbf{\CS{#1}}} +% \newrobustcmd\texttbf[1]{\textbf{\texttt{#1}}} +% \newrobustcmd\textitbf[1]{\textit{\textbf{#1}}} +% \renewrobustcmd*\bf{\bfseries}\newcommand\nnn{\normalfont\mdseries\upshape}\newcommand\nbf{\normalfont\bfseries\upshape} +% \newrobustcmd*\blue{\color{blue}}\newcommand*\red{\color{dr}}\newcommand*\green{\color{green}}\newcommand\rred{\color{red}} +% \newrobustcmd\rrbf{\color{red}\bfseries} +% \newrobustcmd*\pdf{\textsc{pdf}} +% \definecolor{copper}{rgb}{0.67,0.33,0.00} \newcommand\copper{\color{copper}} +% \definecolor{daleif1}{rgb}{.647,.129,.149} +% \definecolor{dg}{rgb}{0.02,0.29,0.00} \newcommand\dg{\color{dg}} +% \definecolor{db}{rgb}{0,0,0.502} \newcommand\db{\color{db}} +% \definecolor{dr}{rgb}{0.75,0.00,0.00} \let\dr\red +% \definecolor{lk}{rgb}{0.2,0.2,0.2} \newrobustcmd\lk{\color{lk}} +% \newrobustcmd\bk{\color{black}}\newcommand\md{\mdseries} +% \newrobustcmd\ie{\emph{ie.}\,} +% \newrobustcmd\etc{{\bk\emph{etc.}}} +% \newrobustcmd\textt[2][]{\texorpdf\texttt{#1#2}} +% \newcommand\cellstrut{}\let\cellstrut\bottopstrut +% \def\M{\@ifstar{\M@i\@firstofone}{\M@i\meta}} +% \def\M@i#1{\@ifnextchar[\M@square +% {\ifx (\@let@token^^A) +% \expandafter\M@paren +% \else\ifx |\@let@token +% \expandafter\expandafter\expandafter\M@bar +% \else \expandafter\expandafter\expandafter\M@brace +% \fi\fi#1}} +% \def\M@square #1[#2]{\M@Bracket[{#1{#2}}]} +% \def\M@paren #1(#2){\M@Bracket({#1{#2}})} +% \def\M@bar #1|#2|{\M@Bracket\textbar{#1{#2}}\textbar} +% \def\M@brace #1#2{\M@Bracket\{{#1{#2}}\}} +% \def\M@Bracket#1#2#3{{\ttfamily#1#2#3}} +% \newrobustcmd*\thisyear{\begingroup +% \def\thisyear##1/##2\@nil{\endgroup +% \oldstylenums{\ifnum##1=2010\else 2010\,\textendash\,\fi ##1}^^A +% }\expandafter\thisyear\thisdate\@nil +% } +% \newenvironment{movepage}[2][]{% +% \advance\hsize by\dimexpr#2\relax +% \hoffset\dimexpr\ifblank{#1}{-\dimexpr#2\relax}{\dimexpr#1\relax}\relax +% \linewidth\hsize +% \textwidth\hsize +% }{\clearpage} +% \DefineVerbatimEnvironment{VerbLines}{Verbatim}{frame=lines,framesep=6pt,fontfamily=\ttdefault,fontseries=m} +% \DefineVerbatimEnvironment{VerbLines*}{Verbatim}{frame=lines,framesep=6pt,fontfamily=\ttdefault,fontseries=m,commandchars=$()} +% \DefineVerbatimEnvironment{Verb*}{Verbatim}{fontfamily=\ttdefault,fontseries=m,commandchars=$()} +% +% \newrobustcmd*\csanchor[2][]{^^A +% \immediate\write\@mainaux{\csgdef{zen@declcs.\string\detokenize{#2}}{}}^^A +% \raisedhyperdef[14pt]{declcs}{#2}{\cs[{#1}]{#2}}^^A +% } +% \renewrobustcmd\declcs[2][]{^^A +% \if@nobreak \par\nobreak +% \else \par\addvspace\parskip +% \Needspace{.08\textheight}\fi +% \changefont{size+=2.5pt,spread=1,fam=\ttdefault}^^A +% \def\*{\unskip\,\texttt{*}}\noindent +% \hskip-\leftmargini +% \begin{tabu}{|l|}\hline +% \expandafter\SpecialUsageIndex\csname #2\endcsname +% \csanchor[{#1}]{#2}} +% \renewcommand\enddeclcs{% +% \crcr \hline \end{tabu}\nobreak +% \par \nobreak \noindent +% \ignorespacesafterend +% } +% \def\declmargin{\hspace*{\dimexpr-\leftmargini+\arrayrulewidth+\tabcolsep}} +% \pretocmd\textasteriskcentered{\usefont{OMS}{cmsy}mn}{}{} +% \let\plainllap\llap +% \newrobustcmd\macro@llap[1]{{\global\let\llap\plainllap +% \setbox0=\hbox\bgroup \raisedhyperdef{macro}{\saved@macroname}{#1}\egroup +% \ifdim\wd0>20mm +% \hbox to\z@ \bgroup\hss \hbox to20mm{\unhcopy0\hss}\egroup +% \edef\@tempa{\hskip\dimexpr\the\wd0-20mm}\global\everypar\expandafter{\the\expandafter\everypar +% \@tempa \global\everypar{}}^^A +% \else \llap{\unhbox0}\fi}} +% \AtBeginEnvironment{macro}{\if@nobreak\else\Needspace{2\baselineskip}\fi +% \MacrocodeTopsep\z@skip \MacroTopsep\z@skip \parsep\z@ \topsep\z@ \itemsep\z@ \partopsep\z@ +% \let\llap\macro@llap} +% \AtEndEnvironment{macro}{\goodbreak\vskip.3\parskip} +% +% \newrobustcmd*\IMPLEMENTATION{% +% ^^A\geometry{top=0pt,includeheadfoot,headheight=.6cm,headsep=.6cm,bottom=.6cm,footskip=.5cm,left=3.5cm,right=1.2cm} +% \newgeometry{top=0pt,includeheadfoot,headheight=.6cm,headsep=.6cm,bottom=.6cm,footskip=.5cm,left=3.5cm,right=.5cm} +% \pagesetup*{ +% right/offset-=.7cm, +% head/left+=\ \ (i\,m\,p\,l\,e\,m\,e\,n\,t\,a\,t\,i\,o\,n), +% }% +% \bookmarksetup{openlevel=1} +% \sectionformat\section{bookmark={color=black,bold*,bold=false}} +% \section(Implementation)[\mdseries\scshape\pmb{Implementation}]{Implementation} \label{sec:implementation} +% \addtocontents{toc}{\tocsetup{subsection/font+=\smaller,section/skip*=.5,subsection/skip-=1pt}}} +% +% \newcommand\tikzlabel[2][]{\tikz[{remember picture,#1}]\coordinate ({#2});\ignorespaces} +% +% \AddEnumerateCounter\engrec\@grec{\@grec{23}} +% \bottomtitles=.15\textheight +% \pagesetup[plain]{ +% norules, font=\scriptsize, +% left/offset=2cm, +% right/offset=.5cm, +% foot/left/offset+=.5cm, +% foot/right=\oldstylenums{\thepage} / \oldstylenums{\pageref{LastPage}} +% } +% \pagesetup[corpus]{ +% pagestyle=plain, +% head/font=\footnotesize\color{LightSteelBlue}, +% head/left=\moveleft1cm\vbox to\z@{\vss\setbox0=\null\ht0=\z@\wd0=\paperwidth\dp0=\headheight\rlap{\colorbox{GhostWhite}{\box0}}}\vskip-\headheight\thispackage, +% head/right=\thisinfo, +% foot/left/font+=\color[gray]{.35}, +% foot/left=\vbox to\baselineskip{\vss{{\rotatebox[origin=l]{90}{\thispackage\,[rev.\thisversion]\,\copyright\,\thisyear\,\lower.4ex\hbox{\pkgcolor\NibRight}\,\FC}}}}, +% foot/right=\oldstylenums{\thepage} / \oldstylenums{\pageref{LastPage}} +% } +% \pagesetup[firstpage]{ +% pagestyle=plain,norules, +% foot/left=\vbox to\baselineskip{\vss{{\rotatebox[origin=l]{90}{\thispackage\,[rev.\thisversion]\,\copyright\,\thisyear\,\lower.4ex\hbox{\pkgcolor\NibRight}\,\FC\quad \xemail{florent.chervet at free.fr}}}}}, +% } +% \sectionformat\section[hang]{ +% font=\LARGE\bfseries, +% bookmark={color=MidnightBlue,bold}, +% bottom=\smallskipamount, +% left=-1cm, +% } +% \sectionformat\subsection[hang]{ +% font=\Large\bfseries, +% top=.5\smallskipamount, +% bottom=.5\smallskipamount, +% left=-1cm, +% } +% \sectionformat\subsubsection[hang]{ +% font=\large\bfseries, +% top=.5\smallskipamount, +% bottom=.5\smallskipamount, +% left=-1cm, +% bookmark={color=RoyalBlue}, +% } +% +% \newcommand\macrocodecolor{\color{macrocode}}\definecolor{macrocode}{rgb}{0.05,0.02,0.07} +% \newcommand\reflinkcolor{\color{reflink}}\colorlet{reflink}{MidnightBlue} +% \let\stf \textasteriskcentered +% \newrobustcmd*\stform{\@ifnextchar*{\@stform[]\textasteriskcentered\@gobble}\@stform} +% \newrobustcmd*\@stform[2][\string]{\texttbf{\rred#1#2}\Xspace} +% \newrobustcmd*\xspaceverb{\ifnum\catcode`\ =\active\else\expandafter\xspace\fi} +% \let\Xspace\xspaceverb +% +% \makeatother +% +% \title{\vspace*{-36pt}\bfseries\href{http://www.tex.ac.uk/tex-archive/help/Catalogue/entries/enumitem-zref.html}{\HUGE\thispackage}\vspace*{6pt}} +% \date{} +% \author{\small\thisdate~--~\hyperref[v\thisversion]{version \thisversion}} +% \subtitle{\begin{tabu}{c}\LARGE \thisinfo\\[.3ex]\large The \cs\refitem command \\[.5ex] \small\FC\end{tabu}\vspace*{-24pt}} +% \maketitle +% +% \deffootnote{1em}{0pt}{\rlap{\thefootnotemark.}\kern1em} +% {\vspace*{-1.3cm}\let\quotation\relax\let\endquotation\relax +% \begin{abstract}\parskip\medskipamount\parindent0pt\lastlinefit0\leftskip.5cm\rightskip\leftskip +% +% \thispackage, as a companion package for \Xpackage{enumitem}, extends the references mechanism +% for lists of items and allows hyperlinks to any items in lists formatted by \xpackage{enumitem}. +% Hyper-references to lists seems not always necessary, but their importance rise much when a document +% contains lists that can stretch out on several pages. +% +% Primarily intented for \texttbf{enumerate} environments (\ie numbered lists), +% \thispackage* can also reference any item in \texttbf{description} or \texttbf{itemize} +% environments: restrictions can be set with the \hyperref[package options]{package options}. +% +% A \hyperref[sec:naturalrefscheme]{natural reference scheme} for referencing items anywhere in the +% document is provided with three modalities (the \hyperref[commarefscheme]{\emph{commaref}} scheme, +% the \hyperref[refitemscheme]{\emph{refitem}} scheme and the \hyperref[userscheme]{\emph{user}} scheme). +% The references can be typeset differently with the command +% \hyperref[refitem]{\cs{refitem}}, its options and eventually arbitrary text. +% +% Additionnally, \thispackage* allows to typeset greek-enumerated lists with the +% \refitem{package options{greek}}[\textt{greek}] or \refitem{package options{greekctr}}[\textt{greekctr}] +% package options, which use code from packages \Xpackage{alphalph} and \Xpackage{engrec} or \Xpackage{greekctr}. +% +% References to items in external documents compiled with \xpackage{enumitem-zref} is also possible +% with \hologo{pdfTeX}\footnote{This is not \xpackage{xr} but ``pure'' \pdf.}. +% +% \thispackage* requires and is based on the packages \xpackage{enumitem} by Javier Bezos +% and \Xpackage{zref} by Heiko Oberdiek. +% It works with an \eTeX{} distribution of \LaTeX. +% +% \end{abstract}} +% +% \thisfootinfo +% +% \enlargethispage\baselineskip +% \tocsetup{ +% before=\colorlet{reflink}{black}, +% pagestyle=firstpage, +% section/skip=4pt plus2pt minus2pt, +% section/dotsep,section/leaders, +% subsection/skip=0pt plus2pt minus2pt, +% subsubsection/pagenumbers=off, +% subsubsection/dotsep=, +% subsubsection/font=\small, +% title=Contents\quad{\pkgcolor\leaders\vrule height3.4pt depth-3pt\hfill\null}\kern0pt\vskip-6pt, +% title/top=6pt plus2pt, +% bookmark={text=Contents,bold}, +% columns=2, +% multicols/beforeend=\aftergroup\tochrule, +% } +% \def\tochrule{\leavevmode{\pkgcolor\hrule}} +% \begingroup\let\footnoterule\relax +% \tableofcontents +% \clearpage \endgroup +% +% \pagestyle{corpus} +% +% { +% \sectionformat\section{font=\centering\lsstyle\bfseries\LARGE,label=} +% \value{secnumdepth}=0\relax +% \section(\cs{refitem} properties summary){Summary of the properties for \cs{refitem}} +% } +% +% \colorlet{reference}{DarkGreen} +% \colorlet{properties}{RoyalBlue} +% +% \subsection*{Terms definitions} +% +% +% \begin{itemize}[labelsep=2em,leftmargin=3cm] +% \item [\cs{label}\M*{user}] This is a user \emph{label}. +% \item [{\cs{item}\M*[user]}] This is a user \emph{item}. +% \item [\cs{item}] This is an \emph{automatic} item. +% \end{itemize} +% +% \marginnote\dbend User items are labelized, hence expanded (with \cs\protect). +% +% The \cs\label command can be put inside the optional argument of \cs\item:\par +% \centerline{ \cs{item}\M*[ text \cs{label}\M*{label of the item}] }§ +% or in the paragraph that follows. +% +% Package \xpackage{hyperref}'s \textt{[verbose]} option reports all inserted +% anchor names in the \xext{log} file. +% +% \subsection*{Syntax for \cs{refitem}} +% +% {\large +% \begin{tikzpicture} +% +% \node at (0,0) (refitem) [anchor=west] {\cs{refitem}} +% node [anchor=west] at (refitem.east) (reference) {\M*{\textcolor{reference}{reference}}} +% node [anchor=west] at (reference.east) (properties) {\M*[\textcolor{properties}{properties to display}]}; +% +% \node at (0,-4) [anchor=west] (refdesc) {reference with either:} +% node [anchor=west] at (refdesc.east) {% +% \begin{tabu}spread0pt \{{X[-1r]X[-1]}. +% The \hyperref[refitemscheme]{\emph{refitem}} scheme: &\textt{listname\M*{label}\M*{label}\M*{label}...} \\ +% The \hyperref[commarefscheme]{\emph{commaref}} scheme:& \textt{listname,index,index,index,...} \\ +% The \hyperref[userscheme]{\emph{user}} scheme: &\textt{reference} to a \cs{label} command +% \end{tabu}}; +% \draw [->,color=reference] (refdesc.north) -- (reference.south); +% +% \node at (7,-2) [anchor=west] (propdesc) { +% \begin{tabu}spread0pt {X[-1]} Optional text containing properties\\ +% Default is \M*[\textcolor{properties}{\cs{ref}} ]\end{tabu}}; +% +% \draw [->,color=properties] (propdesc.north) -- (properties); +% +% \end{tikzpicture}} +% +% +% The order in which the properties are given is related to the depth of the list:§§ +% \begin{tikzpicture}[start chain, node distance=.5cm and 1.5cm] +% \node [on chain] at (0,0) {\textbf[} +% node [on chain,color=properties] (grandparents) {\cs{ref}} +% node [on chain,color=properties] (parents) {\cs{ref}} +% node [on chain,color=properties] (item) {\cs{ref}} node [on chain] {\textbf]}; +% \node at ($(item.south)+(0,-1.5)$) (itemref) {\begin{tabu}{c} refers to\\ the item\\ \refitem{tikzex,1,2}\end{tabu}}; +% \draw [->] (itemref.north) -- (item.south); +% +% \node at ($(parents.south)+(0,-1.5)$) (parentsref) {\begin{tabu}{c} refers to\\ the parent\\ \refitem{tikzex,1}\end{tabu}}; +% \draw [->] (parentsref.north) -- (parents.south); +% +% \node at ($(grandparents.south)+(0,-1.5)$) (grandparentsref) {\begin{tabu}{c} refers to the\\ second ancestor\\ \itshape Here an\\\itshape empty string\end{tabu}}; +% \draw [->] (grandparentsref.north) -- (grandparents.south); +% +% \filldraw [MistyRose] (12,-1.3) rectangle (15,-1.8); +% +% \node (list) [on chain,yshift=-1cm,xshift=-1cm] {\begin{tabu}to6cm{X} +% \begin{enumerate}[label=\arabic*.,name=tikzex] +% \item One +% \begin{enumerate}[label=\roman*)] +% \item sub item +% \item sub item +% \end{enumerate} +% \item Two +% \end{enumerate} \end{tabu}}; +% +% \end{tikzpicture} +% +% \smallskip +% +% \newtabulinestyle{dotted=on 1pt off2pt} +% \def\dash{\hbox{$\scriptscriptstyle\mkern2mu\cdotp\mkern2mu$}} +% +% \AtBeginShipoutNext{\AtBeginShipoutUpperLeft{^^A +% \tikz[remember picture,overlay]\draw [<->] (common properties start) -- (common properties end) +% node [midway,above,rotate=90] {\scriptsize\lsstyle\begin{tabu}{X[-1,c]} most common\\ properties\end{tabu}};}} +% +% {\def\arraystretch{1}\def\margintext#1{\noalign{\vtop to0pt{\marginnote{\ttfamily\small #1}[-2.5ex]\vss}}} +% \begin{tabu}{>{\leavevmode\color{properties}}X[2.3]X[8]>{\bfseries\sffamily}X[-2c]} \hline \tabucline- +% \rowfont[c]{\color{black}\bfseries} +% Property &Description &Examples \\ \tabucline[\dash]- +% \tikzlabel[yshift=1ex,xshift=-.3cm]{common properties start} +% \cs{label} &The item label: automatic or user defined by \cs{item}\M*[...] &II)\, \textmd{or}\, \textbullet \\ +% \cs{label\stform*}&For automatic labels in \textt{enumerate} lists: the label without any text around (useful to ``concatenate'' labels). +% Otherwise, the same as \cs{label}. &II\, \textmd{or}\, \textbullet \\ +% \cs{ref} &If the \textt{ref} key of \xpackage{enumitem} has been set, the ``evaluation'' of the \textt{ref} key. +% Otherwise, the same as \cs{label} &II)\, \textmd{or}\, \textbullet \\ +% \tikzlabel[xshift=-.3cm]{common properties end} +% \cs{ref\stform*} &The same as \cs{label\stform*} &II\, \textmd{or}\, \textbullet \\ \tabucline[\dash]- +% \cs{listname} &The name given to the list with the key \textt{name}. \\ +% \cs{depth} &The list depth. \\ +% \cs{index} &The index of the item in the list. Every item is counted.\\ +% \cs{listctr} &The value of \cs{@listctr} for the item -- only inside \textt{enumerate} lists. +% May be different from \cs{index} if the list contains user \emph{items}. \\ +% \cs{type} &The type of the list: either \textt{enumerate} or \textt{itemize} or \textt{description}. \\ +% \cs{currentlabel} &\LaTeX's \cs{@currentlabel} \\ +% \cs{anchor} &The name of the anchor set for the item. \\ \margintext{\textsuperscript{hyperref}} +% \cs{currentlabelname}&\xpackage{hyperref}'s (or \xpackage{nameref}'s) \cs{@currentlabelname} \\ \margintext{\textsuperscript{hyperref}} +% \textt{\string\refitem} &The list of references with the \hyperref[refitemscheme]{\emph{refitem}} scheme for the item. & \mdseries\csref{zeninfo} \\ +% \cs{commaref} &The list of references with the \hyperref[commarefscheme]{\emph{commaref}} scheme for the item. & \mdseries\csref{zeninfo} \\ +% \cs{default} &The same as \cs{ref} & \\ \tabucline- +% \end{tabu}} +% +% +% \clearpage +% +% \section{Forewords} +% +% \subsection{Numbered lists, not numbered lists and \texorpdf\xpackage{hyperref}} +% \label{sec:numberedlists} +% +% \LaTeX{} defines two ``classes'' of lists of items: +% \begin{itemize}[leftmargin=1cm] +% \item \texttbf{enumerate} lists which are \textit{numbered} (\ie a counter gives an index to each item in the list), +% \item \texttbf{description} and \texttbf{itemize} lists which are \textit{not numbered} (no counter, thus no index). +%\end{itemize} +% +% When \xpackage{hyperref} is used in \textit{numbered lists}, each \cs{item} gives \xpackage{hyperref} +% the opportunity to define an anchor, whose name is chosen considering the current value of the \emph{index}. +% +% +% Different cases have to be considered: +% \begin{enumerate}[label=\arabic*),name=numberedlists,leftmargin=1cm] +% \item We are in a \emph{numbered} list (\ie \textt{enumerate}): +% \begin{enumerate}[label=\roman*),leftmargin=*] +% \item if the item is automatic (\cs{item} without option), \xpackage{hyperref} puts an anchor named \texttt{Item.IDX}. +% \item if the item is user defined (\cs{item}\M*[user item]), \xpackage{hyperref} does not put an anchor. +% \end{enumerate} +% \item We are not in a \emph{numbered} list (\ie \texttt{description} or \texttt{itemize}): +% \begin{enumerate}[label=\roman*),leftmargin=*] +% \item[] \xpackage{hyperref} does not put an anchor. +% \end{enumerate} +% \end{enumerate} +% +% Moreover, when \xpackage{hyperref} is loaded, the expansion of the \cs{label} command leads to the expansion of the item label +% (with \cs{protect}) for it is written to the \xext{aux} file: +% \begin{itemize} +% \item in the case \refitem{numberedlists{1}{i}}[\ref*\,\ref] +% \item and also in the case \refitem{numberedlists{1}{ii}}[\ref*\,\ref] if: +% \begin{itemize}[label=-] +% \item the list is a \textt{description} list, and +% \item package \xpackage{nameref} is loaded, and +% \item the \cs{label} command appears inside the \textt{user item} text. +% \end{itemize} +% \end{itemize} +% +% +% {\flushright\smaller\lk I was guardedly affraid about those rules when I understood them, as you may be...\par} +% +% \thispackage adds an anchor in the cases \refitem{numberedlists,1,2}[\ref*\,\ref] and \refitem{numberedlists,2}. +% The item label text is always expanded (with \cs{protect} and \xpackage{babel} protection). +% +% +% \subsection(A "natural" reference scheme for lists){A ``natural'' reference scheme for lists} +% \label{sec:naturalrefscheme} +% +% \thispackage provides \textbf{3 ways} to reference a specific item in a list. The first 2 can be used to reference +% items in lists of external documents as well. +% +% References are made with the command: \csref{refitem}, but \cs{hyperref} can be used as well. +% +% \makeatletter +% \newrobustcmd*\presitem{\@ifstar\presitem@star\presitem@nost} +% \newrobustcmd*\presitem@nost[1]{this is the item \presitem@star{#1}} +% \newrobustcmd*\presitem@star[1]{\ifdim\lastskip<.4em\unskip\hskip.4em\fi\textcolor{reference}{\textt{#1}}} +% \newrobustcmd*\namelist[1]{\texttt{`#1'}} +% \makeatother +% +% \cs{subitem} and \cs{subsubitem} provided in some classes cannot be referenced with \thispackage*. +% +% \subsubsection(The commaref scheme){The \textit{\db commaref} scheme} +% \label{commarefscheme} +% +% Assuming you gave a name to your \textt{enumerate}, \textt{description} or \textt{itemize} list, +% and let's say this name is \namelist{myList}, each item is given an index. +% Any item is indexed, whether it's printed by the mean of a user item or an an automatic item. +% Then: +% \begin{itemize}[name=commaref-myList] +% \item \presitem{myList,1} +% \item \presitem{myList,2} +% \begin{itemize}[itemindent=2cm,font=\bfseries] +% \item \presitem{myList,2,1} +% \item \presitem{myList,2,2} +% \item [user-defined] \presitem{myList,2,3} +% \end{itemize} +%\end{itemize} +% +% Reference to the third item can be made with: +% +% \begin{tabu}{lX} +% \cs[\red]{refitem}\M*{myList,2,1} &this prints: \refitem{commaref-myList,2,1} for it is the first item in the inner list. \\ +% \cs[\red]{refitem}\M*{myList,2,1}\M*[\cs{ref}.\cs{ref}] &prints: \refitem{commaref-myList,2,1}[\ref.\ref]. \\ +% \cs[\red]{refitem}\M*{myList,2,1}\M*[\cs{label}\cs{ }\cs{label}] &prints: \refitem{commaref-myList,2,1}[\label\ \label]. +% \end{tabu} +% +% +% Nothing simplest, no more comment... +% +% \subsubsection(The refitem scheme){The \textit{\db refitem} scheme} +% \label{refitemscheme} +% +% \begin{enumerate}[label=\Alph*),name=refitem-myList] +% \item \presitem{myList\M*{A}}. +% \item \presitem{myList\M*{B}} (as you'd have expected...) +% \begin{enumerate}[label=\roman*)] +% \item \presitem{myList\M*{B}\M*{i}}. \\ +% and is \emph{also} \presitem*{innerlist\{i\}} if this nested list has been named \namelist{innerlist}. +% \item \presitem{myList\{B\}\{ii\}} \quad (or \presitem*{innerlist\{ii\}}). +% \begin{enumerate}[label=\engrec*)\ ,ref=\engrec*] +% \item \presitem{myList\{B\}\{ii\}\{\string\alpha\}} (with the package option \texttt{[greek]}). +% \item \presitem{myList\{B\}\{ii\}\{\string\beta\}} \quad (or \presitem*{innerlist\{ii\}\{\string\beta\}}). +% \end{enumerate} +% \end{enumerate} +% \item \presitem{myList\{C\}} (as you'd have expected...) +% \item[\textbf{perso}] \presitem{myList\{perso\}}. +% \item \presitem{myList\{D\}} and is also \presitem*{myList,5} in the \textit{commaref} scheme. +% \begin{itemize} +% \item \presitem{myList\{D\}\{1\}} +% \item \presitem{myList\{D\}\{2\}} \\ +% inside \textt{itemize} lists, labels are replaced by their arabic index in the \textit{refitem} scheme. +% \end{itemize} +% \end{enumerate} +% +% And here is a reference to: +% +% \begin{tabu}{lX} +% \cs[\red]{refitem}\M*{myList\M*{B}\M*{ii}\M*{\cs{alpha}}} & \refitem{refitem-myList{B}{ii}{\alpha}} \\ +% \cs[\red]{refitem}\M*{myList\M*{B}\M*{ii}\M*{\cs{alpha}}}\M*[\cs{label}\cs{ }\cs{label}\cs{ }\cs{label}] & \refitem{refitem-myList{B}{ii}{\alpha}}[\label\ \label\ \label] \\ +% \cs[\red]{refitem}\M*{myList\M*{B}\M*{ii}\M*{\cs{alpha}}}\M*[\cs{label\stf}-{}-\cs{label\stf}-{}-\cs{label}] & \refitem{refitem-myList{B}{ii}{\alpha}}[\label*--\label*--\label] \\ +% \end{tabu} +% +% Now what happens with a description list: +% +% \begin{enumerate}[label=\arabic*\textdegree),name=refitem-myList2] +% \item \presitem{myList\M*{1}} +% \item \presitem{myList\M*{2}} +% \begin{description} +% \item [First description label] \presitem{myList\M*{2}\M*{first description label}} +% \item [And a second one] \presitem{myList\M*{2}\M*{and a second one}} +% \end{description} +% \item \presitem{myList\M*{3}} +% \end{enumerate} +% +% \begin{tabu}{lX} +% \cs[\red]{refitem}\M*{myList\M*{2}\M*{first description label}} & \refitem{refitem-myList2{2}{first description label }} \\ +% \cs[\red]{refitem}\M*{myList2\M*{2}\M*{first description label}}\M*[\cs{ref\stf}, \cs{label}] & \refitem{refitem-myList2{2}{first description label }}[\ref*, \label] \\ +% \cs[\red]{refitem}\M*{myList2\M*{2}\M*{first description label}}\M*[\cs{ref}\cs{ }\cs{ref}] & \refitem{refitem-myList2{2}{first description label }}[\ref\ \ref] \\ +% \end{tabu} +% +% The correspondance between the reference name and the reference that is finally printed is immediate: +% the \emph{refitem} scheme is almost useful when used with \xpackage{hyperref}. +% +% The list name \textt{myList} is case sensitive, but the item number \M*{B} or \M*{first description label} is not. +% This can be changed with the \refitem{package options{CaSeS}} package option. Trailing spaces in the item label +% are always removed from the reference name in the \hyperref[refitemscheme]{\emph{refitem}} scheme. +% +% +% \subsubsection({The user scheme (\cs{label})}){The \textit{\db user} scheme: with the \cs{label} command} +% \label{userscheme} +% +% \begin{enumerate}[label=\arabic*\,\textendash,name=user-myList,ref=\arabic*] +% \item \presitem{myList,1} and \presitem*{myList\{1\}} and as long as I type \cs{label}\M*{Important Item} it is also named \presitem*{Important Item}. +% \item \presitem{myList,2} and \presitem*{myList\{2\}}. +% \begin{enumerate}[label=\alph*)\ ] +% \item \presitem{myList,2,1} and \presitem*{myList\{2\}\{a\}}. +% \item \presitem{myList,2,2} and \presitem*{myList\{2\}\{b\}} and as long as I type:\\ +% \cs{label}\M*{Important subitem} it is also named \presitem*{Important subitem}. \label{Important subitem} +% \end{enumerate} +% \end{enumerate} +% +% Then you get: +% +% \begin{tabu}{X[-5]X} +% \cs[\red]{refitem}\M*{Important subitem} &\refitem{Important subitem} \\ +% \cs[\red]{refitem}\M*{Important subitem}\M*[\cs{label}\cs{ }\cs{label}] &\refitem{Important subitem}[\label\ \label] \\ +% \cs[\red]{refitem}\M*{Important subitem}\M*[\cs{ref\stf} sub point \cs{ref}] &\refitem{Important subitem}[\ref* sub point \ref] +% \end{tabu} +% +% The reference is case sentitive. +% +% \section{User Interface} +% \label{sec:userinterface} +% +% \subsection{Naming lists} +% +% To use the reference schemes defined by \thispackage, it is necessary to give lists a name. For that purpose, +% two new keys: \textt{name}\, and\, \textt{name\stform*} have been added to the keys provided by \xpackage{enumitem}. +% +% The key \textt{`name'} gives a name to the list, while \textt{name\stform*} is a bit more clever +% and should be used in every circonstances when lists are nested, almost when lists are automatically +% named by the mean of the paragraph they belong to. Example: +% +% \begin{Verb*} +% \newlist{myList}{enumerate}{3} +% \setlist[myList]{ label* = \arabic*., name* = \arabic{section}.\arabic{subsection}} +% \end{Verb*} +% +% In case of nested lists,\, \texttt{name\stform*}\, will compare the name you gave to the list with the name +% of its parent list, and ignore the key in case of equality. +% +% This gives: +% +% \newlist{naming-myList}{enumerate}{3} +% \setlist[naming-myList]{ label*=\arabic*., name* = \arabic{section}.\arabic{subsection}} +% +% \begin{naming-myList}[itemsep=0pt] +% \item First item +% \item Second item +% \begin{naming-myList}[itemsep=0pt] +% \item sub item +% \item another sub item +% \item a last sub item \cs{label}\M*{for further reference} \label{for further reference} +% \end{naming-myList} +% \end{naming-myList} +% +% And then: +% +% \begin{tabu}{lX[c]X} +% \cs[\red]{refitem}\M*{2.1,2,3} &\refitem{2.1,2,3} &in the \hyperref[commarefscheme]{\emph{commaref}} scheme \\ +% \cs[\red]{refitem}\M*{2.1\M*{2}\M*{3}} &\refitem{2.1{2}{3}} &in the \hyperref[refitemscheme]{\emph{refitem}} scheme \\ +% \cs[\red]{refitem}\M*{for further reference} &\refitem{for further reference} &in the \hyperref[userscheme]{\emph{user}} scheme \\ +% \end{tabu} +% +% \medbreak +% +% To name your lists automatically it is also possible to use (these are examples): +% +% \begin{itemize}[itemsep=0pt,topsep=0pt] +% \item \xpackage{interfaces-hypbmsec} with package \xpackage{hypbmsec}:\\ +% \textt{name\stform* = \cs{csname} the\cs{lastsectionname}\cs{endcsname}} +% \item package \xpackage{refcount}: \textt{name\stform* = \cs{getrefbykeydefault}\M*{reference}\M*{anchor}\M*{default}}. +% \end{itemize} +% +% +% \subsection(Making references: \cs{refitem}){Referencing the items : \csbf{refitem}} +% \label{refitem} +% +% \begin{declcs}{refitem}\M{reference}\M*[text with properties \cs{ref}, \cs{label} \etc.]\textsuperscript{babel}\\ +% \cs{refitem}\stform* \\ +% \end{declcs} +% +% \thispackage provides \cs{refitem} to reference the items of lists with the following possible syntaxes: +% +% {\tabcolsep=4pt +% \begin{tabu}{X[-1]<{\cellstrut}X} \toprule \savetabu{refitem} +% \cs{refitem}\M*{\textcolor{reference}{refname}}\M*[\textcolor{properties}{properties}] +% & displays a reference to \textt{\dg refname} \par +% the text displayed depends on the optional \textcolor{properties}{\textt{properties}} \par +% whose default value is \cs{ref}. \\ \tabucline[\dash]- +% \cs{refitem}\stform*\M*{\textcolor{reference}{refname}}\M*[\textcolor{properties}{properties}] +% & can be used when you want a reference but no hyperlink. \\ \bottomrule +% \end{tabu}} +% +% If the reference \textcolor{reference}{\textt{rename}} does not point to an item, \cs{refitem} +% behaves like \cs{ref} (or \cs{ref\stf}) and the \M*[properties] are ignored. +% A warning is displayed in the \xext{log} file. +% +% The properties available with \cs{refitem} are: +% +% \begin{enumerate}[labelwidth=2.4cm,leftmargin=2.6cm,align=left] +% \item [\csbf{ref}] This is the default property: the same as \LaTeX's \cs{ref} command: it expands +% to the text corresponding to the \textt{ref} key of the \xpackage{enumitem} list environment, +% which by default is: +% \begin{itemize}[leftmargin=1cm] +% \item in \textt{enumerate} lists: the same as the \textt{label}. +% \item in \textt{itemize} lists: the index of the item. +% \item in \textt{description} lists: the user defined label, or if no label has been given to +% the \cs{item} command, the index of the item. +% \end{itemize} +% \item [\csbf{label}] The label is printed, whatever value the \textt{ref\ key} has been given. For \textt{description}, +% the label may be empty. +% \item [\csbf{label\stf} \csbf{ref\stf}] This is a variant of \cs{label}: automatic labels in \textt{enumerate} lists are related +% to a counter. \cs{ref\stf} or \cs{label\stf} prints the formatted value of the counter, without any text around. +% For \textt{itemize}, \textt{description} or user items inside \textt{enumerate} lists, this is the same as \cs{label}. +% \item [\cs{page}] The same as \cs{pageref}. +% \item [\cs{name}] The name that has been given to the list. +% \item [\cs{depth}] The depth of the list (equal to\, \textt 1\, if the list is not nested). +% \item [\cs{index}] The index of the item; user defined items are counted. +% \item [\cs{listctr}] The item number inside numbered lists (\ie \textt{enumerate}); user defined items are not counted: +% this is the value of the counter \cs{@listctr}. +% \item [\cs{type}] The type of the list (\ie \textt{enumerate}, \textt{itemize} or \textt{description}) +% \item [\cs{refitem}] The list of references names that can be invoked with \cs{refitem} for this specific item +% in the \hyperref[refitemscheme]{\emph{refitem}} scheme (see also \csref{zeninfo}). +% \item [\cs{commaref}] The list of references names that can be invoked with \cs{refitem} for this specific item +% in the \hyperref[commarefscheme]{\emph{commaref}} scheme (see also \csref{zeninfo}). +% \end{enumerate} +% +% \begin{declcs}{refitem}\M*[file:\textellipsis]\M{reference}\M{text}\textsuperscript{babel} +% \end{declcs} +% +% For reference to external files (to make hyperlinks), \cs{refitem} can be invoked with the following syntax: +% +% \begin{tabu}{X[-1]<{\cellstrut}X}\toprule +% \cs{refitem}\M*[file:\textellipsis]\M*{{\dg refname}}\M*{{\bf text}} +% &Can be used for references to an external \xext{pdf} file. \\ \tabucline[dotted]- +% \cs{refitem}\M*[]\M*{{\dg refname}}\M*{{\bf text}} +% & The current file is used by default... +% \\ \bottomrule +% \end{tabu} +% +% Only the \hyperref[refitemscheme]{\emph{refitem}} and the \hyperref[commarefscheme]{\emph{commaref}} schemes can be used. +% The \hyperref[userscheme]{user} scheme cannot be used presently for external files. An implementation ``à la \xpackage{xr}'' +% might be provided in a further release. +% +% +% \iffalse +% \begin{tabu}{|>{\ttfamily}l<{\cellstrut}X[m]|} +% \multicolumn{2}{c}{\makecell[c]{\cellstrut\Large\bfseries Available properties \\ +% \bfseries\large\cellstrut For the usage of those properties, please refer to the \hyperref[sec:completeexample]{complete example}.% +% }} \\ \hline +% \csbf[\db]{ref} & +% This is the default property. +% The same as \LaTeX's\, \cs{ref}: the text corresponding to the \texttt{ref} key of the +% \xpackage{enumitem} list environment is printed, which by default is the same as the +% \textt{label} key in \textt{enumerate} lists. For \textt{itemize} lists, \cs{ref} +% is the index of the item. \par +% See \Xpackage{enumitem} package documentation for explanation of the \textt{ref\ key}. \\\hline +% \csbf[\db]{label} & +% The label will be printed, whatever value the \textt{ref\ key} has been given. \\\hline +% \csbf[\db]{page} & The page will be printed, like ``standard'' \LaTeX-\cs{pageref} \\\hline\hline +% \cs{name} & the list name it is has one (otherwise an empty string)\\ \tabucline[on1pt off 2pt]- +% \cs{depth} & the list depth \\ \tabucline[on1pt off 2pt]- +% \cs{index} & the \textbf{index} of the item: user defined items \textbf{are counted}\\ \tabucline[on1pt off 2pt]- +% \cs{listctr} & the \textbf{item number}: user defined items are \textbf{not counted}\\ \tabucline[on1pt off 2pt]- +% \cs{type} & the type of the list (\ie \texttt{enumerate} or \texttt{itemize} or \texttt{description}) \\ \tabucline[on1pt off 2pt]- +% \cs{refitem} & the list of references names that can be invoked with \cs{refitem} for this specific item +% using the \textit{refitem} scheme (see \hyperref[subsec:zeninfo]{\cs{zeninfo}}) \\ \tabucline[on1pt off 2pt]- +% \cs{commaref} & +% the list of references names usable with \cs{refitem} for this specific item using the \textit{commaref} +% scheme (see \hyperref[subsec:zeninfo]{\cs{zeninfo}})\\ \hline\hline +% \end{tabu} +% \fi +% +% +% \subsection[The package options]{\thispackage* package options} +% \label{subsec:packageoptions}\label{package options} +% +% \thispackage can be loaded with the following options: +% \newcommand\CheckOK{{\scriptsize\textcolor{ForestGreen}\CheckmarkBold}} +% \newcommand\CheckFAIL{{\scriptsize\textcolor{Crimson}\XSolidBrush}} +% +% \AtBeginShipoutNext{\AtBeginShipoutUpperLeft{\tikz[remember picture,overlay] +% \draw [<->] (package options start) -- (package options end) +% node [midway,above,rotate=90] {\lsstyle\scriptsize\ttfamily defaults};}} +% \enlargethispage{1.5\baselineskip} +% \begin{itemize}[font=\ttfamily,labelwidth=2cm,leftmargin=\widthof{description\hbox to1em{}},labelsep=6pt,align=left,name=package options] +% \item[enumerate] disables the references for \textt{itemize} and \textt{description} lists: \marginnote{\tikzlabel[xshift=-.2cm,yshift=.2cm]{package options start}\scriptsize\textt{true}} +% only enumerated lists can be referenced. +% \item [itemize] enables/disables the references for \textt{itemize} lists. \marginnote{\scriptsize\textt{true}} +% \item [description] enables/disables the references for \textt{description} lists. \marginnote{\scriptsize\textt{true}} +% \item [greek] Defines \cs{engrec} (lowercase) and \cs{EnGrec} (uppercase) to make enumerate \marginnote{\scriptsize\textt{false}} +% lists of items with the greek alphabet as the label (package \xpackage{engrec}).\\ +% \cs{engrec} and \cs{EnGrec} can be used in place of \cs{arabic} (f.ex. \textt{label=\cs{engrec}*}). +% \item [greekctr] Defines \cs{greek} and \cs{Greek} (like \textt{greek} option but with package \Xpackage{greekctr}). \marginnote{\scriptsize\textt{false}} +% \item [CaSeS] Activate this option to get CaSeS sEnSiTiV references in the \marginnote{\tikzlabel[xshift=-.2cm,yshift=-.5cm]{package options end}\scriptsize\textt{false}} +% \hyperref[refitemscheme]{\emph{refitem}} scheme. This option applies only +% to the \hyperref[refitemscheme]{refitem} scheme. +% List names are always case sensitive.\\ +% If this option is enabled with \xpackage{hyperref}, anchors corresponding to the +% \hyperref[refitemscheme]{\emph{refitem}} scheme will be case sensitiv as well. \\ +% Package \xpackage{hyperref}'s \textt{[verbose]} option allows to see anchor names in the \xext{log} file. \par +% \centering +% \begin{tabu}to .8\linewidth{X[2r]@{\hskip1cm}XX} \tabucline- +% \rowfont[c]{\bfseries\ttfamily} & CaSeS = true & CaSeS = false \\ \tabucline[\dash]- +% & +% \begin{enumerate}[label=\Roman*),before=\vspace*{-\baselineskip}] +% \item First +% \item Second +% \end{enumerate} +% & +% \begin{enumerate}[label=\Roman*),before=\vspace*{-\baselineskip}] +% \item First +% \item Second +% \end{enumerate} \\ \tabucline[\dash]- +% +% \cs{refitem}\M*{myList\M*{I}} &\CheckOK works & \CheckOK works \\ +% \cs{refitem}\M*{myList\M*{i}} &\CheckFAIL doesn't work & \CheckOK works \\ +% \cs{refitem}\M*{mylist\M*{I}} &\CheckFAIL doesn't work & \CheckFAIL doesn't work \\ +% +% \multicolumn3c{List names are always case sensitive.} \\ \tabucline- +% \end{tabu} +% \end{itemize} +% +% {\small +% \begin{tabu}{>{\ttfamily}X[-4r]*3{X[c]}} \tabucline- +% \multicolumn4c{\textbf{Types of lists that can be referenced}} \\ +% \rowfont{\normalfont\itshape} +% \hfill\textup{Package option}\hfill\null &enumerate &itemize &description \\\tabucline- +% [enumerate] &\textbullet & & \\\tabucline[\dash]- +% [itemize] &\textbullet &\textbullet & \\\tabucline[\dash]- +% [description] &\textbullet & &\textbullet \\\tabucline[\dash]- +% [enumerate,itemize] &\textbullet &\textbullet & \\\tabucline[\dash]- +% [enumerate,description] &\textbullet & &\textbullet \\\tabucline[\dash]- +% [itemize,description] &\textbullet &\textbullet &\textbullet \\\tabucline[\dash]- +% [enumerate,itemize,description] &\textbullet &\textbullet &\textbullet \\\tabucline[\dash]- +% {\normalfont none of the above} &\textbullet &\textbullet &\textbullet \\\tabucline- +% \end{tabu}} +% +% \footnotetext{\parbox[t]{\linewidth}{For the French language with \xpackage{babel} \textt{frenchb}-setup, +% \textt{itemize} lists can be processed by \thispackage* only if the option: +% +% \centerline{\cs{frenchbsetup}\M*{CompactItemize=false}} +% +% has been set. This option is automatically set by \xpackage{enumitem-zref} when option \textt{[itemize]} +% is passed.}} +% +% +% \subsection[{If your are lost \cs{zeninfo} is your friend}]{If your are lost \csbf{zeninfo} is your friend} +% \label{subsec:ifyouarelost} \label{subsec:zeninfo} +% +% \begin{declcs}{zeninfo}\M[info-key] +% \end{declcs} +% +% In the paragraph following an item, \cs{zeninfo} reports some informations about the references to the current item: +% +% \begin{tabu}{@{}>{\ttfamily\bfseries}X[-1]X} +% depth &The depth of the list. \\ +% index &The index of the item. \\ +% commaref &The references that can be used to reference the item in the \hyperref[commarefscheme]{\emph{commaref}} scheme. \\ +% refitem &The reference that can be used to reference the item in the \hyperref[refitemscheme]{\emph{refitem}} scheme. \\ +% anchor &The anchor set for the item (if \xpackage{hyperref}). +% \end{tabu} +% +% With no argument, \cs{zeninfo} prints all these informations. +% \bigskip +% +% Example with the \xpackage{pifont} package: +% +% \begin{Verb*} +% \newcommand\@Ding[1]{\ding{\number\numexpr#1 + 171}} +% \newcommand\Ding[1]{\@Ding{\value{#1}}} +% \AddEnumerateCounter \Ding \@Ding {} +% +% \begin{enumerate}[label=\Ding*,name=dingList] +% \item One +% \item Two +% \item Three ($rred(\zeninfo)) +% \end{enumerate} +% \end{Verb*} +% +% {\makeatletter +% \newcommand\@Ding[1]{\ding{\number\numexpr#1+171}} +% \newcommand\Ding[1]{\@Ding{\value{#1}}} +% \AddEnumerateCounter\Ding\@Ding{} +% +% \begin{enumerate}[label=\Ding*,name=dingList] +% \item One +% \item Two +% \item Three \textcolor{ForestGreen}\zeninfo +% \end{enumerate} +% +% Now: +% +% {\centering +% \begin{tabu}{X[-1r]X[-1c]X[-1]} +% \cs[\rred]{refitem}\M*{dingList\M*{\cs{@Ding}\M*{3}}} & produces & \refitem{dingList{\@Ding{3}}} +% \end{tabu}\par} +% +% Note that for this purpose: +% \begin{itemize} +% \item \cs{@Ding} could be named differently (without \textt @). +% \item the \hyperref[commarefscheme]{\emph{commaref}} scheme is easier: \cs{refitem}\M*{dingList,3} gives \refitem{dingList,3}. +% \end{itemize} +% +% This example shows the output of \textcolor{ForestGreen}{\cs{zeninfo}}. +% +% } +% +% +% +% +% \StopEventually{ +% } +% \clearpage +% \section{Flow chart of expansion: How does it work ?} +% +% \begin{center} +% +% \hspace*{-1.5cm} +% \begin{tikzpicture}[framed,scale=.75, +% start chain=going below,every join/.style={->},node distance=.5cm and .5cm] +% +% \node [on chain,font=\bfseries] (beginenv) {\cs{begin}\M*{list environment}} +% node [on chain] (H) {} +% node [on chain=going right] (enit@@list) {% +% \begin{tabu}spread0pt {X[-1]} set the standard keys stored into \cs{enit@@list}\\ set the automatic \textt{name} key without argument.\end{tabu}}; +% \draw [->] (beginenv) |- (enit@@list); +% \node [on chain,join] (zen@autoname) {\cs{zen@autoname} (callback)} +% node [on chain=going right,join,node distance=2cm] (zen@autonamedesc) {% +% \begin{tabu}spread0pt \{{X[-1]}. \rowfont[c]{} saves:\\ \cs{zen@@priorlistname} \\ \cs{zen@@priorcommaref} \\ \cs{zen@@priorrefitem}\\ +% \rowfont[c]{} defines: \\ \cs{zen@@grouplevel} \\ \cs{zen@@depth} \\ +% \rowfont[c]{} overloads: \\ \cs{@trivlist} \end{tabu}}; +% \node [yshift=-.5cm] (HH) at (zen@autonamedesc.south -| H) {}; +% \chainin (HH); +% \node [on chain=going right] (enit@@enum) {set the standard keys stored into \cs{enit@@enum}, \cs{enit@@item} or \cs{enit@@desc}}; +% \draw [->] (H) |- (enit@@enum); +% \chainin (HH); +% \node [on chain] (HHH) {} +% node [on chain=going right] (userkeys) {set the user keys for the environment}; +% \draw [->] (HH) |- (userkeys); +% \node [on chain] (HH) {}; +% \node (keyname) at (HH -| zen@autoname) {key \textt{name}}; +% \chainin (keyname); +% \draw [->] (userkeys) |- (keyname.west); +% \node (keynamecallback) at (keyname -| zen@autonamedesc.west) [anchor=west] {\begin{tabu}spread0pt \{{X[-1]}. \rowfont[c]{} defines:\\ \cs{zen@@listname}\end{tabu}}; +% \chainin (keynamecallback); +% \draw [->] (keyname) -- (keynamecallback); +% +% \node [yshift=0cm] (HH) at (keynamecallback.south -| H) {}; +% \chainin (HH); +% \node [on chain=going right] (expandlist) {expand \cs{list}}; +% \draw [->] (HHH) |- (expandlist); +% \node [on chain] (HH) {} node [on chain=going right] (expand @trivlist) {\cs{@trivlist}}; +% \draw [->] (expandlist) |- (expand @trivlist); +% \node [on chain] (HH) {} node [on chain=going right] (expand zen@setupref) {expand \cs{zen@setupref}}; +% \draw [->] (expand @trivlist) |- (expand zen@setupref); +% \node [on chain=going right] {} +% node [on chain=going right,join= with expand zen@setupref] (zen@setuprefdesc) {\begin{tabu}spread0pt \{{X[-1]}. +% overloads: \cs{makelabel}\\ +% defines \cs{zen@refitem@fun}\footnotemark +% \end{tabu}}; +% \node [yshift=-1cm] (Hitem) at (H |- zen@setuprefdesc) {}; +% \chainin (Hitem); +% \node [on chain=going right] (item) {expand \cs{item}}; +% \draw [->] (Hitem |- expandlist) |- (item); +% \node [on chain] (HH) {} node [on chain=going right] (makelabel) {\cs{makelabel}}; +% \draw [->] (item) |- (makelabel); +% \node [on chain] (HH) {} node [on chain=going right] (zen@makeref) {\cs{zen@makeref}}; +% \draw [->] (makelabel) |- (zen@makeref); +% \node [on chain=going right,join] (zen@makerefdesc) {% +% \begin{tabu}spread0pt \{{X[-1]X[-2]}. +% \rowfont[c]{} defines: & \\ +% \cs{zen@@ref} &\xpackage{zref} property (\cs{ref})\\ +% \cs{zen@@starlabel} &\xpackage{zref} property (\cs{label\textasteriskcentered})\\ +% \cs{zen@@commaref} &(\hyperref[commarefscheme]{\emph{commaref}} scheme) \\ +% \cs{zen@@refitem} &(\hyperref[refitemscheme]{\emph{refitem}} scheme) \\ +% \cs{zen@@anchor} &\xpackage{hyperref} \\ +% \multicolumn2l{\cs{refstepcounter\M*{zenItem}}} if no anchor \\ +% & has been set by \xpackage{hyperref}. +% \end{tabu}}; +% \node[yshift=-.5cm] (HH) at (makelabel |- zen@makerefdesc.south) {}; +% \chainin (HH); +% \node [on chain=going right] (makelabelORI) {original \cs{makelabel}: typeset the label}; +% \draw [->] (makelabel) |- (makelabelORI); +% \chainin (HH); +% \node [on chain] {} node [on chain=going right] (zen@labelize) {\cs{zen@labelize}}; +% \draw [->] (HH) |- (zen@labelize); +% \node [on chain=going right,join] (zen@labelizedesc) {\begin{tabu}spread0pt \{{X[-1]}. insert anchors\\ write \xpackage{zref} labels. \end{tabu}}; +% \node (HH) at (H |- zen@labelizedesc.south) {}; +% \chainin (HH); +% \node [on chain,join = with Hitem,font=\bfseries] (endenv) {\cs{end}\M*{list environment}}; +% +% \end{tikzpicture} +% +% \footnotetext{Used for the property \cs{label\textasteriskcentered} +% and to define the label (and the anchor) in the \emph{refitem} scheme.} +% +% \end{center} +% \clearpage +% +% \StopEventually{ +% } +% +% \IMPLEMENTATION +% +% \subsection{Identification and requirements} +% +% The package namespace is \texttbf{\db\string\zen@} +% +% \begin{macrocode} +%<*package> +\NeedsTeXFormat{LaTeX2e}[2005/12/01] +\ProvidesPackage{enumitem-zref}[2011/02/18 v1.8 - Extended references for enumitem pkg] +\RequirePackage{ltxcmds,etoolbox,kvoptions,gettitlestring,enumitem} +\RequirePackage{zref}[2010/05/01] +\RequirePackage{zref-user,zref-counter} +\GetTitleStringDisableCommands{\let\enit@format \@empty} +% \end{macrocode} +% +% Some \cs{catcode} assertions: +% +% \begin{macrocode} +\let\zen@AtEnd \@empty +\def\TMP@EnsureCode#1#2{{% + \count@\catcode#1\relax + \toks@\expandafter{\zen@AtEnd \catcode#1 } + \xdef\zen@AtEnd{\the\toks@ \the\count@\relax}} + \catcode#1 #2\relax +} +\TMP@EnsureCode{40}{12} % ( +\TMP@EnsureCode{41}{12} % ) +\TMP@EnsureCode{`\Ï}{14} % Ï (default comment: itemize option) +\TMP@EnsureCode{`\Ð}{14} % Ð (default comment: description option) +\TMP@EnsureCode{`\Ë}{9} % Ë (default ignore: external option) +% \end{macrocode} +% +% \subsection{The package options} +% +% \begin{macrocode} +\SetupKeyvalOptions{family=zen,prefix=zen@} +\DeclareBoolOption{CaSeS} +\DeclareBoolOption{itemize} +\DeclareBoolOption{description} +\DeclareBoolOption{enumerate} +\DeclareVoidOption{greek}{\AtEndOfPackage\zen@option@greek} +\def\zen@option@greek{% + \RequirePackage{engrec,alphalph} + \let\zen@grecORI \@grec \let\zen@GrecORI \@Grec + \let\@grec \relax \let\@Grec \relax + \newalphalph\@grec[wrap]\zen@grecORI{24} + \newalphalph\@Grec[wrap]\zen@GrecORI{24} + \AddEnumerateCounter\engrec\@grec{\@grec{23}}% widest is \psi + \AddEnumerateCounter\EnGrec\@Grec{\@Grec{12}}% widest is M + \let\zen@option@greek \relax +}% \zen@option@greek +\DeclareVoidOption{greekctr}{\AtEndOfPackage\zen@option@greekctr} +\def\zen@option@greekctr{% + \RequirePackage{greekctr,alphalph} + \let\zen@greekORI \@greek \let\zen@GreekORI \@Greek + \let\@greek \relax \let\@Greek \relax + \newalphalph\@greek[wrap]\zen@greekORI{24}% + \newalphalph\@Greek[wrap]\zen@GreekORI{24}% + \AddEnumerateCounter\greek\@greek{\@greek{23}}% widest is \psi + \AddEnumerateCounter\Greek\@Greek{\@Greek{12}}% widest is M + \let\zen@option@greekctr \relax +}% \zen@option@greekctr +\DeclareVoidOption{external}{\catcode`\Ë 14\relax}% Ë = comment +\DeclareDefaultOption{\@unknownoptionerror} +\AtBeginDocument{% + \@ifpackageloaded{greekctr} \zen@option@greekctr \relax + \@ifpackageloaded{engrec} \zen@option@greek \relax +} +\ProcessLocalKeyvalOptions{zen} +\ifzen@enumerate\else + \ifzen@itemize \zen@enumeratetrue\else + \ifzen@description \zen@enumeratetrue\else + \zen@enumeratetrue \zen@itemizetrue \zen@descriptiontrue + \fi\fi + \ifzen@enumerate\else + \zen@enumeratetrue \PackageWarning{enumitem-zref} + {Option `enumerate = false' has no effect}% + \fi +\fi +\ifzen@itemize \catcode`\Ï 9 \fi % ignore Ï +\ifzen@description\catcode`\Ð 9 \fi % ignore Ð +\AtBeginDocument{\zen@item@comma \setcounter{zenItem}\z@} +% \end{macrocode} +% +% Babel French: \xfile{frenchb} redefines \cs{itemize} at begin document. +% +% Therefore, when option \texttt{[itemize]} of \thispackage is used, one have to ensure that +% babel-french setup \texttt{CompactItemize=false} is set: +% +% \begin{macrocode} +Ï \AtEndPreamble{\ifdefined\frenchbsetup\frenchbsetup{CompactItemize=false}\fi}% [itemize] option +% \end{macrocode} +% +% \subsection{Some constants} +% +% \begin{macro}{zenItem} +% +% is the global \LaTeX{} counter for \xpackage{zref} labels and anchors added by \thispackage* +% +% \begin{macro}{\c@zenidx} +% +% is the local counter for the index of the items. +% Every item is counted. +% +% \begin{macro}{\zen@toks} +% +% A token to be used by \cs{refitem} at the time the (optional) properties are analyzed: +% we can't use \cs{toks@} at this time, because \cs{toks@} could have been set to a value +% anywhere else. +% +% \begin{macrocode} +\newcounter{zenItem} +\globcount\c@zenidx +\newtoks\zen@toks +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\zen@@autolabel} +% +% To check if the item user-defined or automatic. +% +% \begin{macrocode} +\def\zen@@autolabel{\@itemlabel} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\zen@@noreference} +% +% How to display undefined references. +% +% \begin{macrocode} +\def\zen@@noreference{\nfss@text{\reset@font\bfseries ??}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\zen@Hy@anchor} +% +% is used to put the anchors for the items. +% It's a wrapper for \xpackage{hyperref} \cs{Hy@raisedlink}. +% +% \begin{macrocode} +\protected\def\zen@Hy@anchor#1{% + \Hy@raisedlink{\hyper@anchorstart{#1}\hyper@anchorend}% +}% \zen@Hy@anchor (wrapper for \Hy@raisedlink) +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\zen@lowercase} +% \begin{macro}{\zen@CaSeS} +% +% is used to make lowercase references in the \hyperref[refitemscheme]{\emph{refitem}} scheme, +% when the package option \refitem{package options{cases}} is not active. +% +% \begin{macrocode} +\let\zen@CaSeS \@firstofone +\ifzen@CaSeS \let\zen@lowercase \zen@CaSeS +\else \let\zen@lowercase \lowercase +\fi +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\zen@ifrefundefined} +% +% Switch to the first part if the \LaTeX{} label exists, to the second part otherwise. +% \begin{macrocode} +\def\zen@ifrefundefined#1{\ltx@IfUndefined{r@#1}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\zen@box} +% +% A utility to expand code inside a temporary \cs{vbox} +% +% \begin{macrocode} +\def\zen@box{\hfuzz\maxdimen \vfuzz\hfuzz \hbadness\@M \vbadness\hbadness + \tracinglostchars\z@ \everypar{}\setbox\z@=\vbox} +% \end{macrocode} +% \end{macro} +% +% \subsection{Properties for the zref list: zen@list} +% +% \begin{macro}{\zen@unique} +% +% is the unique counter to create unique labels for \xpackage{zref} references (internal use only): +% +% \begin{macrocode} +\zref@newlist{zen@list} +\def\zen@{zen>\the\c@zenItem} +\zref@newprop{zen@}[]\zen@ +\def\zen@temp#1#2#3{% + \zref@newprop{zen@#2}[\zen@@noreference]{#3}% + \ifx U#1\expandafter\let\csname zen@extract@#2\endcsname\unexpanded + \else \expandafter\let\csname zen@extract@#2\endcsname\detokenize + \fi +}% +\zref@newprop*{zen@page}[\zen@@noreference]\thepage +\expandafter\let\csname zen@extract@page\endcsname\unexpanded +\zen@temp U{anchor}\zen@@anchor +\zen@temp U{default}\zen@@ref +\zen@temp U{type}{\ifdefined\zen@@type\ifnum\zen@@type<\z@\else \enit@type \fi\fi} +\zen@temp D{listname}\zen@@listname +\zen@temp U{depth}{\the\@listdepth} +\zen@temp U{index}{\the\c@zenidx} +\zen@temp U{listctr}{\ifdefined\@listctr \the\value\@listctr\fi} +\zen@temp U{parents}\zen@@parents +\zen@temp U{label}\zen@@itemlabel +\zen@temp U{starlabel}\zen@@starlabel +\zen@temp U{ref}\zen@@ref +\zen@temp U{item}\@itemlabel +\zen@temp U{currentlabel}\@currentlabel +\zen@temp U{currentlabelname}\@currentlabelname +\zen@temp D{refitem}\zen@@refitem +\zen@temp D{commaref}\zen@@commaref +\zen@temp U{counter}{\zref@getcurrent{counter}} +\zref@addprop{zen@list}{% + zen@default,zen@page,zen@type,zen@depth,zen@listctr,% + zen@listname,zen@index,zen@label,zen@ref,zen@starlabel,% + zen@parents,zen@refitem,zen@commaref,zen@item,zen@currentlabel,zen@counter} +\newif\ifzen@Hy +\AtBeginDocument{% + \ifdefined\hyper@anchor \zen@Hytrue + \zref@addprop{zen@list}{zen@anchor,zen@currentlabelname}% + \else \zen@Hyfalse \let\zen@refHy \zen@refText + \fi +} +% \end{macrocode} +% \end{macro} +% +% \subsection{Normalisation of references and item labels} +% +% \begin{macro}{\zen@Normalize} +% +% \begin{macrocode} +\def\zen@Normalize#1#2#3{\begingroup \let\zen@=#1% + \def\GetTitleStringResult{#3}\toks@{}% + \ifx \GetTitleStringResult\@empty \else + \zen@NormalizeCommands \GetTitleStringExpand{#3}% + \expandafter\zen@trailingspaces \GetTitleStringResult{\@nnil}\@nnil + \fi + \edef\x{\endgroup + \def\noexpand#2{\expandafter\zen@zap@doublespaces + \detokenize\expandafter{\GetTitleStringResult} \@empty}% + \def\noexpand\zen@temp {\expandafter\zen@zap@doublespaces + \detokenize\expandafter{\the\toks@} \@empty}% + }\x +}% \zen@Normalize +\def\zen@trailingspaces#1#{\toks@{#1}\expandafter\zen@trailingsp@ces} +{\catcode47 = 8 % / +\gdef\zen@trailingsp@ces#1{% + \ifx \@nnil#1\@empty \expandafter\remove@to@nnil + \else \zen@{\toks@\expandafter{\the\expandafter\toks@ + \expandafter{\romannumeral0\zen@postspace #1/ /}}}% + \expandafter\zen@trailingsp@ces % (loop) + \fi +}% \zen@trailingsp@ces +\gdef\zen@postspace#1 /{\zen@postsp@ce#1/} +\gdef\zen@postsp@ce#1/#2{ #1} +}% \catcode group +\def\zen@NormalizeCommands{% + \let\ensuremath \@firstofone % \ensuremath (engrec package) + \let\relax \@empty + \csname @safe@activestrue\endcsname +}% \zen@NormalizeCommands +\def\zen@zap@doublespaces#1 #2{% + #1% + \ifx#2\@empty\else\space\expandafter\zen@zap@doublespaces\fi + #2% +}% \zen@zap@doublespaces +% \end{macrocode} +% \end{macro} +% +% +% \subsection{Keys \textt{name} and \textt{name\stf} are added to \xpackage{enumitem} environments} +% +% \begin{macrocode} +\define@key{enumitem}{name}[]{\zen@namelist{#1}} +\define@key{enumitem}{name*}[]{\zen@starnamelist{#1}} +% \end{macrocode} +% +% \begin{macro}{\zen@namelist} +% +% is the callback for the key \texttt{name}. +% +% \begin{macrocode} +Ë \AtBeginDocument{\gappto\enit@@list{,name}}% ignore if [external] +\def\zen@namelist #1{% + \ifdefined\zen@@grouplevel\else \let\zen@@grouplevel \z@ \fi + \ifnum\zen@@grouplevel<\currentgrouplevel% first (automatic) assignment to name + \zen@type % = (automatic from \enit@@list) + \ifcase\zen@@type % (case 0) = enum + \zen@autoname + \or % (case 1) = itemize +Ï \zen@autoname % [itemize] option only + \or % (case 2) = description +Ð \zen@autoname % [description] option only + \fi + \else \zen@Normalize\zen@CaSeS\zen@@listname {#1}% + \let\zen@@listname \zen@temp + \fi +}% \zen@namelist (code for key name) +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\zen@starnamelist} +% +% is the callback for the key \textt{name\stf}. +% +% \begin{macrocode} +\def\zen@starnamelist #1{% (1st automatic assignment to name done before) + \zen@Normalize\zen@CaSeS\zen@@listname{#1}% + \let\zen@@listname \zen@temp + \ifx \zen@@priorlistname\zen@@listname + \let\zen@@listname \@empty \fi + \zen@namelist\zen@@listname +}% \zen@starnamelist (code for key name*) +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\zen@autoname} +% +% is the callback for the key \textt{name} automatically set without argument +% by \cs{setkeys}\M*{enit@@list}. This corresponds to some setup: +% +% \begin{itemize} +% \item save the prior list name \etc. +% \item define the group level, +% \item define the list depth, +% \item reset the index, +% \item save the definition of \cs{@trivlist} and overload it temporarily +% until its next expansion at the beginning of the list. +% \end{itemize} +% +% \begin{macrocode} +\def\zen@autoname{% (1st automatic assignment to key name (by \enit@@list)) + \unless \ifx\zen@@listname\@empty + \let\zen@@priorlistname \zen@@listname \fi + \unless\ifdefined\zen@@priorlistname \let\zen@@priorlistname \@empty\fi + \let\zen@@listname \@empty + \ifdefined\zen@@commaref \let\zen@@priorcommaref \zen@@commaref + \else \let\zen@@priorcommaref \@empty + \let\zen@@commaref \@empty + \fi + \ifdefined\zen@@refitem \let\zen@@priorrefitem \zen@@refitem + \else \let\zen@@priorrefitem \@empty + \let\zen@@refitem \@empty + \fi + \edef\zen@@grouplevel {\the\currentgrouplevel}% + \edef\zen@@depth {\number\@listdepth}% + \ifnum \zen@@depth>\@ne \edef\zen@@parents{{\the\c@zenItem}\zen@@parents}% + \else \let\zen@@parents \@empty \fi + \let\zen@refitem@fun \@undefined + \ifcase \zen@@type \zen@prepare@resume \fi % (enumerate only: key resume) + \c@zenidx \z@ + \let\zen@trivlistORI \@trivlist + \let\@trivlist \zen@trivlist +}% \zen@name@list +\def\zen@prepare@resume{\expandafter\def\expandafter\enit@endenumerate + \expandafter{\enit@endenumerate \zen@endenumerate}% +}% \zen@prepare@resume +\def\zen@endenumerate{% saves the value of \c@zenidx at the exit of enum envir + \zen@toks\expandafter{\enit@afterlist}% + \xdef\enit@afterlist{\the\zen@toks + \def\expandafter\noexpand + \csname enit@resume@\@currenvir\endcsname{% + \csname c@\@listctr\endcsname + \the\csname c@\@listctr\endcsname + \c@zenidx \the\c@zenidx\relax}}% +}% \zen@prepare@resume +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\zen@trivlist} +% +% \cs{@trivlist} is temporarily overloaded, and the original definition +% is immediately restored at the time it will be expanded, just after having +% set all the specified keys for the list environment. +% +% The overload sets \cs{zen@setuprefs} to be expanded at the end of \cs{@trivlist}. +% +% \begin{macrocode} +\def\zen@trivlist{% + \let\@trivlist \zen@trivlistORI % restore orginal immediately + \@trivlist \zen@setuprefs +}% \zen@trivlist +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\zen@type} +% +% expands to:§ +% \begin{enumerate}[label=,leftmargin=2cm,itemsep=0pt,parsep=0pt] +% \item[0] if \texttt{enumerate} +% \item[1] if \texttt{itemize} (and \texttt{[itemize]} option is active) +% \item[2] if \texttt{description} (and \texttt{[description]} option is active) +% \item[-1] in any other case +% \end{enumerate} +% +% \begin{macrocode} +\def\zen@type{% + \ifdefined\enit@type + \expandafter\strip@prefix \if e\enit@type>\let\zen@@type\z@ % enum begins with e + \else>\expandafter\strip@prefix \if i\enit@type>\let\zen@@type\@ne % item begins with i + \else>\expandafter\strip@prefix \if d\enit@type>\let\zen@@type\tw@ % desc begins with d + \else>\let\zen@@type\m@ne + \fi\fi\fi + \else \let\zen@@type\m@ne + \fi +}% \zen@type +% \end{macrocode} +% \end{macro} +% +% +% \subsection{Overloading \cs{makelabel}} +% +% \begin{macro}{\zen@setuprefs} +% +% expands just at the end of \cs{@trivlist}. \cs{makelabel} is overloaded +% in order to make the references and write the labels into the \xext{aux} file. +% +% \begin{macro}{\zen@makelabel} +% \begin{macrocode} +\def\zen@setuprefs{% + \edef \zen@temp{\zen@@priorlistname\zen@@listname}% + \ifx \zen@temp\@empty + \ifx \makelabel\zen@makelabel \let\makelabel \zen@makelabelORI \fi + \else + \ifx \makelabel\zen@makelabel \else + \let \zen@makelabelORI \makelabel + \let \makelabel \zen@makelabel \fi + \fi + \let\zeninfo \zen@info + \ifcase \zen@@type % enumerate only (key start) + \ifnum \c@zenidx=\z@ \c@zenidx\value\@enumctr\relax \fi + \fi + \zen@refitem@implicit +}% \zen@setuprefs +\def\zen@makelabel#1{\zen@makeref{#1}\zen@makelabelORI{#1}\zen@labelize} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% +% \begin{macro}{\zen@refitem@implicit} +% +% defines \cs{zen@refitem@fun} which cancels text around the formatted counter +% in \textt{enumerate} lists (\ie numbered lists). This will be used at the time +% of \cs{makelabel} to create the \textt{refitem} and the property \cs{label\stf} +% (which corresponds to \xpackage{zref} property \textt{zen@starlabel}). +% +% \begin{macrocode} +\def\zen@refitem@implicit{% determine value of key refitem according to the label + \def\zen@gtemp {{\the\c@zenidx}}% + \ifnum \zen@@type=\z@ % enumerate + {\let\enit@refstar \zen@refitemfromlabel + \enit@labellist \zen@box{\@itemlabel}}% + \fi + \let\zen@refitem@fun \zen@gtemp +}% \zen@refitem@implicit +\def\zen@refitemfromlabel#1{\def#1##1{0% + \def\zen@temp{##1}\ifx \zen@temp\@enumctr + \gdef\zen@gtemp{{#1{##1}}}\fi}% +}% \zen@refitemfromlabel +% \end{macrocode} +% \end{macro} +% +% +% \subsection{Creating references} +% +% \begin{macro}{\zen@makeref} +% +% is expanded just before the original version of \cs{makelabel} +% +% The aim is to set the \xpackage{zref} properties defined by \thispackage* +% for the current item, and to define the anchor names. +% +% \begin{macrocode} +\def\zen@makeref#1{% #1 = argument of \makelabel + \def\zen@@itemlabel{#1}\advance\c@zenidx \@ne + \ifx \zen@@itemlabel\zen@@autolabel + \if@nmbrlist + \global\advance\c@zenItem \@ne + \let\zen@@ref \@currentlabel + \else + {\refstepcounter{zenItem}}% + \let\zen@@ref \zen@refitem@fun + \fi + \let\zen@@starlabel \zen@refitem@fun + \zen@Normalize\zen@lowercase\zen@currentrefitem \zen@refitem@fun + \else % user defined label + {\refstepcounter{zenItem}}% + \zen@Normalize\zen@lowercase\zen@@ref {{\zen@@itemlabel}}% + \let\zen@@starlabel \zen@@ref + \fi + \let\zen@currentrefitem \zen@temp % \zen@temp defined by \zen@Normalize + \let\zen@@anchor \@currentHref + \zen@makeref@item@comma +}% \zen@makeref +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\zen@labelize} +% +% is expanded just after the original version of \cs{makelabel} +% +% \textt{zlabel}{\smaller s} are written into the \xext{aux} file. +% +% \begin{macrocode} +\def\zen@labelize{% + \ifzen@Hy \zen@anchors + \zref@labelbyprops{zen->\@currentHref}{zen@}\fi + \zref@labelbylist\zen@{zen@list}% + \zen@keeplabel +}% \zen@makeref +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\zen@makeref@item@comma} +% +% Creates the references for the \hyperref[commarefscheme]{\emph{commaref}} +% and the \hyperref[refitemscheme]{\emph{refitem}} schemes. +% +% \begin{macrocode} +\def\zen@makeref@item@comma{% +\begingroup % to avoid silent assignment to \relax + \edef\x{\endgroup + \def\noexpand\zen@@commaref{% + \expandafter\zen@commaref@\zen@@priorcommaref \@nnil}% + \def\noexpand\zen@@refitem{% + \expandafter\zen@refitem@\zen@@priorrefitem \@nnil}% + }\x +}% \zen@makeref@item@comma +\def\zen@refitem@#1{% + \ifx\@nnil#1% + \ifx \zen@@listname\@empty \else + {\zen@@listname\zen@currentrefitem}\fi + \else {#1\zen@currentrefitem}\expandafter\zen@refitem@ % loop + \fi +}% \zen@refitem@ +\def\zen@commaref@#1{% + \ifx\@nnil#1% + \ifx \zen@@listname\@empty \else + {\zen@@listname,\the\c@zenidx}\fi + \else {#1,\the\c@zenidx}\expandafter\zen@commaref@ % loop + \fi +}% \zen@commaref@ +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\zen@anchors} +% +% Put the \pdf anchors for the current item. +% +% \begin{macrocode} +\let\zen@list@anchors\@empty +\def\zen@anchors{\begingroup + \def\zen@@anchors{\endgroup}% + \expandafter\expandafter\expandafter\zen@anchors@ + \expandafter\zen@@commaref \zen@@refitem \@nnil + \zen@@anchors +}% \zen@anchors +\def\zen@anchors@#1{% + \ifx \@nnil#1\else + \expandafter\in@\csname refitem.#1\expandafter\endcsname\expandafter{\zen@list@anchors}% + \ifin@ \zen@anchor@ignore{#1}% + \else + \edef\zen@@anchors{\zen@@anchors\zen@Hy@anchor{refitem.#1}}% + \xdef\zen@list@anchors{% + \unexpanded\expandafter{\zen@list@anchors}% + \expandafter\noexpand\csname refitem.#1\endcsname}% + \fi + \expandafter\zen@anchors@ % loop + \fi +}% \zen@anchors@ (loop) +\def\zen@anchor@ignore#1{\PackageInfo{enumitem-zref}{Ignored anchor `#1'}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\zen@keeplabel} +% +% As far as references are built and written inside \cs{makelabel} (which was overloaded) +% they are built inside a group (inside a \cs{sbox}, and thus inside a \cs{color@setgroup}...\cs{color@endgroup} +% group if packages \xpackage{color} or \xpackage{xcolor} are used, and may be inside other grouping levels +% depending on the user need (she may have redefined \cs{makelabel} for a special purpose). +% +% Therefore, we take advantage of the e-\TeX{} command \cs{currentgrouplevel} in order to +% decide how many levels of grouping we have to ``pass through'' for keeping the current +% values of \cs{z@zenidx} (the item \emph{index}), \cs{zen@@refitem},\, and\, \cs{zen@@commaref}. +% +% The ``target'' group level has been saved into \cs{zen@@grouplevel} at the beginning of the +% environment, while setting the automatic \texttt{name} key for the first time. +% +% \begin{macrocode} +\def\zen@keep#1{\def\noexpand#1{\unexpanded\expandafter{#1}}}% +\def\zen@keeplabel{% + \xdef\zen@gtemp{% + \noexpand\ifnum \zen@@grouplevel<\currentgrouplevel + \aftergroup \noexpand\zen@gtemp + \noexpand\else + \c@zenidx \the\c@zenidx\relax + \zen@keep \zen@@refitem + \zen@keep \zen@@commaref + \ifzen@Hy \zen@keep\zen@@anchor\fi + \noexpand\fi + }\aftergroup\zen@gtemp +}% \zen@keeplabel +% \end{macrocode} +% \end{macro} +% +% +% \subsection[{Extracting zref properties}]{Extracting \xpackage{zref} properties} +% +% \begin{macro}{\zen@extract} +% +% A wrapper to \cs{zref@extractdefault} which can also \cs{detokenize} the result. +% +% \begin{macrocode} +\newcommand*\zen@extract[3]{% #1=ref #2=prop #3=def + \csname zen@extract@#2\endcsname\expandafter\expandafter% + \expandafter{\zref@extractdefault{zen>\number#1}{zen@#2}{#3}}% +}% \zen@extract +% \end{macrocode} +% \end{macro} +% +% +% \subsection{Referencing the items: \cs{refitem}} +% +% \begin{macro}{\refitem} +% +% The general macro to print references and insert hyperlinks, +% with a star variant (no hyperlink). +% +% \begin{macrocode} +\newrobustcmd*\refitem{\begingroup \@ifstar + {\zen@refitemOpt \zen@reftext }% no hyperlink + {\zen@refitemOpt \zen@refHy }% +}% \refitem +\def\zen@refHy{% +%% \edef\zen@@anchor{\zen@extract\c@zenItem{anchor}{}\unexpanded}% +%% \ifx \zen@@anchor\@empty \zen@@text +%% \else + \hyperref{}{}{\zref@extract{zen>\the\c@zenItem}{zen@anchor}}\zen@@text +%% \fi +}% \zen@ref +\def\zen@refText{\zen@@text} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\zen@refitemOpt} +% +% If the first argument is an option, then \cs{refitem} makes a hyperlink +% to an external document. +% +% \begin{macrocode} +\def\zen@refitemOpt#1{\let\zen@ref@#1\@ifnextchar[\zen@refitemExternal \zen@refitemRef } +\def\zen@refitemRef #1{\@tempswatrue \let\zen@lastwarn \m@ne + \zen@Normalize\zen@lowercase\zen@@label {#1}% + \zen@ifrefundefined \zen@@label + {\expandafter\expandafter\expandafter \zen@refused + \csname\ifcsname zen@refitem(\zen@temp)\endcsname + zen@refitem(\zen@temp)\else + zen@norefitem\fi\endcsname>}% + \zen@refitemFromAnchor +}% \zen@refitemRef +\def\zen@norefitem {\z@>0} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\zen@refused} +% +% Checks if the label exists in the \hyperref[commarefscheme]{\emph{commaref}} scheme +% or in the \hyperref[refitemscheme]{\emph{refitem}} scheme. +% +% \begin{macrocode} +\def\zen@refused#1>#2>{% + \ifcase#1\relax + \@tempswafalse \refused\zen@@label + \let\zen@ref@ \zen@refText % do not create a hyperlink if no reference + \or \let\zen@@label \zen@temp \c@zenItem =#2\relax + \else \let\zen@@label \zen@temp \zen@MultipleLabels + \c@zenItem =#2\relax + \fi + \zen@refitem@prop +}% \zen@refused +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\zen@refitemFromAnchor} +% +% When \cs{refitem} refers to a user item, we can reached the \xpackage{zref} properties +% with the chain: +% +% \tikz[start chain=going right,every join/.style={->}] +% \node [on chain] {\LaTeX{} label} +% node [on chain,join] {\xpackage{hyperref} anchor} +% node [on chain,join] {\thispackage* label} +% node [on chain,join] {property}; +% +% \begin{macrocode} +\def\zen@refitemFromAnchor{% + \edef\zen@@anchor{\getrefbykeydefault\zen@@label{anchor}{}}% + \ifx \zen@@anchor\@empty + \@tempswafalse \G@refundefinedtrue \zen@warn\z@ + \let\zen@ref@ \zen@refText + \else + \edef\zen@temp{\zref@extractdefault{zen->\zen@@anchor}{zen@}{}}% + \ifx \zen@temp\@empty + \@tempswafalse \G@refundefinedtrue \zen@warn\@ne + \ifzen@Hy \ifx\zen@ref@ \zen@refHy \def\zen@ref@{\ref{\zen@@label}}% + \else \def\zen@ref@ {\ref*{\zen@@label}}% + \fi + \else \def\zen@ref@{\ref{\zen@@label}}% + \fi + \else \c@zenItem \expandafter\strip@prefix\zen@temp\relax + \fi + \fi + \zen@refitem@prop +}% \zen@refitemFromAnchor +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\def\zen@warn#1{\let\zen@lastwarn#1% + \message{Package enumitem-zref Warning: + \ifcase#1 % + \string\refitem{\zen@@label}: + User references to \string\label\space^^J\zen@spaces + require hyperref and the appropriate options for enumitem-zref^^J\zen@spaces + \ifzen@Hy Check the options given to package enumitem-zref. + \else Package hyperref is not loaded.\fi + \or User reference does not point to an item!^^J\zen@spaces + \string\refitem{\zen@@label} + \fi\on@line^^J^^J}} +\edef\zen@spaces{\@spaces\@spaces} +% \end{macrocode} +% +% +% \begin{macro}{\zen@refitem@prop} +% +% tests if \cs{refitem} has a following optional argument: the properties. +% +% As long as the optional argument is in last position, we have to take a special +% care about the the spaces (\cs{@ifnextchar} removes spaces). +% +% \begin{macrocode} +\def\zen@refitem@prop{\futurelet\zen@temp \zen@refitemProp} +\def\zen@gobblespace#1 {#1}% +\let\zen@space \relax +\def\zen@refitemProp{% + \ifcase 0\ifx \zen@temp[\else + \ifx \zen@temp\@sptoken 1\else + 2\fi\fi\relax + \expandafter \zen@refitemPrint + \or \let\zen@space\space + \expandafter\zen@gobblespace\expandafter\zen@refitem@prop + \else \expandafter\zen@refitemPrint \expandafter[\expandafter]% + \fi +}% \zen@refitemProp +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\zen@refitemPrint} +% +% is the final macro to print the reference made by \cs{refitem}. +% The properties, if specified, are first analyzed by \cs{zen@refitemText}. +% +% \begin{macrocode} +\long\def\zen@refitemPrint[#1]{\def\zen@@text{#1}% + \if@tempswa % got a reference + \ifx \zen@@text\@empty + \edef\zen@@text{{\zen@extract\c@zenItem{default}\zen@@noreference}\zen@space}% + \else\zen@refitemText + \fi + \else + \ifx \zen@@text\@empty \def\zen@@text{\zen@@noreference\zen@space}%\refused\zen@@label + \else \zen@refitem@noText + \fi + \fi + \zen@ref@ + \endgroup +}% \zen@refitemPrint +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\zen@refitemText} +% +% creates the text to be typeset for the reference, depending on the properties +% given by the user as the last optional argument to \cs{refitem}. +% +% \begin{macrocode} +\def\zen@refitemText{\zen@propcount + \ifnum \c@zenidx>\z@ \advance\c@zenidx \m@ne + \ifnum \c@zenidx>\z@ + \edef\zen@@parents{\zen@extract\c@zenItem{parents}{}}% + \edef\zen@@depth{\zen@extract\c@zenItem{depth}0}% + \else \let\zen@@depth \@ne % shortcut (only one property) + \fi + \def\ref{\@ifstar{\zen@ancestorprop{starlabel}}{\zen@ancestorprop{ref}}}% + \def\label{\@ifstar{\zen@ancestorprop{starlabel}}{\zen@ancestorprop{label}}}% + \def\default{\zen@ancestorprop{default}}\def\counter{\zen@ancestorprop{counter}}% + \def\type{\zen@ancestorprop{type}}\def\listname{\zen@ancestorprop{listname}}% + \def\index{\zen@ancestorprop{index}}\def\listctr{\zen@ancestorprop{listctr}}% + \def\depth{\zen@ancestorprop{depth}}\def\refitem{\zen@ancestorprop{refitem}}% + \def\anchor{\zen@ancestorprop{anchor}}\def\commaref{\zen@ancestorprop{commaref}}% + \def\page{\zen@ancestorprop{page}}\def\currentlabel{\zen@ancestorprop{currentlabel}}% + \def\currentlabelname{\zen@ancestorprop{currentlabelname}}% + {\zen@box{\zen@@text + \expandafter}\expandafter}\expandafter\zen@toks + \expandafter{\the\zen@toks \zen@nil}% + \def\ref{\the\zen@toks}\zen@clprops + \def\ref{\@ifstar{\the\zen@toks}{\the\zen@toks}}\let\label\ref + \long\def\zen@##1##2\zen@nil{\zen@toks{##2\zen@nil}##1}\let\zen@nil\relax + \fi +}% \zen@refitemText +\def\zen@ancestorprop#1{% + \ifnum \zen@@depth>\c@zenidx + \advance\c@zenidx \m@ne + \ifnum \c@zenidx<\z@ \let\zen@ \c@zenItem + \else \edef\zen@{\zen@ancestor}% + \fi + \edef\zen@temp{{\zen@extract\zen@{#1}\zen@@noreference}}% + \else \def\zen@temp{{}}\advance\c@zenidx \m@ne + \fi + \zen@toks\expandafter{\the\expandafter\zen@toks \expandafter\zen@ \zen@temp}% +}% \zen@ancestorproperty +\def\zen@ancestor{\expandafter\ltx@car\romannumeral0\expandafter\ltx@GobbleNum + \expandafter{\the\expandafter\c@zenidx\expandafter}\zen@@parents{}{}{}\@nil % no need of {}... +}% \zen@getancestor +\def\zen@propcount{\c@zenidx\z@ + \def\ref{\advance\c@zenidx \@ne}\zen@clprops + {\zen@box{\zen@@text \expandafter}\expandafter}\expandafter + \c@zenidx \the\c@zenidx\relax +}% \zen@propcount +\def\zen@clprops{\let\label\ref \let\page\ref + \let\none\ref \let\default\ref \let\counter\ref \let\listname\ref + \let\anchor\ref \let\depth\ref \let\type\ref \let\index\ref \let\listctr\ref + \let\refitem\ref \let\commaref\ref \let\currentlabel\ref \let\currentlabelname\ref +}% \zen@clprops +\def\zen@refitem@noText{\let\ref \zen@@noreference \zen@clprops} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\zen@refitemExternal} +% +% for references to an anchor in an external document with \cs{hyperref}: +% +% \begin{macrocode} +\def\zen@refitemExternal[#1]#2{% + \toks@{#1}\zen@Normalize\zen@lowercase\zen@@label {#2}% + \edef\zen@ref@{\endgroup + \noexpand\hyperref{\the\toks@}{refitem}{\zen@temp}% + }\zen@ref@ +}% \zen@Hy@external +% \end{macrocode} +% \end{macro} +% +% +% \subsection{Undefined references and duplicate labels management} +% +% +% \begin{macro}{\zen@MultipleLabels} +% +% \begin{macrocode} +\def\zen@MultipleLabels{% + \PackageWarning{enumitem-zref} + {`\zen@@label' on page \thepage \space multiple defined\MessageBreak + Only the first one will be referenced}% et mettre ici la liste des références correspondant aux alias +}% \zen@MultipleLabels +% \end{macrocode} +% \end{macro} +% +% \subsection{\cs{zeninfo} (If you are lost...)} +% +% \begin{macro}{\zen@info} +% +% \cs{zeninfo} executes \cs{zen@info} when inside environments: +% +% \begin{macrocode} +\newrobustcmd*\zen@info[1][]{\begingroup \sloppy + \def\sep##1{##1\hskip\z@ plus.001fil\relax\linebreak[2]}% + \ifcase\zen@whichinfo{#1} \zen@@depth % case 0 (depth) + \or \the\c@zenidx % case 1 (index) + \or % case 2 (type) + \ifcase\zen@@type enumerate\or itemize\or description\or unknown\fi + \or anchor=\ifzen@Hy\zen@@anchor\else no hyperref\fi % case 3 (anchor) + \or refitem=\sep{}\detokenize\expandafter{\zen@@refitem}% case 4 (refitem) + \or commaref=\sep{}\detokenize\expandafter{\zen@@commaref}% case 5 (commaref) + \else % (case -1) give all infos + {\ifdefined\scriptsize\scriptsize\fi + zeninfo:\sep{}depth=\sep{}\zen@@depth + \sep/ idx=\sep{}\the\c@zenidx + \ifcase\zen@@type \sep/ ctr=\sep{}\the\value\@listctr \fi % enumerate only + \sep/ commaref=\sep{}\detokenize\expandafter{\zen@@commaref}% + \sep/ refitem=\sep{}\detokenize\expandafter{\zen@@refitem}% + \ifzen@Hy\sep/ anchor=\sep{}\zen@@anchor \fi + }% + \fi\endgroup +}% \zen@info +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\zeninfo} +% +% is executed when out of scope: +% +% \begin{macrocode} +\newrobustcmd\zeninfo[1][]{\begingroup + \ifdefined\zen@@type + \ifcase \zen@@type \zeninfo@err +Ï \or \zeninfo@err +Ð \or \zeninfo@err + \else\zeninfo@err[{in environment \@currenvir\MessageBreak + You should be in a list environment}]% + \fi\endgroup +}% \zeninfo (out of scope) +\newcommand*\zeninfo@err[1][{you should give a name to your \@currenvir\space list}]{% + \PackageError{enumitem-zref} + {\string\zeninfo\space is not available\MessageBreak + #1}\@eha +}% \zeninfo@err +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\zen@whichinfo} +% +% \begin{macrocode} +\def\zen@whichinfo#1{% + \expandafter\strip@prefix \if d#1>\z@ % depth (begins with d) + \else>\expandafter\strip@prefix\if i#1>\@ne % index (begins with i) + \else>\expandafter\strip@prefix\if t#1>\tw@ % type (begins with t) + \else>\expandafter\strip@prefix\if a#1>\thr@@% anchor (begins with a) + \else>\expandafter\strip@prefix\if r#1>4 % refitem(begins with r) + \else>\expandafter\strip@prefix\if c#1>5 % commaref(begins with c) + \else>\m@ne + \fi\fi\fi\fi\fi\fi +}% \zen@whichinfo +% \end{macrocode} +% \end{macro} +% +% +% \subsection{Create the references At Begin Document for the \texorpdf\emph{refitem} and the \texorpdf\emph{commaref} schemes} +% +% \begin{macro}{\zen@item@comma} +% +% \begin{macrocode} +\def\zen@item@comma{% + \begingroup \c@zenidx \@ne %%\loggingall + \@whilesw \ifcsname Z@R@zen>\the\c@zenidx\endcsname\fi + {\advance\c@zenidx \@ne}% + \@whilenum \c@zenidx>\@ne + \do{\advance \c@zenidx \m@ne + \zref@wrapper@unexpanded{% + \edef\zen@refitem{% + \zref@extractdefault{zen>\the\c@zenidx}{zen@refitem}{}% + \zref@extractdefault{zen>\the\c@zenidx}{zen@commaref}{}}% + \edef\zen@refitem{\expandafter + \zen@item@comma@ \zen@refitem \@nnil}% + \expandafter\zen@def@item@comma@ \zen@refitem \@nnil}}% + \endgroup +}% \zen@item@comma +\def\zen@item@comma@ #1{% + \ifx\@nnil#1\else + \expandafter\noexpand\csname zen@refitem(\detokenize{#1})\endcsname + \expandafter\zen@item@comma@ % (loop) + \fi +}% \zen@item@comma@ +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\zen@def@item@comma@} +% +% \begin{macrocode} +\def\zen@def@item@comma@ #1{\ifx\@nnil#1\else + \zen@def@item@comma{#1}\expandafter\zen@def@item@comma@ \fi % loop +}% \zen@def@item@comma@ +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\zen@def@item@comma} +% +% \begin{macrocode} +\newif\ifzen@duplicatealiases +\def\zen@def@item@comma #1{% + \xdef#1{% + \ifdefined#1% + \ifx\relax#1\@empty \@ne>\the\c@zenidx% create new + \else \expandafter + \ifnum\expandafter\strip@prefix#1=\c@zenidx% redefinition to the same location + #1% + \else + \number\numexpr1+#1% increment multiplicity + \fi + \fi + \else \@ne>\the\c@zenidx% create new + \fi}% + \ifzen@duplicatealiases\else + \expandafter\expandafter\expandafter\strip@prefix + \expandafter\strip@prefix\ifnum\@ne<#1>\global\zen@duplicatealiasestrue\else>>\fi + \fi +}% \zen@def@item@comma +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\zen@AtEnd \let\zen@AtEnd\@undefined +% +% \end{macrocode} +% +% \restoregeometry +% \sectionformat\section{label=,font=\LARGE\bfseries,mark=\marksthe{section}{#1}} +% \sectionformat\subsection{font+=\smaller,left=0pt} +% \pagesetup{pagestyle=corpus,head/left+=\ {\lsstyle(\thefirstmarks{section})}} +% +% \begin{thebibliography}{9} +% +% \bibitem{enumitem} +% \textit{The \xpackage{enumitem} package}; Javier Bezos\\ +% 2009/05/18 v2.2 -- Customized lists \\ +% \CTANhref{enumitem} +% +% \bibitem{zref} +% \textit{The \xpackage{zref} package}; Heiko Oberdiek\\ +% 2010/05/01 v2.17 -- New reference scheme for LaTeX2e \\ +% \CTANhref{zref} +% +% \bibitem{gettitlestring} +% \textit{The \xpackage{gettitlestring} package}; Heiko Oberdiek\\ +% 2009/12/18 v1.3 -- Cleanup title references\\ +% \CTANhref{gettitlestring} +% +% \bibitem{engrec} +% \textit{The \xpackage{engrec} package}; Yvon Henel \\ +% 2008/05/07 v1.1 -- Greek letters from counters\\ +% \CTANhref{engrec} +% +% \end{thebibliography} +% +% \setitemize{leftmargin=2em} +% \sectionformat\subsection{font=\normalsize\bfseries\pkgcolor} +% \bottomtitles=-1pt +% \begin{History} +% +% \begin{Version}{2011/02/18 v1.8}\HistLabel{v1.8} +% \item Documentation recompiled after \Xpackage{tabu} package v2.5 release. +% \end{Version} +% +% \begin{Version}{2010/12/30 v1.75}\HistLabel{v1.75} +% \item Bug fixed with empty items and nested lists. +% \end{Version} +% +% \begin{Version}{2010/12/27 v1.7}\HistLabel{v1.7} +% \item Documentation improvement. +% \item No modification in the package file. +% \end{Version} +% +% \begin{Version}{2010/12/17 v1.5}\HistLabel{v1.5} +% \item \thispackage now works with the keys: \textt{start=},\, \textt{resume},\, and\, \textt{resume\stf}\, +% of \xpackage{enumitem} package. +% \item Package option: \refitem{package options{greekctr}}[\textt{greekctr}] added as an alternative to the +% \refitem{package options{greek}}[\textt{greek}] package option: \textt{greekctr} is based on the +% \Xpackage{greekctr} package while \textt{greek} is based on \Xpackage{engrec}. +% Both uses code of \Xpackage{alphalph} in order to make the counters \textsl{wrap} around the greek alphabet. \\ +% Options \refitem{package options{greek}}[\textt{greek}] and/or \refitem{package options{greekctr}}[\textt{greekctr}] +% are automatically loaded \cs{AtBeginDocument} if the \xpackage{engrec} / \xpackage{greekctr} packages are detected. +% \end{Version} +% +% \begin{Version}{2010/12/10 v1.2}\HistLabel{v1.2} +% \item Bug encountered in \cs\zen@anchors@: \\ +% \cs\ifx\#1\cs\@nnil is not the same as \cs\ifx\cs\@nnil\#1\quad !! +% \end{Version} +% +% \begin{Version}{2010/12/02 v1.1}\HistLabel{v1.1} +% \item The first version. +% \end{Version} +% +% \end{History} +% +% \clearpage +% \PrintIndex +% +% \Finale \ No newline at end of file -- cgit v1.2.3