\documentclass{barticle}
\title{EkiT pRbn/dh} \author{Ajana elkhk} \date{pNNicesh {oi}bshakh, 1413}
\begin{document}
\bng
\maketitle
\section{pRthm pirec/chd}
rbiin/dRnaethr EkiT kibtar shuru inec ed{O}ya Hl.
\begin{verse}
kt Ajanaer jana{I}el tuim \\ kt gher idel ThNNa{I}. \\
duurek kirel inkT bn/dhu,\\ prek kirel bha{I}....
\end{verse}
\end{document}
-
1@MdKutubuddinSardar: What is your question? I could compile your code and in produced a "Bengali" document. (I assume the script is "Bengali".)– SonyFeb 23, 2013 at 19:51
-
2Since you have some responses below that seem to answer your question, please consider marking one of them as ‘Accepted’ by clicking on the tickmark below their vote count (see How do you accept an answer?). This shows which answer helped you most, and it assigns reputation points to the author of the answer (and to you!). It's part of this site's idea to identify good questions and answers through upvotes and acceptance of answers.– jub0bsApr 20, 2013 at 10:47
-
A site for Bangla language has been proposed at Area51. Please visit and support.– Always ConfusedApr 27, 2017 at 16:21
8 Answers
Although it's not completely clear what your question is asking, I would recommend using XeLaTeX and the polyglossia
package for Bengali. This way you just enter your Bengali text in regular form.
I used the Akaash font from here: Free Bangla Fonts. Since I don't speak Bengali, I translated a short text from English using Google Translate. My apologies if it did an awful translation.
% !TEX TS-program = XeLaTeX
\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}
As the example shows, and as mentioned in the comments, this does not make all numerals Bengali. For a solution to this problem, see:
-
1
-
@HaseebMahmud See the accepted answer to this question: How to get devanagari numerals in latex or xetex Jan 25, 2014 at 17:53
-
@AlanMunn : Is there any conversion chart for english to bengali , for the way of the OP?– QwertyApr 21, 2016 at 8:10
The problem with polyglossa
is that its support for Bangla (or Bengali) is quite limited. This prompted me to write a new package latexbangla
, which extends the former's functionalities and addresses most of the Bangla related typesetting issues. It also provides full support for common commands and environments, automatic transition from Bangla to English (and vice versa), and a patch to fix unproportionate whitespace error in popular Bangla fonts. With latexbangla
, you can simply type usual LaTeX syntax and expect everything to behave as it should.
Sample code: (from package documentation)
\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}
UPD: There is number breaking problem with new polyglossia
and LaTeXbangla
.
Way to fix that pointed here. This problem is mainly because of polyglossia
bug. Which was fixed later on. But LaTeXbangla
wasn't updated.
-
-
1The package 'banglatex' is missing from CTAN, not latexbangla. I have updated the link, check again. Jan 11, 2017 at 12:17
-
-
I was using your code in a different project and got "! Package polyglossia Error: The current roman font does not contain the Bengal i script! (polyglossia) Please define \bengalifont with \newfontfamily." Apr 15, 2017 at 0:02
-
As of 2020, LuaLaTeX (with the HarfBuzz renderer) is able to display Bengali. The babel
package also supports it. The following template (based on the accepted answer) runs on LuaLaTeX in TeX Live 2020.
\documentclass{article}
\tracinglostchars=2
\usepackage[bidi=basic,layout=sectioning]{babel}
\usepackage{fontspec}
\babelprovide[import,main]{bengali}
\babelprovide[onchar=fonts ids]{english}
\defaultfontfeatures{Scale=MatchLowercase, Ligatures=TeX, Renderer=HarfBuzz}
%% These fonts are abailable at: https://www.google.com/get/noto/
\babelfont{rm}
[Ligatures=Common,Scale=1.0,Language=Default]{Noto Serif}
\babelfont{sf}
[Language=Default]{Noto Sans}
\babelfont{tt}
[Language=Default]{Noto Sans Mono}
\babelfont[bengali]{rm}
[Language=Default]{Noto Serif Bengali}
\babelfont[bengali]{sf}
[Language=Default]{Noto Sans Bengali}
\babelfont[bengali]{tt}
[Language=Default]{Noto Sans Bengali UI}
\babeltags{english=english}
\babeltags{bengali=bengali}
\begin{document}
\section{ভূমিকা}
এটি একটি ইংরেজি লেখা ছোট অধ্যায় যে বাঙ্গালী এ Google Translate দ্বারা অনুবাদ করা হয়েছে. এটা খুব স্পষ্ট নয় যদি সঠিক অনুবাদ বা না কিন্তু ক্রিয়াটি ফন্ট দেখাতে যথেষ্ট হওয়া উচিত.
\end{document}
This sample automatically switches from the Bengali font to the English font whenever you switch to the Latin script, so “Google Translate” appears in Noto Serif, rather than Noto Serif Bengali. If you remove the onchar=fonts ids
option, you can still switch between them with \textenglish
, \begin{english}
, etc.
You can change the numbering of pages, chapters, equations and so on to Bengali by adding the maparabic
option to \babelprovide
, and can also redefine other counters such as alph
and Alph
.
You can also use your fonts of choice. The Language=Default
font features are not strictly necessary. I included them to suppress some harmless warning messages.
\documentclass{report}
\usepackage{fontspec}
\setmainfont{[Kalpurush.ttf]}
\newfontface{\en}{[Chapaza Italic.ttf]} %%this is optional, if you want to use a secondary font. Any english font is supported
\begin{document}
\chapter{আমি বাংলায় গান গাই। }
এখন খুব সহজে বাংলা ফন্ট ব্যবহার করুন\\
{\en fontspec} প্যাকেজ এবং {\en XeLatex} ইঞ্জিন এর সাহায্যে।\\
{\Large বড়ো অক্ষর}\\
\rule{6cm}{1pt}\\
{\en\ Hope this will help you a lot}
\end{document}
working very well, just download Kalpurush.ttf font and past it into the project folder. remember that the font name need to be accurate. Now change your latex compile engine to XeLatex instead of PdfLatex. Kalpurus.ttf download link: Click
-
Welcome to TeX.SX! You can highlight code in your post using back-ticks. To highlight code-blocks, either indent them by four spaces or use the
{}
on the gui.– user30471Jan 4, 2018 at 14:16 -
-
1How is this different from the other answers (apart from the fonts chosen)? Jan 4, 2018 at 22:29
-
choosing a font is the main thing while you are using bangla. You have used Akaash.ttf and that is not good in arranging the bangla alphabets– RaviJan 5, 2018 at 5:59
-
1@ravi Then you should explain why in your answer. I have no stake in this issue, but if you want to help other Bangla users your answer should explain why this is a better approach. Also, the other answer uses the same main font as your example, but also suggests the
banglalatex
package. Do you have problems with that package too? Jan 5, 2018 at 16:02
\documentclass[12pt]{article}
\usepackage{fontspec}
%\setmainfont[]{kalpurush.ttf} % u can use only one font
\setmainfont[
BoldFont=kalpurush.ttf,
ItalicFont=kalpurush.ttf,
BoldItalicFont=kalpurush.ttf
]{kalpurush.ttf}
\title{বাংলা আমার মায়ের ভাষা}
\author{বিপুল }
\date{শনিবার ২১শে ভাদ্র ১৪২৭ বঙ্গাব্দ}
\begin{document}
\maketitle
কিভাবে সহজে ঝামেলামুক্তভাবে বাংলা লিখবেন?
\begin{enumerate}
\item প্রথমে https://www.overleaf.com তে যান, একাউন্ট খুলুন, এবং প্রজেক্ট তৈরি করুন।
\item আপনার পছন্দের বাংলা ফন্ট ডাউনলোড করুন, আমি কালপুরুষ ব্যবহার করেছি।
\item ফন্টটি ওভারলিফে আপলোড করুন
\item usepackage{fontpec} এবং setmainfront(kalpurush.ttf) সেট করা হয়েছে।
\item এখন পছন্দ মতো বাংলা লিখুন।
\item আপনি চাইলে বোল্ড, ইটালিক বা অন্য স্টাইলের জন্য ভিন্ন ভিন্ন ফন্ট ব্যবহার করতে পারেন।
\item শুভকামনা রইলো।
\end{enumerate}
-
I want to use Kalpurush font only for Bengali text, and the default English font elsewhere. How to achieve that in Overleaf? Nov 19, 2020 at 15:08
-
you can do something like this
\usepackage{polyglossia} \setdefaultlanguage{english} \setotherlanguages{hindi,sanskrit,bengali} \usepackage{fontspec} \setmainfont{Times New Roman} \newfontfamily{\devanagarifont}[Script=Devanagari]{Lohit Devanagari.ttf} \newfontfamily{\bengalifont}[Script=Bengali]{kalpurush.ttf}
– BiMoApr 4 at 17:55
I'm using overleaf for Bangla writing. There is no installation and it's easy. Follow my instruction.
-
4Please do not link to remote ressources for this as the remote content from your GitHub repository might not be available in the future. Instead please add a copy of the instructions to your answer here. Jul 26, 2019 at 8:41
I specifically needed a solution that could be compiled with pdflatex on Overleaf. Unfortunately, many of the modern packages require XeLaTeX or LuaLaTeX.
For this, you can use pdflatex_bengali based on the bangtex package.
Quickstart Guide
- Put the mf folder along with all its contents in the same directory as your LaTeX source code.
- Put the bangla_commands.tex file in the same directory as your LaTeX source code.
- Put
\input{bangla_commands}
in the preamble of your LaTeX source code - When you write বাংলা enclose it within the
\bng
command like this{\bng baNNGla \*l*ikhun}
which should output বাংলা লিখুন - The
\bng
command can be replaced by commands specifying other sizes, and this is outlined in the demo.tex and demo.pdf files. - A simple example document is shown below
\documentclass{article}
\title{Bengali Test}
\author{{\lbng Airt/r \*gh*eaSh}}
\input{bangla_commands}
\begin{document}
\maketitle
\section{Example}
{\bng baNNGla \*l*ikhun}
\end{document}
Download any Bengali Unicode font from here and add it to the directory where your .tex file resides.
I downloaded the Kalpurush font.
Then add two commands like this before the \begin{document}
command.
\usepackage{fontspec}
\newfontfamily\ben{kalpurush.ttf}
(Use the name of the ttf file you downloaded)
Now you can write Bengali text anywhere like this:
{\ben কম্পিউটার বিজ্ঞান}
Don't forget to put everything inside curly braces like I did above. Compile using XeLaTeX.
I have done this in Overleaf and it is working perfectly.
-
Two downvotes without as much as a comment pointing out the issues with a new contributor's answer are just so disheartening to see. If you are going to downvote something, please at least leave a comment mentioning how the poster can improve their answer.– Aritrayesterday