如何改善此表中单元格的大小?

如何改善此表中单元格的大小?

我想要得到一个像图片一样的表格,但我不知道如何调整单元格的大小。在此处输入图片描述

我正在使用这个代码

\documentclass[11pt,letterpaper]{article}
\usepackage[letterpaper]{geometry}
\usepackage{geometry}
\geometry{letterpaper, left=0.6 in, right = 0.6 in, top = 0.8 in, bottom= 0.8 in}
\usepackage[spanish]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{multirow}
    \begin{table}[ht!]
    \centering
    \begin{tabular}{|p{em}|p{5.585em}|p{8.665em}|p{7.415em}|c|}
        \hline
        \multirow{2}[4]{*}{\textbf{Ejes Temáticos}} & \multicolumn{3}{p{21.665em}|}{\textbf{Habilidades Cognitivas}} & \multicolumn{1}{c|}{\multirow{2}[4]{*}{\textbf{Totales}}} \bigstrut\\
        \cline{2-4}    \multicolumn{1}{|c|}{} & \textbf{Comprensión} & \textbf{Aplicación} & \textbf{Análisis, Síntesis y Evaluación} &  \bigstrut\\
        \hline
        \textbf{Números} & \multicolumn{1}{c|}{2} & 1 - 3 - 5 - 6 - 7 - 9 - 10 - 11 - 12 - 13 - 14 - 15 & 4 - 8 - 16 - 17 & 17 \bigstrut\\
        \hline
        \textbf{Álgebra} & \multicolumn{1}{c|}{} & 18 - 19 - 20 - 21 - 22 - 23 - 24 - 26 - 28 - 29 - 30 - 31 - 32 - 33 - 34 - 35 & 25 - 27 - 36 & 19 \bigstrut\\
        \hline
        \textbf{Geometría} & \multicolumn{1}{c|}{} & 37 – 38 – 39 – 40 – 41 – 42 – 43 – 44 – 45 – 46 – 48 – 49 – 50 – 51 – 52 – 53 – 54 – 55 – 56 – 57  & 47 - 58 & 22 \bigstrut\\
        \hline
        \textbf{Datos y Azar} & 60 - 64 & 59 – 61 – 62 – 63 – 65 – 66 – 67 – 68 – 70 – 71 – 72 – 73 – 74 – 75 – 76 – 77 – 78 - 79  & 69 - 80 & 22 \bigstrut\\
        \hline
    \end{tabular}%
    \end{table}%

结果是

在此处输入图片描述

答案1

看看,如果你喜欢以下对表格的“重新设计”:

\documentclass[11pt,letterpaper]{article}
\usepackage[letterpaper]{geometry}
\usepackage[spanish]{babel}
\usepackage{makecell, multirow, tabularx}
\renewcommand\theadfont{\small\bfseries}
\renewcommand\theadgape{}

\begin{document}
\begin{table}[ht!]
    \setcellgapes{3pt}
    \makegapedcells
%    \small
\begin{tabularx}{\linewidth}{|>{\bfseries}l|p{4.4em}|>{\hsize=1.2\hsize}X|>{\hsize=0.8\hsize}X|c|}
    \hline
\multirow{3}{*}{\thead{Ejes\\ Temáticos}} 
    & \multicolumn{3}{c|}{\thead{Habilidades Cognitivas}} 
            & \multirow{3}{*}{\thead{Totales}}                     \\
    \cline{2-4}    
    &  \thead{Com-\\prensión} 
        & \thead{Aplicación} 
            & \thead{Análisis, Síntesis\\ y Evaluación} 
                                &       \\
    \hline
Números 
    & 2 & 1 - 3 - 5 - 6 - 7 - 9 - 10 - 11 - 12 - 13 - 14 - 15 
            & 4 - 8 - 16 - 17   & 17    \\
    \hline
Álgebra 
    &   & 18 - 19 - 20 - 21 - 22 - 23 - 24 - 26 - 28 - 29 - 30 - 31 - 32 - 33 - 34 - 35 
            & 25 - 27 - 36      & 19    \\
    \hline
Geometría
    &   & 37 - 38 - 39 - 40 - 41 - 42 - 43 - 44 - 45 - 46 - 48 - 49 - 50 - 51 - 52 - 53 - 54 - 55 - 56 -  57      & 47 - 58           & 22    \\
    \hline
\thead[lt]{Datos\\ y Azar}
    & 60 - 64
        & 59 - 61 - 62 - 63 - 65 - 66 - 67 - 68 - 70 - 71 - 72 - 73 - 74 - 75 - 76 - 77 - 78 - 79
            & 69 - 80           & 22    \\
    \hline
\end{tabularx}
    \end{table}
\end{document}

在此处输入图片描述

编辑:

为了更好地定位最后一行的内容,我添加了t选项\thead\thead[lt]{Datos\\ y Azar}

答案2

另一项重新设计:

姆韦

\documentclass[11pt,letterpaper]{article}
\usepackage{geometry}
\geometry{letterpaper, left=0.6 in, right = 0.6 in, top = 0.8 in, bottom= 0.8 in}
\usepackage{tabulary,booktabs}
\begin{document}
\begin{table}[h]
\centering\tabcolsep.6em 
\begin{tabulary}{\linewidth}{LCp{15em}p{8em}C}\toprule
 &  \multicolumn{3}{c}{Habilidades cognitivas} &  \\\cmidrule{2-4}
