9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder% \iffalse meta-comment
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder% Copyright (C) 1998, 2000, 2006, 2008 by
e6d40133bc9f858308654afb1262b8b483ec5922Till Mossakowski% Heiko Oberdiek <oberdiek@uni-freiburg.de>
97018cf5fa25b494adffd7e9b4e87320dae6bf47Christian Maeder% This work may be distributed and/or modified under the
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder% conditions of the LaTeX Project Public License, either
3f69b6948966979163bdfe8331c38833d5d90ecdChristian Maeder% version 1.3 of this license or (at your option) any later
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder% version. The latest version of this license is in
f3a94a197960e548ecd6520bb768cb0d547457bbChristian Maeder% and version 1.3 or later is part of all distributions of
e6d40133bc9f858308654afb1262b8b483ec5922Till Mossakowski% LaTeX version 2005/12/01 or later.
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder% This work has the LPPL maintenance status "maintained".
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder% This Current Maintainer of this work is Heiko Oberdiek.
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder% This work consists of the main source file refcount.dtx
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder% and the derived files
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder% refcount.sty, refcount.pdf, refcount.ins, refcount.drv.
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder% Distribution:
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder% CTAN:macros/latex/contrib/oberdiek/refcount.dtx
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder% CTAN:macros/latex/contrib/oberdiek/refcount.pdf
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder% (a) If refcount.ins is present:
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder% (c) If you insist on using LaTeX
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder% latex \let\install=y\input{refcount.dtx}
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder% (quote the arguments according to the demands of your shell)
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder% Documentation:
e83ed59502a681713982f25c559aae77a4145734Christian Maeder% (a) If refcount.drv is present:
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder% The class ltxdoc loads the configuration file ltxdoc.cfg
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder% if available. Here you can specify further options, e.g.
e83ed59502a681713982f25c559aae77a4145734Christian Maeder% use A4 as paper format:
e83ed59502a681713982f25c559aae77a4145734Christian Maeder% \PassOptionsToClass{a4paper}{article}
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder% Programm calls to get the documentation (example):
e83ed59502a681713982f25c559aae77a4145734Christian Maeder% Installation:
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder \def\x{LaTeX2e}%
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder\expandafter\endgroup
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder\ifcase 0\ifx\install y1\fi\expandafter
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder \ifx\csname processbatchFile\endcsname\relax\else1\fi
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder \ifx\fmtname\x\else 1\fi\relax
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder\else\csname fi\endcsname
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder\Msg{************************************************************************}
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder\Msg{* Installation}
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder\Msg{* Package: refcount 2008/08/11 v3.1 Data extraction from references (HO)}
2eb84fc82d3ffa9116bc471fda3742bd9e5a24bbChristian Maeder\Msg{************************************************************************}
2eb84fc82d3ffa9116bc471fda3742bd9e5a24bbChristian Maeder\askforoverwritefalse
35db0960aa2e2a13652381c756fae5fb2b27213bChristian Maeder\let\MetaPrefix\relax
9929f81562adecc8aafaefb14a0159afcf4a3351Christian MaederThis is a generated file.
9929f81562adecc8aafaefb14a0159afcf4a3351Christian MaederCopyright (C) 1998, 2000, 2006, 2008 by
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder Heiko Oberdiek <oberdiek@uni-freiburg.de>
eb483f2216949400bfef8f6deb5320f071445626Christian MaederThis work may be distributed and/or modified under the
07b1bf56f3a486f26d69514d05b73100abb25a0eChristian Maederconditions of the LaTeX Project Public License, either
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maederversion 1.3 of this license or (at your option) any later
eb483f2216949400bfef8f6deb5320f071445626Christian Maederversion. The latest version of this license is in
e83ed59502a681713982f25c559aae77a4145734Christian Maederand version 1.3 or later is part of all distributions of
eb483f2216949400bfef8f6deb5320f071445626Christian MaederLaTeX version 2005/12/01 or later.
eb483f2216949400bfef8f6deb5320f071445626Christian MaederThis work has the LPPL maintenance status "maintained".
9929f81562adecc8aafaefb14a0159afcf4a3351Christian MaederThis Current Maintainer of this work is Heiko Oberdiek.
083679daeba30fce9d60f7170a2cfd9f9c80bfb2Till MossakowskiThis work consists of the main source file refcount.dtx
083679daeba30fce9d60f7170a2cfd9f9c80bfb2Till Mossakowskiand the derived files
e33e3b425e953236b4617870f995d263ac35b883Christian Maeder refcount.sty, refcount.pdf, refcount.ins, refcount.drv.
e33e3b425e953236b4617870f995d263ac35b883Christian Maeder\let\MetaPrefix\DoubleperCent
083679daeba30fce9d60f7170a2cfd9f9c80bfb2Till Mossakowski \file{refcount.ins}{\from{refcount.dtx}{install}}%
083679daeba30fce9d60f7170a2cfd9f9c80bfb2Till Mossakowski \file{refcount.drv}{\from{refcount.dtx}{driver}}%
e83ed59502a681713982f25c559aae77a4145734Christian Maeder \file{refcount.sty}{\from{refcount.dtx}{package}}%
e83ed59502a681713982f25c559aae77a4145734Christian Maeder\Msg{************************************************************************}
083679daeba30fce9d60f7170a2cfd9f9c80bfb2Till Mossakowski\Msg{* To finish the installation you have to move the following}
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder\Msg{* file into a directory searched by TeX:}
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder\Msg{* And install the following script file:}
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder\Msg{* To produce the documentation run the file `refcount.drv'}
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder\Msg{* through LaTeX.}
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder\Msg{* Happy TeXing!}
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder\Msg{************************************************************************}
e83ed59502a681713982f25c559aae77a4145734Christian Maeder\NeedsTeXFormat{LaTeX2e}
e953bea49e7f0e1a43bccf2a66c5e2a2b50848e0Christian Maeder [2008/08/11 v3.1 Data extraction from references (HO)]%
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder\documentclass{ltxdoc}
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder\usepackage{holtxdoc}[2008/08/11]
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder\begin{document}
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder\end{document}
afbd86903151121381e4e9d22862136817d7f0f0Christian Maeder% \CheckSum{198}
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder% \CharacterTable
e83ed59502a681713982f25c559aae77a4145734Christian Maeder% {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
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder% 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
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder% Digits \0\1\2\3\4\5\6\7\8\9
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder% Exclamation \! Double quote \" Hash (number) \#
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder% Dollar \$ Percent \% Ampersand \&
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder% Acute accent \' Left paren \( Right paren \)
e83ed59502a681713982f25c559aae77a4145734Christian Maeder% Asterisk \* Plus \+ Comma \,
e953bea49e7f0e1a43bccf2a66c5e2a2b50848e0Christian Maeder% Minus \- Point \. Solidus \/
e953bea49e7f0e1a43bccf2a66c5e2a2b50848e0Christian Maeder% Colon \: Semicolon \; Less than \<
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder% Equals \= Greater than \> Question mark \?
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder% Commercial at \@ Left bracket \[ Backslash \\
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder% Right bracket \] Circumflex \^ Underscore \_
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder% Grave accent \` Left brace \{ Vertical bar \|
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder% Right brace \} Tilde \~}
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder% \title{The \xpackage{refcount} package}
e83ed59502a681713982f25c559aae77a4145734Christian Maeder% \date{2008/08/11 v3.1}
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder% \author{Heiko Oberdiek\\\xemail{oberdiek@uni-freiburg.de}}
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder% \begin{abstract}
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder% References are not numbers, however they often store numerical
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder% data such as section or page numbers. \cs{ref} or \cs{pageref}
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder% cannot be used for counter assignments or calculations because
e83ed59502a681713982f25c559aae77a4145734Christian Maeder% they are not expandable, generate warnings, or can even be links,
e83ed59502a681713982f25c559aae77a4145734Christian Maeder% The package provides expandable macros to extract the data
e953bea49e7f0e1a43bccf2a66c5e2a2b50848e0Christian Maeder% from references. Packages \xpackage{hyperref}, \xpackage{nameref},
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder% \xpackage{titleref}, and \xpackage{babel} are supported.
e83ed59502a681713982f25c559aae77a4145734Christian Maeder% \end{abstract}
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder% \tableofcontents
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder% \section{Usage}
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder% \subsection{Setting counters}
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder% The following commands are similar to \LaTeX's
e83ed59502a681713982f25c559aae77a4145734Christian Maeder% \cs{setcounter} and \cs{addtocounter},
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder% but they extract the number value from a reference:
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder% \begin{quote}
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder% \cs{setcounterref}, \cs{addtocounterref}\\
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder% \cs{setcounterpageref}, \cs{addtocounterpageref}
e83ed59502a681713982f25c559aae77a4145734Christian Maeder% They take two arguments:
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder% \begin{quote}
e83ed59502a681713982f25c559aae77a4145734Christian Maeder% \cs{...counter...ref} |{|\meta{\LaTeX\ counter}|}|
e953bea49e7f0e1a43bccf2a66c5e2a2b50848e0Christian Maeder% |{|\meta{reference}|}|
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder% An undefined references produces the usual LaTeX warning
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder% and its value is assumed to be zero.
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder% \begin{quote}
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder%\begin{verbatim}
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder%\newcounter{ctrA}
42c01284bba8d7c8d995c8dfb96ace57d28ed1bcTill Mossakowski%\newcounter{ctrB}
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder%\refstepcounter{ctrA}\label{ref:A}
e953bea49e7f0e1a43bccf2a66c5e2a2b50848e0Christian Maeder%\setcounterref{ctrB}{ref:A}
e953bea49e7f0e1a43bccf2a66c5e2a2b50848e0Christian Maeder%\addtocounterpageref{ctrB}{ref:A}
e953bea49e7f0e1a43bccf2a66c5e2a2b50848e0Christian Maeder%\end{verbatim}
25a0b76bc87e80c0f697951d9817862755a71d33Christian Maeder% \subsection{Expandable commands}
e83ed59502a681713982f25c559aae77a4145734Christian Maeder% These commands that can be used in expandible contexts
25a0b76bc87e80c0f697951d9817862755a71d33Christian Maeder% (inside calculations, \cs{edef}, \cs{csname}, \cs{write}, \dots):
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder% \begin{quote}
e83ed59502a681713982f25c559aae77a4145734Christian Maeder% \cs{getrefnumber}, \cs{getpagerefnumber}
42c01284bba8d7c8d995c8dfb96ace57d28ed1bcTill Mossakowski% They take one argument, the reference:
e953bea49e7f0e1a43bccf2a66c5e2a2b50848e0Christian Maeder% \begin{quote}
e953bea49e7f0e1a43bccf2a66c5e2a2b50848e0Christian Maeder% \cs{get...refnumber} |{|\meta{reference}|}|
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder% The default for undefined references can be changed
50dce6b011347f92377adb8bbabaeeb80975e86dChristian Maeder% with macro \cs{setrefcountdefault}, for example this
50dce6b011347f92377adb8bbabaeeb80975e86dChristian Maeder% package calls:
e83ed59502a681713982f25c559aae77a4145734Christian Maeder% \begin{quote}
7325bbe03797fd413af504fb3fac109b2c652a7bChristian Maeder% \cs{setrefcountdefault}|{0}|
50dce6b011347f92377adb8bbabaeeb80975e86dChristian Maeder% Since version 2.0 of this package there is a new
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder% \begin{quote}
50dce6b011347f92377adb8bbabaeeb80975e86dChristian Maeder% \cs{getrefbykeydefault} |{|\meta{reference}|}|
e83ed59502a681713982f25c559aae77a4145734Christian Maeder% |{|\meta{key}|}| |{|\meta{default}|}|
7325bbe03797fd413af504fb3fac109b2c652a7bChristian Maeder% This generalized version allows the extraction
e83ed59502a681713982f25c559aae77a4145734Christian Maeder% of further properties of a reference than the
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder% two standard ones. Thus the following properties
50dce6b011347f92377adb8bbabaeeb80975e86dChristian Maeder% are supported, if they are available:
e83ed59502a681713982f25c559aae77a4145734Christian Maeder% \begin{quote}
50dce6b011347f92377adb8bbabaeeb80975e86dChristian Maeder% \begin{tabular}{@{}l|l|l@{}}
42c01284bba8d7c8d995c8dfb96ace57d28ed1bcTill Mossakowski% Key & Description & Package\\
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder% \meta{empty} & same as \cs{ref} & \LaTeX\\
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder% |page| & same as \cs{pageref} & \LaTeX\\
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder% |title| & section and caption titles & \xpackage{titleref}\\
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder% |name| & section and caption titles & \xpackage{nameref}\\
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder% |anchor| & anchor name & \xpackage{hyperref}\\
e83ed59502a681713982f25c559aae77a4145734Christian Maeder% |url| & url/file & \xpackage{hyperref}/\xpackage{xr}
50dce6b011347f92377adb8bbabaeeb80975e86dChristian Maeder% \end{tabular}
25a0b76bc87e80c0f697951d9817862755a71d33Christian Maeder% \subsection{Undefined references}
3a3bbc51abf804d91bc9d8e0f2ce745cfae4c9c7Christian Maeder% Because warnings and assignments cannot be used in
e3c9174a782e90f965a0b080c22861c3ef5af12dTill Mossakowski% expandible contexts, undefined references do not
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder% produce a warning, their values are assumed to be zero.
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder% \begin{quote}
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder%\begin{verbatim}
eb483f2216949400bfef8f6deb5320f071445626Christian Maeder%\label{ref:here}% somewhere
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder%\refused{ref:here}% see below
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder%\ifodd\getpagerefnumber{ref:here}%
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder% reference is on an odd page
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder% reference is on an even page
1320edfb75af112d509a6ce0a4c02425da7fed4dChristian Maeder%\end{verbatim}
9929f81562adecc8aafaefb14a0159afcf4a3351Christian Maeder% In case of undefined references the user usually want's
3639c2cf7f65e04c883054f4a52c6fa733663304Christian Maeder% to be informed. Also \LaTeX\ prints a warning at
% CTAN\footnote{\url{ftp://ftp.ctan.org/tex-archive/}}:
% \item[\CTAN{macros/latex/contrib/oberdiek/refcount.dtx}] The source file.
% \item[\CTAN{macros/latex/contrib/oberdiek/refcount.pdf}] Documentation.
% \item[\CTAN{install/macros/latex/contrib/oberdiek.tds.zip}]
% for \TeX\ Files'' (\CTAN{tds/tds.pdf}). Directories
% \paragraph{Unpacking.} Unpack the \xfile{oberdiek.tds.zip} in the
% |unzip oberdiek.tds.zip -d ~/texmf|
% Check the directory \xfile{TDS:scripts/oberdiek/} for
% \xfile{pdfatfi.pl} that should be installed in such a way
% |chmod +x scripts/oberdiek/pdfatfi.pl|\\
% \verb|tex refcount.dtx|
% If you have a \xfile{docstrip.cfg} that configures and enables \docstrip's
% e.g. unpack the file into the current directory:
% \verb|pdftk refcount.pdf unpack_files output .|
% \verb|latex \let\install=y\input{refcount.dtx}|
% configuration file \xfile{ltxdoc.cfg}. For instance, put this
%pdflatex refcount.dtx
%pdflatex refcount.dtx
%pdflatex refcount.dtx
% newsgroup \xnewsgroup{comp.text.tex}: