
我正在嘗試建立下表
但問題是第三列中的大圓括號位於水平線上。有什麼方法可以輕鬆地將括號垂直居中對齊嗎?
\begin{tabular}{ |c | c | c|}
\hline
\rowcolor{myblue} \textcolor{white}{Parabola} & \textcolor{white}{Equation of Tangent} & \textcolor{white}{Point of Contact} \\
\rule{0pt}{25pt}\bm{$y^2=4ax$} & \bm{$\displaystyle y=mx+\frac{a}{m}$} & \bm{$\displaystyle \bigg(\frac{a}{m^2},\frac{2a}{m}\bigg)$} \\ \hline
\rule{0pt}{25pt}\bm{$y^2=-4ax$} & \bm{$\displaystyle y=mx-\frac{a}{m}$} & \bm{$\displaystyle \bigg(-\frac{a}{m^2},\frac{2a}{m}\bigg)$} \\ \hline
\rule{0pt}{20pt}\bm{$x^2=4ay$} & \bm{$\displaystyle y=mx-am^2$} & \bm{$\displaystyle \big(2am,am^2\big)$} \\ \hline
\rule{0pt}{20pt}\bm{$x^2=-4ay$} & \bm{$\displaystyle y=mx+am^2$} & \bm{$\displaystyle \big(-2am,-am^2\big)$} \\ \hline
\end{tabular}
答案1
我建議使用其中提供{NiceTabular}
的nicematrix
參數cell-space-bottom-limit
並受到包裝cell-space-top-limit
長度\cellspacebottomlimit
和啟發的啟發。\cellspacetoplimit
cellspace
{NiceTabular}
colortbl
當規則與彩色面板結合使用時,它的設計目的是在 PDF 檢視器中提供比標準更好的結果。但是,您需要進行多次編譯。
\documentclass{article}
\usepackage{nicematrix}
\begin{document}
\begin{center}
\everymath{\displaystyle}
\NiceMatrixOptions{cell-space-top-limit=2pt,cell-space-bottom-limit=2pt}
\begin{NiceTabular}{ccc}[hvlines,colortbl-like]
\rowcolor{blue!50} \textcolor{white}{Parabola} & \textcolor{white}{Equation of Tangent} & \textcolor{white}{Point of Contact} \\
$y^2=4ax$& $y=mx+\frac{a}{m}$& $\biggl(\frac{a}{m^2},\frac{2a}{m}\biggr)$ \\
$y^2=-4ax$ & $y=mx-\frac{a}{m}$ & $ \biggl(-\frac{a}{m^2},\frac{2a}{m}\biggr)$ \\
$x^2=4ay$ & $y=mx-am^2$& $\bigl(2am,am^2\bigr)$ \\
$x^2=-4ay$ & $y=mx+am^2$& $\bigl(-2am,-am^2\bigr)$ \\
\end{NiceTabular}
\end{center}
\end{document}
答案2
使用nccmath
、cellspace
、 和hhline
包以及array
for 表:
\documentclass{article}
\usepackage{nccmath}
\usepackage[table]{xcolor}
\usepackage{cellspace, hhline}
\setlength\cellspacetoplimit{5pt}
\setlength\cellspacebottomlimit{5pt}
\begin{document}
\[
\begin{array}{ |c | c | >{$}Sc<{$}|}
\hhline{---}
\rowcolor{blue!50}
\text{\textcolor{white}{Parabola}}
& \text{\textcolor{white}{Equation of Tangent}}
& \text{\textcolor{white}{Point of Contact}} \\
\hhline{---}
y^2=4ax
& y=mx+\frac{a}{m}
& \Bigl(\mfrac{a}{m^2},\mfrac{2a}{m}\Bigr) \\ \hhline{---}
y^2=-4ax
& y=mx-\dfrac{a}{m}
& \Bigl(-\mfrac{a}{m^2},\mfrac{2a}{m}\Bigr) \\ \hhline{---}
x^2=4ay
& y=mx-am^2
& \bigl(2am,am^2\bigr) \\ \hhline{---}
{x^2=-4ay}
& y=mx+am^2
& \bigl(-2am,-am^2\bigr) \\ \hhline{---}
\end{array}
\]
\end{document}
附錄: 單元格中的方程式以等號對齊並以逗號表示的版本:
\documentclass{article}
\usepackage{nccmath}
\usepackage[table]{xcolor}
\usepackage{cellspace, hhline}
\setlength\cellspacetoplimit{5pt}
\setlength\cellspacebottomlimit{5pt}
\usepackage{xparse}
\NewExpandableDocumentCommand\mcw{O{>{\color{white}}Sc|}m}
{\multicolumn{2}{#1}{#2}}
\usepackage[skip=1ex]{caption}
\begin{document}
\[
\setlength\arrayrulewidth{0.5pt}
\setlength\arraycolsep{12pt}
\begin{array}{ |r@{\,}l | >{\qquad}r@{\,}l | r@{,\,}>{$}Sl<{$}|}
\hhline{*{6}{-}}
\rowcolor{blue!50}
\mcw[|>{\color{white}}Sc|]{Parabola}
& \mcw{Equation of Tangent}
& \mcw{Point of Contact} \\
\hhline{*{6}{-}}
y^2 & = 4ax
& y & =mx+\frac{a}{m}
& \Bigl(\mfrac{a}{m^2} & \mfrac{2a}{m}\Bigr) \\
\hhline{*{6}{-}}
y^2 & = -4ax
& y & = mx-\dfrac{a}{m}
& \Bigl(-\mfrac{a}{m^2} & \mfrac{2a}{m}\Bigr) \\
\hhline{*{6}{-}}
x^2 & = 4ay
& y & = mx-am^2
& \bigl(2am & am^2\bigr) \\
\hhline{*{6}{-}}
x^2 & = -4ay
& y & = mx+am^2
& \bigl(-2am & -am^2\bigr) \\
\hhline{*{6}{-}}
\end{array}
\]
\end{document}