2

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.

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

4 Answers 4

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.

0
2

With use of the 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

Addendum:
Today, when tabularray package is available, I would write your table as follows:

\documentclass{article} \usepackage{geometry} % otherwise the size of \textwidth is to small \usepackage{xcolor} \usepackage{tabularray} \begin{document} \begin{center} \begin{tblr}{colspec = { *{5}{X[c, m, cmd=\linespread{0.84}\relax]} }, row{1} = {font=\bfseries, abovesep = 4pt}, row{2-Z} = 7ex, hlines = {gray!30}, vlines = {gray!30} } Framework & Linguaggio & Licenza & Prerequisiti & Tipologia \\ 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 \\ \end{tblr} \end{center} \end{document} 

where tblr is defined in tabularray package. Above MWE gives:

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

0

Here is a solution with {NiceTabular} of nicematrix

\documentclass{article} \usepackage{geometry} \usepackage{nicematrix} \begin{document} \begin{center} \begin{NiceTabular}{ *{5}{X[c, m]} }[hvlines,rules/color=gray!50,cell-space-limits=2pt] \RowStyle{\bfseries} Framework & Linguaggio & Licenza & Prerequisiti & Tipologia \\ 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 \\ \end{NiceTabular} \end{center} \end{document} 

enter image description here

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.