我试图在本节中对齐4个方程。问题是,我不能使用\begin{align}
环境,因为它们都是在文本块之后列出的。理想情况下,所有方程都会最终对齐。我玩\hspace
和\hfill
,但不认为它们是最佳解决方案。什么是适当和最有力的方法呢?
我的代码如下:
\subsection*{Cumulative distributions}
Cumulative frequency distribution: $F(d) = \int_{0}^{d} f(x) dx$ \\
Cumulative number distribution: $N(d) = \int_{0}^{d} n(x) dx$ \\
Cumulative mass distribution: $M(d) = \int_{0}^{d} m(x) dx$ \\
Cumulative number distribution: $V(d) = \int_{0}^{d} v(x) dx$ \\
答案 0 :(得分:1)
有很多方法可以实现这一目标:
\documentclass{article}
\usepackage{eqparbox,mathtools}
\newcommand{\dx}{\mathrm{d}x}
\renewcommand{\thesubsection}{\arabic{subsection}}% Just for this example
\begin{document}
\subsection{Cumulative distributions}
Cumulative frequency distribution: $F(d) = \int_0^d f(x) \dx$ \\
Cumulative number distribution: $N(d) = \int_0^d n(x) \dx$ \\
Cumulative mass distribution: $M(d) = \int_0^d m(x) \dx$ \\
Cumulative number distribution: $V(d) = \int_0^d v(x) \dx$
\subsection{Cumulative distributions}
Cumulative frequency distribution:\ $\phantom{M(d)}\mathllap{F(d)} = \int_0^d f(x) \dx$ \\
\rlap{Cumulative number distribution:}%
\phantom{Cumulative frequency distribution:}\ $\phantom{M(d)}\mathllap{N(d)} = \int_0^d n(x) \dx$ \\
\rlap{Cumulative mass distribution:}%
\phantom{Cumulative frequency distribution:}\ $M(d) = \int_0^d m(x) \dx$ \\
\rlap{Cumulative number distribution:}%
\phantom{Cumulative frequency distribution:}\ $\phantom{M(d)}\mathllap{V(d)} = \int_0^d v(x) \dx$
\subsection{Cumulative distributions}
\eqmakebox[cfd][l]{Cumulative frequency distribution:} $\eqmakebox[Md][r]{$F(d)$} = \int_0^d f(x) \dx$ \\
\eqmakebox[cfd][l]{Cumulative number distribution:} $\eqmakebox[Md][r]{$N(d)$} = \int_0^d n(x) \dx$ \\
\eqmakebox[cfd][l]{Cumulative mass distribution:} $\eqmakebox[Md][r]{$M(d)$} = \int_0^d m(x) \dx$ \\
\eqmakebox[cfd][l]{Cumulative number distribution:} $\eqmakebox[Md][r]{$V(d)$} = \int_0^d v(x) \dx$
\subsection{Cumulative distributions}
%\noindent
\begin{tabular}{@{} l @{\ } r @{} l @{}}
Cumulative frequency distribution: & $F(d) = {}$ & $\int_0^d f(x) \dx$ \\
Cumulative number distribution: & $N(d) = {}$ & $\int_0^d n(x) \dx$ \\
Cumulative mass distribution: & $M(d) = {}$ & $\int_0^d m(x) \dx$ \\
Cumulative number distribution: & $V(d) = {}$ & $\int_0^d v(x) \dx$
\end{tabular}
\end{document}
默认显示
使用某些框操作,设置重叠内容和\phantom
s。
使用eqparbox
在相同宽度的框中设置类似<tag>
的内容。也可以指定对齐。
使用tabular
水平对齐内容。缺点是结构不能像其他选项一样在整个页面中被破坏。