[Tex/LaTex] newline in multirow environment

line-breakingmultirowtables

I have a table with many multirow environment that are each compouned with many lines.
I have seen that it is possible to break lines in multirows by fixing a particular width (with minipage for example) but I would like to decide where to break a line precisely (with a \newline for instance).

Example of current latex document :

\documentclass{article}
\usepackage[frenchb]{babel}
\usepackage[T1]{fontenc}
\usepackage{multirow}

\begin{document}
\begin{table}
\begin{tabular}{|c|c|}\hline
\multirow{5}{*}{Numbers from 1 to 5}&1 \\ 
&2 \\
&3 \\
&4 \\
&5 \\ \hline
\end{tabular}
\end{table} 
\end{document}

The result is

enter image description here

What i would like to get is something like that :

enter image description here

Best Answer

There is several ways to do it. A very simple way is using \shortstack

\documentclass{article}
\usepackage[frenchb]{babel}
\usepackage[T1]{fontenc}
\usepackage{multirow}

\begin{document}
\begin{table}
  \begin{tabular}{|c|c|}\hline
    \multirow{5}{*}{\shortstack[l]{Numbers from\\ 1 to 5}}&1 \\ 
                                                          &2 \\
                                                          &3 \\
                                                          &4 \\
                                                          &5 \\ \hline
  \end{tabular}
\end{table} 

\begin{table}
  \begin{tabular}{|c|c|}\hline
    \multirow{5}{*}{\shortstack{Numbers from\\ 1 to 5}}&1 \\ 
                                                       &2 \\
                                                       &3 \\
                                                       &4 \\
                                                       &5 \\ \hline
  \end{tabular}
\end{table} 

\begin{table}
  \begin{tabular}{|c|c|}\hline
    \multirow{5}{*}{\parbox{3cm}{Numbers from\\ 1 to 5}}&1 \\ 
                                                        &2 \\
                                                        &3 \\
                                                        &4 \\
                                                        &5 \\ \hline
  \end{tabular}
\end{table}

\end{document}

enter image description here