I am still unsure what you are looking for, but based on your last comments regarding adding vspace
, I am curious why you do not place the section number (1.1, 1.2 and 1.3) in the same cell i column 2. The cells in the third columns will then shrink and expand automatically if you add or delete text. If you have rows where two sections contain text, you place that section in a separate row, see example 2.
Two additional improvements:
- Remove the
centering
-environment. longtable is centred by default, and use its own alignment algorithm (see documentation)
- Calculate the rows by taking into account the influence of
tabcolsep
s and the width of vertical rules, see the new preamble. If you have several similar tables, I recommend that you load array and define two new column-types using \newcolumntype
, which you then may use in the your tables’ preambles:
\newcolumntype{M}{p{\dimexpr(0.175\linewidth-2\tabcolsep-1.5\arrayrulewidth)}}
\newcolumntype{N}{p{\dimexpr(0.65\linewidth-2\tabcolsep-\arrayrulewidth)}}
The preamble for the first tabular:
\begin{longtable}{|M|M|N|}
\documentclass{article}
\usepackage{longtable}
\usepackage{lipsum, array}
\begin{document}
\begin{longtable}{
|p{\dimexpr(0.175\linewidth-2\tabcolsep-1.5\arrayrulewidth)}
|p{\dimexpr(0.175\linewidth-2\tabcolsep-1.5\arrayrulewidth)}
|p{\dimexpr(0.65\linewidth-2\tabcolsep-\arrayrulewidth)}|}
\hline
1 & 1.1 \par 1.2\par 1.3 & \lipsum[1]\\\hline
2 & 2.1 & \lipsum[2] \\ \hline
\end{longtable}
\end{document}
For certain, I would have chosen a different layout, using booktabs rules and no vertical rules.
\documentclass{article}
\usepackage{longtable}
\usepackage{lipsum, array}
\newcolumntype{O}{p{\dimexpr(0.175\linewidth-1.5\tabcolsep)}}
\newcolumntype{P}{p{\dimexpr(0.65\linewidth-\tabcolsep)}}
\begin{document}
\begin{longtable}{@{}OOP@{}}
\toprule \addlinespace[1ex]
1 & 1.1 \par 1.2\par 1.3 & \lipsum[1]\\\midrule \addlinespace[1ex]
2 & 2.1 & \lipsum[2] \\\cmidrule(l{\tabcolsep}){3-3}
& 2.2\par 2.3 & \lipsum[2] \\ \midrule
\end{longtable}
\end{document}