到目前为止,我一直在使用 XePersian 包来排版波斯语文章,现在我想在英文文档中插入一些波斯语单词,如果不使用 XePersian 包,做到这一点的最少代码是什么?
\documentclass{article}
\usepackage{fontspec}
\setmainfont{Tahoma}
\begin{document}
book
کتاب
% rendered as ک ت ا ب but should be rendered کتاب
\end{document}
答案1
非常简单。我这样做:
\usepackage{bidi}% this should be the last package to load.
\newfontfamily\Kayhan[Script=Arabic]{XB Kayhan}% for example
\newenvironment{Farsi}%more human readable - other stuff can be added as well
{\begin{RTL}}
{\end{RTL}}
然后像这样写波斯语:
This is an english paragraph with some
\begin{Farsi}\Kayhan
نوشته فارسی
\end{Farsi}
that is added.
答案2
\documentclass{article}
\usepackage{fontspec}
\newfontfamily\faFont[Script=Arabic]{Yas}
\usepackage{bidi}
\newenvironment{Fa}{\begin{RTL}\faFont}{\end{RTL}}
\newcommand{\fa}[1]{{\faFont\RL{#1}}}
\begin{document}
\begin{Fa}
پاراگراف فارسی
\end{Fa}
This is a Persian word: \fa{سیب}. It means apple.
\end{document}
用于波斯语内容的fa
单词级别和Fa
段落级别。
答案3
使用 XePersian: http://bay.uchicago.edu/tex-archive/macros/xetex/latex/xepersian/xepersian.pdf
1 \documentclass{minimal}
2 \usepackage{xepersian}
3 \usepackage{enumerate}
4 \settextfont{XB Niloofar}
5 \begin{document}
ﺍﯾﻦ ﻓﻘﻂ ﯾﮏ ﺁﺯﻣﺎﯾﺶ ﺍﺳﺖ 6
7 \end{document}