1

I am writing a bilingual (English + Bangla) document with the package latexbangla.

(For the following MWE, kindly download the font Kalpurush from here: https://www.omicronlab.com/bangla-fonts.html)

% !TEX program = xelatex
\documentclass{book}
\usepackage[banglamainfont=Kalpurush, banglattfont=Kalpurush]{latexbangla}                               
\setdefaultlanguage[numerals=Bengali, changecounternumbering=true]{bengali}
\usepackage[autostyle]{csquotes}

\begin{document}

\section*{Section 1}
I said,```মানুষ মাত্রই ভুল করে'- এটাকে ইংরেজিতে অনুবাদ কর".\\
He replied, ```To err is human' - It's an easy one. আরো কঠিন কিছু জিজ্ঞেস করেন".

\section*{Section 2}
I said,"'মানুষ মাত্রই ভুল করে'- এটাকে ইংরেজিতে অনুবাদ কর".\\
He replied, "'To err is human' - It's an easy one. আরো কঠিন কিছু জিজ্ঞেস করেন".

\section*{Section 3}
I said,``ইংরেজিতে অনুবাদ কর - `মানুষ মাত্রই ভুল করে'".\\
He replied, ```To err is human' - It's an easy one. আরো কঠিন কিছু জিজ্ঞেস করেন".

\end{document}

The output: The screenshot of the output of my MWE

Here, Check the red marks where the quotation marks appear wrongly. I want to configure the quotation-mark style to make my Section 1 and Section 2 look the same without changing the code inside the sections. Also, check the red mark in my Section 3. Before the Bangla text, the double-quote appears as two separate single-quotes. How can I fix these issues? And what can I do to switch from curly to neutral quote-marks everywhere?

4
  • 1
    If you want to keep the TeX mappings, like He replied, \textquotedbl\textquotesingle To err is human{}\textquotesingle\ - It's an easy one. আরো কঠিন কিছু জিজ্ঞেস করেন\textquotedbl.? With mappings on, two backticks give left double quote, and one gives left single quote. Does tex.stackexchange.com/questions/591300/… help?
    – Cicada
    May 31, 2021 at 13:52
  • I don't want to change anything inside the sections and don't wish to put anything like textquotebl. I wanted both `` and " to generate the same quote marks by configuring the quotation style.
    – raf
    May 31, 2021 at 14:15
  • Unrelated: the documentation (texdoc latexbangla) mentions that banglamainfont and banglattfont cannot be the same font.
    – Cicada
    Jun 1, 2021 at 11:39
  • But I haven't faced any problem using the same font!
    – raf
    Jun 1, 2021 at 12:06

1 Answer 1

1

If staying with latexbangla is required, then redefining the xetex mappings will do it, such that `` and " will both produce " instead of “ and ” (and likewise, ` and ' will both produce ' instead of ‘ and ’), all the while keeping the other ligatures.

new mappings

The blue is to highlight the source for the font.

example usage

Note that to treat single right quote and apostrophe as separate characters (straight versus curly, for example) can be done, but implies markup/code/mapping rules to distinguish them.

Several things need to be done.

(1) Map file

latexbangla uses ucharclasses, which requires xetex, which in turn can understand mapping files.

Adapting the answer from here How does one display straight quotes in the normal font? on how to modify the mapping file to keep the other standard ligatures, a copy of tex-text.map will have these alternative lines in it:

;U+0027         <>  U+2019  ; ' -> right single quote
;U+0027 U+0027  <>  U+201D  ; '' -> right double quote
;U+0022          >  U+201D  ; " -> right double quote

U+0060          <>  U+0027  ; ` -> straight single quote
U+0060 U+0060   <>  U+0022  ; `` -> straight double quote

Say the new .map file is called tex-text3.map. Compiling with teckit_compile.exe will produce tex-text3.tec, a binary file.

(2) Define mapped fonts

latexbangla uses polyglossia in the background, which in turn calls fontspec.

The .tec file is called into play with the Mapping= option of a fontspec command: e.g., \newfontfamily\myrmlat[Mapping=tex-text3,Colour=blue]{Noto Serif} .

(3) Modify latexbangla latin environment

latexbangla defines a latin environment with legacy OT1 font encoding (for some reason).

\newenvironment{latin}
{\fontencoding{OT1}\ifx\f@family\btt@@name\fontfamily{lmtt}
\else\fontfamily{lmr}\fi\selectfont}\relax

Since it is xelatex, we can go Unicode. Xelatex can also understand truetype/opentype fonts anyway, so modern fonts can be used instead, including our mapped fonts (which can be the TTF/OTF versions of Latin Modern Roman and Latin Modern Mono, if desired).

\makeatletter
\renewenvironment{latin}
{\ifx\f@family\btt@@name\myttlat
\else\myrmlat\fi}\relax
\makeatother

MWE

% !TEX program = xelatex
\documentclass{book}
\usepackage[table]{xcolor}

\usepackage[banglamainfont=Kalpurush, banglattfont=Atma]{latexbangla}                               
\setdefaultlanguage[numerals=Bengali, changecounternumbering=true]{bengali}

%\newenvironment{latin}
%{\fontencoding{OT1}\ifx\f@family\btt@@name\fontfamily{lmtt}
%\else\fontfamily{lmr}\fi\selectfont}\relax



%(E)
\newfontfamily\myrmlat[Mapping=tex-text3,Colour=blue]{Noto Serif}
\newfontfamily\myttlat[Mapping=tex-text3,Colour=green]{Noto Sans Mono}

\makeatletter
\renewenvironment{latin}
{\ifx\f@family\btt@@name\myttlat
\else\myrmlat\fi}\relax
\makeatother


\begin{document}
\begin{tabular}{lll}
\rowcolor{blue!7}
Character & now maps to & instead of \\
\hline\\
\Large\textasciigrave & 
\Large ` & 
\Large\symbol{8216} \\
\Large\textasciigrave\textasciigrave &  
\Large `` & 
\Large\textquotedblleft \\
\Large\textquotesingle & 
\Large ' & 
\Large\symbol{8217} \\
\Large\textquotedbl & 
\Large " & 
\Large\textquotedblright \\
\hline
\end{tabular}

\bigskip
so that 
`x' = 'x',``y" = "y".


\section*{Section 1}
I said,```মানুষ মাত্রই ভুল করে' - এটাকে ইংরেজিতে অনুবাদ কর".\\
He replied, ```To err is human' - It's an easy one. আরো কঠিন কিছু জিজ্ঞেস করেন".

\section*{Section 2}
I said,"'মানুষ মাত্রই ভুল করে' - এটাকে ইংরেজিতে অনুবাদ কর".\\
He replied, ```To err is human' - It's an easy one. আরো কঠিন কিছু জিজ্ঞেস করেন''.

\section*{Section 3}
I said,``ইংরেজিতে অনুবাদ কর - `মানুষ মাত্রই ভুল করে'".\\
He replied, ```To err is human' - It's an easy one. আরো কঠিন কিছু জিজ্ঞেস করেন".

\end{document}
2
  • Note that the web page is doing its own mapping: y'' becomes 'y''.
    – Cicada
    Jun 1, 2021 at 11:45
  • Wow! Thank you so much for the answer!
    – raf
    Jun 1, 2021 at 12:07

You must log in to answer this question.

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