表格大小问题

表格大小问题

我在文章中插入表格时遇到了麻烦。我的文章有 2 个表格。

我想在一个表中放置 2 列长度。我可以实现,但它会切断线。

参见下图。

在此处输入图片描述

代码如下:

\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}ll|lllll|llll|llll|l|}
\cline{3-16}
                                                                                                   &             & \multicolumn{5}{c|}{\begin{tabular}[c]{@{}c@{}}Compassos com \\ pausas (CV; \%)\end{tabular}} & \multicolumn{4}{c|}{\begin{tabular}[c]{@{}c@{}}Notas Usadas\\  (NCN)\end{tabular}} & \multicolumn{4}{c|}{\begin{tabular}[c]{@{}c@{}}Qualidade das \\ Notas (NQ; \%)\end{tabular}} & \multicolumn{1}{c|}{\begin{tabular}[c]{@{}c@{}}Razão de Intervalos \\ RI(\%)\end{tabular}} \\
                                                                                                      &             & S             & Pe            & V            & Pi          & C                                & S                  & V                  & Pi                  & C                  & S                     & V                     & Pi                    & C                    & Pe                                                                                         \\ \hline
\multicolumn{2}{|l|}{Dados de treinamento}                                                                            & 13.06         & 13.06         & 24.4         & 29.8        & 15.1                             & 6.71               & 8.08               & 8.28                & 8.38               & 95                    & 86.9                  & 93.4                  & 94.6                 & 93.6                                                                                       \\ \hline
\multicolumn{1}{|l}{\multirow{4}{*}{\begin{tabular}[c]{@{}l@{}}Composição\\   do zero\end{tabular}}}   & Simplificado & 97.4          & 100           & 17.5         & 5.68        & \multicolumn{1}{c|}{5.00}        & 6                  & 7.88               & 7.32                & 9.72               & 5                     & 27.8                  & 36.1                  & 31.2                 & 5                                                                                          \\
\multicolumn{1}{|l}{}                                                                                  & Improviso    & 11.59         & 7.33          & 23.3         & 27.6        & 11.1                             & 6.53               & 8.69               & 9.13                & 9.09               & 76.5                  & 61.6                  & 67.2                  & 68.1                 & 98.2                                                                                       \\
\multicolumn{1}{|l}{}                                                                                  & Compositor   & 5.01          & 33.9          & 6.34         & 5.02        & 5.01                             & 7.51               & 9.2                & 9.89                & 10.19              & 54.5                  & 52.4                  & 54.9                  & 57.5                 & 80.3                                                                                       \\
\multicolumn{1}{|l}{}                                                                                  & Híbrido      & 7.14          & 34.7          & 16.7         & 22.8        & 11.04                            & 7.35               & 9.76               & 10.45               & 10.24              & 49.6                  & 48.2                  & 50.5                  & 57                   & 76.3                                                                                       \\ \hline
\multicolumn{1}{|c}{\multirow{3}{*}{\begin{tabular}[c]{@{}c@{}}Composição\\ condicional\end{tabular}}} & Improviso    & 9.6           & 8.47          & 18.3         & 15.7        & 8.44                             & 7.05               & 8.79               & 7.12                & 9.23               & 78.9                  & 63.8                  & 64.44                 & 67.3                 & 96.6                                                                                       \\
\multicolumn{1}{|c}{}                                                                                  & Compositor   & 5.65          & 25.7          & 6.97         & 25.1        & 6.49                             & 7.51               & 9.57               & 6.49                & 10.1               & 58.5                  & 53.4                  & 70.62                 & 64                   & 89.5                                                                                       \\
\multicolumn{1}{|c}{}                                                                                  & Híbrido      & 7.09          & 9.53          & 15.3         & 28.5        & 9.05                             & 7.86               & 9.43               & 8.33                & 9.32               & 48.3                  & 60.6                  & 72.27                 & 72.1                 & 76.8                                                                                       \\ \hline
\end{tabular*}

答案1

