ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* newbie ConTeXt question
@ 2008-03-11 20:52 jazz_johnson
  2008-03-11 21:49 ` Wolfgang Schuster
  0 siblings, 1 reply; 3+ messages in thread
From: jazz_johnson @ 2008-03-11 20:52 UTC (permalink / raw)
  To: ntg-context

Hi:

I'm trying to setup a simple (for now) letterhead like the following.
Is there a way to automatically adjust the horizontal spacing between
the \vbox{} \cbox{} \lbox{}
so that if I change the document margins, the center box is automatically 
centered?
I've tried putting in \hfill's without luck.


\startenvironment
\setuppapersize[letter][letter]
\setuplayout[height=9in,
             header=1.0in,
             footer=0in,
             topspace=1in,
             backspace=1.33in, %the backspace includes the margin
             location=middle,marking=on]
\setuppagenumbering [alternative=singlesided]
\noheaderandfooterlines
\setupbodyfont[cmr,12pt]
\usesymbols[mvs] \setupsymbolset[martinvogel 2]

\def\MyLetterhead%
{%\showboxes
   \vbox{%\showboxes

      \hbox{%\showboxes
         \vbox{\hsize 3in
               \tfa Your neighborhood\crlf
               \scd{Company Store}}
         \lbox{\hsize 3.0in \txx \setupinterlinespace \it Our Friendly Motto}
      }  \setupinterlinespace[line=.25ex]
      
      \hbox{
         \vbox{ \setupinterlinespace[height=.5,top=.5,line=.1ex]
         \hsize 6.0in \thinrules[n=1, rulethickness=1.5pt] \crlf
         \thinrules[n=1, rulethickness=0.7pt]}
      }

      \hbox{ \tfx \setupinterlinespace[reset,medium]
         \vbox{ \hsize 1.5in 
              \it www.mydomain.net\crlf 
                  email@mydomain.net\crlf 
                  contact@mydomain.net}
         \cbox{ \hsize 2.3in
               \symbol[star]~Va~\symbol[star]~Md~\symbol[star] \crlf
               \symbol[Telephone]    (555)123-4567 \crlf
               \symbol[Faxmachine] (555)987-6543}
         \lbox{ \hsize 2.0in 
                    1234 Main St.\crlf 
                     P.O. Box 123\crlf 
                     City, State 12345}
      }
   }
   \setupinterlinespace[reset]
}

\definelogo[Mylogo] [header] [left] [command=\MyLetterhead, state=stop]

\stopenvironment
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: newbie ConTeXt question
  2008-03-11 20:52 newbie ConTeXt question jazz_johnson
@ 2008-03-11 21:49 ` Wolfgang Schuster
  2008-03-12  1:42   ` jazz_johnson
  0 siblings, 1 reply; 3+ messages in thread
From: Wolfgang Schuster @ 2008-03-11 21:49 UTC (permalink / raw)
  To: ntg-context

On Tue, 11 Mar 2008 15:52:41 -0500
jazz_johnson@verizon.net wrote:

> Hi:
> 
> I'm trying to setup a simple (for now) letterhead like the following.
> Is there a way to automatically adjust the horizontal spacing between
> the \vbox{} \cbox{} \lbox{}
> so that if I change the document margins, the center box is automatically 
> centered?
> I've tried putting in \hfill's without luck.
> 
> 
> \startenvironment
> \setuppapersize[letter][letter]
> \setuplayout[height=9in,
>              header=1.0in,
>              footer=0in,
>              topspace=1in,
>              backspace=1.33in, %the backspace includes the margin
>              location=middle,marking=on]
> \setuppagenumbering [alternative=singlesided]
> \noheaderandfooterlines
> \setupbodyfont[cmr,12pt]
> \usesymbols[mvs] \setupsymbolset[martinvogel 2]
> 
> \def\MyLetterhead%
> {%\showboxes
>    \vbox{%\showboxes
> 
>       \hbox{%\showboxes
>          \vbox{\hsize 3in
>                \tfa Your neighborhood\crlf
>                \scd{Company Store}}
>          \lbox{\hsize 3.0in \txx \setupinterlinespace \it Our Friendly Motto}
>       }  \setupinterlinespace[line=.25ex]
>       
>       \hbox{
>          \vbox{ \setupinterlinespace[height=.5,top=.5,line=.1ex]
>          \hsize 6.0in \thinrules[n=1, rulethickness=1.5pt] \crlf
>          \thinrules[n=1, rulethickness=0.7pt]}
>       }
> 
>       \hbox{ \tfx \setupinterlinespace[reset,medium]
>          \vbox{ \hsize 1.5in 
>               \it www.mydomain.net\crlf 
>                   email@mydomain.net\crlf 
>                   contact@mydomain.net}
>          \cbox{ \hsize 2.3in
>                \symbol[star]~Va~\symbol[star]~Md~\symbol[star] \crlf
>                \symbol[Telephone]    (555)123-4567 \crlf
>                \symbol[Faxmachine] (555)987-6543}
>          \lbox{ \hsize 2.0in 
>                     1234 Main St.\crlf 
>                      P.O. Box 123\crlf 
>                      City, State 12345}
>       }
>    }
>    \setupinterlinespace[reset]
> }
> 
> \definelogo[Mylogo] [header] [left] [command=\MyLetterhead, state=stop]
> 
> \stopenvironment

Hi Jazz,

\setuppapersize[letter][letter]

\setuplayout
  [height=9in,
   header=1.0in,
   footer=0in,
   topspace=1in,
   backspace=1.33in,
   location=middle]

\setuppagenumbering
  [alternative=singlesided]

\noheaderandfooterlines

\usesymbols[mvs] \setupsymbolset[martinvogel 2]

\startsetups[letter:head]

  \vbox
    {\setupframed[frame=off,offset=none]
     \framed[width=\hsize,align=right,bottomframe=on,rulethickness=1.5pt]
      {{\tfa Your neighborhood}\\
       {\scd Company Store}\hfill{\itxx\strut Our Friendly Motto}}
     \framed[width=\hsize,align=right,topframe=on,rulethickness=0.7pt]
       {\framed[width=fit,align=right]
          {\smallbodyfont\it\strut www.mydomain.net\\
	   email@mydomain.net\\
	   contact@mydomain.net\par}
        \hfill
        \framed[width=fit,align=middle]
          {\smallbodyfont\strut
	   \symbol[star]~Va~\symbol[star]~Md~\symbol[star]\\
           \symbol[Telephone]~(555)123-4567\\
	   \symbol[Faxmachine]~(555)987-6543\par}
        \hfill
        \framed[width=fit,align=left]
	  {\smallbodyfont\strut1234 Main St.\\
	   P.O. Box 123\\
	   City, State 12345\par}}}

\stopsetups

\definelayer
  [header]
  [width=\paperwidth,height=\paperheight]

\setlayerframed
  [header]
  [hoffset=\backspace,voffset=.5\headerheight,frame=off,width=
\textwidth] {\setups{letter:head}}

\setupbackgrounds[page][background=header]

\starttext

\input knuth

\stoptext

Greetings
Wolfgang
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: newbie ConTeXt question
  2008-03-11 21:49 ` Wolfgang Schuster
@ 2008-03-12  1:42   ` jazz_johnson
  0 siblings, 0 replies; 3+ messages in thread
From: jazz_johnson @ 2008-03-12  1:42 UTC (permalink / raw)
  To: mailing list for ConTeXt users

THANKS! 

Your code fixed a lot of problems in addition to the centering problem --  
even fixing a perculiar problem with the linespacing in the right adress box. 

I'll have to read up on framed boxes. Using a bottom & a top border to draw a
double rule eliminated the hackish \setupinterlinespace I had used to adjust 
the spacing between the two lines.

I'll also have to read up on layers and overlays.

Thanks again for quick reply.
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-03-12  1:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-11 20:52 newbie ConTeXt question jazz_johnson
2008-03-11 21:49 ` Wolfgang Schuster
2008-03-12  1:42   ` jazz_johnson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).