uliska / lilyglyphs

Make LilyPond's notational elements available in Lua- and XeLaTeX
30 stars 13 forks source link

hyperref creates big boxes around lilyglyphs commands in TOC entries #87

Open uliska opened 10 years ago

uliska commented 10 years ago

Reported by NickS on oll-user (ATM not present in the archives yet):

I've just started using lilyglyphs and I've noticed it interacts with the "hyperref" package to produce very large bounding boxes around section titles in the table of contents. This can be seen in the PDF generated by running xelatex on the following code:

\documentclass{article}
% for lilyglyphs
\usepackage{fontspec}
\usepackage{lilyglyphs}
% for use without lilyglyphs
% \newcommand{\doublesharp}{$\sharp\sharp$}
% \newcommand{\flatflat}{$\flat\flat$}
% for hyperlinks
\usepackage{hyperref}
\author{Author}
\title{Title}
\begin{document}
\maketitle
\tableofcontents
\section{\texorpdfstring{The B\doublesharp}{\ref{The Bdoublesharp} The B++}}
This is the B\doublesharp.
\section{\texorpdfstring{The C\flatflat}{\ref{The Cdoubleflat} The C--}}
This is the C\flatflat.
\end{document}

By comparison, if you comment out the two "usepackage" lines (for fontspec and lilyglyphs) and uncomment the two "newcommand" lines (for doublesharp and flatflat), the resulting PDF has normal bounding boxes (but of course not proper accidentals).

In any case the PDF bookmark names don't like any accidentals (hence I use the "++" and "--" in the 2nd parameter of \texorpdfstring ), but it would be great if the lilyglyph symbols could be displayed in the table of contents without the very tall bounding boxes.

uliska commented 10 years ago

Note that this issue is only present with xelatex. lualatex produces the expected result.