
私は変更しました補題環境内部のサンプルmdframedパッケージを作成するサンプル環境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
望ましくない出力は、環境に2つの引数があり、1つの引数しか入力しなかったため、システムがテキストの最初の文字を2番目の引数として自動的に選択したためだと思いますexample
。詳細については、このstackoverflowの投稿。
とにかく、新しい環境を次のように使用する必要があります。
\begin{example}[فوریه]{second rags} %it is not optional and it is a label for this env.
برای محاسبه تبدیل فوریه .....
\end{example}
テキスト内でこの例を参照するには、 を使用します\ref{second arg}
。この 2 番目の引数は、次のように変更して削除できます。
\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}}