[texhax] index entries in latex/makeindex, post 2

Uwe Lück uwe.lueck at web.de
Tue Dec 16 18:25:42 CET 2008

I failed to write what nameref redefines: it's \nameref. Right? -- Uwe.
Rename \nameref! [Completed below]

At 17:14 16.12.08, Zbigniew Nitecki wrote:
>The following macros are among those I have to generate index entries:
>\newcommand{\namerefindex}[4]{\index{#2, #1 (#3-#4)}}%prints name, date in 
>index not text
>\newcommand{\namerefsilent}[4]{#1\  #2\ (#3-#4)}%prints name, date in text 
>not index
>\newcommand{\nameref}[4]{#1\  #2\ 
>(#3-#4)\namerefindex{#1}{#2}{#3}{#4}}%prints name, date in text
>Included in the same macro file are the following:
>\newcommand{\Fermatref}{\nameref{Pierre de}{Fermat}{1601}{1665}}
>When I run the full book text as described above, I get an error messages 
>referring to the
>paragraph quoted above:
>LaTeX Warning: Reference `Pierre de' on page 2 undefined on input line 52.
>! Missing \endcsname inserted.
><to be read again>
>                    \unhbox
>l.52 ...h cenury by \Fermatref{} and \Descartesref

Look into your .log file. I'm quite sure that you see that nameref.sty
(coming with hyperref.sty) is loaded \AtBeginDocument, which (re)defines
to produce a \ref. The error you get says that the corresponding \label
is missing.

HTH -- Uwe.

More information about the texhax mailing list