我使用 empheq 包将跨越多行的方程式放在方框内(使用 align)。方程式有 6 行,整个方框应接收一个数字 (1),为此我\nonumber \\
在其他 5 行上使用命令。如果方程式相对较窄,这种方法有效。
但是,如果方程很宽,行号会放在方框下方,但会包含额外的空白行(我认为是 6 行,与方程的数量一样多)。我怎样才能让方程号直接位于方框方程的下方(右侧)?
\documentclass[11pt]{article}
\usepackage{empheq}
\newcommand*\widefbox[1]{\fbox{\hspace{2em}#1\hspace{2em}}}
\begin{document}
\begin{empheq}[box=\widefbox]{align}
& abcdefghijklmnopqrstuvwxyz \dots abcdefghijklmnopqrstuvwxyz \nonumber \\
& abcdefghijklmnopqrstuvwxyz \dots abcdefghijklmnopqrstuvwxyz \nonumber \\
& abcdefghijklmnopqrstuvwxyz \dots abcdefghijklmnopqrstuvwxyz \nonumber \\
& abcdefghijklmnopqrstuvwxyz \dots abcdefghijklmnopqrstuvwxyz \nonumber \\
& abcdefghijklmnopqrstuvwxyz \dots abcdefghijklmnopqrstuvwxyz \nonumber \\
& abcdefghijklmnopqrstuvwxyz \dots abcdefghijklmnopqrstuvwxyz
\end{empheq}
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklm
\end{document}
结果:
另一种修改是让第一行不包含\nonumber \\
命令,在这种情况下行号会上移,但到下一行仍然会有多余的空白。
\begin{empheq}[box=\widefbox]{align}
& abcdefghijklmnopqrstuvwxyz \dots abcdefghijklmnopqrstuvwxyz \\
& abcdefghijklmnopqrstuvwxyz \dots abcdefghijklmnopqrstuvwxyz \nonumber \\
& abcdefghijklmnopqrstuvwxyz \dots abcdefghijklmnopqrstuvwxyz \nonumber \\
& abcdefghijklmnopqrstuvwxyz \dots abcdefghijklmnopqrstuvwxyz \nonumber \\
& abcdefghijklmnopqrstuvwxyz \dots abcdefghijklmnopqrstuvwxyz \nonumber \\
& abcdefghijklmnopqrstuvwxyz \dots abcdefghijklmnopqrstuvwxyz \nonumber
\end{empheq}
结果:
谢谢!
答案1
问题部分来自于您的盒子比\linewidth
– 更宽,并且可能存在错误。我建议,本着@Barbara Beeton 评论的精神,用\widefbox
一个简单的\boxed
命令和一个alignedat
环境来模仿您:
\documentclass[11pt]{article}
\usepackage{showframe}
\usepackage{empheq}
\newcommand*\widefbox[1]{\fbox{\hspace{1em}#1\hspace{1em}}}
\begin{document}
\begin{equation}%
\boxed{\qquad \begin{alignedat}{2} & abcdefghijklmnopqrstuvwxyz ... abcdefghijklmnopqrstuvwxyz & \qquad & \\
& abcdefghijklmnopqrstuvwxyz ... abcdefghijklmnopqrstuvwxyz \\
& abcdefghijklmnopqrstuvwxyz ... abcdefghijklmnopqrstuvwxyz \\
& abcdefghijklmnopqrstuvwxyz ... abcdefghijklmnopqrstuvwxyz \\
& abcdefghijklmnopqrstuvwxyz ... abcdefghijklmnopqrstuvwxyz \\
& abcdefghijklmnopqrstuvwxyz ... abcdefghijklmnopqrstuvwxyz
\end{alignedat}}
\end{equation}
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklm
\end{document}
但是,如果您不使用边注,我建议您加载geometry
使用更合理边距的包:
\documentclass[11pt]{article}
\usepackage[showframe]{geometry}
\usepackage{empheq}
\newcommand*\widefbox[1]{\fbox{\hspace{2em}#1\hspace{2em}}}
\begin{document}
\begin{empheq}[box=\widefbox]{align}
& abcdefghijklmnopqrstuvwxyz ... abcdefghijklmnopqrstuvwxyz \nonumber \\
& abcdefghijklmnopqrstuvwxyz ... abcdefghijklmnopqrstuvwxyz \nonumber \\
& abcdefghijklmnopqrstuvwxyz ... abcdefghijklmnopqrstuvwxyz \nonumber \\
& abcdefghijklmnopqrstuvwxyz ... abcdefghijklmnopqrstuvwxyz \nonumber \\
& abcdefghijklmnopqrstuvwxyz ... abcdefghijklmnopqrstuvwxyz \nonumber \\
& abcdefghijklmnopqrstuvwxyz ... abcdefghijklmnopqrstuvwxyz
\end{empheq}
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklm
\end{document}}