
나는기본정리 환경내부의 샘플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
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}}