这只是在最后一列移动一个\\位置。不过,我建议你使用以下方法设置没有嵌套表格的表格:表格型书签. 参见示例 2:

示例 1

在此处输入图片描述

\documentclass[paper=landscape, DIV=15]{scrartcl}
\usepackage{array, multirow}


\begin{document}


\centering

\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}ll|lllll|llll|llll|l|}
\cline{3-16}

&
&\multicolumn{5}{c|}{\begin{tabular}[c]{@{}c@{}}Compassos com \\ pausas (CV; \%)\end{tabular}}
&\multicolumn{4}{c|}{\begin{tabular}[c]{@{}c@{}}Notas Usadas\\  (NCN)\end{tabular}}
&\multicolumn{4}{c|}{\begin{tabular}[c]{@{}c@{}}Qualidade das \\ Notas (NQ; \%)\end{tabular}}
&\multicolumn{1}{c|}{\begin{tabular}[c]{@{}c@{}}Razão de \\Intervalos  RI(\%)\end{tabular}} \\
&             & S             & Pe            & V            & Pi          & C                                & S                  & V                  & Pi                  & C                  & S                     & V                     & Pi                    & C                    & Pe                                                                                         \\ \hline
\multicolumn{2}{|l|}{Dados de treinamento}                                                                            & 13.06         & 13.06         & 24.4         & 29.8        & 15.1                             & 6.71               & 8.08               & 8.28                & 8.38               & 95                    & 86.9                  & 93.4                  & 94.6                 & 93.6                                                                                       \\ \hline
\multicolumn{1}{|l}{\multirow{4}{*}{\begin{tabular}[c]{@{}l@{}}Composição\\   do zero\end{tabular}}}   & Simplificado & 97.4          & 100           & 17.5         & 5.68        & \multicolumn{1}{c|}{5.00}        & 6                  & 7.88               & 7.32                & 9.72               & 5                     & 27.8                  & 36.1                  & 31.2                 & 5                                                                                          \\
\multicolumn{1}{|l}{}                                                                                  & Improviso    & 11.59         & 7.33          & 23.3         & 27.6        & 11.1                             & 6.53               & 8.69               & 9.13                & 9.09               & 76.5                  & 61.6                  & 67.2                  & 68.1                 & 98.2                                                                                       \\
\multicolumn{1}{|l}{}                                                                                  & Compositor   & 5.01          & 33.9          & 6.34         & 5.02        & 5.01                             & 7.51               & 9.2                & 9.89                & 10.19              & 54.5                  & 52.4                  & 54.9                  & 57.5                 & 80.3                                                                                       \\
\multicolumn{1}{|l}{}                                                                                  & Híbrido      & 7.14          & 34.7          & 16.7         & 22.8        & 11.04                            & 7.35               & 9.76               & 10.45               & 10.24              & 49.6                  & 48.2                  & 50.5                  & 57                   & 76.3                                                                                       \\ \hline
\multicolumn{1}{|c}{\multirow{3}{*}{\begin{tabular}[c]{@{}c@{}}Composição\\ condicional\end{tabular}}} & Improviso    & 9.6           & 8.47          & 18.3         & 15.7        & 8.44                             & 7.05               & 8.79               & 7.12                & 9.23               & 78.9                  & 63.8                  & 64.44                 & 67.3                 & 96.6                                                                                       \\
\multicolumn{1}{|c}{}                                                                                  & Compositor   & 5.65          & 25.7          & 6.97         & 25.1        & 6.49                             & 7.51               & 9.57               & 6.49                & 10.1               & 58.5                  & 53.4                  & 70.62                 & 64                   & 89.5                                                                                       \\
\multicolumn{1}{|c}{}  & Híbrido      & 7.09          & 9.53          & 15.3         & 28.5        & 9.05                             & 7.86               & 9.43               & 8.33                & 9.32               & 48.3                  & 60.6                  & 72.27                 & 72.1                 & 76.8
\\ \hline
\end{tabular*}

\end{document}

示例 2 – tabularx 和 booktabs

在此处输入图片描述

