2

The package csquotes defines the quotation marks from the quoted (=inner) language, not from the environning language.

How can one set the outer language for defining the quotation marks of \foreignquote and \foreignblockcquote?

Edit: I am looking for a way to have the quotation marks produced before the language switch and the reference (if any) after the language has been switched back.

An example with \foreignquote:

\documentclass[11pt,a4paper,french,english]{article} 
  \usepackage[utf8]{inputenc} 
   \usepackage[T1]{fontenc} 
   \usepackage[autostyle=true]{csquotes} 
   \usepackage{babel} 
   \begin{document}     
   \selectlanguage{english}     In an English paper, 
   if I quote something that is in French, 
  I have guillemets: \foreignquote{french}{Ceci est en français.}       
  I am looking for \enquote{\selectlanguage{french}Ceci est en français.} 
  \end{document}

Example with \foreignquote

An example with \foreignblockcquote:

    \selectlanguage{english}    In an English paper, 
       if I quote something that is in French, 
\foreignblockcquote{french}{REF}{Ceci est en \enquote{français}.}
%      I have guillemets: \foreignblockcquote{french}{REF}{Ceci est en \enquote{français}}.}        
      I am looking for \blockcquote{REF}{\selectlanguage{french}Ceci est en \og français \fg.\selectlanguage{english}} 

Example with \foreignblockcquote

Note: I put \selectlanguage{english} at the end of \blockcquote in order for the reference to be in the paper's main language, here English.

2 Answers 2

2

I could not find an official interface on the csquotes side that lets you do this, but there are some internal macros that you can redefine to let csquotes first produce the quotation marks and only then switch the language.

\documentclass[11pt,a4paper,french,english]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage[autostyle=true]{csquotes}

\makeatletter
%  {<init>}{<endinit>}{<text>}
\long\def\csq@quote@i#1#2#3{%
  \csq@bqgroup\csq@oqopen@i#1#3#2\csq@qclose@i{}}
\long\def\csq@quote@ii#1#2#3{%
  \csq@bqgroup\csq@iqopen@i#1#3#2\csq@qclose@i{}}
\makeatother

\begin{document}
  In an English paper, if I quote something that is in French,
  I have guillemets: \foreignquote{french}{Ceci est en français.}
  
  I am looking for \enquote{\selectlanguage{french}Ceci est en français.}
\end{document}

I am looking for “Ceci est en français.”


If you want to reset the quotation mark level so that the foreign-language quotes start at the outer level, you need to dig a bit deeper.

The following solution should also address most block language switching commands.

\documentclass[11pt,a4paper,french,english]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage[autostyle=true]{csquotes}
\usepackage[backend=biber, style=authoryear]{biblatex}

\addbibresource{biblatex-examples.bib}

\makeatletter
\newcount\saved@csq@qlevel

\newcommand*{\tcsq@saveandreset@qlevel}{%
  \saved@csq@qlevel\csq@qlevel
  \csq@qlevel\z@}
  
\newcommand*{\tcsq@restore@qlevel}{%
  \csq@qlevel\saved@csq@qlevel}

%  {<init>}{<endinit>}{<text>}
\long\def\csq@quote@i#1#2#3{%
  \csq@bqgroup\csq@oqopen@i#1#3#2\csq@qclose@i{}}
\long\def\csq@quote@ii#1#2#3{%
  \csq@bqgroup\csq@iqopen@i#1#3#2\csq@qclose@i{}}


\def\csq@fquote@i#1{\csq@quote@i{\csq@lang{#1}\tcsq@saveandreset@qlevel}{\tcsq@restore@qlevel\csq@endlang}}
\def\csq@fquote@ii#1{\csq@quote@ii{\csq@lang{#1}\tcsq@saveandreset@qlevel}{\tcsq@restore@qlevel\csq@endlang}}
\def\csq@hquote@i#1{\csq@quote@i{\csq@hyph{#1}\tcsq@saveandreset@qlevel}{\tcsq@restore@qlevel\csq@endhyph}}
\def\csq@hquote@ii#1{\csq@quote@ii{\csq@hyph{#1}\tcsq@saveandreset@qlevel}{\tcsq@restore@qlevel\csq@endhyph}}

