5

I want to get a table like the picture but I don't know how to adjust the size of the cell. enter image description here

I'm using this code

\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}%

And the result is

enter image description here

  • 1
    On design of table has page layout big influence. Therefore please extend your code snippet to complete small document (MWE: Minimal Working Example) beginning with \documentclass, following with preamble in which you load only packages relevant to table and page layout, than your table code snippet and ending with \end{document} – Zarko Jul 2 '19 at 2:20
  • 1
    Sorry, I extended the code – Mijail Littin Jul 2 '19 at 2:30
  • Just a note, your minus signs are not actual minus signs in the Aplicación column, specifically, the Geometría and Datos y Azar rows. – M. Al Jumaily Jul 2 '19 at 3:09
3

See, if you liked the following "redesign" of your table:

\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}

enter image description here

Edit:

For beter positioning of contents in the last row I add option t to \thead: \thead[lt]{Datos\\ y Azar}

|improve this answer|||||
7

Another redesign:

mwe

\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}
|improve this answer|||||
6

Maybe you can also use a more compact version with a comma separated list and ranges:

enter image description here

\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}
|improve this answer|||||
  • 2
    This is probably the best answer so far, in terms of typography and use of space. However, it breaks rule 5 of the booktabs package: “Do not use ‘ditto’ signs or any other such convention to repeat a previous value. In many circumstances a blank will serve just as well.” Why not replace those em-dashes with a blank space? – AJFarmar Jul 2 '19 at 16:08
3

And if you want to try something different, you may try cals. I have assumed that you prefer the layout you have chosen. If not, it is easy to build a more ‘booktabs’ style tabular:

\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}

enter image description here

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.