Mojca Miklavec wrote:
Hello,
On the wiki (http://contextgarden.net/Vertically_centred) a while ago someone asked how to do the following in ConTeXt:
%%%%%%
\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}
%%%%%%
^^^^ watch the \\ ! ! ! !
I don't know if this would be the proper solution, but for the second case (\parbox[c]{1em}{...} which should make a paragraph 1 em wide and center the paragraph box vertically) I tried the following:
%%%%%%
\setupTABLE[frame=on] % only for debugging reasons \setupTABLE[c][1,2][align=lohi] % to center vertically (any better way?) \bTABLE \bTR\bTD a midaligned parbox: \eTD\bTD[offset=0pt,width=1em] % 1em wide paragraph 1 2 3 \eTD\eTR \eTABLE
%%%%%%
so, in order to compare, use 1\\2\\3 here too \setupTABLE[frame=on] % only for debugging reasons \setupTABLE[c][1,2][align=lohi] % to center vertically (any better way?) \bTABLE \bTR\bTD a midaligned parbox: \eTD\bTD[offset=overlay,width=1em] % 1em wide paragraph 1 2 3 \eTD\eTR \bTR\bTD a midaligned parbox: \eTD\bTD[offset=overlay,width=1em] % 1em wide paragraph \ruledhbox{1 2} 3 \eTD\eTR \bTR\bTD a midaligned parbox: \eTD\bTD[offset=overlay,width=1em] % 1em wide paragraph 1\\2\\3 \eTD\eTR \eTABLE
My ConTeXt version is 2005.06.27. See the vcenter-context-old.png for the result.
The strange thing is that the number 2 is still in the first line, although it is too wide.
Even more strange, I tried the same on live.contextgarden.net. See vcenter-context-new.png for the result.
vcenter-latex.tex is what the result should be.
tex's ways of determining the optimal paragraph are magic ... Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------