
\begin{table}[h]
\centering
\caption{Minimum Deviation ${D}_m$ from ${R}_1$}
\begin{tabular}{|c|>{$}c<{$}|}
\hline
Color & \text{Angle ($^\circ$)} \\ \hline
Red Medium & 48.17 \pm 0.25 \\ \hline
Yellow & 49.19 \pm 0.25 \\ \hline
Blue cyan weak & 50.16 \pm 0.25 \\ \hline
Blue cyan strong & 50.27 \pm 0.25 \\ \hline
Blue medium & 50.52 \pm 0.25 \\ \hline
Violet & 51.10 \pm 0.25 \\
\hline
\end{tabular}
\end{table}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
最初は のみを使用してテーブルを書き始めました\begin{tabular}
が、テーブル環境内で記述する必要があると言われました。そのため、エラーが発生しているにも\begin{table}
かかわらず、必要なテーブルが作成されたので、 のみを使用して記述できない理由がわかりません\begin{tabular}
。将来的に深刻な問題が発生するのでしょうか? とはどういう意味ですか? を入力すると、列に垂直線が表示される{|c|>{$}c<{$}|}
ことはわかっています。 を入力すると、まったく機能しませんでした。 を使用したこの表記法が何なのかまったくわかりません。\begin{tabular}{|c|c|c|}
|r|
$
答え1
tabular
ドキュメント内でフロートさせたいtable
場合にのみ、環境内に が必要です。テーブルを配置した場所に正確に配置したい場合は、環境を使用する必要はありません。table
table
は{|c|>{$}c<{$}|}
、2 番目の列を自動的に数式モードにします。そのため、 が必要であり、の代わりに\text
と記述できます。これは、この数式テキストをドキュメントの別の場所 (2 番目の列以外) に記述する場合に必要になります。48.17 \pm 0.25
$48.17 \pm 0.25$
また、テーブルはそのbooktabs
包み. 表の比較は次のとおりです。
そして、booktabs
バージョン(最初の列l
も左揃えに変更しました):
ノート:
- 私はその
caption
包みキャプション用。 - その
array
包みを介して 2 番目の列を数式モードに設定できるようにするには、 が必要です>{$}c<{$}
。 - その
amsmath
包みマクロには必要です\text{}
。
コード:
\documentclass{article}
\usepackage{ams math}% Needed for \text
\usepackage{array}% For tabluar specification
\usepackage{caption}
\usepackage{booktabs}
\begin{document}
{\centering
\captionof{table}{Minimum Deviation ${D}_m$ from ${R}_1$}
\begin{tabular}{|c|>{$}c<{$}|}
\hline
Color & \text{Angle ($^\circ$)} \\ \hline
Red Medium & 48.17 \pm 0.25 \\ \hline
Yellow & 49.19 \pm 0.25 \\ \hline
Blue cyan weak & 50.16 \pm 0.25 \\ \hline
Blue cyan strong & 50.27 \pm 0.25 \\ \hline
Blue medium & 50.52 \pm 0.25 \\ \hline
Violet & 51.10 \pm 0.25 \\
\hline
\end{tabular}\par}
\par\bigskip\noindent
With the \verb|booktabs| package:
{\centering
\captionof{table}{Minimum Deviation ${D}_m$ from ${R}_1$}
\begin{tabular}{l >{$}c<{$}}\toprule
Color & \text{Angle ($^\circ$)} \\
\cmidrule(lr){1-1}
\cmidrule(lr){2-2}
Red Medium & 48.17 \pm 0.25 \\
Yellow & 49.19 \pm 0.25 \\
Blue cyan weak & 50.16 \pm 0.25 \\
Blue cyan strong & 50.27 \pm 0.25 \\
Blue medium & 50.52 \pm 0.25 \\
Violet & 51.10 \pm 0.25 \\
\bottomrule
\end{tabular}\par}
\end{document}