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

Bug when enquote starts with duplicated character in section with Hyperref. #70

Open
LustigePerson opened this issue Apr 3, 2024 · 1 comment

Comments

@LustigePerson
Copy link

I found a really weird behavior:
If I "enquote" (csquotes) something that starts with two identical characters in a section header AND use hyperref I get the error:

! Argument of \csq@pdf@quote@ii has an extra }.
<inserted text> 
                \par 
l.19 \section{Foo Bar \enquote{AA}}

When the "double" character is not at the start everything is fine.

MWE:

\documentclass{article}

\usepackage{csquotes}

%Hyperref
\usepackage{hyperref}
 
 
\begin{document}
\section{Foo Bar \enquote{AA}}
\end{document}

See here for discussion.

There is also an explanation from another user.
I quote his comment here:
It's a bug in csquotes: if I modify two definitions to have \if*#1 instead of \if#1*, the run is successful.

The \if#1* test is obviously wrong: with \tracingmacros=1 I get

\enquote #1->\if #1*\relax \expandafter \@firstoftwo \else \expandafter \@secon
doftwo \fi {\csq@pdf@quote@ii } {\csq@pdf@quote@i {#1}}
#1<-AA

but clearly the macro is supposed to check if there's a leading *.

\usepackage{csquotes}
 
%Hyperref
\usepackage{hyperref}

% fix the bugs
\makeatletter
\long\def\csq@pdf@quote#1{%
  \if*#1\relax
    \expandafter\@firstoftwo
  \else
    \expandafter\@secondoftwo
  \fi
    {\csq@pdf@quote@ii}
    {\csq@pdf@quote@i{#1}}}
\long\def\csq@pdf@fquote#1{%
  \if*#1\relax
    \expandafter\@firstoftwo
  \else
    \expandafter\@secondoftwo
  \fi
    {\expandafter\csq@pdf@quote@ii\@gobble}
    {\csq@pdf@quote@i}}
\makeatother

\begin{document}

\section{Foo Bar \enquote{AA}}

\end{document}
@josephwright
Copy link
Owner

Duplicate of #60

@josephwright josephwright marked this as a duplicate of #60 Apr 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants