1

I have a table like this: enter image description here

But in some cells of the columns "Prerequisiti" and "Tipologia" I need multirow (like in case of "Node Js | Apache").

I would like that che my cells looks like enter image description here Is it possible?

This is my code

\begin{center}
\begin{tabular}{ |c|c|c|c|c|c| } 
\hline
Framework & Linguaggio & Licenza & Prerequisiti & Tipologia \\
\hline
Pybossa & Python & Open Source & & Applicazioni Web \\ 
CrowdThruth & PHP & Open source & & Applicazioni Web\\ 
Ionic   & Angularjs & Open source & Node.js | Apache Cordova
& Native | Cross Platform\\
Appcelerator Titanium   & Javascript &  Open Source & Node.js |
Java & Cross platform \\
Xamarin & C\# & Open Source & Visual Studio & Native | Cross Platform \\
Django  & Python    & Open Source&  Python&     Applicazioni web\\
\hline
\end{tabular}
\end{center}

I use \usepackage{multirow}

but I don't know how to use it properly.

  • if possible also the cells equally high, but it's not fundamental. – JEricaM Aug 29 '17 at 14:37
1

One of the nicest (and in my opinion most underrated :-)) features of tabulars is that they can be nested. In this case, if the purpose is just to have some cells with a text written in more rows you can just define a command

\newcommand{\multlinecell}[1]{\begin{tabular}{@{}c@{}}#1\end{tabular}}

The @{} suppresses the spacing on the sides. You can then type your table as

\documentclass{article}

\usepackage{array}

\newcommand{\multlinecell}[1]{\begin{tabular}{@{}c@{}}#1\end{tabular}}

\begin{document}

\begin{tabular}{|*{6}{>{\vphantom{\multlinecell{two\\lines}}}c|}} 
\hline
\bfseries Framework \multlinecell{\strut\\\strut}& \bfseries Linguaggio & \bfseries Licenza & \bfseries Prerequisiti & \bfseries Tipologia \\
\hline
Pybossa & Python & Open Source & & Applicazioni Web \\ 
\hline
CrowdThruth & PHP & Open source & & Applicazioni Web\\ 
\hline
Ionic   & Angularjs & Open source & \multlinecell{Node.js\\Apache Cordova} & \multlinecell{Native\\Cross Platform}\\
\hline
\multlinecell{Appcelerator\\Titanium}   & Javascript &  Open Source & \multlinecell{Node.js\\Java} & Cross platform \\
\hline
Xamarin & C\# & Open Source & Visual Studio & \multlinecell{Native\\Cross Platform} \\
\hline
Django  & Python    & Open Source&  Python &  Applicazioni web \\
\hline
\end{tabular}

\end{document}

enter image description here

I've used the \multlinecell also in order to force all cells to have the same height.

1

with use of makecell packages:

\documentclass{article}
\usepackage{geometry}% otherwise the text width is to small
\usepackage{makecell}
\renewcommand\theadfont{\bfseries\normalsize}
\setcellgapes{3pt}
%---------------------------------------- for showing page layout
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%

\begin{document}
    \begin{center}
\begin{tabular}{ |*{5}{c|} }
\hline
\thead{Framework} & \thead{Linguaggio} & \thead{Licenza}
        & \thead{Prerequisiti}  & \thead{Tipologia}                \\
\hline
Pybossa & Python & Open Source  & & Applicazioni Web \\
\hline
CrowdThruth & PHP & Open source & & Applicazioni Web\\
\hline
Ionic   & Angularjs & Open source & \makecell{Node.js\\Apache Cordova} & \makecell{Native\\Cross Platform}\\
\hline
\makecell{Appcelerator\\Titanium}   & Javascript &  Open Source & \makecell{Node.js\\ Java} & Cross platform \\
\hline
Xamarin & C\# & Open Source & Visual Studio & \makecell{Native\\Cross Platform} \\
\hline
Django  & Python    & Open Source&  Python &  Applicazioni web \\
\hline
\end{tabular}
    \end{center}
\end{document}

enter image description here

1

Here is a solution based on makecell, with some colour, and equal height rows (by trial and error):

\documentclass[svgnames, table]{article}
\usepackage[utf8]{inputenc}
\usepackage{array, makecell, booktabs}
\usepackage{xcolor}
\newcommand\mystrut{\rule[-2ex]{0pt}{24pt}}

\begin{document}

\begin{center}
  \sffamily\renewcommand\theadfont{\normalsize\bfseries}
  \setcellgapes{5pt}\makegapedcells
  \setlength\tabcolsep{3pt}
  \setlength{\fboxsep}{0pt}
  \arrayrulecolor{Gainsboro}
  \fbox{\begin{tabular}{ *{5}{c|}c}%{ |*{5}{c!{\color{Gainsboro}\vrule width0.4pt}}c}
      \thead{Framework} & \thead{Linguaggio} & \thead{Licenza} & \thead{Prerequisiti} & \thead{Tipologia} \\
      \Xhline{0.4pt}
      \mystrut Pybossa & Python & Open Source & & Applicazioni Web \\
      \hline
      \mystrut CrowdThruth & PHP & Open source & & Applicazioni Web \\
      \hline
      Ionic & Angularjs & Open source & \makecell{Node.js \\ Apache Cordova}
                           & \makecell{Native \\ Cross Platform}\\
      \hline
      \makecell{Appcelerator \\ Titanium} & Javascript & Open Source & \makecell{Node.js\\
      Java} & Cross platform \\
      \hline
      Xamarin & C\# & Open Source & Visual Studio & \makecell{Native \\Cross Platform} \\
      \hline
      \mystrut Django & Python & Open Source & Python & Applicazioni web \\\arrayrulecolor{black}
    \end{tabular}}
\end{center}

\end{document} 

enter image description here

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.