我需要一些帮助来格式化这个表格。无法弄清楚如何在不弄乱整个表格的情况下更改宽度和高度,以及字体大小和颜色。
感谢任何帮助。谢谢!
\documentclass{article}
\begin{document}
\begin{center}
\begin{tabular}{ p{14mm} | p{14mm} | p{14mm} | p{14mm} | p{14mm} | p{14mm} | p{14mm} }
Plan & Special* & Platinum & Gold & Silver & Bronze & Red\\
\hline
Website \& Banners & X & X & X & X & X & X \\
\hline
Car & X & X & X & X \\
\hline
Size (cm^2) & Custom & 2.5 x 90 - 5 x 60 & 2.5 x 25 - 5 x 40 & 5 x 15 & \\
\hline
T-Shirts & X & X & X & X & X\\
\end{tabular}
\end{center}
\end{document}
我尝试使用 slashbox,效果更好,但仍然无法显示在文档上
\begin{tabular}{l||*{6}{c}}
\backslashbox{Logo}{Plans}
&\makebox[3em]{Special}&\makebox[3em]{Platinum}&\makebox[3em]{Gold}
&\makebox[3em]{Silver}&\makebox[3em]{Bronze}&\makebox[3em]{Red}\\\hline\hline
Website \\ \& \\ Banners &X&X&X&X&X&X\\\hline
T-Shirts &x&X&X&X&X&\\\hline
Car &X&X&X&X&&\\\hline
Size &Custom&$2.5 \times 90 - 5 \times 60$ &$2.5 \times 25 - 5 \times 40$&$5 \times
15$&&\\
\end{tabular}
\begin{center}
\mbox{
\scalebox{1.18}{
\begin{center}
\tiny{
\textcolor{textcol}{
\begin{tabularx}{.8632\textwidth}{@{} l | *{6}{C|} @{}}
\toprule
\backslashbox{Logo}{Plan}
& Special* & Platinum & Gold & Silver & Bronze & Red\\ \hline
\midrule
Website \& Banners & X & X & X & X & X & X \\\hline
\addlinespace
T-Shirts & X & X & X & X & & \\\hline
Car & X & X & X & X & & \\\hline
Size (cm$^2$)
& Custom
& $2.5{\times}90 - 5{\times}60$
& $2.5{\times}25 - 5{\times}40$
& $5{\times}15$ & & \\
\bottomrule
\end{tabularx}
}}
\end{center}
}
}
\end{center}
答案1
\documentclass{article}
\usepackage{tabularx}
\begin{document}
\noindent\footnotesize
\begin{tabularx}{\linewidth}{ X *6{|l} }
Plan & Special* & Platinum & Gold & Silver & Bronze & Red\\ \hline
Website \& Banners & X & X & X & X & X & X \\\hline
Car & X & X & X & X & X\\\hline
Size (cm${}^2$) & Custom & $2.5 \times 90 - 5 \times 60$ & $2.5 \times 25 - 5 \times 40$ & $5 \times 15$ & \\\hline
T-Shirts & X & X & X & X & X\\
\end{tabularx}
\normalsize
foo
\end{document}
答案2
使用tabularx
表环境的两个示例:
\documentclass{article}
\usepackage{geometry}
\usepackage{booktabs, makecell, tabularx}
\newcolumntype{C}{>{\centering\arraybackslash}X}
%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\begin{document}
\begin{center}
\setcellgapes{5pt}\makegapedcells
\begin{tabularx}{\linewidth}{@{} | l | *{6}{C|} @{}}
\hline
Plan & Special* & Platinum & Gold & Silver & Bronze & Red\\
\hline
Website \& Banners & X & X & X & X & X & X \\
\hline
Car & X & X & X & X & & \\
\hline
Size (cm$^2$)
& Custom
& $2.5{\times}90 - 5{\times}60$
& $2.5{\times}25 - 5{\times}40$
& $5{\times}15$ & & \\
\hline
T-Shirts & X & X & X & X & & \\
\hline
\end{tabularx}
\end{center}
\begin{center}
\begin{tabularx}{\linewidth}{@{} l *{6}{C} @{}}
\toprule
Plan & Special* & Platinum & Gold & Silver & Bronze & Red\\
\midrule
Website \& Banners & X & X & X & X & X & X \\
Car & X & X & X & X & & \\
\addlinespace
Size (cm$^2$)
& Custom
& $2.5{\times}90 - 5{\times}60$
& $2.5{\times}25 - 5{\times}40$
& $5{\times}15$ & & \\
T-Shirts & X & X & X & X & & \\
\bottomrule
\end{tabularx}
\end{center}
\end{document}
(红线表示文本边框)