Ejes\par temáticos & ~\par Comprensión & ~\par Aplicación & Análisis, síntesis\newline y evaluación & ~\par Totales \\\midrule
 Números & 2 & 1--3--5--6--7--9--10--11--12--13--14--15 & 4--8--16--17 & 17 \\\addlinespace
 Álgebra & --- & 18--19--20--21--22--23--24--26--28--29--30--31--32--33--34--35 & 25--27--36 & 19 \\\addlinespace
 Geometría & --- & 37--38--39--40--41--42--43--44--45--46--48--49--50--51--52--53--54--55--56--57 & 47--58 & 22 \\\addlinespace
 Datos y azar & 60--64 & 59--61--62--63--65--66--67--68--70--71--72--73--74--75--76--77--78--79 & 69--80 & 22 \\\bottomrule
\end{tabulary}
\end{table}
\end{document}

答案3

也许您还可以使用更紧凑的版本,其中以逗号分隔列表和范围:

在此处输入图片描述

\documentclass[11pt,letterpaper]{article}
\usepackage{geometry}
\geometry{letterpaper, left=0.6 in, right = 0.6 in, top = 0.8 in, bottom= 0.8 in}
\usepackage{booktabs}
\begin{document}
\begin{table}[h]
\centering\tabcolsep.6em 
\begin{tabular}{lcccc}\toprule
 &  \multicolumn{3}{c}{Habilidades cognitivas} &  \\\cmidrule{2-4}
Ejes\par temáticos & ~\par Comprensión & ~\par Aplicación & Análisis, síntesis\newline y evaluación & ~\par Totales \\\midrule
 Números & 2 & 1, 3, 5--7, 9--15 & 4, 8, 16--17 & 17 \\
 Álgebra & --- & 18--24, 26, 28--35 & 25, 27, 36 & 19 \\
 Geometría & --- & 37--46, 48--57 & 47, 58 & 22 \\
 Datos y azar & 60, 64 & 59, 61--68, 70--79 & 69, 80 & 22 \\\bottomrule
\end{tabular}
\end{table}
\end{document}

答案4

如果你想尝试一些不同的东西,你可以尝试卡路里。我假设您更喜欢所选的布局。如果不是,则可以轻松构建更像“booktabs”样式的表格:

\documentclass[11pt, letterpaper]{article}
\usepackage{geometry, cals}
\geometry{letterpaper, left=0.6 in, right = 0.6 in, top = 0.8 in, bottom= 0.8 in}
\usepackage[spanish]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

\let\nc=\nullcell                                                  % Shortcuts
\let\sc=\spancontent

\begin{document}

\begin{calstable}

% Defining column relativ to each other and relativ to the margins
\colwidths{{\dimexpr(\columnwidth)/60*14\relax}
            {\dimexpr(\columnwidth)/60*10\relax}
            {\dimexpr(\columnwidth)/60*15\relax}
            {\dimexpr(\columnwidth)/60*14\relax}
            {\dimexpr(\columnwidth)/60*6\relax}
            }
% The tabular fills the text area

% Set up the tabular
\makeatletter
\def\cals@framers@width{0.8pt}   % Outside frame rules, reduce if the rule is too heavy
\def\cals@framecs@width{0.4pt}
\def\cals@bodyrs@width{0.8pt}
\cals@setpadding{Ag}
\cals@setcellprevdepth{Al}
\def\cals@cs@width{0.4pt}             % Inside rules, reduce if the rule is too heavy
\def\cals@rs@width{0.4pt}

% R1 Heading
\thead{\bfseries
\brow
    \nc{lrt}
    \nc{ltb}
    \nc{tb}
    \nc{rtb}\alignC\sc{\vfil Habilidades Cognitivas}
    \nc{lrt}
\erow
% R2 Heading
\brow
    \nc{lrb}\alignL\sc{\vfil Ejes Temáticos}
    \alignC\cell{\vfil Comprensión}
    \alignC\cell{\vfil Aplicación}
    \alignC\cell{\vfil Análisis, Síntesis y Evaluación}
    \nc{lrb}\alignC\sc{\vfil Totales}
\erow
\mdseries
}
%\tfoot{%                                  % Uncomment if the tabular has mor ethan one page
%   \lastrule\nointerlineskip%
%   \textit{\strut Some table caption%
%   }%
%   \par%
%   }

% R3 Body
\brow
    \alignL\cell{\vfil\textbf{Números}}
    \alignC\cell{}
    \cell{\vfil 1 -- 3 -- 5 -- 6 -- 7 -- 9 -- 10 -- 11 -- 12 -- 13 -- 14 -- 15}
    \cell{\vfil 4 -- 8 -- 16 -- 17}
    \cell{\vfil 17}
\erow
% R4 Body
\brow
    \alignL\cell{\vfil\textbf{Álgebra}}
    \alignC\cell{}
    \cell{\vfil 18 -- 19 -- 20 -- 21 -- 22 -- 23 -- 24 -- 26 -- 28 -- 29 -- 30 -- 31 -- 32 -- 33 -- 34 -- 35}
    \cell{\vfil 25 -- 27 -- 36}
    \cell{\vfil 19}
\erow
% R5 Body
\brow
    \alignL\cell{\vfil \textbf{Geometría}}
    \alignC\cell{}
    \cell{\vfil 37 – 38 – 39 – 40 – 41 – 42 – 43 – 44 – 45 – 46 – 48 – 49 – 50 – 51 – 52 – 53 – 54 – 55 – 56 – 57}
    \cell{\vfil 47 -- 58}
    \cell{\vfil 22}
\erow
% R6 Body
\brow
    \alignL\cell{\vfil\textbf{Datos y Azar}}
    \alignC\cell{\vfil 60 -- 64}
    \cell{\vfil 59 -- 61 -- 62 -- 63 -- 65 -- 66 – 67 – 68 – 70 – 71 – 72 – 73 – 74 – 75 – 76 – 77 – 78 - 79}
    \cell{\vfil 69 -- 80}
    \cell{\vfil 22}
\erow
\makeatletter

\end{calstable}\par % \par to align the tabular

\end{document}

在此处输入图片描述

相关内容