如何对齐列出的类似数学表达式

时间:2017-01-17 21:23:03

标签: latex tex typesetting

我试图在本节中对齐4个方程。问题是,我不能使用\begin{align}环境,因为它们都是在文本块之后列出的。理想情况下,所有方程都会最终对齐。我玩\hspace\hfill,但不认为它们是最佳解决方案。什么是适当和最有力的方法呢?

enter image description here

我的代码如下:

\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$ \\

1 个答案:

答案 0 :(得分:1)

有很多方法可以实现这一目标:

enter image description here

\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}
  1. 默认显示

  2. 使用某些框操作,设置重叠内容和\phantom s。

  3. 使用eqparbox在相同宽度的框中设置类似<tag>的内容。也可以指定对齐。

  4. 使用tabular水平对齐内容。缺点是结构不能像其他选项一样在整个页面中被破坏。