[Tex/LaTex] Best way to use multi-lingual quotes using csquotes package in AUCTeX Emacs

arabicauctexcsquotesemacsright-to-left

When I write in Arabic (Rt-to-Lt) language I get the quotation marks reversed (the right instaed of left and vice versa) if I want to keep font-locking of AUCTeX setup.

Emacs editor using AUCTeX
Font-locking is right in the first line, but not in the second. However the second line will get the quotations right in the PDF for Arabic.

enter image description here

Output
So you can see the second line has it right in Arabic.

enter image description here

My trial code to fix that

\documentclass[twoside=semi]{scrbook}

\usepackage{polyglossia}
\setmainlanguage[numerals=mashriq,abjadjimnotail=true]{arabic} 
\newfontfamily\arabicfont[Script=Arabic,Ligatures=TeX]{Simplified Arabic} 

\usepackage[style=arabic]{csquotes}
\DeclareQuoteStyle[quotes]{arabic}
{\textquotedblright}{\textquotedblleft}
{\textquoteright}{\textquoteleft}

\DeclareQuoteStyle[guillemets]{arabic}
{\guillemotright}{\guillemotleft}
{\guilsinglright}{\guilsinglleft}

\DeclareQuoteOption{arabic}
\DeclareQuoteAlias[quotes]{arabic}{arabic}


\begin{document}

هنا نص باللغة العربية ``داخل علامتي الاقتباس''. 

هنا نص باللغة العربية "داخل علامتي الاقتباس``. 

\end{document}

%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:

ERROR

ERROR: Package csquotes Error: Quote style not defined.

I want to keep font-locking (fontification for quotations) setup unchanged, but change the quotations from within csquotes package. I looked up in the documentation and I didn't find a support for Arabic language for example, but one can add a style and a variant for this language. I tried to reverse the quotation marks in a new style called arabic with two variants quotes and guillemets, but it didn't work. What am I missing?

Notes:

  • csquotes Version 5.1d
  • Compilation by xetex

Best Answer

I don't know arabic, so I don't even know what the correct quotes are in this case.

But what I can tell you is that the command \DeclareQuoteOption can be used only in a configuration file csquotes.cfg. This file can contain new options which can then be used at loading time by the csquotes package. In fact it is loaded by csquotes before processing its options.

So you have to create a file with that name in your document directory with the following contents

\ProvidesFile{csquotes.cfg}

\DeclareQuoteStyle[quotes]{arabic}
{\textquotedblright}{\textquotedblleft}
{\textquoteright}{\textquoteleft}

\DeclareQuoteStyle[guillemets]{arabic}
{\guillemotright}{\guillemotleft}
{\guilsinglright}{\guilsinglleft}

\DeclareQuoteAlias[quotes]{arabic}{arabic}
\DeclareQuoteOption{arabic}

\endinput

At this point your MWE can be reduced to:

\documentclass[twoside=semi]{scrbook}

\usepackage{polyglossia}
\setmainlanguage[numerals=mashriq,abjadjimnotail=true]{arabic}
\newfontfamily\arabicfont[Script=Arabic,Ligatures=TeX]{Simplified Arabic}

\usepackage[style=arabic]{csquotes}

\begin{document}

هنا نص باللغة العربية ``داخل علامتي الاقتباس''.

هنا نص باللغة العربية "داخل علامتي الاقتباس``.

هنا نص باللغة العربية \enquote{داخل علامتي الاقتباس}.

\end{document} 

and this is its output:

enter image description here

The output of \enquote seems to be the one you are expecting.


If you want, you can add

\MakeOuterQuote{"}

in your document and use "..." for your quotes.

MWE:

\documentclass[twoside=semi]{scrbook}

\usepackage{polyglossia}
\setmainlanguage[numerals=mashriq,abjadjimnotail=true]{arabic}
\newfontfamily\arabicfont[Script=Arabic,Ligatures=TeX]{Simplified Arabic}

\usepackage[style=arabic]{csquotes}
\MakeOuterQuote{"}

\begin{document}

هنا نص باللغة العربية ``داخل علامتي الاقتباس''.

هنا نص باللغة العربية \enquote{داخل علامتي الاقتباس}.

هنا نص باللغة العربية "داخل علامتي الاقتباس".

\end{document} 

The output is the same as above.

Related Question