我需要制作一个包含一些方程式和代码的表格,如下所示:
\documentclass[12pt,a4paper]{article}
\usepackage[latin1]{inputenc}
\usepackage{amsmath,amsfonts,amssymb}
\def\arraystretch{3}
\setlength\tabcolsep{0.5cm}
\begin{document}
\begin{tabular}{|l|l|}
\hline
$|A|>B \Leftrightarrow \left[ \begin{array}{l}A>B\\A<-B\end{array} \right.$&$|A|\geq B \Leftrightarrow \left[ \begin{array}{l}A \geq B\\A\leq -B\end{array} \right.$\\
\hline
$\sqrt{A}>B \Leftrightarrow \left[ \begin{array}{l}\begin{cases}B < 0\\A\geq 0\end{cases}
\\\begin{cases}B\geq 0\\A>B^2\end{cases}
\end{array} \right.$ & $\sqrt{A}\geq B \Leftrightarrow \left[ \begin{array} {l}\begin{cases}B < 0\\A\geq 0\end{cases}
\\\begin{cases}B\geq 0\\A\geq B^2\end{cases}
\end{array} \right.$ \\
\hline
\end{tabular}
\end{document}
我想缩短左括号,以便它们占用更少的空间。谢谢帮助。
答案1
错误在于设置\arraystretch
为 3,因为嵌套环境也继承了该设置array
。
通过一些视觉格式化,它会变得更容易。
\documentclass[12pt,a4paper]{article}
\usepackage[latin1]{inputenc}
\usepackage{amsmath,amsfonts,amssymb}
\begin{document}
\begin{tabular}{|l|l|}
\hline
&\\[-.5\normalbaselineskip]
$|A|>B \Leftrightarrow
\left[
\begin{array}{l}
A > B
\\
A < -B
\end{array}
\right.$ &
$|A|\geq B \Leftrightarrow
\left[
\begin{array}{l}
A \geq B\\A\leq -B
\end{array}
\right.$
\\
&\\[-.5\normalbaselineskip]
\hline
&\\[-.5\normalbaselineskip]
$\sqrt{A}>B \Leftrightarrow
\left[
\begin{array}{l}
\begin{cases}B < 0\\A\geq 0\end{cases}
\\[4ex]
\begin{cases}B\geq 0\\A>B^2\end{cases}
\end{array}
\right.$ &
$\sqrt{A}\geq B \Leftrightarrow
\left[
\begin{array}{l}
\begin{cases}B < 0\\A\geq 0\end{cases}
\\[4ex]
\begin{cases}B\geq 0\\A\geq B^2\end{cases}
\end{array} \right.$ \\[2.75\normalbaselineskip]
\hline
\end{tabular}
\end{document}
一个不同的实现booktabs
:
\documentclass[12pt,a4paper]{article}
\usepackage{amsmath,booktabs,array}
\begin{document}
$\begin{array}{
@{}
l
@{}
>{{}}c<{{}}
@{}
l
@{\qquad}
l
@{}
>{{}}c<{{}}
@{}
l
@{}
}
\toprule
\addlinespace
|A|>B & \Leftrightarrow &
\left[
\begin{array}{l}
A > B
\\
A < -B
\end{array}
\right. &
|A|\geq B & \Leftrightarrow &
\left[
\begin{array}{l}
A \geq B\\A\leq -B
\end{array}
\right.
\\
\addlinespace
\midrule
\addlinespace
\sqrt{A}>B & \Leftrightarrow &
\left[
\begin{array}{l}
\begin{cases}B < 0\\A\geq 0\end{cases}
\\
\addlinespace
\begin{cases}B\geq 0\\A>B^2\end{cases}
\end{array}
\right. &
\sqrt{A}\geq B & \Leftrightarrow &
\left[
\begin{array}{l}
\begin{cases}B < 0\\A\geq 0\end{cases}
\\
\addlinespace
\begin{cases}B\geq 0\\A\geq B^2\end{cases}
\end{array} \right.
\\
\addlinespace
\bottomrule
\end{array}$
\end{document}