ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* vertically centered aligment of different sized texts
@ 2006-05-16 23:50 frantisek holop
  2006-05-17  0:02 ` Aditya Mahajan
  0 siblings, 1 reply; 12+ messages in thread
From: frantisek holop @ 2006-05-16 23:50 UTC (permalink / raw)


hi there,

another question to which shamefully i cannot find the answer.
perhaps it's just too late...


consider the following example:


\definefont[BigFont][Regular sa 3]
\starttext
{\tfc The {\BigFont 7}\high{th} Seal}
\stoptext


how can i make that line vertically centered, like
    --,
the  /th seal
    /

:)


is \startalignment used for this?

-f
-- 
every great journey begins with a single step.

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

* Re: vertically centered aligment of different sized texts
  2006-05-16 23:50 vertically centered aligment of different sized texts frantisek holop
@ 2006-05-17  0:02 ` Aditya Mahajan
  2006-05-17 16:28   ` Willi Egger
  0 siblings, 1 reply; 12+ messages in thread
From: Aditya Mahajan @ 2006-05-17  0:02 UTC (permalink / raw)


On Wed, 17 May 2006, frantisek holop wrote:

> hi there,
>
> another question to which shamefully i cannot find the answer.
> perhaps it's just too late...
>
>
> consider the following example:
>
>
> \definefont[BigFont][Regular sa 3]
> \starttext
> {\tfc The {\BigFont 7}\high{th} Seal}
> \stoptext
>
>
> how can i make that line vertically centered, like
>    --,
> the  /th seal
>    /
>
> :)
>

I do not know if this is the best way to do this, but you can exploit 
inframed.

{\tfc The \inframed[foregroundstyle=\BigFont,frame=off]{ 7}\high{th} Seal}
or
{\tfc The \inframed[foregroundstyle=\BigFont,frame=off]{ 7\high{th}} Seal}

depending on what you want.


> is \startalignment used for this?

I think that startalignment is only for horizontal alignment, but I 
may be wrong here.

Aditya

-- 
Aditya Mahajan, EECS Systems, University of Michigan
http://www.eecs.umich.edu/~adityam || Ph: 7342624008

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

* Re: vertically centered aligment of different sized texts
  2006-05-17  0:02 ` Aditya Mahajan
@ 2006-05-17 16:28   ` Willi Egger
  2006-05-17 16:53     ` Taco Hoekwater
  2006-05-17 20:19     ` frantisek holop
  0 siblings, 2 replies; 12+ messages in thread
From: Willi Egger @ 2006-05-17 16:28 UTC (permalink / raw)


Hi,

Vertical positioning requires a \strut as an anchor. Hereafter you might 
use \vfill .... \vfill

\starttext
    \strut
    \vfill
        Your Text
    \vfill
\stoptext

Willi

Aditya Mahajan wrote:
> On Wed, 17 May 2006, frantisek holop wrote:
>
>   
>> hi there,
>>
>> another question to which shamefully i cannot find the answer.
>> perhaps it's just too late...
>>
>>
>> consider the following example:
>>
>>
>> \definefont[BigFont][Regular sa 3]
>> \starttext
>> {\tfc The {\BigFont 7}\high{th} Seal}
>> \stoptext
>>
>>
>> how can i make that line vertically centered, like
>>    --,
>> the  /th seal
>>    /
>>
>> :)
>>
>>     
>
> I do not know if this is the best way to do this, but you can exploit 
> inframed.
>
> {\tfc The \inframed[foregroundstyle=\BigFont,frame=off]{ 7}\high{th} Seal}
> or
> {\tfc The \inframed[foregroundstyle=\BigFont,frame=off]{ 7\high{th}} Seal}
>
> depending on what you want.
>
>
>   
>> is \startalignment used for this?
>>     
>
> I think that startalignment is only for horizontal alignment, but I 
> may be wrong here.
>
> Aditya
>
>   

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

* Re: vertically centered aligment of different sized texts
  2006-05-17 16:28   ` Willi Egger
@ 2006-05-17 16:53     ` Taco Hoekwater
  2006-05-17 20:15       ` frantisek holop
  2006-05-17 20:19     ` frantisek holop
  1 sibling, 1 reply; 12+ messages in thread
From: Taco Hoekwater @ 2006-05-17 16:53 UTC (permalink / raw)



>
>how can i make that line vertically centered, like
>   --,
>the  /th seal
>   /
>
>:)

Abusing math mode is easiest:

   \def\vcentered#1%
     {\dontleavehmode\mathematics{\vcenter{\hbox{#1}}}}
   \starttext
   {\tfc The \vcentered{{\BigFont 7}\high{th}} Seal}
   \stoptext


Cheers, Taco

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

* Re: vertically centered aligment of different sized texts
  2006-05-17 16:53     ` Taco Hoekwater
