2

Description of the table

I would like to create a table:

  1. that has 4 columns of a fixed given width

  2. that has two types of rows:

    • one whose height is fixed to 1cm

    • the other one with a fixed height of 4cm

  3. where the text is vertically centered inside the cell

  4. where one could \newline inside a cell.

(The points 3. and 4. are less important)

Can anyone help me?

Some things I've tried

I've looked for a solution but didn't find anything. The best I've seen is

  • \usepackage{makecell} for 4.

  • there for 2 : using \vbox to 15ex{} for instance. But the vertical space is added to the content, not integrated.

  • For 1. there are on the contrary a lot of posted solutions (p{cm}, etc.)).

Drawing

I've made a drawing that shows what the table looks like:

enter image description here

2

I'm not sure how to get exact rowheights, that may depend on printer, printerdriver and so on. But you can play with the height of the rule in the first column to make ends meet.

\documentclass[paper=landscape]{scrartcl}

\usepackage{array, booktabs, lmodern}
\usepackage{ragged2e}

\newcolumntype{F}{>{\Centering}m{4cm}}
\renewcommand{\familydefault}{\sfdefault}

\begin{document}
\thispagestyle{empty}

\renewcommand{\arraystretch}{.001}
\begin{tabular}{@{}m{0pt}@{}FFFF}\toprule
\rule{0pt}{1cm} & \textbf{first column} & \textbf{second} & \textbf{third}& \textbf{fourth} \\\midrule{}
  \rule{0pt}{5cm}& some text & some longer text, which will take some lines, if you
                              need, look for the command arraybackslash &
                            The text should be centered vertically as well & last
                                                                             column\\\midrule
  \rule{0pt}{1cm}& next line & & & \\\midrule

\end{tabular}
\end{document}

Looks like this:

enter image description here

  • It's perfect but if you add vertical rule between the columns (\begin{tabular}{@{}m{0pt}@{}|F|F|F|F|}) there are small white spaces (but it is not so important for what I want to do) – Colas Aug 31 '18 at 19:40

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.