2

I read hundreds of threads now, but I don't get the point. Why isn't the text in the left column of the following table vertically centered?

\documentclass{article}
\usepackage[utf8]{inputenc}

\usepackage{booktabs} \usepackage{multirow} \usepackage{pdflscape} \usepackage{longtable, array} \usepackage{lipsum}

\begin{document}

\begin{landscape} \begin{longtable}{ m{0.1\linewidth} p{.35\linewidth}p{.55\linewidth} } \endfirsthead \endhead \toprule \textbf{Enum} & \textbf{Example} & \textbf{Description} \ \midrule 1 & test & \lipsum[50]\ \midrule 2a & test & \lipsum[50]\ 2b & test & \lipsum[50]\ \bottomrule \end{longtable} \end{landscape}

\end{document}

My local compiler as well as overleaf produce the following output enter image description here

Can anybody help? If possible I would also like to have the text in the left column centered horizontally, but I think this will be done quickly then.

2 Answers2

4

With tabularray is simple:

\documentclass{article}
\usepackage{pdflscape}
\usepackage{tabularray}
\UseTblrLibrary{booktabs}

\usepackage{lipsum}

\begin{document}

\begin{landscape} \begin{longtblr}[ caption = {caption text}, label = {tab:longtblr} ]{ colspec = {Q[c] X[l] X[1.6,m,j]}, row{1} = {font=\bfseries}, rowhead = 1 } \toprule Enum & Example & Description \ \midrule 1 & test & \lipsum[50] \ \midrule 2a & test & \lipsum[50] \ \addlinespace 2b & test & \lipsum[50] \ \bottomrule \end{longtblr} \end{landscape}

\end{document}

Where meaning of the used column specifications are:

  • Q[c] (or shorter c) define columns with horizontal centered contents
  • X[l] define X column (similar as at tabularx package) where option l define that column contents is left aligned
  • X[1.6,m,j is define X similar as above, however options 1.6 make it wide for 1.6 time, m vertical center cells contents, and j that cells content is justified.

enter image description here

L.J.R.
  • 10,932
Zarko
  • 296,517
2

https://github.com/AnMnv/eBook (example 4.11)

enter image description here

\documentclass{article}
\usepackage[left=1.5cm,right=1.5cm,
    top=1.5cm,bottom=2cm,bindingoffset=0cm]{geometry}
\usepackage{float}
\usepackage{array, makecell}
\usepackage[utf8]{inputenc}
\usepackage{lipsum}
\usepackage{booktabs}

\usepackage{multirow} \usepackage{pdflscape} \usepackage{longtable, array}

\begin{document}

\begin{landscape} \begin{longtable}{@{} {2}{m{.\paperwidth}} {1}{m{.40\paperwidth}} @{}} \endfirsthead \endhead \toprule \textbf{Enum} & \textbf{Example} & \textbf{Description} \ \midrule 1 & test & \lipsum[50]\ \midrule 2a & test & \lipsum[50]\ 2b & test & \lipsum[50]\ \bottomrule \end{longtable} \end{landscape}

\end{document}

WinnieNotThePooh
  • 3,008
  • 1
  • 7
  • 14