I'm learning XeTeX mainly because it enables typesetting in my native language (Thai). With normal pdfLaTeX, arranging the document into sections was easy and intuitive, and I hope to be able to do the same thing with XeTeX. Here is my example .tex file,



   \title{ลอง XeTeX}
   \section{ตอนที่ 1: ทดสอบ}


The preamble file is the following. Sorry for including lots of packages, but lots of them were ported from my pdfLaTeX workflow and wonder if they would work similarly with XeTeX?



\XeTeXlinebreaklocale "th_TH"

\newfontfamily{\thaifont}[Path = /usr/share/fonts/ThaiFonts/]{THSarabun.ttf}
\newfontfamily{\thaiBF}[Path = /usr/share/fonts/ThaiFonts/]{THSarabun Bold.ttf}
\newfontfamily{\thaiIT}[Path = /usr/share/fonts/ThaiFonts/]{THSarabun Italic.ttf}

\newenvironment{thaipar}[2]{\par \setlength{\parindent}{#1} \Large \setlength{\parskip}{#2}}


% Package descriptions:
%    ragged2e - for paragraph alignment commands "raggedleft/right, center"
%    fontspec - for .ttf fonts support and unicode support in XeLaTeX
%    polyglossia - locale support for specific languages in XeLaTeX
%    xltxtra - for Thai language line break

And this is the result I got

enter image description here

The Thai text doesn't appear at all in \section{}, and also I would like the paragraphs to be indented but they don't seem to do so like in pdfLaTeX. Yes, in the preamble I included the environment that will indent the paragraphs, but can it also work the same way as in pdfLaTex (that a text after the blank line starts a new paragraph automatically?) Do I need any specific setups?

Thank you and I appreciate for all your help.


I found out the way to make the section show the text, thanks to Latex and Thai language. I forgot to set the main font to the Thai font, hence the section doesn't show. To do this, use \setmainfont[Path=/Path/To/Font/]{THSarabun.ttf}

  • I also found out how to indent the paragraph. That was silly of me. Just \setlength{\parindent}{0.25in} will do. I didn't think of this as this is not necessary with pdfLaTeX...
    – KhunWasut
    Sep 29 '15 at 21:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.