我一直在尝试编写一个命令来显示偏导数,如下所示
我写了这个:
\documentclass[11pt, french]{article}
\usepackage[french]{babel}
\selectlanguage{french}
\usepackage[T1]{fontenc}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{esint}
\begin{document}
\newcommand{\par}[2]{\frac{\partial #1}{\partial #2}}
\par{f}{x}
\end{document}
但它不起作用......
答案1
\par
是结束段落的 tex 基元。您可能期望
! LaTeX Error: Command \par already defined.
Or name \end... illegal, see p.192 of the manual.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.9 ...{\par}[2]{\frac{\partial #1}{\partial #2}}
?
但实际上你得到了
Runaway argument?
{
! Paragraph ended before \new@command was complete.
<to be read again>
\par
l.9 \newcommand{\par
}[2]{\frac{\partial #1}{\partial #2}}
?
由于 的特殊性质\par
。
只需将该命令命名为其他名称,例如\pardiff
,然后在数学模式下使用:
\documentclass[11pt, french]{article}
\usepackage[french]{babel}
\selectlanguage{french}
% xetex \usepackage[T1]{fontenc}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{esint}
\begin{document}
\newcommand{\pardiff}[2]{\frac{\partial #1}{\partial #2}}
$\pardiff{f}{x}$
\end{document}