From: Mark Wooding Date: Mon, 25 Jul 2022 21:45:29 +0000 (+0100) Subject: mdwref.dtx: Make the `\xref' command robust. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/mdwtools/commitdiff_plain/5893e63785289dacde4099004aed510cabf7eee8 mdwref.dtx: Make the `\xref' command robust. Otherwise it doesn't work very well in figure captions and suchlike. --- diff --git a/mdwref.dtx b/mdwref.dtx index acfcd44..1a40fb3 100644 --- a/mdwref.dtx +++ b/mdwref.dtx @@ -217,7 +217,7 @@ % We're meant to typeset a reference. The first job is to see whether % there's an optional argument. If so, grab it; otherwise |\relax| will do. % \begin{macrocode} -\def\xref{\@ifnextchar[\xref@{\xref@[\relax]}} +\DeclareRobustCommand\xref{\@ifnextchar[\xref@{\xref@[\relax]}} \def\xref@[#1]#2{\xref@@{#1}#2:\q@delim:\q@delim:\q@delim\q@delim} % \end{macrocode} % Right; now we abuse \TeX's argument parser to pick apart the reference