\documentclass{article}
\usepackage{fontspec}
%
% This file is a sample tex file to illustrate use of
% XeTeX in typesetting Bengali document.
% License: GNU FDL: (C) Golam Mortuza Hossain, 2008
%
%
% Define fonts that you want to use
%
\font\serif="FreeSerif:script=beng"
\font\serifbb="FreeSerif:script=beng" at 24pt
\font\deffont="FreeSerif:script=beng" at 14pt
\font\mukti="Mukti Narrow Bold:script=beng"
%
% "script=beng" in above lines ensures that appropriate
% complex text rendering engines are used for proper
% rendering of Bengali.
%
\title{\bf\serifbb পাগলা দাশু}
\author{\bf\serif সুকুমার রায়}
\date{}
\begin{document}
\deffont %Default font used for the document
\maketitle
আমাদের স্কুলের যত ছাত্র তাহার মধ্যে এমন কেহই ছিল না, যে পাগলা দাশুকে
না চিনে। যে লোক আর কাহাকেও জানে না, সেও সকলের আগে পাগলা দাশুকে চিনিয়া
লয়। সেবার একজন নূতন দারোয়ান আসিল, একেবারে আনকোরা পাড়াগেঁয়ে লোক, কিন্তু
প্রথম যখন সে পাগলা দাশুর নাম শুনিল, তখনই সে আন্দাজে ঠিক ধরিয়া লইল যে,
এই ব্যক্তিই পাগলা দাশু। কারণ তার মুখের চেহারায়, কথাবার্তায়, চলনে চালনে
বোঝা যাইত যে তাহার মাথায় একটু 'ছিট' আছে। তাহার চোখদুটি গোল-গোল,
কানদুটা অনাবশ্যক রকমের বড়, মাথায় এক বস্তা ঝাঁকড়া চুল। চেহারাটা দেখিলেই
মনে হয়---
\vskip 10mm
% Specific font can be used for any part of the document
{\mukti বিঃদ্রঃ এই বাংলা পাতাটি লেখার জন্য XeTeX ব্যবহার করা হয়েছে।}
\end{document}
- 400
- 1
- 14
- 1,676
2 Answers
Don't mix high level commands (fontspec) with low level ones (\font). Here's how you can do in a better way; I've commented out the \mukti lines because I don't have the font
\documentclass{article}
\usepackage{fontspec}
\setmainfont{FreeSerif}
%\newfontfamily{\mukti}[Script=beng]{Mukti Narrow Bold}
\usepackage{polyglossia}
\setmainlanguage{bengali}
\title{পাগলা দাশু}
\author{সুকুমার রায়}
\date{}
\begin{document}
\maketitle
আমাদের স্কুলের যত ছাত্র তাহার মধ্যে এমন কেহই ছিল না, যে পাগলা দাশুকে
না চিনে। যে লোক আর কাহাকেও জানে না, সেও সকলের আগে পাগলা দাশুকে চিনিয়া
লয়। সেবার একজন নূতন দারোয়ান আসিল, একেবারে আনকোরা পাড়াগেঁয়ে লোক, কিন্তু
প্রথম যখন সে পাগলা দাশুর নাম শুনিল, তখনই সে আন্দাজে ঠিক ধরিয়া লইল যে,
এই ব্যক্তিই পাগলা দাশু। কারণ তার মুখের চেহারায়, কথাবার্তায়, চলনে চালনে
বোঝা যাইত যে তাহার মাথায় একটু 'ছিট' আছে। তাহার চোখদুটি গোল-গোল,
কানদুটা অনাবশ্যক রকমের বড়, মাথায় এক বস্তা ঝাঁকড়া চুল। চেহারাটা দেখিলেই
মনে হয়---
\vspace{10mm}
% Specific font can be used for any part of the document
%{\mukti বিঃদ্রঃ এই বাংলা পাতাটি লেখার জন্য XeTeX ব্যবহার করা হয়েছে।}
\end{document}

