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

  • 1
    so long as "bottom" is just one line always then this is a duplicate of https://tex.stackexchange.com/questions/303798/tabular-columns-with-different-vertical-alignment/343579#343579 – David Carlisle Jan 25 '21 at 08:47
  • @DavidCarlisle I need a solution with three columns – theNewOne Jan 25 '21 at 08: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. – David Carlisle Jan 25 '21 at 08: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 '21 at 09: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. – David Carlisle Jan 25 '21 at 09:18
  • Is there maybe a method to "measure" the height of the content of the second column and to put the content of the third column into a box with exactly this height? Inside the box one could align the content at the bottom maybe. – theNewOne Jan 25 '21 at 09:32
  • https://tex.stackexchange.com/questions/166808/move-tabular-entry-to-bottom-of-row/166821#166821 – David Carlisle Jan 25 '21 at 09:58

1 Answers1

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}

David Carlisle
  • 757,742
Zarko
  • 296,517
  • \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 – David Carlisle Jan 25 '21 at 09: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 '21 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) – David Carlisle Jan 25 '21 at 12:09
  • @DavidCarlisle, thank you very much! – Zarko Jan 25 '21 at 13:05
  • note that assumes a single paragraph, prevgraf just gives lines on the paragraph just finished – David Carlisle Jan 25 '21 at 13:11
  • Thanks @DavidCarlisle, this worked for me. Added my solution to my post as well. – theNewOne Jan 25 '21 at 13:23
  • Thank you as well @Zarko – theNewOne Jan 25 '21 at 13:23
  • @DavidCarlisle, I tested your code. It works fine. I only need to figured out, why <{\endgraf\xdef\zzz{\the\prevgraf}} insert one empty line in L cell. About this I will ask new question. – Zarko Jan 25 '21 at 13:25
  • oh sorry that's my fault, there is a final strut added, hmm need to be a bit more carefull inserting the prevgraf no time now, sorry. – David Carlisle Jan 25 '21 at 13:40
  • @DavidCarlisle, meanwhile I ask question about this. (https://tex.stackexchange.com/questions/580392/using-prevgraf-in-multirow-cells). Please, write an answer on this. – Zarko Jan 25 '21 at 14:00