1

This is my table (the a's and b's replace actual letters). How do I make the sentences that are all b's to fit in their cells without changing the width of the cells?

\begin{center}
\begin{tabular}{ K{1.7cm}|K{1.4cm}|K{2.3cm}|K{1.4cm}|K{1cm}|K{1cm}|K{1.4cm}|K{1cm} } \hline

\multirow{6}{*}{bbbbbb bbbbbbbbbb} & \multirow{3}{*}{bbbbb bbbbbb} & aaa & \% & \% & \% & \% & \% \\ \cline{3-8}
 &  & aaaaaaaaaaa & \% & \% & \% & \% & \% \\ \cline{3-8}
 &  & aaaaa & \% & \% & \% & \% & \% \\ \cline{2-8}
 & \multirow{3}{*}{bbbbbb bbbbbbbb}  & aaa & \% & \% & \% & \% & \% \\ \cline{3-8}
 &  & aaaaaaaaaaa & \% & \% & \% & \% & \% \\ \cline{3-8}
 &  & aaaaa & \% & \% & \% & \% & \% \\ \hline      
\end{tabular}
\end{center}

enter image description here

My header includes:

\usepackage{array}
\usepackage{tabulary}
\newcolumntype{K}[1]{>{\centering\arraybackslash}m{#1}}

\usepackage{multirow}
\usepackage{multicol}

Thanks!

3
  • try p column type instead of m
    – koleygr
    Sep 16, 2017 at 12:43
  • still looks the same
    – TamarV
    Sep 16, 2017 at 13:09
  • 1
    welcome to tex.se!please extend and merge your code snippets to one small, but complete document begining with \documentclass{...} and ending with \end{document}, which demonstrate your problem. it seems that your use of multirow` is wrong. column, where is used had to be p{..} type and then\multirow{...}{=}{...text ... }.
    – Zarko
    Sep 16, 2017 at 14:01

2 Answers 2

2

You can use a parbox like this:

\documentclass[a4paper,10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{array}
\usepackage{tabulary}
\newcolumntype{K}[1]{>{\centering\arraybackslash}m{#1}}
\usepackage{multirow}
\usepackage{multicol}

\begin{document}

\begin{center}
\begin{tabular}{ c|c|c|K{1.4cm}|K{1cm}|K{1cm}|K{1.4cm}|K{1cm} } \hline

\multirow{6}{*}{\parbox{1.9cm}{\centering bbbbbb bbbbbbbbbb}} & \multirow{3}{*}{\parbox{1.7cm}{\centering bbbbb bbbbbb}} & aaa & \% & \% & \% & \% & \% \\ \cline{3-8}
 &  & aaaaaaaaaaa & \% & \% & \% & \% & \% \\ \cline{3-8}
 &  & aaaaa & \% & \% & \% & \% & \% \\ \cline{2-8}
 & \multirow{3}{*}{\parbox{1.7cm}{\centering bbbbbb bbbbbbbb}}  & aaa & \% & \% & \% & \% & \% \\ \cline{3-8}
 &  & aaaaaaaaaaa & \% & \% & \% & \% & \% \\ \cline{3-8}
 &  & aaaaa & \% & \% & \% & \% & \% \\ \hline      
\end{tabular}
\end{center}

\end{document}

Output:

enter image description here

0
2

your use of multirow is wrong. for broke text in cell into more lines you need to do one of the following:

  • defined width of multirow cell, for example \multirow{4}{2cm}{ ... text in cell ...}
  • if you have insttaled recent version of multirow package (recommended) , than you can use \multirow{4}{=}{ ... text in cell ...}, where {=} consider defined column type. for breaking of text into more lines than column had to be p{...} (or m or b) type or X tape, if you use tabularx.

edit: complete mwe. with exploiting features of recent multirow package you obtain clear and concise code:

\documentclass[a4paper,10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{array}
\usepackage{tabulary}
\newcolumntype{K}[1]{>{\centering\arraybackslash}m{#1}}
\usepackage{multirow}
\usepackage{multicol}

\begin{document}
\begin{center}
\renewcommand\arraystretch{1.2}
\renewcommand\multirowsetup{\centering} % for horizontal centering of multirow cell content 
    \begin{tabular}{ K{2cm}|K{1.5cm}|K{2.3cm}|c|c|c|c|c} \hline
\multirow{6}{=}{bbbbbb bbbbbbbbbb} 
    &   \multirow{3}{=}{bbbbb bbbbbb} 
        & aaa   & \% & \% & \% & \% & \% \\ \cline{3-8}
    &   & aaaaaaaaaaa 
                & \% & \% & \% & \% & \% \\ \cline{3-8}
    &   & aaaaa & \% & \% & \% & \% & \% \\ \cline{2-8}
    &   \multirow{3}{=}{bbbbbb bbbbbbbb}  
        & aaa   & \% & \% & \% & \% & \% \\ \cline{3-8}
    &   & aaaaaaaaaaa 
                & \% & \% & \% & \% & \% \\ \cline{3-8}
    &   & aaaaa & \% & \% & \% & \% & \% \\ \hline
    \end{tabular}
\end{center}
\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .