![테이블 형식 프리앰블에 이미 중앙화된 열을 중앙화하는 방법은 무엇입니까?](https://rvso.com/image/392337/%ED%85%8C%EC%9D%B4%EB%B8%94%20%ED%98%95%EC%8B%9D%20%ED%94%84%EB%A6%AC%EC%95%B0%EB%B8%94%EC%97%90%20%EC%9D%B4%EB%AF%B8%20%EC%A4%91%EC%95%99%ED%99%94%EB%90%9C%20%EC%97%B4%EC%9D%84%20%EC%A4%91%EC%95%99%ED%99%94%ED%95%98%EB%8A%94%20%EB%B0%A9%EB%B2%95%EC%9D%80%20%EB%AC%B4%EC%97%87%EC%9E%85%EB%8B%88%EA%B9%8C%3F.png)
저는 2행의 제목과 6열의 표를 만들고 있습니다. 3개의 주요 제목과 6개의 부제목이 있습니다. 모든 열은 c
유형이지만 열 3과 4는 올바르게 중앙 집중화되어 있지 않습니다. 도움이 필요하세요?
\documentclass[12pt,a4paper]{article}
\usepackage{multirow}
\usepackage{multicol}
\usepackage{booktabs}
\usepackage[
font=footnotesize,
justification=centering,
figurewithin=section,
tablewithin=section
]{caption}
\usepackage{siunitx}
\usepackage{chemformula}
\begin{document}
\begin{table}[h]
\centering
\footnotesize
\caption{My caption}
\label{my-label}
\begin{tabular}{cccccc}
\toprule
\multicolumn{2}{c}{\textbf{Time (\si{min})}} &%
\multicolumn{2}{c}{\textbf{Water + \ch{CH3COOH} \SI[inter-unit-product=~]{0,15}{\%~v/v}}} &%
\multicolumn{2}{c}{\textbf{Oil}} \\
\midrule
\textbf{Point 1} & \textbf{Point 2} &%
\textbf{Point 1} & \textbf{Point 2} &%
\textbf{Point 1} & \textbf{Point 2} \\
\midrule
0,00 & 0,00 & 100 & 90 & 0 & 10 \\
0,50 & 0,50 & 90 & 70 & 10 & 30 \\
8,50 & 8,00 & 100 & 0 & 0 & 100 \\
13,50 & 8,10 & 100 & 90 & 0 & 10 \\
\bottomrule
\end{tabular}
\end{table}
\end{document}
답변1
makecell
및 s를 기반으로 한 변형 cmidrule
:
\documentclass[12pt,a4paper]{article}
\usepackage{multirow}
\usepackage{multicol}
\usepackage{booktabs}
\usepackage{makecell}
\renewcommand{\theadfont}{\bfseries}
\usepackage[
font=footnotesize,
justification=centering,
figurewithin=section,
tablewithin=section,
skip=6pt
]{caption}
\usepackage{siunitx}
\usepackage{chemformula}
\begin{document}
\begin{table}[h]
\centering
\caption{My caption}
\label{my-label}
\begin{tabular}{cccccc}
\toprule
\multicolumn{2}{c}{\thead{Time \\(\si{min})}} &%
\multicolumn{2}{@{}c@{}}{\thead{Water\,$+$\,\ch{CH3COOH}\\ \SI[inter-unit-product=~]{0,15}{\%~v/v}}} &%
\multicolumn{2}{c}{\thead{Oil}} \\
\cmidrule(lr){1-2}\cmidrule(lr){3-4}\cmidrule(lr){5-6}
\textbf{Point 1} & \textbf{Point 2} &%
\textbf{Point 1} & \textbf{Point 2} &%
\textbf{Point 1} & \textbf{Point 2} \\
\cmidrule(lr){1-2}\cmidrule(lr){3-4}\cmidrule(lr){5-6}
0,00 & 0,00 & 100 & 90 & 0 & 10 \\
0,50 & 0,50 & 90 & 70 & 10 & 30 \\
8,50 & 8,00 & 100 & 0 & 0 & 100 \\
13,50 & 8,10 & 100 & 90 & 0 & 10 \\
\bottomrule
\end{tabular}
\end{table}
\end{document}
답변2
다음을 사용하는 편도 tabularx
:
\documentclass[12pt,a4paper]{article}
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{siunitx}
\usepackage{chemformula}
\begin{document}
\tabcolsep.5em\small
\begin{tabularx}{\linewidth}{cc>{\hfil}X>{\hfil}Xcc}\toprule
\multicolumn{2}{c}{\textbf{Time (\si{min})}} &%
\multicolumn{2}{c}{\textbf{Water + \ch{CH3COOH} \SI[inter-unit-product=~]{0,15}{\%~v/v}}}&%
\multicolumn{2}{c}{\textbf{Oil}} \\
\cmidrule(rl){1-2}\cmidrule(rl){3-4}\cmidrule(rl){5-6}
\textbf{Point 1} & \textbf{Point 2} &%
\textbf{Point 1} & \textbf{Point 2} &%
\textbf{Point 1} & \textbf{Point 2} \\
\cmidrule(rl){1-1}\cmidrule(rl){2-2}\cmidrule(rl){3-3}
\cmidrule(rl){4-4}\cmidrule(rl){5-5}\cmidrule(rl){6-6}
0,00 & 0,00 & 100 & 90 & 0 & 10 \\
0,50 & 0,50 & 90 & 70 & 10 & 30 \\
8,50 & 8,00 & 100 & 0 & 0 & 100 \\
13,50 & 8,10 & 100 & 90 & 0 & 10 \\\bottomrule
\end{tabularx}
\end{document}
Acetic acid \SI{0,15}{\percent}
하지만 개인적으로는 표준 표 형식과 열을 그대로 유지하면서 더 짧은 헤더로 변경하겠습니다 c
.
답변3
다음은 두 줄과 더 큰 줄로 분할된 열 헤더가 있는 버전입니다 \tabcolsep
.
\documentclass[12pt,a4paper]{article}
\usepackage{multirow}
\usepackage{multicol}
\usepackage{booktabs}
\usepackage[
font=footnotesize,
justification=centering,
figurewithin=section,
tablewithin=section
]{caption}
\usepackage{siunitx}
\usepackage{chemformula}
\usepackage{makecell}
\begin{document}
\begin{table}[h]
\centering
\footnotesize
\setlength{\tabcolsep}{15pt}
\caption{My caption}
\label{my-label}
\begin{tabular}{@{\hspace{7pt}}cccccc@{\hspace{7pt}}}
\toprule
\multicolumn{2}{c}{\textbf{Time (\si{min})}} &%
\multicolumn{2}{c}{\textbf{\makecell[cc]{Water + \ch{CH3COOH} \\ \SI[inter-unit-product=~]{0,15}{\%~v/v}}}} &%
\multicolumn{2}{c}{\textbf{Oil}} \\
\cmidrule(r){1-2} \cmidrule(lr){3-4} \cmidrule(l){5-6}
\textbf{Point 1} & \textbf{Point 2} &%
\textbf{Point 1} & \textbf{Point 2} &%
\textbf{Point 1} & \textbf{Point 2} \\
\midrule
0,00 & 0,00 & 100 & 90 & 0 & 10 \\
0,50 & 0,50 & 90 & 70 & 10 & 30 \\
8,50 & 8,00 & 100 & 0 & 0 & 100 \\
13,50 & 8,10 & 100 & 90 & 0 & 10 \\
\bottomrule
\end{tabular}
\end{table}
\end{document}