0

I am new in LaTex. I know little beyond the contents covered in the course LaTeX101X in edX. I want to prepare documents in Bengali containing mathematical and chemical equations which are usually written in English. I have found a similar discussion in this forum and followed the first two answers. The first answer by Alan Munn provided the following sample code:

\documentclass[10pt]{article}
\usepackage{polyglossia}
\setmainlanguage[numerals=Devanagari]{bengali}
\setotherlanguage{english}
\newfontfamily\englishfont[Scale=MatchLowercase]{Linux Biolinum O}
\newfontfamily\bengalifont[Script=Bengali]{Akaash}
\begin{document}
\tableofcontents

\section{ভূমিকা}
এটি একটি ইংরেজি লেখা ছোট অধ্যায় যে বাঙ্গালী এ \textenglish{Google Translate} দ্বারা অনুবাদ করা হয়েছে. এটা খুব স্পষ্ট নয় যদি সঠিক অনুবাদ বা না কিন্তু ক্রিয়াটি ফন্ট দেখাতে যথেষ্ট হওয়া উচিত.
\end{document}

The second answer by Adib Hasan provided the following sample code:

\documentclass{article}
\usepackage[banglamainfont=Kalpurush, 
            banglattfont=Siyam Rupali
           ]{latexbangla}
\begin{document}
পিথাগোরাস(Pythagoras)-এর উপপাদ্যটি হল, \textit{সমকোণী ত্রিভুজের অতিভুজের উপর অঙ্কিত  
বর্গক্ষেত্রের ক্ষেত্রফল অপর দুই বাহুর উপর অঙ্কিত বর্গক্ষেত্রের ক্ষেত্রফলের সমষ্টির সমান।}
অর্থাৎ কোন সমকোণী ত্রিভুজের অতিভুজ $c$ এবং অপর দুই বাহু $a$ এবং $b$ হলে,
\[c^2=a^2+b^2\]
লক্ষ্য করুন, এখন পর্যন্ত টেক্সট প্রদর্শনের জন্য \textbf{কালপুরুষ} ফন্ট ব্যবহৃত হয়েছে।\\
\texttt{এবার, টেলিটাইপ(Teletype) টেক্সট প্রদর্শনের জন্য \textbf{সিয়াম রূপালী} 
ফন্ট ব্যবহৃত হল।}\\
পুনরায় টেক্সট প্রদর্শনের জন্য \textbf{কালপুরুষ} ফন্ট ব্যবহৃত হচ্ছে।
\end{document}

When I compiled both codes same error was shown:

line 45: Fatal Package fontspec Error: The fontspec package requires either XeTeX or(fontspec) LuaTeX. \msg_fatal:nn {fontspec} {cannot-use-pdftex}
line 45: Emergency stop. \msg_fatal:nn {fontspec} {cannot-use-pdftex}

According to the error message, it seems that I should switch to XeTeX or LuaTeX. But how can I do this? Also, is it possible to write Bengali without switching to XeTeX or LuaTeX? Besides, can you give some suggestions regarding writing Bengali in LaTeX?

N.B. I use MiKTeX. The LaTeX editor, I use, is TeXstudio.

3
  • 1
    I wouldn't use the latexbangla package, it is a bit buggy. To switch to xelatex or lualatex check the menu in tex studio. There should be suitable buttons. And while it is probably possible to write bengali with pdflatex it is not recommended. With lualatex or xelatex it is much easier. Commented Jul 8, 2020 at 8:17
  • Instead of latexbangla package, which one may be used?
    – Imran
    Commented Jul 8, 2020 at 8:46
  • 3
    your first example from Alan should be fine. Instead of polyglossia you can also use babel, there should be examples on the site too. Commented Jul 8, 2020 at 8:49

2 Answers 2

1

Here is one of your examples with babel + xelatex.

\documentclass[10pt]{article}

\usepackage[english]{babel}

\babelprovide[main, import, maparabic]{bengali}

\babelfont{rm}{Shonar Bangla}  % A Windows font
\babelfont[english]{rm}{Linux Biolinum O}

\begin{document}

\tableofcontents

\section{ভূমিকা}

এটি একটি ইংরেজি লেখা ছোট অধ্যায় যে বাঙ্গালী এ
\foreignlanguage{english}{Google Translate} দ্বারা অনুবাদ করা হয়েছে. এটা খুব স্পষ্ট নয় যদি সঠিক অনুবাদ বা না কিন্তু ক্রিয়াটি ফন্ট দেখাতে যথেষ্ট হওয়া উচিত.

\end{document}

enter image description here

3
  • Where may I find the fonts for Bengali?
    – Imran
    Commented Jul 8, 2020 at 14:21
  • 1
    @Imran I used a Windows font. To find and inspect fonts in your system I strongly recommend dp4 Font Viewer. In Mac, there are (iir) Arial Unicode MS and Kohinoor Bangla. In other systems, sorry, I don't know. Commented Jul 8, 2020 at 15:22
  • Thanks a lot. I can't find the upvote option for comment.
    – Imran
    Commented Jul 8, 2020 at 16:22
1

One time change to another compiler

With TeXstudio, you can click Tools -> Commands -> XeLaTeX to use XeLaTeX instead of pdflatex.

Change of one document to another compiler

If you want to configure a specific document to be compiled through LuaLaTeX, you can refer to Tell TeXstudio to compile a particular document with LuaLaTeX.

Permanent change of TeXstudio to another compiler

And of course you can also configure TeXstudio to use XeLaTeX/LuaLaTeX by default for the regular build command by changing it at Options -> Configure TeXstudio in tab Build: enter image description here

Replace your standard compiler from pdflatex to XeLaTeX or LuaLaTeX.

7
  • "Change of one document to another compiler" - Is it possible for XeLaTeX?
    – Imran
    Commented Jul 8, 2020 at 9:09
  • 1
    Of course, sorry that I didn't list the whole matrix of possibilities, but XeLaTeX or LuaLaTeX can be used in any of the mentioned contexts.
    – TobiBS
    Commented Jul 8, 2020 at 9:22
  • @Imran why did you take away your upvote and answered marks? You asked three questions in one and I answered the first, because that was the starting point for you to investigate further. It would have been kind, if after that you would have opened the next question, to support the purpose of the platform.
    – TobiBS
    Commented Jul 8, 2020 at 15:31
  • I apologize to you for removing upvote and answered marks. I have asked questions in this forum for the first time. I didn't know that only one answer can be accepted. And, I am not sure about removing the upvote as I can't see it (I have only 3 reputation till now). I tried to upvote both the answers several times and maybe then the upvote was removed. Also thanks for your suggestion about asking questions. From next time, I will keep your advice in mind while asking questions (I don't know if there is any way now to separate these questions and answers).
    – Imran
    Commented Jul 8, 2020 at 16:16
  • Thanks for your answer. It is really too helpful. I couldn't start writing in Bengali without the processes mentioned in your answer, I won't be able to write Bengali in TeXstudio.
    – Imran
    Commented Jul 8, 2020 at 16:25

You must log in to answer this question.

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