Using of quotes in multi-lingual documents is very complicated, given the different possibilities of showing quotes ("
, ''
, or <<
- french), in addition to what language you want to use (Lt-to-Rt) or (Rt-to-Lt) which will inherit values of babel
or polyglossia
. On the other hand, the csquotes
package offers a seamless way to switch between different variants of one style, but I think it has some limitations which I would highlight here that might be of interest for developers in future. On top of that keeping the font-lock of the editor (Emacs + AUCTeX) to enhance readability of the script makes it even a harder task. So there are 2 main players (csquotes
and editor's font-lock) interacting to give you the desired effect and I will show my best compromise to satisfy both. I am open to all kinds of suggestions.
Consider this MWE using Ar-En
\documentclass[twoside=semi]{scrbook}
\usepackage{polyglossia}
\setmainlanguage[numerals=mashriq,abjadjimnotail=true]{arabic}
\setotherlanguages{english}
\newfontfamily\englishfont{Linux Libertine}
\newfontfamily\arabicfont[Script=Arabic,Ligatures=TeX]{Simplified Arabic}
\usepackage[arabic=guillemets,english=guillemets]{csquotes}
\MakeAutoQuote{«}{»}
\begin{document}
هذا نص باللغة العربية «خارج «داخل» الاقتباس».
هذا نص باللغة العربية \enquote{خارج \enquote{داخل} الاقتباس}.
\begin{english}
This is English text «outer «inner» quotations».
This is English text \enquote{outer \enquote{inner} quotations}.
\end{english}
\end{document}
%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:
Notes:
- Arabic is Rt-to-Lt like Hebrew and Persian, whearas English is Lt-to-Rt
- As you can see
\enquote{}
is a bad idea if you write with Rt-to-Lt, period.
csquotes
package does not ship with arabic
style, this must be defined in csquotes.cfg
file (see below)
\MakeAutoQuote{«}{»}
has many advantages (see: https://tex.stackexchange.com/a/39292/26295)
- It is better than
\MakeOuterQuote{"}
which will give you headache with font-lock alone with this unmatched single "
over there see https://emacs.stackexchange.com/q/7942/2443
- To type
«
and »
press C-x 8 <
and C-x 8 >
, respectively.
Font-lock Code in .init
(font-lock-add-keywords 'latex-mode (list (list "\\(«\\(.+?\\|\n\\)\\)\\(+?\\)\\(»\\)" '(1 'font-latex-string-face t) '(2 'font-latex-string-face t) '(3 'font-latex-string-face t))))
Definitions Code in csquotes.cfg
On my Windows machine this file is in this path:
c:/texlive/2014/texmf-dist/tex/latex/csquotes/csquotes.cfg
\ProvidesFile{csquotes.cfg} % already in the file
% Put your definitions here.
\DeclareQuoteStyle[quotes]{arabic}
{\textquotedblright}{\textquotedblleft}
{\textquoteright}{\textquoteleft}
\DeclareQuoteStyle[guillemets]{arabic}
{\guillemotleft}{\guillemotright}
{\guilsinglleft}{\guilsinglright}
\DeclareQuoteStyle[guillemets]{english}
{\guillemotright}{\guillemotleft}
{\guilsinglright}{\guilsinglleft}
\DeclareQuoteAlias[quotes]{arabic}{arabic}
\DeclareQuoteOption{arabic}
\endinput % already in the file check by yourself
Output with guillemets
Note: see the guillemets variant of english style was added and inverted to match the main language (arabic) of the document. However, this didn't work for quotes! Any idea why? The main reason why I opted for guillemets variants for both Ar and En.
To try quotes change one line in MWE:
\usepackage[arabic=quotes]{csquotes}
Output with quotes
Note: the quotations in Arabic are quite well but they are inverted for English. If I invert defintions in the .cfg
file for arabic style I will get right quotations for English but inverted for Arabic. That is the main different with guillemets, the latter tends to be more consistent with both languages, I am rather interested if someone knows why such a puzzling behavior in csquotes
package --- obviously a limitation.
Conclusion
Using guillemets instead of quotes proves to be a good strategy to have consistent quotation behavior for the two languages and they don't mess with the Rt-to-Lt text as when \enquote
is used, plus they can be font-locked in AUCTeX
with no fuss (see below).