tex

tex で表の網掛けの仕方

投稿日:

表を見やすく網掛けする方法は、エクセルなどでよく使われる。

tex の表でもできる。

colortbl パッケージを使う。マニュアル:https://ftp.jaist.ac.jp/pub/CTAN/macros/latex/contrib/colortbl/colortbl.pdf

xcolor, colortbl パッケージを使う。

\usepackage{xcolor}
\usepackage{colortbl}

色を指定するときに、!(数字)と書いて薄い色を使うようにする。

\usepackage{xcolor}
\usepackage{colortbl}

\begin{document}

\begin{table}[h]
    \centering
    \begin{tabular}{|c|c|c|}
        \hline
	\rowcolor{red!30} 赤1 & 赤2 & 赤3 \\
	A & B & C \\	
	\hline	
    \end{tabular}
\end{table}

\begin{table}[h]
    \centering
    \begin{tabular}{|c|c|c|}
        \hline
	\rowcolor{blue!30} 青1 & 青2 & 青3 \\
	D & E & F \\
	\hline	
    \end{tabular}
\end{table}

\begin{table}[h]
    \centering
    \begin{tabular}{|c|c|c|}
        \hline
	\rowcolor{green!30} 緑1 & 緑2 & 緑3 \\
	G & H & I \\
	\hline	
    \end{tabular}
\end{table}

\end{document}

結果

-tex
-

執筆者:


comment

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

関連記事

no image

tex で丸で囲った文字を出力する方法

丸で囲った文字や、丸数字①などを出力したい場合がある。テキストモードにしてから、\textcircled と \raisebox の組み合わせを使って出力できる。 例 \usepackage{amsm …

no image

tex でマイクロメートル(μm)を入力する方法

tex でマイクロメートル(μm)を表示する方法。(数式モード外での書き方。) 例 20 {\textmu}m 結果 レッドブル シュガーフリー 250ml×24本  全国送料無料(沖縄、離島は要別途 …

no image

tex でギリシャ文字のベータ(β)を入力する方法

ベータ(β)は、ギリシャ文字の2番目の文字。数学等でよく使われる。 例 $\beta$ 結果

no image

tex でブロック行列を入力する方法

ゼロの成分が多いブロック行列を tex で出力する。 \usepackage{amsmath} を使う。 例 \usepackage{amsmath} \begin{document} $$ \lef …

no image

tex で米印(アスタリスク)を入力する方法

アスタリスクは、「*」記号で入力できる。tex の数式モードと、数式モードの外で書き方が異なるので注意。 例 数式モードの中:math mode $x^{*} A* B^{**}$数式モードの外:te …