Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

thanks breaks pdfusetitle #81

Closed
oliviercailloux opened this issue Dec 19, 2018 · 4 comments
Closed

thanks breaks pdfusetitle #81

oliviercailloux opened this issue Dec 19, 2018 · 4 comments

Comments

@oliviercailloux
Copy link

As explained here, hyperref with option pdfusetitle does not like \title{The title\thanks{Thanks}}: the title metadata becomes The titleThanks.

I think it should be The title, thus the title metadata should not include the \thanks part.

@u-fischer
Copy link
Member

It is no a bug that \thanks is not deactivated in "pdf" locations like the bookmarks or the metadata by default: hyperref can't disable every imaginable problematic command, the list would get too long.
I don't think that \thanks is used often enough in titles to justify its addition in the default list.

As a user you can always deactivate it with \pdfstringdefDisableCommands in your document, or you can locally disable or replace it with \texorpdfstring.

@oliviercailloux
Copy link
Author

If I dare insist, I understand that hyperref can’t imagine every possible intricate use of the \title, but this one does not seem intricate at all.

\thanks is used for nothing else than this kind of usage in the cover page; and this example use is given by no other than Leslie Lamport.

Perhaps the list of problematic command taken care of by hyperref could be limited to the ones given as examples in very famous books about LaTeX such as Lamport’s one? I believe that will not make such a huge list.

@u-fischer
Copy link
Member

I think one can add it too \Hy@UseMaketitleString. This looks like the logical place - it will only be used together with pdfusetitle and so not polute the default list.

\documentclass{article}

\usepackage[pdfusetitle]{hyperref}

\makeatletter
\def\Hy@UseMaketitleString#1{%
  \ltx@IfUndefined{Hy@#1}{}{%
    \begingroup
      \let\Hy@saved@hook\pdfstringdefPreHook
      \pdfstringdefDisableCommands{%
        \expandafter\let\expandafter\\\csname Hy@newline@#1\endcsname
        \let\newline\\%
        \def\and{; }%
        \let\thanks\@gobble%<---new
      }%
      \expandafter\ifx\csname @pdf#1\endcsname\@empty
        \expandafter\pdfstringdef\csname @pdf#1\endcsname{%
          \csname Hy@#1\endcsname\@empty
        }%
      \fi
      \global\let\pdfstringdefPreHook\Hy@saved@hook
    \endgroup
  }%
}
\begin{document}
\title{The title\thanks{Thanks}} 

\maketitle
Hello.
\end{document}

@davidcarlisle any objection?

@u-fischer
Copy link
Member

This will be resolved in the next hyperref version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants