1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

LaTeXで論文のような美しい表を作る方法

Last updated at Posted at 2025-10-31

はじめに

LaTeXで表を作成する際は、tabular環境を使う。
ここでは、booktabsパッケージを使って、見やすく整った表を作る方法を紹介する。
次のような表を作成できるようになる。

プリアンブルには以下を記述しておく。

\usepackage{booktabs}

これを読み込むことで、表の上、中、下にきれいな横線を引くためのコマンドが使えるようになる。

表の作成例

\begin{table}[tbp]
  \caption{商品在庫一覧}
  \label{table:stock_list}
  \centering
    \begin{tabular}{@{}lllllll@{}}
      \toprule
      商品名 & 商品ID & \multicolumn{2}{c}{価格 [円]} & \multicolumn{2}{c}{在庫数 [個]} & 備考 \\
      \cmidrule(lr){3-4} \cmidrule(lr){5-6}
      & & 通常価格 & セール価格 & 倉庫A & 倉庫B & \\
      \midrule
      ノート & N001 & 200 & 180 & 120 & 80 & 人気商品 \\
      ボールペン & P015 & 150 & 120 & 300 & 200 &  \\
      消しゴム & E023 & 100 & 90 & 250 & 230 &  \\
      シャープペン & M034 & 300 & 270 & 150 & 100 & 新商品 \\
      付箋 & F045 & 220 & 200 & 180 & 170 &  \\
      \bottomrule
    \end{tabular}
\end{table}

解説

  • table環境は、表全体を囲むために使用する。\captionで表題を付け、\centeringで中央寄せにしている。
  • tabular環境の引数lllllllは、各列の配置を指定している。l=左寄せ、c=中央寄せ、r=右寄せを意味する。
  • @{}で表の両端の余分な空白をなくすことができる。好みで使って欲しい。
  • booktabsパッケージを使うことで、\toprule(上罫線)、\midrule(中罫線)、\bottomrule(下罫線)を利用でき、シンプルで見やすい表を出力できる。
  • \multicolumnで列をまとめ、\cmidruleで部分的な罫線を引くことで、上段に「価格」や「在庫数」といったグループ見出しを設定できる。

参考

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?