Considering the following example:
\documentclass{memoir}
\usepackage{makeidx}
\makeindex
%\usepackage[hyperindex=false]{hyperref}%doesn't help
\usepackage{hyperref} %commenting out this one would do.
\begin{document}
\frontmatter
Something\index{Something}. And something else\index{Something else}
\mainmatter
Something\index{Something}. And something else\index{Something else}
\printindex
\end{document}
And the following minimal xindy style file, formatting roman page numbers as small caps:
(markup-locref :class "roman-page-numbers" :open "\textsc{" :close "}")
$ xindy -M texindy -M scpages.xdy example.idx
This works when I comment out hyperref
:
However with hyperref roman numbers do not get formatted as small caps:
How do I make it work with hyperref
?
Edit: One possible workaround is to comment out hyperref
just for building the index. Once I'm satisfied with the index I can comment it back in again, but I'll have to comment out \makeindex
and not run xindy, which means that if because of editing my project some entries get pushed onto another page it will not automatically be reflected in the index. Also, in the pdf the page numbers will not be clickable. For print this workaround is sufficient, and at least hyperref
works for the rest of the file, i.e. separate page ranges for front- and mainmatter in the pdf.
Edit:
Another temporary fix is to run a perl one liner over the .ind
-file:
perl -pi -e 's/(\\hyperpage{.*?})/\\textsc{$1}/g' myfile.ind
which encapsulates every instance of \hyperpage{[some number]}
with \textsc{}
. That way one doesn't need to switch hyperref
between commented in and out, thus streamlining the build process. The numbers become clickable, and one gets the desired small caps for the roman numbers. This line can be conveniently added to a buildscript after the xindy
call.
\textsc{\thepage}
is equivalent to\thepage
if\thepage
gives an Arabic numeral anyway. At least, normally it is. If you are using a particular font configuration it might not be. But it would be better to have the page numbering set up so\thepage
does the right thing on its own.\pagenumbering{scroman}
. Do you think it might be useful, and compatible withmemoir
?memoir
seems to do something different and I can't figure it out at all.xindy
, not sure how trivial that would be.