0

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,

\documentclass{article}

\input{/home/wpornpat/TeX/preambles/ThaiStandard}

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

   ทดสอบทดสอบทดสอบทดสอบทดสอบทดสอบทดสอบทดสอบทดสอบทดสอบทดสอบทดสอบทดสอบทดสอบทดสอบทดสอบทดสอบ
\end{document}

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?

\usepackage{ragged2e,polyglossia,fontspec,xcolor,color,parskip,xltxtra}
\usepackage{caption,subcaption,fixltx2e,amsfonts,indentfirst,chapterfolder,import,array,multirow,float,graphicx}
\usepackage[top=1.0in,bottom=1.0in,left=1.0in,right=1.0in]{geometry}
\setmainlanguage{thai}

\let\includegraphicsWithoutCF\includegraphics
\renewcommand{\includegraphics}[2][]{\includegraphicsWithoutCF[#1]{\cfcurrentfolder#2}}

\XeTeXlinebreaklocale "th_TH"
\PolyglossiaSetup{thai}{indentfirst=true}

\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}}

\definecolor{KSOrange}{HTML}{FFA500}

% 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.

0
1

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}

1
  • 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.