未分類

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 でかけ算の記号 x (✕)を表示する

かけ算記号を表示するには、$\times$ を使う。 例 $2 \times 3$ 結果

no image

h バー(プランク定数)の書き方

量子科学では、「プランク定数」を h で表すが、h を 2π で割った量を エイチバーで表すことがある。 tex での書き方 $\hbar$ 結果 リベンジH 4【電子書籍】[ 仙道ますみ ]価格:6 …

no image

tex でインテグラルが小さくなる→大きくする方法

文章中でインテグラル(積分記号)を大きくするには、\displaystyle と書けばよい。 例 usual $\int \frac{ax+b}{cx+d} dx$display style $\di …

no image

python3 で、指定した文字が最後に現れる場所を取得する

rfind を使うと、指定した文字が最後に現れる場所(インデックス)を取得することができる。 例 str1 = “12345abab” result = str1.rfind(“ab”) print( …

no image

python3 で、文字列の最後が特定の文字で終わるか判定する方法

endswith を使う。 例 str1 = “こんにちは” result1 = str1.endswith(“は”) result2 = str1.endswith(“わ”) print(resul …