[texhax] Centering within an arbitrary vbox

Philip G. Ratcliffe philip.ratcliffe at fastwebnet.it
Mon May 25 16:40:41 CEST 2009


> I have this bit of TeX code:
> 
>    \line{\hfill\vbox{\hbox{Chapter}\hbox{8}}}
> 
> Which renders something like this (pardon my ASCII art):
> 
> 
> |                                     Chapter|
> |                                     8           |
> 
> What I want is for the "8" to be centered under the "Chapter" 
> but with the combined vbox flush right.
> 
> [snip]

The tabular environment is probably th simplest solution:

\line{\hfill\vbox{%
  \tabcolsep=0pt % to keep things flush
  \begin{tabular}{c}
    Chapter\\8
  \end{tabular}
}}

Cheers,  Phil



More information about the texhax mailing list