最后一个等式的位置比其他两个等式略高,我不知道为什么。
电流输出
当前代码
\documentclass{article}
\usepackage{amsmath}
\usepackage{tabularx}
\begin{document}
\noindent\begin{tabularx}{\textwidth}{@{}XXX@{}}
\begin{equation}
P_1 = \frac{(1+4\omega)^2}{2(3+9\omega)}
\end{equation} &
\begin{equation}
P_2 = \frac{1}{2}-\frac{\omega}{1+4\omega}
\end{equation} &
\begin{equation}
P_3 = \frac{1}{2}
\end{equation}
\end{tabularx}
\end{document}
答案1
这个奇怪的问题是由于第三个方程太短,所以 TeX 插入\abovedisplayshortskip
了\abovedisplayskip
。
您可以不用tabularx
:它只是一系列的小页面:
\documentclass{article}
\usepackage{amsmath}
\usepackage{lipsum} % just for the example
\begin{document}
\lipsum*[2]
\[
\setlength{\abovedisplayshortskip}{\abovedisplayskip}
\setlength{\belowdisplayshortskip}{\belowdisplayskip}
\begin{minipage}{.33333\textwidth}
\vspace*{-\baselineskip}
\begin{equation}
P_1 = \frac{(1+4\omega)^2}{2(3+9\omega)}
\end{equation}
\end{minipage}
%
\begin{minipage}{.33333\textwidth}
\vspace*{-\baselineskip}
\begin{equation}
P_2 = \frac{1}{2}-\frac{\omega}{1+4\omega}
\end{equation}
\end{minipage}
%
\begin{minipage}{.33333\textwidth}
\vspace*{-\baselineskip}
\begin{equation}
P_3 = \frac{1}{2}
\end{equation}
\end{minipage}
\]
\lipsum[3]
\end{document}
有\vspace*{-\baselineskip}
必要取消插入在 之前的一行空段落equation
。此外,我将其设置\abovedisplayshortskip
为相等\abovedisplayskip
,并且为了对称,“下方”也跳过。
看到这个后,您可能想手动修改小页面的宽度。这适用.35\textwidth
于第一个、.4\textwidth
第二个和.2\textwidth
最后一个。
答案2
我不知道它为什么起作用,但只需加载就geometry
可以解决问题!!
实际上,我前段时间定义了一个tabequation
环境,或多或少像您的代码中那样定义,并且我总是使用选项 showframe 加载几何图形,只是为了检查边距是否溢出。我从未观察到类似的问题,所以我想知道代码中的哪些差异解释了行为差异。
如果您感兴趣的话,以下是两个代码。请注意subequations
,如果需要,它们可以与一起使用:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}%
\usepackage{tabularx, mathtools}
\usepackage[showframe]{geometry}
\newcolumntype{E}[1]{>{\equation}>{\hsize=#1\hsize}X<{\endequation}}
\newcolumntype{Y}{>{\equation}X<{\endequation}}
\newenvironment{tabequations}[1]{%
\vspace{\abovedisplayskip}\par\noindent\setlength\tabcolsep{2pt}\setlength\abovedisplayskip{0pt}
\tabularx{\linewidth}{#1}}%
{\endtabularx\par}
\begin{document}
Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text.%
\begin{subequations}
\noindent\begin{tabularx}{\linewidth}{@{}XXX@{}}
\begin{equation}
P_1 = \frac{(1+4\omega)^2}{2(3+9\omega)}
\end{equation} &
\begin{equation}
P_2 = \frac{1}{2}-\frac{\omega}{1+4\omega}
\end{equation} &
\begin{equation}
P_3 = \frac{1}{2}
\end{equation}
\end{tabularx}
\end{subequations}
Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text.%
\begin{subequations}
\begin{tabequations}{@{}*{4}{Y}@{}}
P_1 = \frac{(1+4\omega)^2}{2(3+9\omega)}
& P_2 = \frac{1}{2}-\frac{\omega}{1+4\omega}%
& P_3 = \frac{1}{2}
\end{tabequations}
\end{subequations}
\end{document}
答案3
使用tabularx
和gather
代替equation
(gather
在数学表达式的上方和下方具有更一致的定义垂直空间):
\documentclass{article}
\usepackage{amsmath}
\usepackage{tabularx}
\begin{document}
some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text\\
\begin{tabularx}{\textwidth}{@{}XXX@{}}
\begin{gather}
P_1 = \frac{(1+4\omega)^2}{2(3+9\omega)}
\end{gather} &
\begin{gather}
P_2 = \frac{1}{2}-\frac{\omega}{1+4\omega}
\end{gather} &
\begin{gather}
P_3 = \frac{1}{2}
\end{gather}
\end{tabularx}\\
some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text
some text some text some text some text some text some text some text some text some text
\end{document}