未分類

tex で行の色を1行ごとに交互につける

投稿日:

色を1行ごとに交互につけるには、\xcolor パッケージを使った上で、\rowcolors コマンドを使って色を指定する。

\usepackage[table]{xcolor}
\begin{document}

\begin{table}
{\rowcolors{2}{blue!80!yellow!50}{blue!90!yellow!20}
\begin{tabular}{ |c|c|c|c| }
\hline
1 & 2 & 3 \\
\hline
A & B & C\\
\hline
1 & 2 & 3 \\
\hline
A & B & C\\
\hline
1 & 2 & 3 \\
\hline
A & B & C\\
\hline
\end{tabular}
}
\end{table}

\end{document}

結果

参考

下の例では2行目以降の色が交互になる。\rowcolors{1} とすれば、1行目から色が交互になる。

-未分類

執筆者:


comment

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です

関連記事

no image

tex で行列間の水平間隔を調整する方法

行列を水平方向に並べるとき、間隔を開けたいことがある。\hspace コマンドを使うことで、水平方向の間隔を指定することができる。(行列表示には amsmath パッケージを使う。) 例 \usepa …

no image

tex で href の色を変更する方法

例で、urlcolor=red と書けば、「link to google」の文字列は赤色(red)になる。 もし urlcolor=blue と書けば、リンクは青色になる。 例 \usepackage …

no image

tex で文字の上の点を入力する方法

テキストモードでは \. 数式モードでは \dot{} を使う。 例 \.{a}$\dot{x}$ 結果

no image

tex で差集合の記号を入力する方法

\setminus を使う。 例 $A \setminus B$ 結果

no image

python3 で数字をゼロ埋めして表示する

string の、zfill を使う。 例 n = 3 n0 = str(n).zfill(10) print(n0) 結果 0000000003