我想创建一个如下所示的表格
我曾尝试过
\begin{tabular}{|c|c|c|c|c|}
\hline\text{Parabola}&\text{Curve}&\text{Focus}&\text{Dirextrix}&\text{Vertex}\\\hline $x^2=4py$&\text{up, if}\thinspace $p>0$\newline\text{down, if}\thinspace $p<0$&&&\\\hline$y^2=4px$&&&&\\\hline&&&&\\\hline
\end{tabular}
但是我遇到的除第一列之外的每一列都有问题。颜色不是必需的。
答案1
\documentclass[draft]{article}
\usepackage[table]{xcolor}
\begin{document}\begin{tabular}{|c|r@{\ }l|c|c|c|}\hline
\rowcolor{blue!20}\textbf{Parabola}&\multicolumn{2}{c|}{\textbf{Curve}}&\textbf{Focus}&\textbf{Dirextrix}&\textbf{Vertex}\\\hline
$x^2=4py$&up, if &$p>0$&$F(0,p)$&$y=-p$&$V(0,0)$\\
& down, if&$p<0$&$F(0,p)$&$y=-p$&$V(0,0)$\\\hline
$y^2=4px$&right, if&$p>0$&$F(0,p)$&$y=-p$&$V(0,0)$\\
& left, if&$p<0$&$F(0,p)$&$y=-p$&$V(0,0)$\\\hline
\end{tabular}
\end{document}
答案2
这应该是您所讨论的图像的复制品:
\documentclass{article}%
\usepackage[table]{xcolor} % coloring first row in table
\usepackage{array, multirow} % for multirow cells in the first columns
\usepackage[column=O]{cellspace} % for additional vertical space around cells' contents
\setlength\cellspacetoplimit{3pt}
\setlength\cellspacebottomlimit{3pt}
\begin{document}
\begin{tabular}{| c | r @{\ } >{$}Ol<{$} | >{$}c<{$} | >{$}c<{$} | >{$}c<{$} |}
{$}c<{$}|>{$}c<{$}|}
\hline
\rowcolor{blue!20}
\textbf{Parabola}
&\multicolumn{2}{c|}{\textbf{Curve}}&\textbf{Focus}
& \textbf{Dirextrix} & \textbf{Vertex} \\
\hline
\multirow{2}{*}{$x^2=4py$}
& up, if & p>0 & F(0,p) & y=-p & V(0,0,) \\
& down, if & p<0 & F(0,p) & y=-p & V(0,0,) \\
\hline
\multirow{2}{*}{$y^2=4px$}
& right, if & p>0 & F(0,p) & y=-p & V(0,0,) \\
& left, if & p<0 & F(0,p) & y=-p & V(0,0,) \\
\hline
\end{tabular}
\end{document}