@ 2006-05-17 20:15       ` frantisek holop
  2006-05-18  6:48         ` Taco Hoekwater
  0 siblings, 1 reply; 12+ messages in thread
From: frantisek holop @ 2006-05-17 20:15 UTC (permalink / raw)


hmm, on Wed, May 17, 2006 at 06:53:47PM +0200, Taco Hoekwater said that
> Abusing math mode is easiest:
> 
>    \def\vcentered#1%
>      {\dontleavehmode\mathematics{\vcenter{\hbox{#1}}}}
>    \starttext
>    {\tfc The \vcentered{{\BigFont 7}\high{th}} Seal}
>    \stoptext

thanks a lot.
but if this is the "easiest" then what is the hardest? :)

i certainly envy the html/css people here.
some things are just much more easier.
of course, don't get me wrong, with less
powerful constructs come the limitations.

-f
-- 
will global warming cancel nuclear winter?

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

* Re: vertically centered aligment of different sized texts
  2006-05-17 16:28   ` Willi Egger
  2006-05-17 16:53     ` Taco Hoekwater
@ 2006-05-17 20:19     ` frantisek holop
  1 sibling, 0 replies; 12+ messages in thread
From: frantisek holop @ 2006-05-17 20:19 UTC (permalink / raw)


hmm, on Wed, May 17, 2006 at 06:28:51PM +0200, Willi Egger said that
> Hi,
> 
> Vertical positioning requires a \strut as an anchor. Hereafter you might 
> use \vfill .... \vfill
> 
> \starttext
>     \strut
>     \vfill
>         Your Text
>     \vfill
> \stoptext

i think this is something else.  this centers the line in some context,
but not the contents of the line if the line contains fonts in different
sizes.

i used to use this construct even in latex, very good for title pages,
but intead of \strut i just put a used a non breakable space: ~

-f
-- 
1 + 2 = 3; therefore, 4 + 5 = 6.

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

* Re: vertically centered aligment of different sized texts
  2006-05-17 20:15       ` frantisek holop
@ 2006-05-18  6:48         ` Taco Hoekwater
  2006-05-18  9:46           ` frantisek holop
  0 siblings, 1 reply; 12+ messages in thread
From: Taco Hoekwater @ 2006-05-18  6:48 UTC (permalink / raw)


frantisek holop wrote:
> hmm, on Wed, May 17, 2006 at 06:53:47PM +0200, Taco Hoekwater said that
> 
>>Abusing math mode is easiest:
>>
>>   \def\vcentered#1%
>>     {\dontleavehmode\mathematics{\vcenter{\hbox{#1}}}}
>>   \starttext
>>   {\tfc The \vcentered{{\BigFont 7}\high{th}} Seal}
>>   \stoptext
> 
> 
> thanks a lot.
> but if this is the "easiest" then what is the hardest? :)

The mathematical center of the line is not necesarily the
optical center, so a somewhat more correct approach would
put all the stuff in an \hbox and then compute manually
how far it has to drop down.

For a more pleasing look, it would perhaps be even better
to line up a normal '7' as if it was an oldstyle numeral,
and then enlarging it while keeping the same vertical
alignment ratio.

Cheers, Taco

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

* Re: vertically centered aligment of different sized texts
  2006-05-18  6:48         ` Taco Hoekwater
@ 2006-05-18  9:46           ` frantisek holop
  2006-05-18  9:57             ` Hans Hagen
  2006-05-18 10:08             ` Taco Hoekwater
  0 siblings, 2 replies; 12+ messages in thread
From: frantisek holop @ 2006-05-18  9:46 UTC (permalink / raw)


hmm, on Thu, May 18, 2006 at 08:48:23AM +0200, Taco Hoekwater said that
> The mathematical center of the line is not necesarily the
> optical center, so a somewhat more correct approach would
> put all the stuff in an \hbox and then compute manually
> how far it has to drop down.

i haven't used latex for quite some time now, so i can't
recall how problematic it was to accomplish something like this,
but i find it interesting that there is no easy approach to this.

> For a more pleasing look, it would perhaps be even better
> to line up a normal '7' as if it was an oldstyle numeral,
> and then enlarging it while keeping the same vertical
> alignment ratio.

i've tried the old style numeral but i didn't like it.
by "keeping the same vertical alignment ratio" do you
mean something like \raise?

-f
-- 
i thank my lucky stars i'm not superstitious.

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

* Re: vertically centered aligment of different sized texts
  2006-05-18  9:46           ` frantisek holop
@ 2006-05-18  9:57             ` Hans Hagen
  2006-05-18 10:29               ` frantisek holop
  2006-05-18 10:08             ` Taco Hoekwater
  1 sibling, 1 reply; 12+ messages in thread
From: Hans Hagen @ 2006-05-18  9:57 UTC (permalink / raw)


frantisek holop wrote:
> hmm, on Thu, May 18, 2006 at 08:48:23AM +0200, Taco Hoekwater said that
>   
>> The mathematical center of the line is not necesarily the
>> optical center, so a somewhat more correct approach would
>> put all the stuff in an \hbox and then compute manually
>> how far it has to drop down.
>>     
>
> i haven't used latex for quite some time now, so i can't
> recall how problematic it was to accomplish something like this,
> but i find it interesting that there is no easy approach to this.
>   
there probably is, so can you describe your problem in more detail? 
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
-----------------------------------------------------------------

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

* Re: vertically centered aligment of different sized texts
  2006-05-18  9:46           ` frantisek holop
  2006-05-18  9:57             ` Hans Hagen
@ 2006-05-18 10:08             ` Taco Hoekwater
  1 sibling, 0 replies; 12+ messages in thread
From: Taco Hoekwater @ 2006-05-18 10:08 UTC (permalink / raw)




frantisek holop wrote:
> i've tried the old style numeral but i didn't like it.
> by "keeping the same vertical alignment ratio" do you
> mean something like \raise?

Take the 'normal' 7 in the 'normal' tf size, but place it
as if it was an old-style numeral (using something like 
\lower2pt\hbox{7}). Measure the height of the result box.
Now you have a  box that is say 4.5pt above (and 2pt below
the baseline). Create a new box with the 7 in the increased
font size, and use \lower to make sure that 4.5/6 of it is
above the baseline.  You asked for 'complicated', right?

Taco

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

* Re: vertically centered aligment of different sized texts
  2006-05-18  9:57             ` Hans Hagen
@ 2006-05-18 10:29               ` frantisek holop
  2006-05-18 14:42                 ` Hans Hagen
  0 siblings, 1 reply; 12+ messages in thread
From: frantisek holop @ 2006-05-18 10:29 UTC (permalink / raw)


hmm, on Thu, May 18, 2006 at 11:57:47AM +0200, Hans Hagen said that
> > i haven't used latex for quite some time now, so i can't
> > recall how problematic it was to accomplish something like this,
> > but i find it interesting that there is no easy approach to this.
> >   
> there probably is, so can you describe your problem in more detail? 
> Hans 


when i tried to explain it, i found out that i lack a lot
of printing jargon :)

so here's just a link for a pdf which
uses Taco's mathmode vcentered macro.

http://obiit.org/minusf/tex/7th-seal.pdf
http://obiit.org/minusf/tex/7th-seal.tex


basically it's just having different sized
fonts aligned based on the bigest one, vertically centered

-f
--  
when all think alike, then no one is thinking.

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

* Re: vertically centered aligment of different sized texts
  2006-05-18 10:29               ` frantisek holop
@ 2006-05-18 14:42                 ` Hans Hagen
  0 siblings, 0 replies; 12+ messages in thread
From: Hans Hagen @ 2006-05-18 14:42 UTC (permalink / raw)


frantisek holop wrote:
> hmm, on Thu, May 18, 2006 at 11:57:47AM +0200, Hans Hagen said that
>   
>>> i haven't used latex for quite some time now, so i can't
>>> recall how problematic it was to accomplish something like this,
>>> but i find it interesting that there is no easy approach to this.
>>>   
>>>       
>> there probably is, so can you describe your problem in more detail? 
>> Hans 
>>     
>
>
> when i tried to explain it, i found out that i lack a lot
> of printing jargon :)
>
> so here's just a link for a pdf which
> uses Taco's mathmode vcentered macro.
>
> http://obiit.org/minusf/tex/7th-seal.pdf
> http://obiit.org/minusf/tex/7th-seal.tex
>
>
> basically it's just having different sized
> fonts aligned based on the bigest one, vertically centered
>
>   
taco's solution is pretty clean and texie; (btw, in supp-box you can 
find many boxing macros, but it's hard to keep an overview of what is 
needed and provided since each situation differs)


-- 

-----------------------------------------------------------------
                                          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
-----------------------------------------------------------------

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

end of thread, other threads:[~2006-05-18 14:42 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-05-16 23:50 vertically centered aligment of different sized texts frantisek holop
2006-05-17  0:02 ` Aditya Mahajan
2006-05-17 16:28   ` Willi Egger
2006-05-17 16:53     ` Taco Hoekwater
2006-05-17 20:15       ` frantisek holop
2006-05-18  6:48         ` Taco Hoekwater
2006-05-18  9:46           ` frantisek holop
2006-05-18  9:57             ` Hans Hagen
2006-05-18 10:29               ` frantisek holop
2006-05-18 14:42                 ` Hans Hagen
2006-05-18 10:08             ` Taco Hoekwater
2006-05-17 20:19     ` frantisek holop

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).