未分類

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

X(twitter) 時期を指定して検索する方法

X/Twitter の検索窓に次のように打ち込むことで、条件を指定して、絞り込んだポストを表示することができる。 日付を指定する since:2022-02-22 until:2022-02-23 あ …

no image

tex で文章を右寄せにする方法

テキストを \flushright で囲めば良い。 例 \begin{flushright} Lorem, ipsum dolor sit amet consectetur adipisicing e …

no image

tex で三角形の合同記号を入力する

\equiv を使う。 例 $\triangle{ABC} \equiv \triangle{DEF}$ 結果

no image

C言語でchar文字列の長さを取得する (strlen)

strlen 関数を使って取得すればよい。sizeof という関数もあるが、strlen と振る舞いが異なるので注意。 例 #include<stdio.h> #include<strin …

no image

python3 でクラスの初期化を __init__ で行う

python でクラスのオブジェクトを生成したとき、__init__ メソッドが呼び出される(コンストラクタ)__init__ の引数には自身(self)を指定することが通例。一方、オブジェクト破棄の …