如何让隐形表格“≤”和“≥”从上到下对齐,如下图所示,在 LaTeX Overleaf 上?这是我编写的代码
\begin{table}[htp]
\centering
\begin{tabular}{>{$}c<{$}>{$}c<{$}>{$}c<{$}}
$A(\triangle ADB)$ & $\leq A(\text{sector } ADB)$ & $\leq A(\triangle ADF)$ \\
$\dfrac{ab\sin(c)}{2}$ & $\leq \dfrac{r^2\theta}{2}$ & $\leq \dfrac{ab\sin(c)}{2}$ \\
$\dfrac{(1)(1)\sin(x)}{2}$ & $\leq \dfrac{(1^2)x}{2}$ & $\leq \dfrac{(1)\tan(x)\sin 90^{\circ}}{2}$ \\
$\dfrac{\sin(\theta)}{2}$ & $\leq \dfrac{x}{2}$ & $\leq \dfrac{\tan(x)}{2}$ \\
$2 \cdot \dfrac{\sin(x)}{2}$ & $\leq 2 \cdot \dfrac{x}{2}$ & $\leq 2 \cdot \dfrac{\tan(x)}{2}$ \\
$\sin(x)$ & $\leq x$ & $\leq \tan(x)$ \\
$\sin(x)$ & $\leq x$ & $\leq \dfrac{\sin(x)}{\cos(x)}$ \\
$\dfrac{1}{\sin(x)}$ & $\geq \dfrac{1}{x}$ & $\geq \dfrac{\cos(x)}{\sin(x)}$ \\
$\sin(x) \cdot \dfrac{1}{\sin(x)}$ & $\geq \sin(x) \cdot \dfrac{1}{x}$ & $\geq \sin(x) \cdot \dfrac{\cos(x)}{\sin(x)}$ \\
$1$ & $\geq \dfrac{\sin(x)}{x}$ & $\geq \cos(x)$
\end{tabular}
它看起来是这样的:
如何让这个看起来正确图1变成这样?
答案1
简单的建议是将关系放在各自的列中:
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\[
\begin{array}{*5c}
A(\triangle ADB) & \leq & A(\text{sector } ADB) & \leq & A(\triangle ADF) \\
\dfrac{ab\sin(c)}{2} & \leq & \dfrac{r^2\theta}{2} & \leq & \dfrac{ab\sin(c)}{2} \\
\dfrac{(1)(1)\sin(x)}{2} & \leq & \dfrac{(1^2)x}{2} & \leq & \dfrac{(1)\tan(x)\sin 90^{\circ}}{2} \\
\dfrac{\sin(\theta)}{2} & \leq & \dfrac{x}{2} & \leq & \dfrac{\tan(x)}{2} \\
2 \cdot \dfrac{\sin(x)}{2} & \leq & 2 \cdot \dfrac{x}{2} & \leq & 2 \cdot \dfrac{\tan(x)}{2} \\
\sin(x) & \leq & x & \leq & \tan(x) \\
\sin(x) & \leq & x & \leq & \dfrac{\sin(x)}{\cos(x)} \\
\dfrac{1}{\sin(x)} & \geq & \dfrac{1}{x} & \geq & \dfrac{\cos(x)}{\sin(x)} \\
\sin(x) \cdot \dfrac{1}{\sin(x)} & \geq & \sin(x) \cdot \dfrac{1}{x} & \geq & \sin(x) \cdot \dfrac{\cos(x)}{\sin(x)} \\
1 & \geq & \dfrac{\sin(x)}{x} & \geq & \cos(x)
\end{array}
\]
\end{document}
如果需要的话,这也可以在table
环境中发挥作用。
我还通过在公式环境中使用环境来减少切换到数学模式的过度使用array
。这不仅可以消除各种错误,而且在我看来还可以使代码更加清晰。
答案2
使用五列。
\documentclass{article}
\usepackage{amsmath}
\usepackage{booktabs}
\usepackage{newpxtext,newpxmath}
\begin{document}
\begin{table}[htp]
\centering
\setlength\arraycolsep{2pt}
\setlength\defaultaddspace{8pt}
$\begin{array}{ ccccc }
A(\triangle ADB) & \leq & A(\text{sector } ADB) & \leq & A(\triangle ADF) \\
\addlinespace
\dfrac{ab\sin(x)}{2} & \leq & \dfrac{r^2x}{2} & \leq & \dfrac{ab\sin(c)}{2} \\
\addlinespace
\dfrac{(1)(1)\sin(x)}{2} & \leq & \dfrac{(1^2)x}{2} & \leq & \dfrac{(1)\tan(x)\sin 90^{\circ}}{2} \\
\addlinespace
\dfrac{\sin(x)}{2} & \leq & \dfrac{x}{2} & \leq & \dfrac{\tan(x)}{2} \\
\addlinespace
2 \cdot \dfrac{\sin(x)}{2} & \leq & 2 \cdot \dfrac{x}{2} & \leq & 2 \cdot \dfrac{\tan(x)}{2} \\
\addlinespace
\sin(x) & \leq & x & \leq & \tan(x) \\
\addlinespace
\sin(x) & \leq & x & \leq & \dfrac{\sin(x)}{\cos(x)} \\
\addlinespace
\dfrac{1}{\sin(x)} & \geq & \dfrac{1}{x} & \geq & \dfrac{\cos(x)}{\sin(x)} \\
\addlinespace
\sin(x) \cdot \dfrac{1}{\sin(x)} & \geq & \sin(x) \cdot \dfrac{1}{x} & \geq & \sin(x) \cdot \dfrac{\cos(x)}{\sin(x)} \\
\addlinespace
1 & \geq & \dfrac{\sin(x)}{x} & \geq & \cos(x)
\end{array}$
\caption{Long derivation of a very important fact}
\end{table}
\end{document}
\arraycolsep
调整和的价值观\defaultaddspace
以适合您的口味。
我修正了几个错误:第二行的第一个“c”应该是“x”;在两个例子中,“