1

Following this answer I was given, about how to add small caps roman numbers in the index with babel in Spanish, I have a new problem. With the hyperref package, the links don't go to the right page with these roman numbers. They always go to the very first page of the document.

The link of the table of contents works fine, as well as the words in the index with arabic numbers, but the words in the index with roman numbers don't.

MWE:

\documentclass[a4paper,openright,10pt]{book}
\usepackage[spanish,es-nosectiondot,es-preindex,es-noquoting]{babel}
\usepackage{hyperref}
\usepackage{makeidx}
\makeindex

\title{Example }

\author{Me}

\begin{document}

\frontmatter
\maketitle


\chapter{Introduction}

Hello casa \index{casa} .....

\mainmatter

\chapter{Blaaaaaaaaaaaa}

Words \index{m\'{e}dico}.

\renewcommand{\indexname}{\'{I}ndice de Materias}

\printindex


\end{document}

And the result is:

What should I do to correct the links?

EDIT: An warning message is shown:

0Warning:\040Replacing\040`OT1/cmr/m/n'\040by\040\\MessageBreak\040faked\040sma
ll\040caps\040on\040input\040line\0403.\012}\\endgroup\040\\uppercase\040{iii}}
} has been referenced but does not exist, replaced by a fixed one
</usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmbx12.pfb></usr/
share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmcsc10.pfb></usr/share
/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb></usr/share/texliv
e/texmf-dist/fonts/type1/public/amsfonts/cm/cmr12.pfb></usr/share/texlive/texmf
-dist/fonts/type1/public/amsfonts/cm/cmr17.pfb></usr/share/texlive/texmf-dist/f
onts/type1/public/amsfonts/cm/cmsl10.pfb>
  • 1
    I'm investigating the hyperref internals, which are even trickier than the spanishones ;-). – Javier Bezos Jul 5 '16 at 14:20
2

There are in fact two issues. Both can be fixed easily thanks to the hooks provided by the packages.

Firstly, the index entries are modified by hyperref, which doesn't recognize a macro defined by spanish. This issue is fixed with the following line before \printindex:

\def\esromanindex#1{\hyperindexformat{\textsc}}

Second, there is little bug in hyperref, which redefines an internal macro wrongly, because to create the target name it maps lowercase small caps to uppercase. But fortunately, there is also a hook, so after loading hyperref (and babel) write:

\makeatletter
\addto\pdfstringdefPreHook{\def\es@roman#1{\romannumeral#1 }}
\makeatother

It works for me, which of course doesn't mean it works for everyone ;-). I hope it works also for you, and if so, I'll modify spanishfor it to work with hyperref.

  • That's nice! (+1) – user31729 Jul 5 '16 at 15:19
  • It works perfectly! Thanks a lot Javier (again!). It's a pleasure to learn LaTeX from the best ones! – Minkowski Jul 5 '16 at 15:46
  • Great! I'll prepare a new version, but not right now (I'm very busy finishing babel 3.10). – Javier Bezos Jul 5 '16 at 18:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.