但是,我无法格式化第一列。我想为列宽定义一个特定的测量值,并让此命令在宽度太小时自动换行,此外,我还希望文本位于合并的两个单元格之间。
\begin{table}[H]
\centering
\begin{tabular}{p{3cm}cccccc}
\hline
Variável & Período & Média & Desvio Padrão & \begin{tabular}[c]{@{}c@{}}Coeficiente \\ de variação\end{tabular} & \begin{tabular}[c]{@{}c@{}}Valor\\ Mínimo\end{tabular} & \begin{tabular}[c]{@{}c@{}}Valor\\ Máximo\end{tabular} \\ \hline
\multirow{2}{*}{Leitos de UTI} & 2016 & 1.867 & 2.505 & 134,17\% & 73 & 11.039 \\
& 2019 & 2.016 & 2.738 & 135,81\% & 82 & 12.515 \\ \hline
\multirow{2}{=}{Doadores Efetivos} & 2016 & 141 & 193 & 136,88\% & 5 & 842 \\
& 2019 & 178 & 249 & 139,89\% & 4 & 1.080 \\ \hline
\multirow{2}{*}{CIHDOTT’s} & 2016 & 31 & 56 & 180,65\% & 1 & 255 \\
& 2019 & 25 & 29 & 116,00\% & 1 & 106 \\ \hline
\multirow{2}{*}{Equipes de Transplantes Renais} & 2016 & 6 & 8 & 133,33\% & 1 & 35 \\
& 2019 & 7 & 8 & 114,29\% & 1 & 31 \\ \hline
\multirow{2}{*}{Respiradores de emergência} & 2016 & 2.594 & 3.697 & 142,52\% & 121 & 16.692 \\
& 2019 & 2.981 & 4.115 & 138,04\% & 152 & 18.807 \\ \hline
\multirow{2}{*}{Serviços de Neurocirurgia} & 2016 & 20 & 26 & 130,00\% & 3 & 118 \\
& 2019 & 22 & 28 & 127,27\% & 4 & 127 \\ \hline
\multirow{2}{*}{Valores totais pagos com Serviços Hospitalares} & 2016 & 6.871,29 & 11.235,63 & 163,52\% & 41,79 & 49.342,72 \\
& 2019 & 8.071,96 & 12.114,82 & 150,08\% & 85,20 & 54.430,50 \\ \hline
\multirow{2}{*}{Valores totais pagos com Serviços Profissionais} & 2016 & 2.606,59 & 4.332,99 & 166,23\% & 16,72 & 19.179,92 \\
& 2019 & 3.074,86 & 4.657,82 & 151,48\% & 35,65 & 20.285,42 \\ \hline
\multirow{2}{*}{Recusa Familiar} & 2016 & 120 & 140 & 116,67\% & 12 & 656 \\
& 2019 & 123 & 143 & 116,26\% & 14 & 678 \\ \hline
\multirow{2}{*}{Autorização de Internações Hospitalares} & 2016 & 229 & 363 & 158,51\% & 2 & 1.605 \\
& 2019 & 261 & 377 & 144,44\% & 4 & 1.639 \\ \hline
\end{tabular}\end{table}
正如评论中提到的,我尝试使用命令 \multirow{2}{=}{...} 来解决问题
但这会产生一些线条重叠,如下图所示。
答案1
不确定为什么 * 不起作用,但添加宽度可以(我的手册没有将 = 列为选项)。另一个问题是 3cm 的宽度对于列来说不够宽,但对于页面上的表格来说已经太宽了。
\documentclass{article}
\usepackage{multirow}
\begin{document}
\begin{table}[ht]% friends don't let friends use H
\centering
\setlength{\tabcolsep}{1pt}
\begin{tabular}{p{4cm}cccccc}
\hline
Variável & Período & Média & Desvio Padrão & \begin{tabular}[c]{@{}c@{}}Coeficiente \\ de variação\end{tabular} & \begin{tabular}[c]{@{}c@{}}Valor\\ Mínimo\end{tabular} & \begin{tabular}[c]{@{}c@{}}Valor\\ Máximo\end{tabular} \\ \hline
\multirow{2}{4cm}{Leitos de UTI} & 2016 & 1.867 & 2.505 & 134,17\% & 73 & 11.039 \\
& 2019 & 2.016 & 2.738 & 135,81\% & 82 & 12.515 \\ \hline
\multirow{2}{4cm}{Doadores Efetivos} & 2016 & 141 & 193 & 136,88\% & 5 & 842 \\
& 2019 & 178 & 249 & 139,89\% & 4 & 1.080 \\ \hline
\multirow{2}{4cm}{CIHDOTT’s} & 2016 & 31 & 56 & 180,65\% & 1 & 255 \\
& 2019 & 25 & 29 & 116,00\% & 1 & 106 \\ \hline
\multirow{2}{4cm}{Equipes de Transplantes Renais} & 2016 & 6 & 8 & 133,33\% & 1 & 35 \\
& 2019 & 7 & 8 & 114,29\% & 1 & 31 \\ \hline
\multirow{2}{4cm}{Respiradores de emergência} & 2016 & 2.594 & 3.697 & 142,52\% & 121 & 16.692 \\
& 2019 & 2.981 & 4.115 & 138,04\% & 152 & 18.807 \\\hline
\multirow{2}{4cm}{Serviços de Neurocirurgia} & 2016 & 20 & 26 & 130,00\% & 3 & 118 \\
& 2019 & 22 & 28 & 127,27\% & 4 & 127 \\ \hline
\multirow{2}{4cm}{Valores totais pagos com Serviços Hospitalares} & 2016 & 6.871,29 & 11.235,63 & 163,52\% & 41,79 & 49.342,72 \\
& 2019 & 8.071,96 & 12.114,82 & 150,08\% & 85,20 & 54.430,50 \\ \hline
\multirow{2}{4cm}{Valores totais pagos com Serviços Profissionais} & 2016 & 2.606,59 & 4.332,99 & 166,23\% & 16,72 & 19.179,92 \\
& 2019 & 3.074,86 & 4.657,82 & 151,48\% & 35,65 & 20.285,42 \\ \hline
\multirow{2}{4cm}{Recusa Familiar} & 2016 & 120 & 140 & 116,67\% & 12 & 656 \\
& 2019 & 123 & 143 & 116,26\% & 14 & 678 \\ \hline
\multirow{2}{4cm}{Autorização de Internações Hospitalares} & 2016 & 229 & 363 & 158,51\% & 2 & 1.605 \\
& 2019 & 261 & 377 & 144,44\% & 4 & 1.639 \\ \hline
\end{tabular}\end{table}
\end{document}
答案2
以下解决方案不使用任何 \multirow
指令。它进一步将数据列中的数字与其显式或隐式小数点对齐。最后,它通过使用更少但间距适当的水平线,使表格具有更开放和吸引人的“外观”。
\documentclass{article}
\usepackage[a4paper,margin=3cm]{geometry} % set page parameters as needed
\usepackage[T1]{fontenc}
\usepackage[portuguese]{babel} % or 'brazilian'?
\usepackage{lmodern}
\usepackage{amsmath,tabularx,booktabs}
\newcolumntype{L}{>{\raggedright\arraybackslash}X}
\newcommand\mc[1]{\multicolumn{1}{@{}c@{}}{#1}} % handy shortcut macro
\newcommand\mytab[1]{%
\begin{tabular}[t]{@{} c @{}} #1 \end{tabular}}
\newcommand\mytabx[1]{\smash[b]{%
\begin{tabular}[t]{@{} L @{}} #1 \end{tabular}}}
\usepackage{dcolumn} % align numbers on decimal markers
\newcolumntype{d}[1]{D{,}{,}{#1}}
\begin{document}
\begin{table}[ht]
\begin{tabularx}{\textwidth}{@{} % target width: \textwidth
L l d{4.2} d{5.2} c d{3.2} d{5.2} @{}}
\toprule
Variável &
Período &
\mc{\mytab{Média}} &
\mc{\mytab{Desvio\\Padrão}} &
\mytab{Coeficiente \\ de variação} &
\mc{\mytab{Valor\\ Mínimo}} &
\mc{\mytab{Valor\\ Máximo}} \\
\midrule
Leitos de UTI
& 2016 & 1.867 & 2.505 & 134,17\% & 73 & 11.039 \\
& 2019 & 2.016 & 2.738 & 135,81\% & 82 & 12.515 \\
\addlinespace
Doadores Efetivos
& 2016 & 141 & 193 & 136,88\% & 5 & 842 \\
& 2019 & 178 & 249 & 139,89\% & 4 & 1.080 \\
\addlinespace
CIHDOTT’s
& 2016 & 31 & 56 & 180,65\% & 1 & 255 \\
& 2019 & 25 & 29 & 116,00\% & 1 & 106 \\
\addlinespace
\mytabx{Equipes de Transplantes Renais}
& 2016 & 6 & 8 & 133,33\% & 1 & 35 \\
& 2019 & 7 & 8 & 114,29\% & 1 & 31 \\
\addlinespace
\mytabx{Respiradores de emergência}
& 2016 & 2.594 & 3.697 & 142,52\% & 121 & 16.692\\
& 2019 & 2.981 & 4.115 & 138,04\% & 152 & 18.807\\
\addlinespace
\mytabx{Serviços de Neurocirurgia}
& 2016 & 20 & 26 & 130,00\% & 3 & 118 \\
& 2019 & 22 & 28 & 127,27\% & 4 & 127 \\
\addlinespace
\mytabx{Valores totais pagos com Serviços Hospitalares}
& 2016 & 6.871,29 & 11.235,63 & 163,52\% & 41,79 & 49.342,72 \\
& 2019 & 8.071,96 & 12.114,82 & 150,08\% & 85,20 & 54.430,50 \\
\addlinespace
\mytabx{Valores totais pagos com Serviços Profissionais}
& 2016 & 2.606,59 & 4.332,99 & 166,23\% & 16,72 & 19.179,92 \\
& 2019 & 3.074,86 & 4.657,82 & 151,48\% & 35,65 & 20.285,42 \\
\addlinespace
Recusa Familiar
& 2016 & 120 & 140 & 116,67\% & 12 & 656 \\
& 2019 & 123 & 143 & 116,26\% & 14 & 678 \\
\addlinespace
\mytabx{Autorização de Internações Hospitalares}
& 2016 & 229 & 363 & 158,51\% & 2 & 1.605 \\
& 2019 & 261 & 377 & 144,44\% & 4 & 1.639 \\
\bottomrule
\end{tabularx}
\end{table}
\end{document}