[Tex/LaTex] Context: Vertical-Align Image in Table Cell

contexttablesvertical alignment

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?

Best Answer

The solution for your case, as Aditya says:

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

Note that [location=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
Related Question