我有下一个代码,但我希望垂直线是完整的(它在水平线附近被切断):
\begin{table} [H] \footnotesize
\sisetup{output-decimal-marker = {,}}
\centering
\caption{Massas e percentuais das frações separadas.}
\label{peneiramento}
%\begin{threeparttable}[b]
\begin{tabular}{S[input-symbols = {>},table-format=>2.3]
S[table-format=4]
S[table-format=2.1]|
S[table-format=2]
S[table-format=2.2,separate-uncertainty=true,table-figures-uncertainty=1]
S[table-format=1.3,separate-uncertainty=true,table-figures-uncertainty=1]}
\toprule
\multicolumn{3}{c|}{\makecell[tc]{Peneiramento}} & \multicolumn{3}{c}{\makecell[tc]{Elutriação}} \\
\midrule
{\makecell[tc]{Abertura \\ da peneira \\($\mu m$)}} & {\makecell[tc]{Fração \\ mássica \\ ($g$)}} & {\makecell[tc]{\% \\ massa }} & {\makecell[tc]{Velocidade \\ separação \\ ($m/s$)}} & {\makecell[tc]{Fração \\ mássica \\ ($g$)}} & {\makecell[tc]{$\%$ \\ massa }}
\\
\midrule
4000 & 26,72 & 34 \\
2830 & 8,79 & 11 \\
1900 & 8,88 & 11 \\
595 & 18,19 & 23 \\
297 & 9,74 & 13 \\
149 & 3,96 & 5 \\
Pan & 1,24 & 2 \\
\bottomrule
\end{tabular}
\end{table}
答案1
表格确实不是需要在第 3 列和第 4 列之间有垂直线。只需更加慎重地构造标题材料,例如,提供两个单独的\cmidrule
语句。
\documentclass{article}
\usepackage[portuguese]{babel}
\usepackage{makecell,booktabs,float,siunitx}
\usepackage[skip=0.333\baselineskip]{caption}
\sisetup{per-mode=symbol,output-decimal-marker = {,}}
\begin{document}
\begin{table}[H]
%\footnotesize % not needed, right?
\centering
\caption{Massas e percentuais das frações separadas.}
\label{peneiramento}
\begin{tabular}{@{}
S[table-format=4.0]
S[table-format=2.2]
S[table-format=2.0]
c % ?
S[table-format=2.2,
separate-uncertainty=true,
table-figures-uncertainty=1]
S[table-format=1.3,
separate-uncertainty=true,
table-figures-uncertainty=1]
@{}}
\toprule
\multicolumn{3}{c}{Peneiramento} &
\multicolumn{3}{c}{Elutriação} \\
\cmidrule(r){1-3} \cmidrule(l){4-6}
{\makecell[tc]{Abertura \\ da peneira \\(\si{\micro\meter})}} &
{\makecell[tc]{Fração \\ mássica \\ (\si{\gram})}} &
{\makecell[tc]{\% \\ massa }} &
{\makecell[tc]{Velocidade \\ separação \\
(\si{\meter\per\second})}} &
{\makecell[tc]{Fração \\ mássica \\ (\si{\gram})}} &
{\makecell[tc]{\% \\ massa }}
\\
\midrule
4000 & 26,72 & 34 \\
2830 & 8,79 & 11 \\
1900 & 8,88 & 11 \\
595 & 18,19 & 23 \\
297 & 9,74 & 13 \\
149 & 3,96 & 5 \\
{Pan}& 1,24 & 2 \\
\bottomrule
\end{tabular}
\end{table}
\end{document}
答案2
如果使用得当,垂直线不一定是个坏主意,但如果您希望它们与水平线相交,则必须消除在booktabs
规则周围添加的填充,并将其替换为由 定义的“单元格间隙” makecell
。这在下面的第一个代码中完成。
不过,我还提出了另一种代码,在列之间使用一条粗的垂直灰色规则;从我的角度来看,这看起来更好看。
\documentclass[a4paper, tableportuguese]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage[svgnames, table]{xcolor}
\usepackage{array, cellspace, makecell, caption, booktabs}
\setlength{\cellspacetoplimit}{6pt}
\setlength{\cellspacebottomlimit}{6pt}
\usepackage{float}
\usepackage{siunitx}
\begin{document}
\begin{table} [H] \footnotesize
\sisetup{output-decimal-marker={,}, table-number-alignment=center}
\captionsetup{skip=4pt}
\aboverulesep=0pt
\belowrulesep=0pt
\setcellgapes{0.5ex}\makegapedcells
\renewcommand{\cellalign}{tc}
\centering
\caption{Massas e percentuais das frações separadas.}
\label{peneiramento}
%\begin{threeparttable}[b]
\begin{tabular}{S[input-symbols = {>}, table-format=>2.3]
S[table-format=4]
S[table-format=2.1]!{\vrule width 0.08em}
S[table-format=2]
S[table-format=2.2,separate-uncertainty=true,table-figures-uncertainty=1]
S[table-format=1.3,separate-uncertainty=true,table-figures-uncertainty=1]}
\toprule
\multicolumn{3}{c!{\vrule width 0.08em}}{\makecell {Peneiramento}} & \multicolumn{3}{c}{\makecell {Elutriação}} \\
\midrule
{\makecell{Abertura \\ da peneira \\(\si{\um})}}& {\makecell{Fração \\ mássica \\ (g)}} & {\makecell[tc]{\% \\ massa }} & {\makecell{Velocidade \\ separação \\ (\si{\m\per\s})}} & {\makecell {Fração \\ mássica \\ (g)}} & {\makecell { \% \\ massa }}
\\
\midrule
4000 & 26,72 & 34 \\
2830 & 8,79 & 11 \\
1900 & 8,88 & 11 \\
595 & 18,19 & 23 \\
297 & 9,74 & 13 \\
149 & 3,96 & 5 \\
{Pan} & 1,24 & 2 \\
\bottomrule
\end{tabular}
\end{table}
\vskip1cm
\begin{table} [H] \footnotesize
\sisetup{output-decimal-marker={,}, table-number-alignment=center}
\captionsetup{skip=4pt}
\aboverulesep=-1pt
\belowrulesep=0pt
\cmidrulewidth=0.05em
\setcellgapes{0.5ex}\makegapedcells
\renewcommand{\cellalign}{tc}
\centering
\caption{Massas e percentuais das frações separadas.}
\label{peneiramento}
%\begin{threeparttable}[b]
\begin{tabular}{S[input-symbols = {>}, table-format=>2.3]
S[table-format=4]
S[table-format=2.1]!{\color{Gainsboro}\vrule width 0.5em}
S[table-format=2]
S[table-format=2.2,separate-uncertainty=true,table-figures-uncertainty=1]
S[table-format=1.3,separate-uncertainty=true,table-figures-uncertainty=1]}
\toprule
\addlinespace[0.5ex]
\multicolumn{3}{c!{\color{Gainsboro}\vrule width 0.5em}}{\makecell {Peneiramento}} & \multicolumn{3}{c}{\makecell {Elutriação}} \\
\cmidrule(lr{1em}){1-3}\cmidrule(l{0.5em}r){4-6}
{\makecell{Abertura \\ da peneira \\(\si{\um})}}& {\makecell{Fração \\ mássica \\ (g)}} & {\makecell[tc]{\% \\ massa }} & {\makecell{Velocidade \\ separação \\ (\si{\m\per\s})}} & {\makecell {Fração \\ mássica \\ (g)}} & {\makecell { \% \\ massa }}
\\
\cmidrule(lr{1em}){1-3}\cmidrule(l{0.5em}r){4-6}
4000 & 26,72 & 34 \\
2830 & 8,79 & 11 \\
1900 & 8,88 & 11 \\
595 & 18,19 & 23 \\
297 & 9,74 & 13 \\
149 & 3,96 & 5 \\
{Pan} & 1,24 & 2 \\
\addlinespace[0.8ex]
\bottomrule
\end{tabular}
\end{table}
\end{document}
答案3
如果您确实想将垂直规则与水平规则一起使用,则可以使用与规则兼容的booktabs
环境。{NiceTabular}
nicematrix
booktabs
\documentclass[a4paper, tableportuguese]{article}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage[svgnames]{xcolor}
\usepackage{caption, booktabs}
\usepackage{float}
\usepackage{siunitx}
\usepackage{nicematrix}
\begin{document}
\begin{table} [H] \footnotesize
\sisetup{output-decimal-marker={,}, table-number-alignment=center}
\captionsetup{skip=4pt}
\centering
\caption{Massas e percentuais das frações separadas.}
\label{peneiramento}
\begin{NiceTabular}{S[input-symbols = {>}, table-format=>2.3]
S[table-format=4]
S[table-format=2.1]|
S[table-format=2]
S[table-format=2.2,separate-uncertainty=true,table-figures-uncertainty=1]
S[table-format=1.3,separate-uncertainty=true,table-figures-uncertainty=1]}
\toprule
\Block{1-3}{Peneiramento} &&& \Block{1-3}{Elutriação} \\
\midrule
{\Block{}{Abertura \\ da peneira \\(\si{\um})}}& {\Block{}{Fração \\ mássica \\ (g)}} & {\Block{}{\% \\ massa \\ \\}} &
{\Block{}{Velocidade \\ separação \\ (\si{\m\per\s})}} & {\Block{}{Fração \\ mássica \\ (g)}} & {\Block{}{\% \\
massa\\ \\}}\\
\midrule
4000 & 26,72 & 34 & & & \\
2830 & 8,79 & 11 \\
1900 & 8,88 & 11 \\
595 & 18,19 & 23 \\
297 & 9,74 & 13 \\
149 & 3,96 & 5 \\
{Pan} & 1,24 & 2 \\
\bottomrule
\end{NiceTabular}
\end{table}
\end{document}
您需要多次编译(因为nicematrix
使用 PGF/Tikz 节点)。