Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'd like to vertically center the alignment of an image in a table cell. The Text is (like usual) vertically centered, but the images continue to stick to the top of the cell.

\starttable[|l|l|]
\NC  Darstellung \VL Bedeutung \SR
\HL
\NC {\externalfigure[buttonform][height=0.8\lineheight]} \VL Mausklick zum Aktivieren (nötige Eingabeaktion) \SR
\HL
\NC {\externalfigure[buttontext][frame=on, height=0.8\lineheight]}\VL Bestätigung (zu erwartendes Resultat) \LR
\HL
\stoptable

Is there any known way to position the images (which are as high as a text line) at the same vertical position as the Text in the other cells?

share|improve this question
2  
Add location=low to the second argument of \externalfigure. –  Aditya May 24 '12 at 17:47
add comment

1 Answer

The solution for your case, as Aditya says:

\externalfigure[buttonform][height=0.8\lineheight, location=low]

Note that [align=low] does not center the figure in the table cell, but places it on the bottom of the line of text you are currently on. This only works as centering on the line because the figure is as high as a piece of text; and centering on the line only works as centering in the cell because

  1. All cells in the row contain only one line
  2. The lines of text are vertically centered in the cells.

If you want to center a figure in a table cell in general, though, you should use the TABLE mechanism instead, and pass [align=lohi] to the appropriate row/column/cell. The example below does it in three different ways; any one of these would work.

% set vertical centering (and horizontal justification) for all rows
\setupTABLE[row][align={justified,lohi}]

% set vertical centering for columns 2 and 4 (yes, we have no column 4 yet)
\setupTABLE[column][2,4][align=lohi]

\bTABLE
    \bTR 
        \bTD \input linden \eTD 
        % set vertical centering for a particular cell
        \bTD[align=lohi] \externalfigure[cow][width=1cm] \eTD
    \eTR
\eTABLE
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.