% {<init>}{<endinit>}{<qopen>}{<citehook>}{<cite>}{<punct>}{<text>}{<apunct>}<tpunct>
\long\def\csq@tquote@i#1#2#3#4#5#6#7#8#9{%
  \begingroup
  \csq@setsfcodes
  \edef\csq@tempa{%
    \unexpanded{%
      \mktextquote
      {#3}%
      {#1#7}%
      {#2\csq@qclose@i{}}%
      {#6}{#8}}%
    {\ifblank{#5}
       {}
       {\unexpanded{\csq@switchlang{#4{#5}}}}}}%
  \csq@bqgroup\csq@tempa#9%
  \endgroup}

\def\csq@ftquote@i#1{%
  \csq@getcargs{\csq@tquote
    {\csq@lang{#1}\tcsq@saveandreset@qlevel}{\tcsq@restore@qlevel\csq@endlang}
    {\csq@oqopen@i}}}
\def\csq@ftquote@ii#1{%
  \csq@getcargs{\csq@tquote
    {\csq@lang{#1}\tcsq@saveandreset@qlevel}{\tcsq@restore@qlevel\csq@endlang}
    {\csq@iqopen@i}}}

\def\csq@htquote@i#1{%
  \csq@getcargs{\csq@tquote
    {\csq@hyph{#1}\tcsq@saveandreset@qlevel}{\tcsq@restore@qlevel\csq@endhyph}
    {\csq@oqopen@i}}}
\def\csq@htquote@ii#1{%
  \csq@getcargs{\csq@tquote
    {\csq@hyph{#1}\tcsq@saveandreset@qlevel}{\tcsq@restore@qlevel\csq@endhyph}
    {\csq@iqopen@i}}}

\def\csq@ftcquote@i#1{%
  \csq@getccargs{\csq@tquote
    {\csq@lang{#1}\tcsq@saveandreset@qlevel}{\tcsq@restore@qlevel\csq@endlang}
    {\csq@oqopen@i}}}
\def\csq@ftcquote@ii#1{%
  \csq@getccargs{\csq@tquote
    {\csq@lang{#1}\tcsq@saveandreset@qlevel}{\tcsq@restore@qlevel\csq@endlang}
    {\csq@iqopen@i}}}
  
\def\csq@htcquote@i#1{%
  \csq@getccargs{\csq@tquote
    {\csq@hyph{#1}\tcsq@saveandreset@qlevel}{\tcsq@restore@qlevel\csq@endhyph}
    {\csq@oqopen@i}}}
\def\csq@htcquote@ii#1{%
  \csq@getccargs{\csq@tquote
    {\csq@hyph{#1}\tcsq@saveandreset@qlevel}{\tcsq@restore@qlevel\csq@endhyph}
    {\csq@iqopen@i}}}

% {<init>}{<endinit>}{<citehook>}{<cite>}{<punct>}{<text>}{<apunct>}<tpunct>

\def\csq@bquote@ii#1#2#3#4#5#6#7#8{\csq@tquote@i{}{}{\csq@oqopen@i}{#3}{#4}{#5}{#1#6#2}{#7}{#8}}

% {<init>}{<endinit>}{<citehook>}{<cite>}{<punct>}{<text>}{<apunct>}<tpunct>

\long\def\csq@bquote@iii#1#2#3#4#5#6#7#8{%
  \begin{\csq@blockenvironment}%
  \toggletrue{csq@block}%
  \csq@setsfcodes
  \edef\csq@tempa{%
    \unexpanded{%
      \mkblockquote
      {#1#6}%
      {#5}{#7}}%
    {#2\ifblank{#4}
       {}
       {\unexpanded{\csq@switchlang{#3{#4}}}}}}%
  \csq@tempa#8%
  \end{\csq@blockenvironment}}

\renewrobustcmd*{\foreignblockquote}[1]{%
  \csq@getcargs{\csq@bquote{\csq@lang{#1}\tcsq@saveandreset@qlevel}{\tcsq@restore@qlevel\csq@endlang}}}

\renewrobustcmd*{\hyphenblockquote}[1]{%
  \csq@getcargs{\csq@bquote{\csq@hyph{#1}\tcsq@saveandreset@qlevel}{\tcsq@restore@qlevel\csq@endhyph}}}

\renewrobustcmd*{\hybridblockquote}[1]{%
  \csq@getcargs{%
    \csq@bquote
      {\iftoggle{csq@block}{\csq@lang}{\csq@hyph}{#1}\tcsq@saveandreset@qlevel}
      {\tcsq@restore@qlevel\iftoggle{csq@block}{\csq@endlang}{\csq@endhyph}}}}

\renewrobustcmd*{\foreignblockcquote}[1]{%
  \csq@getccargs{\csq@bquote{\csq@lang{#1}\tcsq@saveandreset@qlevel}{\tcsq@restore@qlevel\csq@endlang}}}

\renewrobustcmd*{\hyphenblockcquote}[1]{%
  \csq@getccargs{\csq@bquote{\csq@hyph{#1}\tcsq@saveandreset@qlevel}{\tcsq@restore@qlevel\csq@endhyph}}}

\renewrobustcmd*{\hybridblockcquote}[1]{%
  \csq@getccargs{%
    \csq@bquote
      {\iftoggle{csq@block}{\csq@lang}{\csq@hyph}{#1}\tcsq@saveandreset@qlevel}
      {\tcsq@restore@qlevel\iftoggle{csq@block}{\csq@endlang}{\csq@endhyph}}}}
\makeatother

\SetCiteCommand{\autocite}
\usepackage{lipsum}

\begin{document}
  Lorem \foreignquote{french}{Ceci est en français.}
  
  Lorem \foreignquote{french}{Ceci \enquote{\enquote{est} en} français.}
  
  Lorem \foreigntextquote{french}{Ceci \enquote{\enquote{est} en} français.}
  
  Lorem \foreignblockcquote{french}{sigfridsson}{Ceci est en \enquote{français}.}
  
  Lorem \foreignblockcquote{french}{sigfridsson}{Ceci est en \enquote{français}. \lipsum}
\end{document}
3
  • This is exactly what I was looking for: produce the quotation marks in the defined language and then switch to the quoted language. Your solution works for \foreignquote if there is no embedded \enquote in it: \foreignquote{french}{Ceci est en \enquote{français}} produces English quotation marks for \enquote. I edited my question to introduce a variant I am looking for with \foreignblockcquote, which with your solution produces French guillemets outside and English quotation marks inside the quote.
    – Tecti
    Jan 22, 2021 at 4:56
  • @Tecti The solution also works if you have an \enquote inside a \foreignquote. But you get the quotation marks for the inner nesting level (which for the default French style are English-style marks; you can test with German to see that there is indeed a switch to the quotation marks of the other language). I guess you could reset the counter when you do language switching so you start at outer French quotation marks, but that probably requires some fiddling.
    – moewe
    Jan 22, 2021 at 5:33
  • Indeed, it works with \foreignquote. But not with \foreignblockcquote when the quoted part is small (inline quote).
    – Tecti
    Jan 22, 2021 at 5:56
1

If I understand correctly this should be enough:

\DeclareQuoteStyle{french}
  {\textquotedblleft}
  {\textquotedblright}
  {\textquoteleft}
  {\textquoteright}

You can change the inner quotation marks to «...» with this:

\DeclareQuoteStyle{french}
  {\textquotedblleft}
  {\textquotedblright}
  {\guillemotleft}
  {\guillemotright}

So that this code

 \foreignquote{french}{Ceci est en français: \enquote{Il l'a dit}}

gives:

enter image description here

2
  • The problem is not to change the style of the quotes themselves. This answer would prevent having embedded quotations, such as \foreignquote{french}{Ceci est en français: \enquote{Il l'a dit}.} I would then want the embedded quotes to be French guillemets (the style of the surrounding language, ie French here).
    – Tecti
    Jan 15, 2021 at 18:20
  • I still don't understand what result you want to achieve. Perhaps a few more examples would help. I added a variation to the code above, in response to your comment
    – Ivan
    Jan 15, 2021 at 19:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .