
\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}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
처음에는 with로만 테이블 작성을 시작했는데 \begin{tabular}
테이블 환경 내부에 있어야 한다는 말을 들었기 때문에 오류에도 불구하고 원하는 테이블이 있었기 때문에 \begin{table}
왜 with로 작성할 수 없는지 이해가 되지 않습니다 . \begin{tabular}
앞으로 심각한 문제가 생길까요? 무슨 {|c|>{$}c<{$}|}
뜻인가요? 내가 넣으면 \begin{tabular}{|c|c|c|}
수직선이 있는 열이 생길 것이라는 것을 알고 있습니다. 내가 이것을 넣었을 때 |r|
전혀 작동하지 않았습니다!. 나는 그것이 $
무엇인지 전혀 모른다!
답변1
tabular
문서에서 떠 있을 수 있기를 table
원하는 경우 에만 환경에 있어야 합니다 . table
테이블을 정확히 배치한 위치에 두고 싶다면 table
환경을 전혀 사용할 필요가 없습니다.
{|c|>{$}c<{$}|}
두 번째 열이 자동으로 수학 모드가 되도록 만들고 있습니다 . 그렇기 때문에 문서의 다른 곳(두 번째 열 외부)에서 이 수학 텍스트를 원할 경우 필요한 것 대신 에 를 필요로 \text
하고 말할 수 있습니다 .48.17 \pm 0.25
$48.17 \pm 0.25$
그리고 테이블이 더 잘 어울리는 것 같아요패키지booktabs
. 다음은 테이블을 비교한 것입니다.
버전 booktabs
(첫 번째 열도 eft 정렬로 변경했습니다 l
):
노트:
- 나는 사용했다패키지
caption
캡션을 위해. - 패키지
array
를 통해 두 번째 열을 수학 모드로 설정할 수 있어야 합니다>{$}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}