![方程和定义方程变量](https://linux22.com/image/267229/%E6%96%B9%E7%A8%8B%E5%92%8C%E5%AE%9A%E4%B9%89%E6%96%B9%E7%A8%8B%E5%8F%98%E9%87%8F.png)
我有一个需要编号的主方程,现在我想定义可能包含另一组方程的方程的变量。例如,请看一看;
代码:
\begin{align}
\label{eq:2.1}
&\frac{J_1(a k s)}{\sqrt{\pi } s}
\end{align}
\begin{align*}
\text{where} ~& \text{\textsl{a} is lens radius}\\
& \textsl{k}=\frac{2 \pi }{\lambda }\\
& \textsl{s}=\sqrt{\left(\frac{u}{z_2}+\frac{x}{z_1}\right){}^2+\left(\frac{v}{z_2}+\frac{y}{z_1}\right){}^2}
\end{align*}
结果:
我们可以看到,方程 2.1 和变量定义之间有超过 2 行间距(空白)...有没有其他有效的方法来定义方程的变量而不对它们进行编号......或者将它们作为子方程 2.1.1,2.1.2 等......
答案1
选项1:
\documentclass[preview,border=12pt]{standalone}
\usepackage{amsmath}
\begin{document}
\begin{gather}\label{eq:2.1}
\frac{J_1(a k s)}{\sqrt{\pi } s}\\
\intertext{where $a$ is lens radius}
\begin{aligned}
k &=\frac{2 \pi }{\lambda }\\
s &=\sqrt{\left(\frac{u}{z_2}+\frac{x}{z_1}\right){}^2+\left(\frac{v}{z_2}+\frac{y}{z_1}\right){}^2}
\end{aligned}\notag
\end{gather}
\end{document}
选项 2:
\documentclass[preview,border=12pt]{standalone}
\usepackage{amsmath}
\begin{document}
\begin{gather}\label{eq:2.1}
\frac{J_1(a k s)}{\sqrt{\pi } s}\\
\begin{aligned}
\text{where } &a \text{ is lens radius}\\
&k =\frac{2 \pi }{\lambda }\\
&s =\sqrt{\left(\frac{u}{z_2}+\frac{x}{z_1}\right){}^2+\left(\frac{v}{z_2}+\frac{y}{z_1}\right){}^2}
\end{aligned}\notag
\end{gather}
\end{document}
选项 3:
\documentclass[preview,border=12pt]{standalone}
\usepackage{amsmath}
\begin{document}
\begin{gather}\label{eq:2.1}
\frac{J_1(a k s)}{\sqrt{\pi } s}\\
\intertext{where}
\begin{aligned}
&a \text{ is lens radius}\\
&k =\frac{2 \pi }{\lambda }\\
&s =\sqrt{\left(\frac{u}{z_2}+\frac{x}{z_1}\right){}^2+\left(\frac{v}{z_2}+\frac{y}{z_1}\right){}^2}
\end{aligned}\notag
\end{gather}
\end{document}
选项 4:
使用\shortintertext
(Peter Grill 的想法):
\documentclass[preview,border=12pt]{standalone}
\usepackage{mathtools}
\begin{document}
\begin{gather}\label{eq:2.1}
\frac{J_1(a k s)}{\sqrt{\pi } s}\\
\shortintertext{where}
\begin{aligned}
&a \text{ is lens radius}\\
&k =\frac{2 \pi }{\lambda }\\
&s =\sqrt{\left(\frac{u}{z_2}+\frac{x}{z_1}\right){}^2+\left(\frac{v}{z_2}+\frac{y}{z_1}\right){}^2}
\end{aligned}\notag
\end{gather}
\end{document}
\intertext
和之间的区别\shortintertext
:
答案2
详情对齐与方程有些时候equation
环境更合适
我已将您移至和环境\text{...}
之间的文本模式。equation
align
% arara: pdflatex
% !arara: indent: {overwrite: true, trace: true}
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{equation}\label{eq:2.1}
\frac{J_1(a k s)}{\sqrt{\pi } s}
\end{equation}
where $a$ is lens radius
\begin{align*}
& k=\frac{2 \pi }{\lambda } \\
& s=\sqrt{\left(\frac{u}{z_2}+\frac{x}{z_1}\right)^2+\left(\frac{v}{z_2}+\frac{y}{z_1}\right)^2}
\end{align*}
否则(按照评论)
where
\begin{align*}
& a\text{ is lens radius} \\
& k=\frac{2 \pi }{\lambda } \\
& s=\sqrt{\left(\frac{u}{z_2}+\frac{x}{z_1}\right)^2+\left(\frac{v}{z_2}+\frac{y}{z_1}\right)^2}
\end{align*}
\end{document}