[tex-eplain] \definexref problem
Adam Fenn
acwfenn at ntlworld.com
Sun Dec 5 13:01:43 CET 2010
How can I modify this:
%----------------------------%<--------------------------
\def\book#1#2#3{%
\definexref{#3:long}{#1}{}%
\definexref{#3:short}{#2}{}%
\definexref{#3full}{#1}{}%
}
\def\bookref#1{%
\readauxfile % make sure the xrefs are loaded
\expandafter \ifx\csname\xrlabel{#1}\endcsname\relax % no marker
defined
\global\expandafter\let\csname\xrlabel{#1}\endcsname\empty %
define it
\csname\xrlabel{#1:long}\endcsname % produce the long ref
\else % the marker already defined
\csname\xrlabel{#1:short}\endcsname % produce the short ref
\fi
}
\book
{first book (long reference)}
{first book (short ref)}
{firstbook}
\book
{article in \string\xrefn{firstbookfull}}
{article (short ref)}
{article}
\bookref{firstbook} % a long first reference
\bookref{firstbook} % a short second reference
\bookref{article} % a long reference to article in first book
\bookref{article} % a short reference
%----------------------------%<--------------------------
so that the macro \book also prints the book title at the place where
it appears?
If I do something like:
\def\book#1#2#3{%
#1
\definexref{#3:long}{#1}{}%
\definexref{#3:short}{#2}{}%
\definexref{#3full}{#1}{}%
}
then it prints \xrefnfirstbookfull because of the preceding \string
(which is needed to suppress expansion of \xrefn).
Hope this is clear.
TIA
Adam.
More information about the tex-eplain
mailing list