- 1,121,712
-
This showing 4errors in my machine(ubuntu10.04) as follows – Md Kutubuddin Sardar Mar 22 '13 at 18:59
-
This showing 4errors in my machine(ubuntu10.04) as follows ./myfile.tex:4:Undefined control sequence\setmainfont{FreeSerif} ./myfile.tex:4:Missing number,treated as zero\setmainfont{{FreeSerif} ./myfile.tex:4:Undefined control sequence\setmainfont{FreeSerif} ./myfile.tex:8:Missing number,treated as zero\setmainlanguage{bengali} – Md Kutubuddin Sardar Mar 22 '13 at 19:10
-
-
@MdKutubuddinSardar As egreg says, the errors are arising as you have an old version of
fontspec: it used to use a command\setseriffontrather than\setmainfont. I'd recommend installing 'vanilla' TeX Live as for complex scripts the updates to the binary part of TeX are also important. – Joseph Wright Mar 23 '13 at 08:02
The standard way to do so in many languages is to use fontspec and polyglossia packages together. Unfortunately, polyglossia's support for Bangla is rather limited. That's why I have written a new package latexbangla to specifically address Bangla related typesetting issues. Some of its features are -- automatic transition from Bangla to English and vice versa, patch for the unproportionate whitespace character issue for popular fonts, and many more (See the package documentation for full details).
Additionally, if you have any suggestion for new features, you can simply contact me and I shall look into it.
Code sample:
\documentclass{article}
\usepackage[banglamainfont=Kalpurush,
banglattfont=Siyam Rupali
]{latexbangla}
\title{পাগলা দাশু}
\author{সুকুমার রায়}
\date{}
\begin{document}
\maketitle
আমাদের স্কুলের যত ছাত্র তাহার মধ্যে এমন কেহই ছিল না, যে পাগলা দাশুকে
না চিনে। যে লোক আর কাহাকেও জানে না, সেও সকলের আগে পাগলা দাশুকে চিনিয়া
লয়। সেবার একজন নূতন দারোয়ান আসিল, একেবারে আনকোরা পাড়াগেঁয়ে লোক, কিন্তু
প্রথম যখন সে পাগলা দাশুর নাম শুনিল, তখনই সে আন্দাজে ঠিক ধরিয়া লইল যে,
এই ব্যক্তিই পাগলা দাশু। কারণ তার মুখের চেহারায়, কথাবার্তায়, চলনে চালনে
বোঝা যাইত যে তাহার মাথায় একটু 'ছিট' আছে। তাহার চোখদুটি গোল-গোল,
কানদুটা অনাবশ্যক রকমের বড়, মাথায় এক বস্তা ঝাঁকড়া চুল। চেহারাটা দেখিলেই
মনে হয়---
\end{document}
And a last tip. The font Mukti Narrow is quite old and does not provide good support for LaTeX. You should consider downloading "modern" fonts like Kalpurush, Siyam Rupali, Solaiman Lipi or Bangla from OmicronLab.
- 381
-
Package 'latexbangla' has been removed from CTAN. Thus, this answer is meaningless now! – Supriyo Dec 30 '16 at 17:23
-
Before calling an answer/package meaningless, you should have notified the author. Originally, I called my package 'banglatex', but had to rename it to 'latexbangla' due to a naming conflict. The later is available in CTAN, but the former is not. – Adib Hasan Jan 11 '17 at 12:32
-
@AdibHasan I am glad that you have contribute in LaTeX as Bangali. Thank you. But, I guess your font is bit bolder than bangtex. Sorry, if I wrong. – alhelal Oct 31 '17 at 08:11
-
@AdibHasan your package don't support
pdflatexbut I am comfortable inpdflatex. – alhelal Oct 31 '17 at 08:24 -
@alhelal, it is not clear what you identified as "my bangla font". Both Kalpurush and Siyam Rupali were developed by OmicronLab (with which I have no ties). I used these fonts in the example above because they are freely available. However, with LaTeXbangla, you are free to use any unicode compatible bangla font. Also note that,
pdflatexhas no support for unicode. Consequently, there is no simple way to write in Bangla with it unless you are willing to write something like this. – Adib Hasan Nov 06 '17 at 03:47

polyglossiapackage, which handles most of this for you. – Alan Munn Mar 19 '13 at 16:01