
\begin{table}[h]
\centering
\caption{My Caption}
\label{my-label}\smallskip
\begin{tabular}{c|c c c}
\small{Text} & \small{Qgc} & \small{Qgc} & \small{Qgc} \\ & \small{{[}MVar{]}} & \small{{[}MVar{]}} & \small{{[}MVar{]}} \\ \hline
\small{A} & \small{-100} & \small{100.00} & \small{100} \\
\small{B} & \small{-100} & \small{100} & \small{100} \\
\small{C} & \small{-100} & \small{100} & \small{100} \\
\end{tabular}
\end{table}
답변1
테이블에 몇 가지 메모를 남겨보세요:
\small
모든 곳에서 반복하는 대신small
처음에만 추가하세요. 또한\small
스위치는 명령이 아니며{}
.>{$}c<{$}
2~4열은 주로 숫자 데이터이므로 열 사양을 추가하여 수학 모드로 전환하는 것이 가장 좋습니다 .동일한 열 헤더가
Qgc [MVar]
세 번 반복되므로 그냥\multicolumn{3}{c}{Qgc [MVar]}
충분합니다.수직선을 모두 제거하고 사용하면
booktabs
가독성이 더욱 향상됩니다.여기에 지정자를 강제하는 대신 LaTeX가 테이블을 놓을 가장 좋은 장소를 결정하도록 두는 것이 좋습니다
[h]
. 그러나 최종 개정 시 텍스트에서 표 코드 부분을 위나 아래로 이동하여 표가 나타나는 위치를 변경할 수 있습니다.
.
\documentclass{article}
\usepackage{booktabs}
\begin{document}
\begin{table}[htbp]
\small\centering
\caption{My Caption}
\label{my-label}
\begin{tabular}{@{}c *3{>{$}c<{$}}@{}}
\toprule
Text & \multicolumn{3}{c}{Qgc [MVar]} \\ \cmidrule(r){1-1} \cmidrule(l){2-4}
A & -100 & 100.00 & 100 \\
B & -100 & 100 & 100 \\
C & -100 & 100 & 100 \\ \bottomrule
\end{tabular}
\end{table}
\end{document}
답변2
앞에 설명: 지시어를 \small
올바르게 사용하지 않고 있습니다.~ 아니다논쟁을 해보세요. 따라서 테이블 셀 내부에서는 \small{Qgc}
와 동일한 작업을 수행합니다 \small Qgc
. 코드 혼란을 줄이는 것이 더 낫습니다. 그렇죠?
둘째, 환경의 모든 단일 셀의 내용은 tabular
에서 렌더링되어야 하므로 단순히 지시문을 \small
발행하는 것이 좋습니다.\small
~ 전에환경 시작 tabular
(및 \small
개별 셀에서 지시문 제거)
셋째, 환경의 콘텐츠를 더 작게 만들려면 인쇄상의 측면에서 관련 자료도 더 작게 tabular
만드는 것이 좋습니다 . \caption
이를 달성하는 쉬운 방법은 패키지를 로드 하고 명령문 바로 앞에 caption
적절한 지시어를 발행하는 것 입니다 .\captionsetup
\caption
-
또한 간단한 대시 대신 인쇄상 적절한(수학 모드 "빼기") 기호를 생성하려면 수학 모드에서 음수를 조판하는 것을 기억하세요 .
마지막으로(내 의견으로는 최소한) "텍스트" 레이블을 수직으로 중앙에 배치하는 \multirow
명령문(패키지에서 제공 )을 사용합니다.multirow
\documentclass{article}
\usepackage{multirow}
\usepackage[skip=0.333\baselineskip]{caption}
\begin{document}
\begin{table}[h]
\centering
\caption{Original version}
\label{version:one}
\begin{tabular}{c|c c c}
\small{Text} & \small{Qgc} & \small{Qgc} & \small{Qgc} \\
& \small{{[}MVar{]}} & \small{{[}MVar{]}} & \small{{[}MVar{]}} \\
\hline
\small{A} & \small{-100} & \small{100.00} & \small{100} \\
\small{B} & \small{-100} & \small{100} & \small{100} \\
\small{C} & \small{-100} & \small{100} & \small{100} \\
\end{tabular}
\bigskip
\captionsetup{font=small}
\caption{Modified Version}
\label{version:two}
\small
\begin{tabular}{c|c c c}
\multirow{2}{*}{Text} & Qgc & Qgc & Qgc \\
& [MVar] & [MVar] & [MVar] \\
\hline
A & $-100$ & 100.00 & 100 \\
B & $-100$ & 100 & 100 \\
C & $-100$ & 100 & 100 \\
\end{tabular}
\end{table}
\end{document}
답변3
여러 행이나 여러 열이 없지만 열이 있는 솔루션입니다 m
.
두 번째 표에서는 헤더에서 줄 바꿈을 허용하기 위해 a를 사용하여 다른 열이 다른 유형이어야 하는 경우(이 경우 소수 정렬을 사용하여 S
패키지 열의 올바른 기호 "-100"에 유의 siunitx
) 를 처리합니다.\parbox
또한 이 경우 열 너비는 너비 \parbox
또는 소수점 앞/뒤의 숫자용으로 예약된 공간(예제의 경우)으로 인해 발생할 수 있습니다.
\documentclass{article}
\usepackage{array,siunitx,booktabs}
\newcolumntype{T}{>{\centering\arraybackslash}m{3em}}
\newcolumntype{U}{S[table-format=4.2]}
\setlength{\belowcaptionskip}{1em}
\begin{document}
\begin{table}
\centering
\caption{My Caption}
\label{my-label}
\small
\begin{tabular}{TTTT}\toprule
Text & Qgc [MVar] & Qgc [MVar] & Qgc [MVar] \\\midrule
A & -100 & 100.00 & 100\\
B & -100 & 100 & 100\\
C & -100 & 100 & 100\\\bottomrule
\end{tabular}
\caption{My Caption}
\begin{tabular}{TUUU}\toprule
Text &
\parbox{3em}{\centering Qgc [MVar]} &
\parbox{3em}{\centering Qgc [MVar]} &
\parbox{3em}{\centering Qgc [MVar]}\\\midrule
A & -100 & 100.00 & 100\\
B & -100 & 10 & 100\\
C & -100 & 1.0 & 100\\\bottomrule
\end{tabular}
\end{table}
\end{document}
답변4
Text
를 사용하여 위치로 이동 \raisebox
하거나 \makecell
의 기본 배치(수직/수평 c
입구)를 사용합니다.
\documentclass{article}
\usepackage{booktabs,makecell}
\begin{document}
\begin{table}
\centering
\begin{tabular}{c c c c}
\toprule
\raisebox{-.5\normalbaselineskip}[0pt][0pt]{Text}
& Qgc & Qgc & Qgc \\
& [MVar] & [MVar] & [MVar] \\
\midrule
A & $-100$ & 100.00 & 100 \\
B & $-100$ & 100 & 100 \\
C & $-100$ & 100 & 100 \\
\bottomrule
\end{tabular}
\bigskip
\begin{tabular}{c c c c}
\toprule
Text & \makecell{Qgc \\{}[MVar]} & \makecell{Qgc \\{}[MVar]} & \makecell{Qgc \\{}[MVar]} \\
\midrule
A & $-100$ & 100.00 & 100 \\
B & $-100$ & 100 & 100 \\
C & $-100$ & 100 & 100 \\
\bottomrule
\end{tabular}
\end{table}
\end{document}