1

I have longtable with multirow:

\documentclass[a4paper,12pt]{report}
\usepackage{multirow}
\usepackage{longtable}
\usepackage{makecell,array}

\begin{document}

{
\begin{longtable}[H]{|p{\dimexpr0.33\linewidth-2\tabcolsep}|m{\dimexpr0.33\linewidth-2\tabcolsep}|p{\dimexpr0.33\linewidth-2\tabcolsep}|}
\caption{Title}
\tabularnewline\hline
\multirow{4}{\linewidth}{ \centering \textbf{Long long  long long long long long long long long long long long long long long long long text}} & Long long  long long long long long long long long long long long long long long long long text & 1111 \tabularnewline \cline{2-3}
 & Long long   long long long long long long long long long long long long text & 1111 \tabularnewline \cline{2-3}
 & Long long  long long long  long long long long long long long long long long long text & 1111 \tabularnewline \cline{2-3}
 & Long long  long long  long long long long long long long long long long long text & 1111 \tabularnewline \cline{1-3}
\end{longtable}
}

\end{document}

enter image description here

I need use columns with specific width \dimexpr0.33\linewidth-2\tabcolsep Here I use a simple example, but in general, the column can be larger and the text is not fixed length.

I want the last column has vertical alignment. I have problem in first column.

I want to get one of the images: enter image description here enter image description here

How can I fix it?

Update. I need use mulrirow and longtable. The figure is the full version of the table in which the problem occurred. enter image description here

4
  • longtable [H] ??? Commented Jun 10, 2014 at 8:31
  • 1
    in your p column width you have allowed for \tabcolsep but not for arrayrulewidth Commented Jun 10, 2014 at 8:33
  • 1
    You can compare your problem with my thread tex.stackexchange.com/questions/183235/….
    – wipet
    Commented Jun 10, 2014 at 10:29
  • @wipet Similar problem, but there are not presented solutions for Latex
    – Harrix
    Commented Jun 10, 2014 at 17:14

2 Answers 2

1

It is possible without using multirow. In a lot of cases you can use a nested tabular. ltablex is a combination of longtable and tabularx:

\documentclass[a4paper,12pt]{report}
\usepackage{ltablex}
\renewcommand\tabularxcolumn[1]{m{#1}}   
\begin{document}

\noindent
\rule{\linewidth}{2pt}

\noindent
\begin{tabularx}{\linewidth}{|X|@{}m{0.66\linewidth}|}
\caption{Title}
\tabularnewline\hline
\bfseries Long long  long long long long long long long long long long long long long long long long text  
  &
   \begin{tabular}{m{\dimexpr0.5\linewidth-2\tabcolsep}|m{\dimexpr0.5\linewidth-\tabcolsep}}  
      Long long  long long long long long long long long long long long long long long long long text
     & 11111  \\\hline
      Long long long long long long long long long long long long long long text
     & 11111  \\\hline 
      Long long long long long long long long long long long long long long text
     & 11111
   \end{tabular}  \\\hline
\end{tabularx}

\end{document}

enter image description here

3
  • 1
    It is a solution what I'am waiting for in my thread, isn't it? My thread is called "Vertically aligned table in plainTeX, LaTeX, Context, etc". LaTeX solution is missing here. Would you post your ideas to this thread too?
    – wipet
    Commented Jun 10, 2014 at 8:23
  • This method works in the simple case. But I have a lot in the general table mulrirows.
    – Harrix
    Commented Jun 10, 2014 at 8:23
  • 1
    I never use multirow. I have a lot of tables and it is always possible to use nested tabulars instead
    – user2478
    Commented Jun 10, 2014 at 9:07
1

You can use the second optional argument (called fixup) of \multirow.

\multirow{4}{\linewidth}[2.5em]{\centering...

2.5em is an empirical value which you should adjust manually.

enter image description here

A negative value will lower the entry.

\documentclass[a4paper,12pt]{report}
\usepackage{multirow}
\usepackage{longtable}
\usepackage{makecell,array}

\begin{document}

{
\begin{longtable}{|p{\dimexpr0.33\linewidth-2\tabcolsep}|m{\dimexpr0.33\linewidth-2\tabcolsep}|p{\dimexpr0.33\linewidth-2\tabcolsep}|}
\caption{Title}
\tabularnewline\hline
\multirow{4}{\linewidth}[-5.8em]{\centering \textbf{Long long  long long long long long long long long long long long long long long long long text}} & Long long  long long long long long long long long long long long long long long long long text & 1111 \\[-1.85em] \cline{2-3}     %% adjust -5.8em and 1.85em suitably
 & Long long   long long long long long long long long long long long long text & 1111 \tabularnewline \cline{2-3}
 & Long long  long long long  long long long long long long long long long long long text & 1111 \tabularnewline \cline{2-3}
 & Long long  long long  long long long long long long long long long long long text & 1111 \tabularnewline \cline{1-3}
\end{longtable}
}

\end{document}

enter image description here

1
  • Good solution, but not automatic(
    – Harrix
    Commented Jun 10, 2014 at 17:13

You must log in to answer this question.

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