There is a simple solution to write Bengali or Bangla in Latex using xelatex compiler, but many journal, conference or preprint (i.e. arXiv) sites do not support xelatex compiler. Most of them uses pdflatex compiler. Polyglossia and fontspec packages (necessary to write Bangla in xelatex compiler) do not seem to work with pdflatex.
To write bengali/Bangla in pdflatex, there is a package for typesetting documents in Bangla or Bengali using the Tex/Latex systems, called [Bangtex]. It is quite difficult to write rules based transliterattions manually to appear as Bengali or Bangla in pdflatex. However, there is a perl script that can automatically transliterate unicode Bengali or Bangla to Bangtex supported transliteration. Once, we get the transliterations, we just need to paste them in the latex file!!
Please follow the below steps:
Open a text file (say, smpldoc.txt
), write unicode Bengali or unicode Bangla in the text file. For example,
রবীন্দ্রনাথের একটি কবিতার শুরু নিচে দেওয়া হল।
- Install Perl in your PC. Download file and installation procedure is available in this link.
- Download the
uni2bangtex.perl
script from this repository. - Note: The command in the next point should be written in a single line not in separate lines.
- Open cmd (command prompt) and run the script as follows:
perl C:\Users\Shibli\Downloads\uni2bangtex.perl C:\Users\Shibli\Downloads\smpldoc.txt > C:\Users\Shibli\Downloads\smpldoc.tex
clarification: perl[space]C:\Users\Shibli\Downloads\uni2bangtex.perl[space]C:\Users\Shibli\Downloads\smpldoc.txt[space]>[space]C:\Users\Shibli\Downloads\smpldoc.tex - Considering
smpldoc.txt
file anduni2bangtex.perl
script are on the same folder, in the above commandC:\Users\Shibli\Downloads
is the file path. Running this command will generate a (.tex) file in the same folder (as in the commandsmpldoc.tex
). - Open the (.tex) file using text editor (i.e. notepad or notepad++ etc).
smpldoc.tex
will containrbiin/dRnaethr EkiT kibtar shuru inec ed{O}ya Hl.
for the bangla example written in the text file.
- Download the
bangla_commands.tex
file from this repository and upload into your latex project. - In the
main.tex
(the tex file that loads when you run your project, may have different name), addbangla_commands.tex
file like\input{bangla_commands}
anywhere before\begin{document}
- Copy the bangtex transliteration obtained in step 2 and paste like
{\bng rbiin/dRnaethr EkiT kibtar shuru inec ed{O}ya Hl.}
where you want to use Bengali. (bangtex trasliteration should inside a{\bng }
block.)
You can write English and Bangla in the input text file. The perl script will keep the English texts as it is. Only Bangla texts will be converted to Bangtex format.
I do not own/claim any of the files/materials mentioned/used in this repo. I found this beautiful package and read their documentation and summarized into simpler steps. All credit goes to the authors/developers of Bangtex and uni2bangtex.