TeX - LaTeX Asked on March 13, 2021
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}
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}}
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.
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:
Answered by Ivan on March 13, 2021
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>}
longdefcsq@quote@i#1#2#3{%
csq@bqgroupcsq@oqopen@i#1#3#2csq@qclose@i{}}
longdefcsq@quote@ii#1#2#3{%
csq@bqgroupcsq@iqopen@i#1#3#2csq@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}
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
newcountsaved@csq@qlevel
newcommand*{tcsq@saveandreset@qlevel}{%
saved@csq@qlevelcsq@qlevel
csq@qlevelz@}
newcommand*{tcsq@restore@qlevel}{%
csq@qlevelsaved@csq@qlevel}
% {<init>}{<endinit>}{<text>}
longdefcsq@quote@i#1#2#3{%
csq@bqgroupcsq@oqopen@i#1#3#2csq@qclose@i{}}
longdefcsq@quote@ii#1#2#3{%
csq@bqgroupcsq@iqopen@i#1#3#2csq@qclose@i{}}
defcsq@fquote@i#1{csq@quote@i{csq@lang{#1}tcsq@saveandreset@qlevel}{tcsq@restore@qlevelcsq@endlang}}
defcsq@fquote@ii#1{csq@quote@ii{csq@lang{#1}tcsq@saveandreset@qlevel}{tcsq@restore@qlevelcsq@endlang}}
defcsq@hquote@i#1{csq@quote@i{csq@hyph{#1}tcsq@saveandreset@qlevel}{tcsq@restore@qlevelcsq@endhyph}}
defcsq@hquote@ii#1{csq@quote@ii{csq@hyph{#1}tcsq@saveandreset@qlevel}{tcsq@restore@qlevelcsq@endhyph}}
% {<init>}{<endinit>}{<qopen>}{<citehook>}{<cite>}{<punct>}{<text>}{<apunct>}<tpunct>
longdefcsq@tquote@i#1#2#3#4#5#6#7#8#9{%
begingroup
csq@setsfcodes
edefcsq@tempa{%
unexpanded{%
mktextquote
{#3}%
{#1#7}%
{#2csq@qclose@i{}}%
{#6}{#8}}%
{ifblank{#5}
{}
{unexpanded{csq@switchlang{#4{#5}}}}}}%
csq@bqgroupcsq@tempa#9%
endgroup}
defcsq@ftquote@i#1{%
csq@getcargs{csq@tquote
{csq@lang{#1}tcsq@saveandreset@qlevel}{tcsq@restore@qlevelcsq@endlang}
{csq@oqopen@i}}}
defcsq@ftquote@ii#1{%
csq@getcargs{csq@tquote
{csq@lang{#1}tcsq@saveandreset@qlevel}{tcsq@restore@qlevelcsq@endlang}
{csq@iqopen@i}}}
defcsq@htquote@i#1{%
csq@getcargs{csq@tquote
{csq@hyph{#1}tcsq@saveandreset@qlevel}{tcsq@restore@qlevelcsq@endhyph}
{csq@oqopen@i}}}
defcsq@htquote@ii#1{%
csq@getcargs{csq@tquote
{csq@hyph{#1}tcsq@saveandreset@qlevel}{tcsq@restore@qlevelcsq@endhyph}
{csq@iqopen@i}}}
defcsq@ftcquote@i#1{%
csq@getccargs{csq@tquote
{csq@lang{#1}tcsq@saveandreset@qlevel}{tcsq@restore@qlevelcsq@endlang}
{csq@oqopen@i}}}
defcsq@ftcquote@ii#1{%
csq@getccargs{csq@tquote
{csq@lang{#1}tcsq@saveandreset@qlevel}{tcsq@restore@qlevelcsq@endlang}
{csq@iqopen@i}}}
defcsq@htcquote@i#1{%
csq@getccargs{csq@tquote
{csq@hyph{#1}tcsq@saveandreset@qlevel}{tcsq@restore@qlevelcsq@endhyph}
{csq@oqopen@i}}}
defcsq@htcquote@ii#1{%
csq@getccargs{csq@tquote
{csq@hyph{#1}tcsq@saveandreset@qlevel}{tcsq@restore@qlevelcsq@endhyph}
{csq@iqopen@i}}}
% {<init>}{<endinit>}{<citehook>}{<cite>}{<punct>}{<text>}{<apunct>}<tpunct>
defcsq@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>
longdefcsq@bquote@iii#1#2#3#4#5#6#7#8{%
begin{csq@blockenvironment}%
toggletrue{csq@block}%
csq@setsfcodes
edefcsq@tempa{%
unexpanded{%
mkblockquote
{#1#6}%
{#5}{#7}}%
{#2ifblank{#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@qlevelcsq@endlang}}}
renewrobustcmd*{hyphenblockquote}[1]{%
csq@getcargs{csq@bquote{csq@hyph{#1}tcsq@saveandreset@qlevel}{tcsq@restore@qlevelcsq@endhyph}}}
renewrobustcmd*{hybridblockquote}[1]{%
csq@getcargs{%
csq@bquote
{iftoggle{csq@block}{csq@lang}{csq@hyph}{#1}tcsq@saveandreset@qlevel}
{tcsq@restore@qleveliftoggle{csq@block}{csq@endlang}{csq@endhyph}}}}
renewrobustcmd*{foreignblockcquote}[1]{%
csq@getccargs{csq@bquote{csq@lang{#1}tcsq@saveandreset@qlevel}{tcsq@restore@qlevelcsq@endlang}}}
renewrobustcmd*{hyphenblockcquote}[1]{%
csq@getccargs{csq@bquote{csq@hyph{#1}tcsq@saveandreset@qlevel}{tcsq@restore@qlevelcsq@endhyph}}}
renewrobustcmd*{hybridblockcquote}[1]{%
csq@getccargs{%
csq@bquote
{iftoggle{csq@block}{csq@lang}{csq@hyph}{#1}tcsq@saveandreset@qlevel}
{tcsq@restore@qleveliftoggle{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}
Answered by moewe on March 13, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP