[texhax] Centering within an arbitrary vbox
Peter Seibel
peter at gigamonkeys.com
Mon May 25 17:16:02 CEST 2009
On Mon, May 25, 2009 at 7:40 AM, Philip G. Ratcliffe
<philip.ratcliffe at fastwebnet.it> wrote:
>> 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}
> }}
Thanks. I had also just figured out this:
\newlength{\foo}
\settowidth{\foo}{CHAPTER}
\hbox to \hsize{\hfill
\vbox{
\hbox{CHAPTER}
\hbox to\foo{\hfill 8\hfill}}}
-Peter
--
Peter Seibel
http://www.codersatwork.com/
http://www.gigamonkeys.com/blog/
More information about the texhax
mailing list