1

Question:

In the following table i would like to adjust length and height of every cell, how can i do this?

MWE:

\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\begin{document}
    \begin{tabular}{|c|c|c|c|c|c|c|c|c|c|c|c|c|c|}
        \cline{1-2} \cline{4-5} \cline{7-8} \cline{10-11} \cline{13-14}
        (1) &  &  & (5) &  &  & (9)  &  &  & (13) &  &  & (17) &  \\ \cline{1-2} \cline{4-5} \cline{7-8} \cline{10-11} \cline{13-14} 
        (2) &  &  & (6) &  &  & (10) &  &  & (14) &  &  & (18) &  \\ \cline{1-2} \cline{4-5} \cline{7-8} \cline{10-11} \cline{13-14} 
        (3) &  &  & (7) &  &  & (11) &  &  & (15) &  &  & (19) &  \\ \cline{1-2} \cline{4-5} \cline{7-8} \cline{10-11} \cline{13-14} 
        (4) &  &  & (8) &  &  & (12) &  &  & (16) &  &  & (20) &  \\ \cline{1-2} \cline{4-5} \cline{7-8} \cline{10-11} \cline{13-14} 
    \end{tabular}
\end{document}
leandriis
  • 62,593
SandyM
  • 2,757

1 Answers1

1

As already mentioned in my previous comments, I'd split up the single table into five different tables. This will make the code much longer but (at least in my opinion) a lot more readable and easier to adjust.

In the following example, I have also used the automated row numbering approach. I have also introduced a new, centered fixed width column type. In order to increase the row height, I have added the makecell package in combination with its \makegepedcells command. Laslty, I made sure, the five tables fit into the textwidth by using \hfill inbetween them.

\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}

\usepackage{makecell} % For increased row height using \makegapedcells

%%%%% Atomatic rownumbering from https://tex.stackexchange.com/a/21245/134144 
\usepackage{array,etoolbox}
\newcounter{magicrownumbers}
\setcounter{magicrownumbers}{0}
\newcommand\rownumber{\stepcounter{magicrownumbers}\arabic{magicrownumbers}}
%%%%% 

\newcommand\rn{\makebox[2.5em][c]{(\rownumber)}}
\newcolumntype{P}{>{\centering\arraybackslash}p{1cm}}
\setcellgapes{6pt}

\begin{document}

\noindent
\makegapedcells
\begin{tabular}{|@{\rn}|P|}
\hline
  \\
\hline
  \\
\hline
 \\
\hline
 \\
\hline
\end{tabular}\hfill
\begin{tabular}{|@{\rn}|P|}
\hline
 \\
\hline
 \\
\hline
 \\
\hline
 \\
\hline
\end{tabular}\hfill
\begin{tabular}{|@{\rn}|P|}
\hline
 \\
\hline
 \\
\hline
 \\
\hline
 \\
\hline
\end{tabular}\hfill
\begin{tabular}{|@{\rn}|P|}
\hline
 \\
\hline
 \\
\hline
 \\
\hline
 \\
\hline
\end{tabular}\hfill
\begin{tabular}{|@{\rn}|P|}
\hline
 \\
\hline
 \\
\hline
 \\
\hline
 \\
\hline
\end{tabular}
\end{document}

enter image description here

You can of course adjust the width of the column containing the number to your liking by changing teh width of the \makebox. By changing the width in the definition of the P type cell, you can change the width of the second column. By adjusting the value of \setcellgapes you can influence the height of the rows.

In the following screenshot, I have used:

\newcommand\rn{\makebox[2em][c]{(\rownumber)}}
\newcolumntype{P}{>{\centering\arraybackslash}p{1.25cm}}
\setcellgapes{10pt}

enter image description here

leandriis
  • 62,593