![输入新命令时出现问题](https://linux22.com/image/412057/%E8%BE%93%E5%85%A5%E6%96%B0%E5%91%BD%E4%BB%A4%E6%97%B6%E5%87%BA%E7%8E%B0%E9%97%AE%E9%A2%98.png)
我有以下代码,用于将公式输入到开始方程中。我使用了 amsmath 包。
\newcommand{\formula}[2]{\begin{equation} #2 \end{equation}}
\formula{z=f(x_0,y_0)+f_x(x_0,y0)(x-x_0)+f_y(x_0,y_0)(y-y_0)}
它在我的程序中不起作用,它说
! TeX capacity exceeded, sorry [input stack size=5000].
\end #1->\csname end#1
\endcsname \@checkend {#1}\expandafter \endgroup \if@e...
l.94 \end
{document}
您是否知道为什么它不起作用?
帖子编辑
\newcommand{\norm}[1]{\lvert \lvert #1 \rvert\rvert}
\newcommand{\formula}[1]{\begin{equation} #1 \end{equation}}
\maketitle
\begin{center}
\textbf{13.8 Maxima and Minima of Functions of Two Variables} \par
Theorem 13.8.6 Page 875 11th Edition
\end{center}
\begin{equation}
D=f_{xx}(x_0,y_0)f_{yy}(x_0,y_0)-f^2_{xy}(x_0,y_0)
\end{equation}
$
\begin{array}{c|c|c|c|c}
f_{xx}(x_0,y_0) & f_{yy}(x_0,y_0) & f^2_{xy}(x_0,y_0) & D & \text{Stationary Point Type} \\
\hline - & - & + & - & \text{ Saddle Point}\\
\hline - & - & + & +& \text{Relative Maximum} \\
\hline - & + & + & -& \text{Saddle Point} \\
\hline +& - & + & - & \text{Saddle Point} \\
\hline + & + & + & -& \text{Saddle Point} \\
\hline +& + & + & +& \text{Relative Minimum}
\end{array}
$
\par
\par
\textbf{Note:} You are subtracting the second term so it is negative ulitmately.
\begin{center}
\textbf{13.7 Tangent Planes and Normal Vectors} \par
Definition 13.7.1
\end{center}
The normal vector is equivalent to the gradient in other words \begin{equation} \vec{n}= \nabla f(x,y,z) \end{equation} The equation of the tangent plane is then the following: \begin{equation}F_x(x_0,y_0,z_0)(x-x_0)+F_y(x_0,y_0,z_0)(y-y_0)+F_z(x_0,y_0,z_0)(z-z_0) \end{equation} \par
13.7.2 Theorem
\formula{z=f(x_0,y_0)+f_x(x_0,y0)(x-x_0)+f_y(x_0,y_0)(y-y_0)}
\end{document}
答案1
\newcommand{\formula}[2]{\begin{equation} #2 \end{equation}}
意味着您将写入\formula{arg 1}{arg 2}
,并且arg 2
出现在等式中(arg 1
并被忽略)。当您随后写入 时\formula{stuff}
,TeX 将继续运行,直到找到下一个标记arg 2
。
所以你可能想要
\newcommand{\formula}[1]{\begin{equation} #1 \end{equation}}