0

I have following:

\documentclass{scrbook}
\usepackage{longtable,array,lipsum,tabularx,multirow}
\newcolumntype{L}[1]{>{\raggedright\arraybackslash}p{#1}}
\newcolumntype{R}[1]{>{\raggedleft\arraybackslash} p{#1}}
\begin{document}
\begin{longtable}[c]{b{20mm}|L{\dimexpr\textwidth-40mm\relax}@{}|R{20mm}}
Column 1 & Column 2 & Column 3 \\ \hline
top & \lipsum[1] & bottom
\end{longtable}
\end{document}

What I get is:

enter image description here

What I want is:

enter image description here

(contents of last column aligned at the bottom line)

Could someone help me to solve this?

Final solution based on this answer of @Zarko and on the comments of @DavidCarlisle

\documentclass{scrbook}
\usepackage{lipsum,longtable, multirow, xltabular,letltxmacro}
\RequirePackage[noprefix,refpage,intoc]{nomentbl}
\newcolumntype{L}{>{\raggedright\arraybackslash}X}
\LetLtxMacro\oldnomenclature\nomenclature
\renewcommand{\nomenclature}[3][]{\oldnomenclature[#1]{#2}{#3}{}{}}
\renewcommand{\pagedeclaration}[1]{\multirow[b]{\zzz}{*}{#1}}
\makenomenclature
\begin{document}
\nomenclature{a}{\lipsum[1]}
\nomenclature{b}{\lipsum[2]}
\printnomenclature[3cm]
\end{document}

used together with makeindex and the makeindex-Style-File nomentbl.ist which is

actual '@'
quote '%'
delim_0   ""
delim_1   ""
delim_2   ""
item_0    ""
delim_t   " \\\\\n"
line_max  1000
heading_prefix   "\\multicolumn{3}{@{}l}{\\nomgroup{"
heading_suffix   "}} \\\\\n\\nopagebreak\\\\*[-3mm]\n\\nopagebreak{}"
headings_flag       1
group_skip        "\\\\*[-3mm]"
preamble "\n\\begin{thenomenclature}\n%
\\begin{xltabular}{\\linewidth}{@{}lL<{\\endgraf\\xdef\\zzz{\\the\\prevgraf}}@{}l@{}l@{}r@{}}\n%
\\textbf{Symbol} & \\textbf{Description} & & & \\textbf{Page} \\\\*[-4mm]\n%
\\hline \\\\*[-2mm] \n"%
postamble "\n\\end{xltabular}\n\n\\end{thenomenclature}\n"
keyword "\\nomenclatureentry"
\endinput

results in

enter image description here

7
  • 1
    so long as "bottom" is just one line always then this is a duplicate of tex.stackexchange.com/questions/303798/… Jan 25, 2021 at 8:47
  • @DavidCarlisle I need a solution with three columns
    – theNewOne
    Jan 25, 2021 at 8:51
  • the visual output in the referenced answer has three columns, using two columns in the markup is just an internal detail to get the alignment. Any solution is going to have to do something similar to get the alignment of the last row of the middle column. Jan 25, 2021 at 8:54
  • My table here is auto-created using makeindex (it is a list for used symbols). The last columns contains the page number. Auto-formatting using the *.ist style file is possible, but I can't see an option to use this particular answer for this purpose
    – theNewOne
    Jan 25, 2021 at 9:05
  • 1
    the underlying table primitives in tex do not support this alignment so any solution is going to require some custom code to get the effect which you will have to integrate into your auto generation somehow. Actually the easiest way (especially if you don't have vertical rules) is to put "bottom" in a row on its own, and possibly add a negative baseline space to move it up. Jan 25, 2021 at 9:18

1 Answer 1

0
  • off-topic: with use of the xltabular instead of `longtable, you will have simpler control over column width
  • using \multirow[b]{<number of lines in adjacent cell(s)>}{*}{bottom} you can achieve what you after, however this solution require manual tweaking: counting number of lines in the middle cell:
\documentclass{scrbook}
\usepackage{longtable, multirow, xltabular}
\newcolumntype{L}{>{\raggedright\arraybackslash}X}
\usepackage{lipsum}

\begin{document}
    \begin{xltabular}{\linewidth}{l|L|r}
Column 1 & Column 2     & Column 3          \\ \hline
top      & \lipsum[1]   & \multirow[b]{15}{*}{bottom}
    \end{xltabular}
\end{document}

enter image description here

\documentclass{scrbook}
\usepackage{longtable, multirow, xltabular}
\newcolumntype{L}{>{\raggedright\arraybackslash}X}
\usepackage{lipsum}

\begin{document}
    \begin{xltabular}{\linewidth}{l|L<{\endgraf\xdef\zzz{\the\prevgraf}}|r}
Column 1 & Column 2     & Column 3          \\ \hline
top      & \lipsum[1]   & \multirow[b]{\zzz}{*}{bottom}
    \end{xltabular}
\end{document}
10
  • \prevgraf at the end of the middle cell would give you the line count so you'd just need to stick it in a global value to leak it to the next column Jan 25, 2021 at 9:59
  • @DavidCarlisle, I wasn't aware for this command. Unfortunately my effort to use it my answer wasn't fruitful. Please, be so kind and show me (us), how to use in this particular case.
    – Zarko
    Jan 25, 2021 at 10:31
  • I added something, feel free to use or delete as you see fit. (added to end of your answer as code in comments is horrible) Jan 25, 2021 at 12:09
  • @DavidCarlisle, thank you very much!
    – Zarko
    Jan 25, 2021 at 13:05
  • note that assumes a single paragraph, prevgraf just gives lines on the paragraph just finished Jan 25, 2021 at 13:11

You must log in to answer this question.

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