Skip to content

Latest commit

 

History

History
40 lines (31 loc) · 4.03 KB

File metadata and controls

40 lines (31 loc) · 4.03 KB

Write-Bangla-or-Bengali-in-Latex

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:

Step 1: Write unicode in Bengali

Open a text file (say, smpldoc.txt), write unicode Bengali or unicode Bangla in the text file. For example, রবীন্দ্রনাথের একটি কবিতার শুরু নিচে দেওয়া হল।

Step 2: Convert unicode Bengali to Bangtex

  • 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 and uni2bangtex.perl script are on the same folder, in the above command C:\Users\Shibli\Downloads is the file path. Running this command will generate a (.tex) file in the same folder (as in the command smpldoc.tex).
  • Open the (.tex) file using text editor (i.e. notepad or notepad++ etc). smpldoc.tex will contain rbiin/dRnaethr EkiT kibtar shuru inec ed{O}ya Hl. for the bangla example written in the text file.

Step 3: Copy and paste into Latex 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), add bangla_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.)

Fun fact

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.

N.B:

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.