著色表
為了使表更具可讀性,以下是對其進行著色的方法:
- 行
- 列
- 行
- 單元格
著色行
使用\rowcolor(由 colortbl 提供 ;也由 xcolor 在 [table] 包選項下載入 )。例:
\documentclass{article}
\usepackage[table]{xcolor}
\begin{document}
\begin{tabular}{ | l | l | l | }
  \rowcolor{green}
  A & B & C \\
  \rowcolor{red}
  D & E & F \\
  G & H & I \\
  \rowcolor{blue}
  J & K & L
\end{tabular}
\end{document}

著色列
可以使用以下方式對列進行著色:
- 
使用 \newcolumntype在表標記外定義列顏色屬性:\newcolumntype{a}{ >{\columncolor{yellow}} c }
- 
在表引數中定義列顏色屬性 \begin{tabular}{ | >{\columncolor{red}} c | l | l }
例:
\documentclass{article}
\usepackage[table]{xcolor}
\newcolumntype{a}{>{\columncolor{yellow}}c}
\newcolumntype{b}{>{\columncolor{green}}c}
\begin{document}
\begin{tabular}{ a | >{\columncolor{red}}c | l | b }
  \hline
  A & B & C & D \\
  E & F & G & H \\
  \hline
\end{tabular}
\end{document}

著色線
使用\arrayrulecolor。例:
\documentclass{article}
\usepackage[table]{xcolor}
\arrayrulecolor{blue}
\begin{document}
\begin{tabular}{ | l | l | l | }
  \hline
  A & B & C \\
  \hline
  D & E & F\\
  \hline
  G & H & I \\
  \hline
\end{tabular}
\end{document}

著色單元格
使用\cellcolor。例:
\documentclass{article}
\usepackage[table]{xcolor}
\begin{document}
\begin{tabular}{ | l | l | l | }
  \hline
  A & B & C \\
  \hline
  D & E & \cellcolor{green}F \\
  \hline
  G & H & I \\
  \hline
\end{tabular}
\end{document}

我們也可以使用包 colortbl 來定義我們自己的顏色。以下是標籤示例:
    \definecolor{Gray}{gray}{0.85}
    \columncolor[RGB]{230, 242, 255}}
    \columncolor[HTML]{AAACED}