![解决方案](https://linux22.com/image/275856/%E8%A7%A3%E5%86%B3%E6%96%B9%E6%A1%88.png)
使用 multicol 包,我得到了这样的布局:我希望所有列都正确对齐。我尝试过使用表格和数组,但它们不允许我的方程式编号。(我需要能够稍后引用它们)
这是我的代码:
\begin{equation}
F_{net} = m_0 a_{net}
\end{equation}
\begin{multicols}{2}
\[F_x = m_0 a_x\]
\[a_x = \frac{\mathrm{d}^2x}{\mathrm{d}t^2} = \frac{F_x}{m_0} = 0\]
\begin{equation}
\frac{\mathrm{d}^2x}{\mathrm{d}t^2} = 0
\end{equation}
\[F_y=m_0 a_y\]
\[a_y = \frac{\mathrm{d}^2y}{\mathrm{d}t^2} = \frac{F_y}{m_0} = -g\]
\begin{equation}
\frac{\mathrm{d}^2y}{\mathrm{d}t^2} = -g
\end{equation}
\end{multicols}
These two second order differential equations can be split into four first order differential equations.
\begin{multicols}{4}
\begin{equation}
\frac{\mathrm{d}x}{\mathrm{d}t} = v_x
\end{equation}
\begin{equation}
\frac{\mathrm{d}v_x}{\mathrm{d}t} = 0
\end{equation}
\begin{equation}
\frac{\mathrm{d}y}{\mathrm{d}t} = v_y
\end{equation}
\begin{equation}
\frac{\mathrm{d}v_y}{\mathrm{d}t} = -g
\end{equation}
\end{multicols}
解决方案
我想将此发布给其他人,如果您愿意\usepackage{amsmath}
,align
环境会提供更为优雅的解决方案。
图中的两个二阶微分方程\vref{eq:2nd-comp}
可以分解为四个相互依赖的一阶微分方程。这样做是为了将方程写成有限差分形式。
\begin{align}
&\frac{\mathrm{d}x}{\mathrm{d}t} = v_x & &\frac{\mathrm{d}v_x}{\mathrm{d}t} = 0 & &\frac{\mathrm{d}y}{\mathrm{d}t} = v_y & &\frac{\mathrm{d}v_y}{\mathrm{d}t} = -g
\end{align}
答案1
我不确定使用multicols
环境来实现此效果是否明智。不过,只需在方程式之间添加一些换行符,如下所示:
\documentclass{article}
\usepackage{multicol}%% env-> \begin{multicols}
\pagestyle{empty}
\begin{document}
\begin{equation}
F_{net} = m_0 a_{net}
\end{equation}
\begin{multicols}{2}
\[F_x = m_0 a_x\]
\[a_x = \frac{\mathrm{d}^2x}{\mathrm{d}t^2} = \frac{F_x}{m_0} = 0\]
\begin{equation}
\frac{\mathrm{d}^2x}{\mathrm{d}t^2} = 0
\end{equation}
\[F_y=m_0 a_y\]
\[a_y = \frac{\mathrm{d}^2y}{\mathrm{d}t^2} = \frac{F_y}{m_0} = -g\]
\begin{equation}
\frac{\mathrm{d}^2y}{\mathrm{d}t^2} = -g
\end{equation}
\end{multicols}
These two second order differential equations can be split into four first order differential equations.
\begin{multicols}{4}
%\abovedisplayskip0pt
%\abovedisplayshortskip0pt
\begin{equation}
\frac{\mathrm{d}x}{\mathrm{d}t} = v_x
\end{equation}
\begin{equation}
\frac{\mathrm{d}v_x}{\mathrm{d}t} = 0
\end{equation}
\begin{equation}
\frac{\mathrm{d}y}{\mathrm{d}t} = v_y
\end{equation}
\begin{equation}
\frac{\mathrm{d}v_y}{\mathrm{d}t} = -g
\end{equation}
\end{multicols}
\end{document}
如果没有换行符,LaTeX 会认为这些方程式都嵌入在同一个段落中。因此,段落中间方程式上方的间距与首行方程式的间距不同,首行方程式被视为开始自己的段落。
顺便说一句,注释掉的两行\abovedisplayskip
和\abovedisplayshortskip
也可用于调整间距问题。但在这种情况下它们不是必需的。
除了使用multicols
环境之外,您还可以使用aligned
环境(您需要加载amsmath
包):
\documentclass{article}
\usepackage{multicol}
\usepackage{amsmath,amssymb}
\pagestyle{empty}
\begin{document}
\begin{equation}
F_{net} = m_0 a_{net}
\end{equation}
\begin{align}
\notag
F_x &= m_0 a_x &
F_y &=m_0 a_y \\[3ex]
%%
\notag
a_x = \frac{\mathrm{d}^2x}{\mathrm{d}t^2} &= \frac{F_x}{m_0} = 0 &
a_y = \frac{\mathrm{d}^2y}{\mathrm{d}t^2} &= \frac{F_y}{m_0} = -g \\[3ex]
%%
\frac{\mathrm{d}^2x}{\mathrm{d}t^2} &= 0 &
\frac{\mathrm{d}^2y}{\mathrm{d}t^2} &= -g
\end{align}
These two second order differential equations can be split into four first order differential equations.
\begin{align}
\frac{\mathrm{d}x}{\mathrm{d}t} &= v_x &
\frac{\mathrm{d}v_x}{\mathrm{d}t} &= 0 &
\frac{\mathrm{d}y}{\mathrm{d}t} &= v_y &
\frac{\mathrm{d}v_y}{\mathrm{d}t} &= -g
\end{align}
\end{document}
答案2
您可以在多列中使用minipage
环境。它遵循:
\begin{multicols}{2}
\begin{minipage}{0.5\linewidth}
\[F_x = m_0 a_x\]
\[a_x = \frac{\mathrm{d}^2x}{\mathrm{d}t^2} = \frac{F_x}{m_0} = 0\]
\begin{equation}
\frac{\mathrm{d}^2x}{\mathrm{d}t^2} = 0
\end{equation}
\end{minipage}
\begin{minipage}{0.5\linewidth}
\[F_y=m_0 a_y\]
\[a_y = \frac{\mathrm{d}^2y}{\mathrm{d}t^2} = \frac{F_y}{m_0} = -g\]
\begin{equation}
\frac{\mathrm{d}^2y}{\mathrm{d}t^2} = -g
\end{equation}
\end{minipage}
\end{multicols}
These two second order differential equations can be split into four first order
differential equations.
\begin{multicols}{4}
\begin{minipage}{0.8\linewidth}
\begin{equation}
\frac{\mathrm{d}x}{\mathrm{d}t} = v_x
\end{equation}
\end{minipage}
\begin{minipage}{0.8\linewidth}
\begin{equation}
\frac{\mathrm{d}v_x}{\mathrm{d}t} = 0
\end{equation}
\end{minipage}
\begin{minipage}{0.8\linewidth}
\begin{equation}
\frac{\mathrm{d}y}{\mathrm{d}t} = v_y
\end{equation}
\end{minipage}
\begin{minipage}{0.85\linewidth}
\begin{equation}
\frac{\mathrm{d}v_y}{\mathrm{d}t} = -g
\end{equation}
\end{minipage}
\end{multicols}
答案3
解决方案
我想将此发布给其他人,如果您愿意\usepackage{amsmath}
,align
环境会提供更为优雅的解决方案。
\begin{align}
\frac{\mathrm{d}x}{\mathrm{d}t} &= v_x &
\frac{\mathrm{d}v_x}{\mathrm{d}t} &= 0 &
\frac{\mathrm{d}y}{\mathrm{d}t} &= v_y &
\frac{\mathrm{d}v_y}{\mathrm{d}t} &= -g
\end{align}