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 で行列に罫線を入れてブロック行列を書く方法

\array の中に、\matrix を入れる。大きなゼロは、\mbox の中に \Huge 0 を書いて入力する。大きなゼロの位置を調整するために、\raisebox を使った。 例 \usepac …

no image

tex でスクリプト体で数式を入力する方法

大文字のスクリプト体を入力するには、mathrsfs パッケージを使う。 例 \usepackage{mathrsfs} \begin{document} $$\mathscr{ABCDEFGHIJK …

no image

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

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

no image

tex で傍点を使って強調する

tex で傍点を使って強調するには、一文字ずつ\. をつける。 例 \.g\.o\.o\.d 結果 このお姉さんはフィクションです!? 1巻【電子書籍】[ むつきつとむ ]価格:660円(税別、送料別 …

no image

tex でニアリーイコール記号を入力する

ニアリーイコール記号を入力するには、\fallingdotseq または、\rigingdotseq を使う。 例 \usepackage{amssymb} \begin{document} $$x …

S