我想在以下表格环境中对齐所有“for all x > something”表达式。
我对上述内容的代码如下:
\begin{tabular}{rl|l}
1. & $f(x) \le g(x + y) \quad \forall x > 1$ & $x$ blah blah $f(x)$ and blah\\
2. & $g(x) \le g(x + y) + \log(x) \quad \forall x > 1$ & $\log(x)$ and $e^x$ blah blah\\
3. & $x \le \frac{(2\log(y))}{\sin(x)} \quad \forall x > 10$ & Blah blah $\cos(x)$ and $y$\\
4. & $f(x, y) = \left(e^{h(x)} + g(y)\right)^{e^x}$ & Using 3. and blah blah $x + y$\\
\hline
Hence & $x$ is $\mathcal{O}(x^x)$ & Because blah blah
\end{tabular}
我尝试使用环境执行对齐aligned
,但没有成功。以下是我的尝试:
尝试 1
\begin{tabular}{rl|l}
1. & $\begin{aligned}
&f(x) \le g(x + y) &&\quad \forall x > 1\\
&g(x) \le g(x + y) + \log(x) &&\quad \forall x > 1\\
&x \le \frac{(2\log(y))}{\sin(x)} &&\quad \forall x > 10\\
&f(x, y) = \left(e^{h(x)} + g(y)\right)^{e^x}
\end{aligned}$ & $x$ blah blah $f(x)$ and blah\\
2. & & $\log(x)$ and $e^x$ blah blah\\
3. & & Blah blah $\cos(x)$ and $y$\\
4. & & Using 3. and blah blah $x + y$\\
\hline
Hence & $x$ is $\mathcal{O}(x^x)$ & Because blah blah
\end{tabular}
第二次尝试
\begin{tabular}{rl|l}
$\begin{aligned}
1. \\
2. \\
3. \\
4.
\end{aligned}$ &
$\begin{aligned}
&f(x) \le g(x + y) &&\quad \forall x > 1\\
&g(x) \le g(x + y) + \log(x) &&\quad \forall x > 1\\
&x \le \frac{(2\log(y))}{\sin(x)} &&\quad \forall x > 10\\
&f(x, y) = \left(e^{h(x)} + g(y)\right)^{e^x}
\end{aligned}$ &
$\begin{aligned}
&\text{$x$ blah blah $f(x)$ and blah}\\
&\text{$\log(x)$ and $e^x$ blah blah}\\
&\text{Blah blah $\cos(x)$ and $y$}\\
&\text{Using 3. and blah blah $x + y$}
\end{aligned}$\\
\hline
Hence & $x$ is $\mathcal{O}(x^x)$ & Because blah blah
\end{tabular}
在第二次尝试中,我设法实现了所需的方程对齐,但表格行之间的对齐仍然不正确。
答案1
使用\hphantom
零宽度框:
\documentclass{article}
\begin{document}
\begin{tabular}{rl|l}
\gdef\tmpbox{$g(x)\leq g(x+y)+\log(x)$}%
1. & \hbox to0pt {$f(x) \le g(x + y)$}\hphantom{\tmpbox}\quad $\forall x > 1$ & $x$ blah blah $f(x)$ and blah\\
2. & $g(x) \le g(x + y) + \log(x) \quad \forall x > 1$ & $\log(x)$ and $e^x$ blah blah\\
3. & \hbox to0pt{$x \le \frac{(2\log(y))}{\sin(x)}$}\hphantom{\tmpbox}\quad $\forall x > 10$ & Blah blah $\cos(x)$ and $y$\\
4. & $f(x, y) = \left(e^{h(x)} + g(y)\right)^{e^x}$ & Using 3. and blah blah $x + y$\\
\hline
Hence & $x$ is $\mathcal{O}(x^x)$ & Because blah blah
\end{tabular}
\end{document}