\documentclass[paper=landscape, DIV=20]{scrartcl}
\usepackage{array, multirow}
\usepackage{tabularx, booktabs, siunitx, ragged2e}

\newcolumntype{C}{>{\centering\arraybackslash\hspace{0pt}}X}
\newcolumntype{L}{>{\RaggedRight\arraybackslash\hspace{0pt}}X}
\newcolumntype{P}[1]{>{\centering\arraybackslash\hspace{0pt}}p{#1cm}}

\begin{document}


\begin{table}
\caption{Adaptive learning rate \emph{etc}.}
\centering\small
\begin{tabularx}{\textwidth}{@{}Ll*{13}{S[table-format=2.2]}S[table-format=2.1]@{}}
\toprule
&
&\multicolumn{5}{P{6.5}}{Compassos \linebreak com pausas (CV; \%)}
&\multicolumn{4}{P{4}}{Notas Usadas \linebreak (NCN)}
&\multicolumn{4}{P{4}}{Qualidade das Notas (NQ; \%)}
&\multicolumn{1}{P{2.6}}{Razão de Intervalos  RI(\%)} \\
\cmidrule(lr){3-7}\cmidrule(lr){8-11}\cmidrule(lr){12-15}\cmidrule(lr){16-16}

& & {$S$} & {$Pe$} & {$V$} & {$Pi$}  & {$C$}  & {$S$}  & {$V$} & {$Pi$}  & {$C$} & {$S$} & {$V$} & {$Pi$} & {$C$}  & {$Pe$}\\ 
\midrule
\multicolumn{2}{@{}l}{Dados de treinamento}  & 13.06 & 13.06 & 24.4 & 29.8  & 15.1 & 6.71 & 8.08 & 8.28  & 8.38 & 95  & 86.9  & 93.4  & 94.6 & 93.6 \\ \midrule
\multicolumn{1}{@{}X}{\multirow{4}{=}{Composição\\ do zero}} & Simplificado & 97.4  & 100 & 17.5 & 5.68  & 5.00  & 6  & 7.88 & 7.32  & 9.72 & 5 & 27.8  & 36.1  & 31.2 & 5  \\
\multicolumn{1}{@{}l}{}  & Improviso  & 11.59 & 7.33  & 23.3 & 27.6  & 11.1 & 6.53 & 8.69 & 9.13  & 9.09 & 76.5  & 61.6  & 67.2  & 68.1 & 98.2 \\
\multicolumn{1}{@{}l}{}  & Compositor & 5.01  & 33.9  & 6.34 & 5.02  & 5.01 & 7.51 & 9.2  & 9.89  & 10.19  & 54.5  & 52.4  & 54.9  & 57.5 & 80.3 \\
\multicolumn{1}{@{}l}{}  & Híbrido  & 7.14  & 34.7  & 16.7 & 22.8  & 11.04  & 7.35 & 9.76 & 10.45 & 10.24  & 49.6  & 48.2  & 50.5  & 57 & 76.3 \\ \midrule
\multicolumn{1}{@{}X}{\multirow{3}{=}{Composição\\ condicional}} & Improviso  & 9.6 & 8.47  & 18.3 & 15.7  & 8.44 & 7.05 & 8.79 & 7.12  & 9.23 & 78.9  & 63.8  & 64.44 & 67.3 & 96.6 \\
\multicolumn{1}{@{}l}{}  & Compositor & 5.65  & 25.7  & 6.97 & 25.1  & 6.49 & 7.51 & 9.57 & 6.49  & 10.1 & 58.5  & 53.4  & 70.62 & 64 & 89.5 \\
\multicolumn{1}{@{}l}{}  & Híbrido  & 7.09  & 9.53  & 15.3 & 28.5  & 9.05 & 7.86 & 9.43 & 8.33  & 9.32 & 48.3  & 60.6  & 72.27 & 72.1 & 76.8
\\ \bottomrule
\end{tabularx}
\end{table}

\end{document}

答案2

我建议您(a)去掉所有垂直线,让您的表格看起来更加开放、更加吸引人;(b)使用包的线条绘制宏booktabs而不是\hline\cline;(c)借助包S提供的列类型,将所有数字与其(显式或隐式)小数标记对齐siunitx

在此处输入图片描述

\documentclass{article}
\usepackage{multirow}
\usepackage[portuguese]{babel}
\usepackage[T1]{fontenc}
\usepackage[a4paper,margin=2.5cm]{geometry} % set page parameters suitably
\usepackage{rotating} % for 'sidewaystable' environment
\usepackage{siunitx}  % for 'S' column type
\usepackage{booktabs}
\begin{document}

\begin{sidewaystable} % switch to landscape format
\setlength\tabcolsep{0pt}
\sisetup{table-format=2.2}

\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}} ll *{13}{S} S[table-format=2.1]}
\toprule
& & 
\multicolumn{5}{c}{\begin{tabular}[c]{c}Compassos com \\ pausas (CV; \%)\end{tabular}} & 
\multicolumn{4}{c}{\begin{tabular}[c]{c}Notas Usadas\\ (NCN)\end{tabular}}             & 
\multicolumn{4}{c}{\begin{tabular}[c]{c}Qualidade das \\ Notas (NQ; \%)\end{tabular}}  & 
\multicolumn{1}{c}{\begin{tabular}[c]{c}Razão de Inter-\\ valos RI (\%)\end{tabular}} \\
\cmidrule{3-7} \cmidrule{8-11} \cmidrule{12-15} \cmidrule{16-16}
& & {S} & {Pe} & {V} & {Pi} & {C} & {S} & {V} & {Pi} & {C} & {S} & {V} & {Pi} & {C} & {Pe} \\ 
\midrule
\multicolumn{2}{l}{Dados de treinamento} & 
13.06 & 13.06 & 24.4 & 29.8 & 15.1 & 6.71 & 8.08 & 8.28 & 8.38 & 95.0 & 86.9 & 93.4 & 94.6 & 93.6 \\ 
\midrule
\multirow{4}{*}{\begin{tabular}[c]{l}Composição\\ do zero\end{tabular}} 
& Simplificado & 97.4  &100.0  & 17.5  &  5.68 &  5.00 & 6.0  & 7.88 & 7.32 &  9.72 &  5.0 & 27.8 & 36.1 & 31.2 & 5.0  \\
& Improviso    & 11.59 &  7.33 & 23.3  & 27.6  & 11.1  & 6.53 & 8.69 & 9.13 &  9.09 & 76.5 & 61.6 & 67.2 & 68.1 & 98.2 \\
& Compositor   &  5.01 & 33.9  &  6.34 &  5.02 &  5.01 & 7.51 & 9.2  & 9.89 & 10.19 & 54.5 & 52.4 & 54.9 & 57.5 & 80.3 \\
& Híbrido      &  7.14 & 34.7  & 16.7  & 22.8  & 11.04 & 7.35 & 9.76 &10.45 & 10.24 & 49.6 & 48.2 & 50.5 & 57.0 & 76.3 \\ 
\midrule
\multirow{3}{*}{\begin{tabular}[c]{l}Composição\\ condicional\end{tabular}}
& Improviso & 9.6  &  8.47 & 18.3  & 15.7 & 8.44 & 7.05 & 8.79 & 7.12 &  9.23 & 78.9 & 63.8 & 64.44 & 67.3 & 96.6 \\
& Compositor& 5.65 & 25.7  &  6.97 & 25.1 & 6.49 & 7.51 & 9.57 & 6.49 & 10.1  & 58.5 & 53.4 & 70.62 & 64.0 & 89.5 \\
& Híbrido   & 7.09 &  9.53 & 15.3  & 28.5 & 9.05 & 7.86 & 9.43 & 8.33 &  9.32 & 48.3 & 60.6 & 72.27 & 72.1 & 76.8 \\ 
\bottomrule
\end{tabular*}
\end{sidewaystable}
\end{document}

相关内容