[Tex/LaTex] Changing font in Farsi/Persian

fontslanguages

I'm typing my thesis in Farsi, and I'm using LiveTeX. I want to change my font in some parts of my documents. I checked most of the relevant questions and answers but unfortunately I couldn't find out my answer. There are two questions:

  1. How can I change the font of some specific parts of my thesis?

  2. What are font families?

I already used {\fontfamily{ppl}\selectfont ... }
but it didn't work.

I used it as:

\documentclass[a4]{book}‎  
  ‎‎‎
‎\usepackage{‎graphicx}‎‎ 
\newenvironment{ppl}{\fontfamily{ppl}\selectfont}{‎Times New ‎R‎oman‎}‎
‎\textwidth =12cm‎ 
‎\textheight =19cm‎
‎‎‎\usepackage{amsmath,amssymb}‎ ‎‎‎
‎‎\usepackage{xepersian}‎‎‎‎
‎\settextfont[Scale=1]{XB Zar}‎
‎\setdigitfont[Scale=1]{XB Zar}‎ 
‎‎‎‎‎‎‎‎‎
\begin{document}
‎‎‎
من این همه را خودم نوشته ام و این یکی را می خواهم به صورت امتحانی در زیر با فونت دیگری بنویسم . ‎‎
‎
‎
\begin{‎ppl‎‎}‎
‎‎‎من این را به صورت امتحانی مینویسم . 
‎
\end{‎ppl‎‎}
‎\end{document} 

Best Answer

You are using xepersian which is used with XeLaTeX, so you can use commands from the fontspec package (which is loaded automatically by xepersian) to change fonts or you can use commands from the xepersian package itself.

XePersian has a command \deflatinfont which allows you to create a command for the latin font you want. For example, you want Times New Roman as the font, so you could do:

\deflatinfont\timesroman{Times New Roman}

You would then use it with:

{\timesroman Some Times Roman text here}

To make this an environment, (after defining the font as shown above) you can do:

\newenvironment{Times}{\timesroman}{\par}

and then use

\begin{Times}
...
\end{Times}

You can use \deflatinfont multiple times (with different command names) in your document to define other latin fonts.

Related Question