
我已經改變了引理環境樣本內多幀包來創建一個範例環境。我正在使用 XePersian 套件以波斯語(具有 RTL 方向)進行排版。我遇到的問題是該句子的第一個字母沒有出現在最終編譯的 PDF 檔案中。例如,句子以“ž”開頭,但在最終輸出中它看起來像““”,如下圖中的紅色矩形所示。如果您能幫助我找出我的錯誤,我將不勝感激。我正在使用的程式碼如下:
\documentclass[a4paper,11pt,aleqn]{article}
\usepackage{amsmath, mathtools}
\usepackage[framemethod=TikZ]{mdframed}
\usepackage{xepersian}
\settextfont[Scale=1]{XB Niloofar}
\setlatintextfont[Scale=1]{XB Niloofar}
\setdigitfont[Scale=0.85]{Yas}
%Lemma
\newcounter{example}[section] \setcounter{example}{0}
\renewcommand{\theexample}{\arabic{example}.\arabic{section}}
\newenvironment{example}[2][]{%
\refstepcounter{example}%
\ifstrempty{#1}%
{\mdfsetup{%
frametitle={%
\tikz[baseline=(current bounding box.east),outer sep=0pt]
\node[anchor=east,rectangle,fill=red!20]
{\strut \theexample~{مثال}};}}
}%
{\mdfsetup{%
frametitle={%
\tikz[baseline=(current bounding box.east),outer sep=0pt]
\node[anchor=east,rectangle,fill=blue!20]
{\strut
~#1
:\theexample
~مثال
};}}%
}%
\mdfsetup{innertopmargin=5pt,roundcorner=10pt,backgroundcolor=gray!10,linecolor=green!20,linewidth=2pt,topline=true, frametitleaboveskip=\dimexpr-\ht\strutbox\relax
}
\begin{mdframed}[]\relax%
\label{#2}}{\end{mdframed}}
\title{\textbf{روشهای جبرانسازی}}
\date{}
\author{نویسنده }
\begin{document}
\maketitle
\section{تبدیلات ریاضی
}
تبدیل فوریه یک تبدیل از زمان به فرکانس است.
\begin{example}[فوریه]
برای محاسبه تبدیل فوریه .....
\end{example}
\end{document}
答案1
我認為不需要的輸出是因為您的example
環境中有兩個參數,並且您只輸入了一個參數,並且系統自動選擇文字的第一個字母作為第二個參數。欲了解更多詳細信息,請閱讀這個 stackoverflow 帖子。
無論如何,您應該按如下方式使用新環境:
\begin{example}[فوریه]{second rags} %it is not optional and it is a label for this env.
برای محاسبه تبدیل فوریه .....
\end{example}
您可以在文本中透過 引用此範例\ref{second arg}
。您可以透過以下修改來刪除第二個參數:
\newenvironment{example}[1][]{%
\refstepcounter{example}%
\ifstrempty{#1}%
{\mdfsetup{%
frametitle={%
\tikz[baseline=(current bounding box.east),outer sep=0pt]
\node[anchor=east,rectangle,fill=red!20]
{\strut \theexample~{مثال}};}}
}%
{\mdfsetup{%
frametitle={%
\tikz[baseline=(current bounding box.east),outer sep=0pt]
\node[anchor=east,rectangle,fill=blue!20]
{\strut
~#1
:\theexample
~مثال
};}}%
}%
\mdfsetup{innertopmargin=5pt,roundcorner=10pt,backgroundcolor=gray!10,linecolor=green!20,linewidth=2pt,topline=true, frametitleaboveskip=\dimexpr-\ht\strutbox\relax
}
\begin{mdframed}[]\relax%
}{\end{mdframed}}