我试图在一个数组中写入由垂直线分隔的三列方程式,但当我使用多列命令时,它不会显示列分隔符。我尝试使用多列包,但它会弄乱格式。
\[
\begin{array}{>{\displaystyle}r>{\displaystyle}l|>{\displaystyle}r>{\displaystyle}l|>{\displaystyle}r>{\displaystyle}l}
\frac{\delta^2\psi_L}{\delta x^2}& = -k^2Ce^{ikx}-k^2Re^{-ikx}&\frac{\delta^2\psi_C}{\delta x^2}& = A\kappa^2e^{\kappa x}+B\kappa^2e^{-\kappa x}&\frac{\delta^2\psi_R}{\delta x^2}& = -Tk^2e^{ikx}\\
&&&&&\\
&=-k^2\psi_L&&=\kappa^2\psi_C&&=-k^2\psi_R\\
&&&&&\\
&=-\frac{2mE}{\hbar^2}\psi_L&&=\frac{2m(V-E)}{\hbar^2}\psi_C&&=-\frac{2mE}{\hbar^2}\psi_R\\
&&&&&\\
\multicolumn{2}{l}{\mbox{Substitute into (1), }V=0}&\multicolumn{2}{c}{\mbox{Substitute into (1)}}&\multicolumn{2}{c}{\mbox{Substitute into (1), }V=0}\\
&&&&&\\
E\psi_L&=E\psi_L&(E-V)\psi_C&=(E-V)\psi_C&E\psi_R&=\psi_R\\
\end{array}
\]
答案1
您可以使用
\multicolumn{2}{l|}{\mbox{Substitute into (1), }V=0}
在您的末尾提供垂直线multicolumn
。以下是完整的 MWE:
% arara: pdflatex
% !arara: indent: {overwrite: yes}
\documentclass{article}
\usepackage{array}
\begin{document}
\[
\begin{array}{>{\displaystyle}r>{\displaystyle}l|>{\displaystyle}r>{\displaystyle}l|>{\displaystyle}r>{\displaystyle}l}
\frac{\delta^2\psi_L}{\delta x^2} & = -k^2Ce^{ikx}-k^2Re^{-ikx} & \frac{\delta^2\psi_C}{\delta x^2} & = A\kappa^2e^{\kappa x}+B\kappa^2e^{-\kappa x} & \frac{\delta^2\psi_R}{\delta x^2} & = -Tk^2e^{ikx} \\
& & & & & \\
& =-k^2\psi_L & & =\kappa^2\psi_C & & =-k^2\psi_R \\
& & & & & \\
& =-\frac{2mE}{\hbar^2}\psi_L & & =\frac{2m(V-E)}{\hbar^2}\psi_C & & =-\frac{2mE}{\hbar^2}\psi_R \\
& & & & & \\
\multicolumn{2}{l|}{\mbox{Substitute into (1), }V=0}&\multicolumn{2}{c|}{\mbox{Substitute into (1)}}&\multicolumn{2}{c}{\mbox{Substitute into (1), }V=0}\\
& & & & & \\
E\psi_L & =E\psi_L & (E-V)\psi_C & =(E-V)\psi_C & E\psi_R & =\psi_R \\
\end{array}
\]
\end{document}
需要注意的是:看起来您正在使用 对引用进行硬编码(1)
;最好避免这种事情,而使用\ref
和\eqref
朋友。
您可以=
使用以下方法在符号周围获得更好的间距
\begin{array}{>{\displaystyle}r@{}>{\displaystyle}l|>{\displaystyle}r@{}>{\displaystyle}l|>{\displaystyle}r@{}>{\displaystyle}l}
消除了列分隔符;此外,您还可以使用例如
\renewcommand{\arraystretch}{3}
并删除空行来设置行距。
% arara: pdflatex
% !arara: indent: {overwrite: yes}
\documentclass{article}
\usepackage{array}
\begin{document}
\[
\renewcommand{\arraystretch}{3}
\begin{array}{>{\displaystyle}r@{}>{\displaystyle}l|>{\displaystyle}r@{}>{\displaystyle}l|>{\displaystyle}r@{}>{\displaystyle}l}
\frac{\delta^2\psi_L}{\delta x^2} & {}= -k^2Ce^{ikx}-k^2Re^{-ikx} & \frac{\delta^2\psi_C}{\delta x^2} & {}= A\kappa^2e^{\kappa x}+B\kappa^2e^{-\kappa x} & \frac{\delta^2\psi_R}{\delta x^2} & {}= -Tk^2e^{ikx} \\
& {} =-k^2\psi_L & & {}=\kappa^2\psi_C & & {} =-k^2\psi_R \\
& {}=-\frac{2mE}{\hbar^2}\psi_L & & {} =\frac{2m(V-E)}{\hbar^2}\psi_C & & {}=-\frac{2mE}{\hbar^2}\psi_R \\
\multicolumn{2}{l|}{\mbox{Substitute into (1), }V=0}&\multicolumn{2}{c|}{\mbox{Substitute into (1)}}&\multicolumn{2}{c}{\mbox{Substitute into (1), }V=0}\\
E\psi_L & {} =E\psi_L & (E-V)\psi_C & {} =(E-V)\psi_C & E\psi_R & {} =\psi_R \\
\end{array}
\]
\end{document}
根据egreg's
建议,您还可以使用新的列类型:
\newcolumntype{M}{>{\displaystyle}r@{}>{\displaystyle}l}
它可以让你写
\begin{array}{M|M|M}
您可能还希望将条目放在最后一行的中心:
\multicolumn{2}{c|}{E\psi_L=E\psi_L} & \multicolumn{2}{c|}{(E-V)\psi_C=(E-V)\psi_C} & \multicolumn{2}{c}{E\psi_R=\psi_R} \\