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 で式番号を自分で指定する方法

amsmath パッケージを使っておき、\begin{equation} と \end{equation} の数式中で \tag を使うと式番号を自分で指定したとおりに表示できる。(式番号の中に日本語 …

no image

tex で絶対値記号やノルムの縦棒を長くする方法

ノルムの絶対値記号を単純に入力しただけでは短くて困ることがあるので、長くしたいときがある。 \amsmath パッケージで、 \lVert や \rVert, \lvert や \rvert&nbsp …

no image

tex で表を横にぶち抜きしたものを作成する方法

multicolumn を使う。 例 \begin{center} \begin{table}[] \begin{tabular}{|c|c|c|c|} \hline \multicolumn …

no image

tex で積分範囲の位置を調整する方法

\int に \limits を書くと、積分範囲の位置を少し上下に移動させることができる。 例 $$\int\limits_{a+b}^{c+d} f(x) dx$$ $$\int_{a+b}^{c+ …

no image

tex の equation で式番号を表示しないようにする方法

\nonumber を使うと式番号を表示しないようにできる。 例 \usepackage{amsmath} \begin{document} \begin{equation} \nonumber y …