Calculating with variables
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
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 -----------------------------------------------------------------
participants (2)
-
"H. Özoguz"
-
Hans Hagen