csquotes icon indicating copy to clipboard operation
csquotes copied to clipboard

\enquote is not guarding againsts internal font changes

Open FrankMittelbach opened this issue 5 years ago • 6 comments

If there is a font change inside \enquote it affects the right quote!

Example:

\documentclass{article}

\usepackage{csquotes}

\begin{document}

\fontfamily{Overlock-LF}\selectfont

A \enquote{test}.

And another \enquote{\fontfamily{cmr}\selectfont test}.

\showoutput

\end{document}

Which gives

enquote-bug.pdf

FrankMittelbach avatar Nov 13 '19 17:11 FrankMittelbach

Suggestions? I'm not clear what would be a 'good' fix for the font situation.

josephwright avatar Nov 13 '19 17:11 josephwright

Suggestions? I'm not clear what would be a 'good' fix for the font situation.

assumption you want the same "outer" font for both left and right quote,

so save the current font away roughly in \csq@bqgroup (I guess) and restore it just before you typeset the right quote.

Might need some stack handling but perhaps not.

FrankMittelbach avatar Nov 13 '19 18:11 FrankMittelbach

Might actually be enough to add an inner group around the argument use, e.g., \enquote{{\fontfamily{cmr}\selectfont test}} already works but of course that should be done internally by \enquote and not something the user needs to do.

FrankMittelbach avatar Sep 28 '21 11:09 FrankMittelbach

Any update on this? I would presume that all this is in fact needed is to ensure that the argument is processed locally by surrounding it with a brace group inside the definition, i.e.,

\long\def\csq@quote@i#1#2#3{%
  \csq@bqgroup#1\csq@oqopen@i{#3}\csq@qclose@i{#2}}
\long\def\csq@quote@ii#1#2#3{%
  \csq@bqgroup#1\csq@iqopen@i{#3}\csq@qclose@i{#2}}

to localize any font changes in #3.

FrankMittelbach avatar Sep 01 '22 09:09 FrankMittelbach

This fix doesn't seem to be a good idea as the kerning around quotation marks will no longer be restored:

\documentclass{article}
\usepackage{csquotes}
\DeclareQuoteStyle{test}{V}{V}{v}{v}
\ExecuteQuoteOptions{style=test}
\begin{document}
\enquote{A}

VAV

\makeatletter
\long\def\csq@quote@i#1#2#3{% original definition
  \csq@bqgroup#1\csq@oqopen@i#3\csq@qclose@i{#2}}
\enquote{A}
\showoutput
\end{document}

schlcht avatar Sep 10 '22 22:09 schlcht

Ah, good point, then perhaps it has to be somewhat more convoluted, e.g.

\long\def\csq@quote@i#1#2#3{%
\csq@bqgroup\expandafter\let\expandafter\myfont\the\font#1\csq@oqopen@i#3\expandafter\ifx\the\font\myfont\else\myfont\fi\csq@qclose@i{#2}}

FrankMittelbach avatar Sep 11 '22 06:09 FrankMittelbach