# Make different vertical alignment at cells

I have longtable with 3 columns. I need:

• 1st column - short word. Vertical alignment = top
• 2nd column - long text. Vertical alignment = top
• 3d column - short number. Vertical alignment = bottom.

I use this code:

\documentclass[twoside]{scrbook}
\usepackage{xtab}
\usepackage{array}

\begin{document}
\begin{xtabular}{r p{10em} b{5em}}
11 may &
Long multiline text. Long multiline text. Long multiline text.
Long multiline text. Long multiline text. &
10 \\
\end{xtabular}
\end{document}


But in 3d column I have alignment by top.

What should I do for my problem?

Thank you.

• the meaning of b is that the bottom row of that column ie 10 here aligns with the reference points of the other cells, so you would need to make the middle row b to make the 10 align with its bottom row, but this would affect the first column as well. – David Carlisle May 13 '15 at 11:39

\documentclass[twoside]{scrbook}
\usepackage{xtab}
\usepackage{array}
\newcommand\z[1]{\hspace*{\fill}{\rlap{\hspace{2\tabcolsep}#1}}}
\begin{document}
\begin{xtabular}{r p{10em} b{5em}}
11 may &
Long multiline text. Long multiline text. Long multiline text.
Long multiline text. Long multiline text.\z{10}&\mbox{}
\\
\end{xtabular}
\end{document}

• Thank you, David. But now I have more question (part two). I want add \dotfill after end of "Long multiline text". And get something like "Table of contents". And with your (nice) method I cant do it. \dotfill fill space before area of your "\z"-command. M.b. you can help me in that situation? I try use 2-columns table and after \dotfill use \makebox[0pt][l]{10}, but ares of this \makebox get out of margin of text. Hope you understand me. – Elisey May 13 '15 at 14:12
• @Evgeny just delete \vspace*{\fill} from the definition, then you will need to use \dotfill (for dots) or \hfill (for space) before \z – David Carlisle May 13 '15 at 14:18
• @Evgeny I added the images that you edited (will delete them later probably) but something is not right. irrespective of the use of this macro the third b{5em} column should leave space, – David Carlisle May 13 '15 at 15:13
• @Evgeny oh make sure you always have something in at least one cell in the third column even if it is just \mbox{} otherwise TeX will omit the column. Normally you have a heading in the first row, but if not any (or every) column will do. – David Carlisle May 13 '15 at 15:15
• @Evgeny I added \mbox{} to my answer – David Carlisle May 13 '15 at 15:16

If I understand well what you need, then this is something like this:

First of all you must decide the main macro design. You need a table (or \halign in my example) only because of first column can include texts with different width. The second column can include page numbers, there is no need of the third column. The second column is only specially formatted paragraph with given \hsize and with negative \parfillskip. The negative \parfillskip causes that the last element in the last line is shifted to the right.

Finally, using \dotfill generates not aligned dots. I recommend to use \leaders primitive (defined in \x macro). So, the text above can be generated by the following macros:

\def\parset{\parindent=0pt \hsize=10em \emergencystretch=2em
\parfillskip=-4em \relax}
`