
我正在透過使用“xepersian”套件用波斯語寫論文。我使用以下命令設定主要字體,
\usepackage{caption}
\usepackage{fontspec}
\usepackage{xepersian}
\settextfont[Scale=1.3, ItalicFont=*, ItalicFeatures={FakeSlant=0.32}, BoldItalicFont=* Bold, BoldItalicFeatures={FakeSlant=0.32}]{B Zar}
\setlatintextfont[Scale=1.2]{Times New Roman}
為了調整字幕的字體,我使用以下命令,
\defpersianfont\BZarScaleOne[Scale=1]{BZar.ttf}
\deflatinfont\TimesNewRomanScaleOne[Scale=1]{Times New Roman}
\DeclareCaptionFont{MyFont}{\fontsize{11pt}{0}\selectfont \BZarScaleOne} % Zar 11
\captionsetup{font=MyFont}
問題是,當我\lr{}
在標題中用英語寫一些東西時,它的大小與正文中的拉丁單字的大小相同。如何更改字幕中拉丁文字的大小?
答案1
CaptionFormat
為此,您必須進行以下更改:
\DeclareCaptionFormat{Mformat}{%
\fontsize{39pt}{42pt}#1#2#3%
}
\captionsetup{font=MyFont,format=Mformat}
這些是你的codes
:
\documentclass{article}
\usepackage{caption}
\usepackage{float}
\usepackage{xcolor}
\usepackage{array}
\usepackage[demo]{graphicx}
\usepackage{xepersian}
\settextfont[Scale=1.3, ItalicFont=*, ItalicFeatures={FakeSlant=0.32}, BoldItalicFont=* Bold, BoldItalicFeatures={FakeSlant=0.32}]{XB Zar}
\setlatintextfont[Scale=1.2]{Times New Roman}
\defpersianfont\BZarScaleOne[Scale=1]{BZar.ttf}
\deflatinfont\TimesNewRomanScaleOne[Scale=2]{Times New Roman}
\DeclareCaptionFont{MyFont}{\fontsize{11pt}{0}\selectfont \BZarScaleOne} % Zar 11
\DeclareCaptionFormat{Mformat}{%
\fontsize{39pt}{42pt}#1#2#3%
}
\captionsetup{font=MyFont,format=Mformat}
\renewcommand{\arraystretch}{1.7}
\begin{document}
\parindent=0cm
\begin{figure}[H]\centering
\includegraphics[width=5cm]{imagefile}
\caption{\lr{Text}}
\end{figure}
و در متن فارسی از
{\color{blue}\lr{Text}}
میتوان بهره گرفت. در صورت نیاز از
{\color{red}\TimesNewRomanScaleOne Text}
نیز میتوان بهره گرفت.
در جدول نیز داریم:
\begin{table}[H]
\begin{tabular}{|l|l|l|l|l|l|}
\hline
4&5&6&4&5&6\\
\hline
7&8&9&7&8&9\\
\hline
\end{tabular}\centering
\caption{\lr{Text}}
\end{table}
\end{document}
這是你的output
:
祝你好運。