* Calculating with variables
@ 2013-11-26 6:59 "H. Özoguz"
2013-11-26 8:54 ` Hans Hagen
0 siblings, 1 reply; 3+ messages in thread
From: "H. Özoguz" @ 2013-11-26 6:59 UTC (permalink / raw)
To: ntg-context
Hello there,
I am new in variables in ConTeXt, so I tried the the following example
of two font-sizes wich should have a ratio of 0.7:
\setvariables[fontsize][bigsize=17pt]
\setvariables[fontsize][smallsize=0.7\getvariable{fontsize}{size}]
\definefont[big][name:arial at \getvariable{fontsize}{bigsize}]
\definefont[small][name:arial at \getvariable{fontsize}{smallsize}]
\starttext
\big Dies ist ein großer Text.\blank
\small Dies ist ein kleiner Text.
\stoptext
That does not work, what is the correct syntax?
[Second question about this will be much more involving I think ... :),
but I will give it his own thread].
Thanks.
Huseyin
___________________________________________________________________________________
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 : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Calculating with variables
2013-11-26 6:59 Calculating with variables "H. Özoguz"
@ 2013-11-26 8:54 ` Hans Hagen
0 siblings, 0 replies; 3+ messages in thread
From: Hans Hagen @ 2013-11-26 8:54 UTC (permalink / raw)
To: ntg-context
On 11/26/2013 7:59 AM, "H. Özoguz" wrote:
> Hello there,
>
> I am new in variables in ConTeXt, so I tried the the following example
> of two font-sizes wich should have a ratio of 0.7:
>
> \setvariables[fontsize][bigsize=17pt]
> \setvariables[fontsize][smallsize=0.7\getvariable{fontsize}{size}]
>
> \definefont[big][name:arial at \getvariable{fontsize}{bigsize}]
> \definefont[small][name:arial at \getvariable{fontsize}{smallsize}]
>
> \starttext
> \big Dies ist ein großer Text.\blank
> \small Dies ist ein kleiner Text.
> \stoptext
>
> That does not work, what is the correct syntax?
should be: "what is my error?" ...
\setvariables[fontsize][smallsize=0.7\getvariable{fontsize}{bigsize}]
(size -> bigsize)
but then the next hurdle is that you get 0.717pt so you need
\setvariables[fontsize][smallsize=\the\dimexpr0.7\dimexpr\getvariable{fontsize}{bigsize}\relax\relax]
which is why the next is better:
\definemeasure[fontsize:big] [17pt]
\definemeasure[fontsize:small][0.7\measured{fontsize:big}]
\definefont[big] [name:arial at \measure{fontsize:big}]
\definefont[small][name:arial at \measure{fontsize:small}]
\starttext
\big Dies ist ein großer Text. \blank
\small Dies ist ein kleiner Text.
\stoptext
Best wikify this!
Alternatively you can set up symbolic sizes (like we already have a b c
d), so that
\definefont[big] [name:arial sa a]
etc can be used
Hans
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
| www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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 : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Calculating with variables
@ 2013-11-26 9:57 "H. Özoguz"
0 siblings, 0 replies; 3+ messages in thread
From: "H. Özoguz" @ 2013-11-26 9:57 UTC (permalink / raw)
To: ntg-context
> which is why the next is better:
>
> \definemeasure[fontsize:big] [17pt]
> \definemeasure[fontsize:small][0.7\measured{fontsize:big}]
>
> \definefont[big] [name:arial at \measure{fontsize:big}]
> \definefont[small][name:arial at \measure{fontsize:small}]
>
> \starttext
> \big Dies ist ein großer Text. \blank
> \small Dies ist ein kleiner Text.
> \stoptext
>
> Best wikify this!
>
> Alternatively you can set up symbolic sizes (like we already have a b c
> d), so that
>
> \definefont[big] [name:arial sa a]
>
> etc can be used
>
> Hans
Thank you! I will wikify it, hopefully in the next days.
Huseyin
___________________________________________________________________________________
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 : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-11-26 9:57 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-26 6:59 Calculating with variables "H. Özoguz"
2013-11-26 8:54 ` Hans Hagen
2013-11-26 9:57 "H. Özoguz"
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).