Difference between revisions of "Vertically Centered Boxes"
Jump to navigation
Jump to search
Line 1: | Line 1: | ||
− | LaTeX | + | ===In LaTeX=== |
− | < | + | <texcode> |
\documentclass{article} | \documentclass{article} | ||
\begin{document} | \begin{document} | ||
Line 7: | Line 7: | ||
a midaligned parbox: \parbox[c]{1em}{1 2 3} | a midaligned parbox: \parbox[c]{1em}{1 2 3} | ||
\end{document} | \end{document} | ||
− | </ | + | </texcode> |
− | ConTeXt: ??? | + | ===In ConTeXt: ???=== |
+ | |||
+ | Please note that this is only my suggestion. I believe there must be an easier way too! | ||
+ | |||
+ | For the first box: | ||
+ | |||
+ | <texcode> | ||
+ | \setupTABLE[frame=off] | ||
+ | \setupTABLE[c][1,2][align=lohi] | ||
+ | \bTABLE | ||
+ | \bTR\bTD | ||
+ | a box with a table: | ||
+ | \eTD\bTD[frame=on] | ||
+ | {\bTABLE[frame=off] | ||
+ | \bTR\bTD 1 \eTD\eTR | ||
+ | \bTR\bTD 2 \eTD\eTR | ||
+ | \bTR\bTD 3 \eTD\eTR | ||
+ | \eTABLE} | ||
+ | \eTD\eTR | ||
+ | \eTABLE | ||
+ | </texcode> | ||
+ | |||
+ | or | ||
+ | |||
+ | <texcode> | ||
+ | a box with a table: \vcenter{\framed{ | ||
+ | \bTABLE[frame=off] | ||
+ | \bTR\bTD 1 \eTD\eTR | ||
+ | \bTR\bTD 2 \eTD\eTR | ||
+ | \bTR\bTD 3 \eTD\eTR | ||
+ | \eTABLE}} | ||
+ | </texcode> | ||
+ | |||
+ | It works on older ConTeXt distributions, here it seems to be broken: | ||
+ | |||
+ | <context> | ||
+ | a box with a table: \vcenter{\framed{ | ||
+ | \bTABLE[frame=off] | ||
+ | \bTR\bTD 1 \eTD\eTR | ||
+ | \bTR\bTD 2 \eTD\eTR | ||
+ | \bTR\bTD 3 \eTD\eTR | ||
+ | \eTABLE}} | ||
+ | </context> | ||
+ | |||
+ | The second box <b>should</b> be possible to typeset as | ||
+ | <texcode> | ||
+ | \setupTABLE[frame=on] | ||
+ | \setupTABLE[c][1,2][align=lohi] | ||
+ | \bTABLE | ||
+ | \bTR\bTD | ||
+ | a midaligned parbox: | ||
+ | \eTD\bTD[offset=0pt,width=1em] | ||
+ | 1 2 3 | ||
+ | \eTD\eTR | ||
+ | \eTABLE | ||
+ | </texcode> | ||
+ | |||
+ | but it doesn't work: | ||
+ | |||
+ | <context> | ||
+ | \setupTABLE[frame=on] | ||
+ | \setupTABLE[c][1,2][align=lohi] | ||
+ | \bTABLE | ||
+ | \bTR\bTD | ||
+ | a midaligned parbox: | ||
+ | \eTD\bTD[offset=0pt,width=1em] | ||
+ | 1 2 3 | ||
+ | \eTD\eTR | ||
+ | \eTABLE | ||
+ | </context> |
Revision as of 18:45, 25 July 2005
In LaTeX
\documentclass{article} \begin{document} a box with a table: \fbox{\begin{tabular}[c]{l}1\\2\\3\end{tabular}}\par a midaligned parbox: \parbox[c]{1em}{1 2 3} \end{document}
In ConTeXt: ???
Please note that this is only my suggestion. I believe there must be an easier way too!
For the first box:
\setupTABLE[frame=off] \setupTABLE[c][1,2][align=lohi] \bTABLE \bTR\bTD a box with a table: \eTD\bTD[frame=on] {\bTABLE[frame=off] \bTR\bTD 1 \eTD\eTR \bTR\bTD 2 \eTD\eTR \bTR\bTD 3 \eTD\eTR \eTABLE} \eTD\eTR \eTABLE
or
a box with a table: \vcenter{\framed{ \bTABLE[frame=off] \bTR\bTD 1 \eTD\eTR \bTR\bTD 2 \eTD\eTR \bTR\bTD 3 \eTD\eTR \eTABLE}}
It works on older ConTeXt distributions, here it seems to be broken:
The second box should be possible to typeset as
\setupTABLE[frame=on] \setupTABLE[c][1,2][align=lohi] \bTABLE \bTR\bTD a midaligned parbox: \eTD\bTD[offset=0pt,width=1em] 1 2 3 \eTD\eTR \eTABLE
but it doesn't work: