我想写出如下图所示的数学公式:
例如,我有以下一段代码
\documentclass[10pt,a4paper]{report}
\usepackage{amsthm}
\usepackage{amsmath}
\usepackage{setspace}
\usepackage{fontspec}
\usepackage{polyglossia}
\usepackage{xunicode}
\usepackage{xcolor}
\usepackage{pifont}
\usepackage{enumitem}
\setmainlanguage{english}
\setotherlanguage{arabic}
\newfontfamily\arabicfont[Script=Arabic,Scale=1.3]{Amiri}
\makeatletter
\newcounter{descriptcount}
\newlist{enumdescript}{description}{2}
\setlist[enumdescript,1]{%
before={\setcounter{descriptcount}{0}%
\renewcommand*\thedescriptcount{\Roman{descriptcount}}}
,font=\bfseries\stepcounter{descriptcount}\thedescriptcount~
}
\setlist[enumdescript,2]{%
before={\setcounter{descriptcount}{0}%
\renewcommand*\thedescriptcount{\alph{descriptcount}}}
,font=\bfseries\stepcounter{descriptcount}\thedescriptcount~
}
\begin{document}
\begin{Arabic}
\begin{enumdescript}
\item [\textbf{{\textarabic{محسن }}}]
\
\begin{itemize}
\item \textarabic{محسن محسن محسن محسن} \hfill $$f(x)=\begin{cases}
\sum\limits_{i=1}^{s} x^{i} & \textarabic{إذا كان} x < 0\\
\\
\int\limits_{i=1}^{s} x^{i} dx & \textarabic{إذا كان} x > 0\\
\\
\textrm{tg}(x) & {غير ذلك} (\pi\sim 3.141 \textarabic{مع} )\end{cases}$$
\end{enumdescript}
\end{Arabic}
\end{document}
产生
答案1
您必须切换到文本模式:
\documentclass[10pt,a4paper]{report}
\usepackage{amsthm}
\usepackage{amsmath}
\usepackage{setspace}
\usepackage{fontspec}
\usepackage{polyglossia}
\usepackage{xunicode}
\usepackage{xcolor}
\usepackage{pifont}
\usepackage{enumitem}
\setmainlanguage{english}
\setotherlanguage{arabic}
\newfontfamily\arabicfont[Script=Arabic,Scale=1.3]{Amiri}
\makeatletter
\newcounter{descriptcount}
\newlist{enumdescript}{description}{2}
\setlist[enumdescript,1]{%
before={\setcounter{descriptcount}{0}%
\renewcommand*\thedescriptcount{\Roman{descriptcount}}}
,font=\bfseries\stepcounter{descriptcount}\thedescriptcount~
}
\setlist[enumdescript,2]{%
before={\setcounter{descriptcount}{0}%
\renewcommand*\thedescriptcount{\alph{descriptcount}}}
,font=\bfseries\stepcounter{descriptcount}\thedescriptcount~
}
\begin{document}
\begin{Arabic}
\begin{enumdescript}
\item [\textbf{{\textarabic{محسن }}}]\mbox{}
\begin{itemize}
\item \textarabic{محسن محسن محسن محسن} \hfill
\[
f(x)=\begin{cases}
\sum\limits_{i=1}^{s} x^{i} & \text{إذا كان}\quad x < 0\\
\\
\int\limits_{i=1}^{s} x^{i} dx & \text{إذا كان}\quad x > 0\\
\\
\operatorname{tg}(x) & \text{غير ذلك}\quad (\pi\sim 3.141\ \text{مع})
\end{cases}
\]
\end{itemize}
\end{enumdescript}
\end{Arabic}
\end{document}
注意。不要使用$$
,而应该使用\[...\]
。此外,正切函数的名称应该是 的参数\operatorname
。