[texhax] Problem with the xr-hyper package

Heiko Oberdiek heiko.oberdiek at googlemail.com
Sat May 17 18:21:26 CEST 2014


On 17.05.2014 16:06, José Carlos Santos wrote:
> 
> --------------------------- A.tex ---------------------------
> \documentclass{book}
> \usepackage{hyperref}
> \newcommand*{\newchapter}[1]{\chapter[\texorpdfstring{\MakeUppercase{#1}}{#1}]{#1}}
> 
> \begin{document}
> \newchapter{ABC}\label{cha}
> A
> \end{document}
> -------------------------------------------------------------

The following change solves the issue:

\pdfstringdefDisableCommands{\let\MakeUppercase\relax}
\newcommand*{\newchapter}[1]{\chapter{#1}}

> --------------------------- B.tex ---------------------------
> \documentclass[article]{memoir}
> \usepackage{amsmath}
> \usepackage{xr-hyper}
> \usepackage{hyperref}
> \externaldocument{A}
> \begin{document}
> \chapter{\nameref{cha}}
> \end{document}
> -------------------------------------------------------------

Or package zref-xr is more powerful and should be more robust then xr-hyper:

\documentclass[article]{memoir}
\usepackage{amsmath}
\usepackage{hyperref}

\usepackage{nameref}% explicit, zref-xr needs to see it
\usepackage{zref-xr}
\zxrsetup{tozreflabel=false, toltxlabel}
\zexternaldocument*{A}

\begin{document}
\chapter{\nameref{cha}}
\end{document}

Yours sincerely
  Heiko Oberdiek




More information about the texhax mailing list