Difference between revisions of "Vertically Centered Boxes"
Jump to navigation
Jump to search
(simplify the macros) |
|||
Line 9: | Line 9: | ||
</texcode> | </texcode> | ||
− | ===In ConTeXt: | + | ===In ConTeXt:=== |
− | |||
− | |||
− | |||
− | |||
<texcode> | <texcode> | ||
− | \ | + | a box with a table: |
− | + | \framed | |
− | + | [location=middle, % vertically centered | |
− | + | align=flushleft, % align=no (default) is a normal hbox | |
− | + | % align=flushleft/middle/flushright/normal is used for multiple lines | |
− | + | offset=5pt] % to make the frame wider (as in LaTeX) | |
− | + | {1\\2\\3} | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | a midaligned parbox: | |
− | a | + | \framed |
− | + | [location=middle, % vertically centered | |
− | + | align=normal, % justified alignment | |
− | + | frame=off, % no frame | |
− | + | width=1em] % make box 1em wide; note that line breaking is not the same as in LaTeX (?) | |
− | + | {1 2 3} | |
</texcode> | </texcode> | ||
− | + | <context> | |
+ | a box with a table: | ||
+ | \framed | ||
+ | [location=middle, % vertically centered | ||
+ | align=flushleft, % align=no (default) is a normal hbox | ||
+ | % align=flushleft/middle/flushright/normal is used for multiple lines | ||
+ | offset=5pt] % to make the frame wider (as in LaTeX) | ||
+ | {1\\2\\3} | ||
− | + | a midaligned parbox: | |
− | a | + | \framed |
− | + | [location=middle, % vertically centered | |
− | + | align=normal, % justified alignment | |
− | + | frame=off, % no frame | |
− | + | width=1em] % make box 1em wide; note that line breaking is not the same as in LaTeX (?) | |
− | + | {1 2 3} | |
</context> | </context> | ||
− | + | If you need a proper table (the one above only had one column), use <code>\bTABLE ... \eTABLE</code> or similar instead of <code>1\\2\\3</code>. See [[Tables Overview]] for more possibilities. | |
− | < | + | |
− | \ | ||
− | \ | ||
− | \ | ||
− | \ | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | </ | ||
− | + | A broken example (for the second box): | |
<context> | <context> | ||
Line 73: | Line 57: | ||
\bTABLE | \bTABLE | ||
\bTR\bTD | \bTR\bTD | ||
− | + | a midaligned parbox: | |
\eTD\bTD[offset=0pt,width=1em] | \eTD\bTD[offset=0pt,width=1em] | ||
− | + | 1 2 3 | |
\eTD\eTR | \eTD\eTR | ||
\eTABLE | \eTABLE | ||
</context> | </context> |
Revision as of 10:49, 29 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:
a box with a table: \framed [location=middle, % vertically centered align=flushleft, % align=no (default) is a normal hbox % align=flushleft/middle/flushright/normal is used for multiple lines offset=5pt] % to make the frame wider (as in LaTeX) {1\\2\\3} a midaligned parbox: \framed [location=middle, % vertically centered align=normal, % justified alignment frame=off, % no frame width=1em] % make box 1em wide; note that line breaking is not the same as in LaTeX (?) {1 2 3}
If you need a proper table (the one above only had one column), use \bTABLE ... \eTABLE
or similar instead of 1\\2\\3
. See Tables Overview for more possibilities.
A broken example (for the second box):