[NTG-context] centering framed boxes

Idris Samawi Hamid ishamid at lamar.colostate.edu
Sun May 15 14:02:26 CEST 2005


I forgot about $\vcenter$ (I hardly ever need math mode, so...)

The following works for the framed boxes, and the text is well positioned 
also, but is there a better/more efficient way to center the text between 
frames?

Best
Idris
=============================================
\setupoutput[pdftex]%

\setuppagenumbering[state=stop]
\starttext\showstruts

\setupfloats[location=middle]
\placefigure
[here][tab:enclosure]{4 Stages.}
{
 \midaligned{
 \framed
 [width=12\baselineskip,height=12\baselineskip,strut=yes]
 {\midaligned{\raise.25ex\hbox{Stage 1}}
   $\vcenter%
   {\framed[width=9\baselineskip,height=9\baselineskip,strut=yes]
     {\midaligned{\raise.25ex\hbox{Stage 2}}
       $\vcenter%
       {\framed[width=6\baselineskip,height=6\baselineskip,strut=yes]
         {\midaligned{\raise.25ex\hbox{Stage 3}}
           $\vcenter%
           {\framed[width=3\baselineskip,height=3\baselineskip,strut=yes]
            {\midaligned{\raise.25ex\hbox{Stage 4}}}
           }$
         \midaligned{\null}}%
       }$
     \midaligned{\null}}%
   }$
 \midaligned{\null}}
 }
}

\stoptext
============================================

===============original message=============
Dear gang,

I need a way to overlay four framed boxes so that each inner box is exactly in
the center of its respective outer box. So far I have the following, but
careful inspection will show that the boxes are not precisely centered with
respect to each other. I could go on by trial and error but I'm sure there is
a direct way to do this.

The text should also be precisely centered between frames.

Thank you in advance!
Idris

============================
Professor Idris Samawi Hamid
Department of Philosophy
Colorado State University
Fort Collins, CO 80523



More information about the ntg-context mailing list