我正在攻读图论数学博士学位。在我的论文中,我必须在 Latex 中为表格的特定单元格行(图形的边缘)着色。这能做到吗?我只找到了一种为整行着色的方法。
您可以用颜色使用特定的电池\cellcolor从xcolor包:
\documentclass{standalone}
\usepackage[table]{xcolor}
\begin{document}
\begin{tabular}{r|c|l}
A & B & C \\\hline
1 & 2 & 3 \\\hline
x & y & \cellcolor{red!25}z
\end{tabular}
\end{document}
Run Code Online (Sandbox Code Playgroud)

第一个建议是手动为每个单元格中的文本着色(如果您的表格不是太大):
\documentclass[english]{report}
\usepackage{color}
\usepackage{booktabs}
\definecolor{light-blue}{rgb}{0.6,0.6,1}
\begin{document}
\begin{table}
\begin{tabular}{lr}
\toprule
\color{red}{Some text} & \color{light-blue}{and some other}\\
\color{cyan}{inside} & \color{green}{a table}\\
\bottomrule
\end{tabular}
\end{table}
\end{document}
Run Code Online (Sandbox Code Playgroud)
产生下表。

默认颜色为black、、、、、、、,此处包含更多详细信息。whiteredgreenbluecyanmagentayellow
此外,为了给单元格的背景着色,我建议使用名为 的包ytableau。
| 归档时间: |
|
| 查看次数: |
15542 次 |
| 最近记录: |