ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* "Missing number, treated as zero" error when using \definefont with \define'd dimension
@ 2013-03-21 19:58 Lars Huttar
  2013-03-21 20:03 ` Wolfgang Schuster
  0 siblings, 1 reply; 2+ messages in thread
From: Lars Huttar @ 2013-03-21 19:58 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hello,

I reported a Missing Number error back in December (thread at
http://www.ntg.nl/pipermail/ntg-context/2012/070471.html) but got
sidetracked on another issue before finding a resolution.
Now I'm back to the Missing Number error, and I have a short example
that reproduces it:

  \define\largefontsize{13pt}

  % Works fine: \definefont[SerifL][Arial at 13pt]
  % Leads to error:
  \definefont[SerifL][Arial at \largefontsize]

  % "Missing number, treated as zero" error thrown on the following line:
  \starttext \SerifL{Hello} \stoptext

Note that the SerifL font definition works fine (no error) if I
hard-code in "13pt" instead of using an intervening \largefontsize
definition. But if I hard-code the point size, it would hamper the
modularity of our font configuration and the use of modes in which
different size fonts are used.

Maybe \define is just the wrong command to use when creating an
identifier for a specified dimension?
I tried changing it to \def and the error went away!

I looked up the documentation of \define
(http://wiki.contextgarden.net/Command/define) and \def, and couldn't
find any obvious difference, except that \def is TeX and \define is
ConTeXt. The wiki page I just linked to mentions differences between
MkII and MkIV, but this error occurs in both (in XeTeX and LuaTeX).

Can someone help me understand why I should not use \define for this
case? (Or in general, when I should not use \define?) Or does the
problem lie somewhere else?

Thanks,
Lars

___________________________________________________________________________________
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] 2+ messages in thread

* Re: "Missing number, treated as zero" error when using \definefont with \define'd dimension
  2013-03-21 19:58 "Missing number, treated as zero" error when using \definefont with \define'd dimension Lars Huttar
@ 2013-03-21 20:03 ` Wolfgang Schuster
  0 siblings, 0 replies; 2+ messages in thread
From: Wolfgang Schuster @ 2013-03-21 20:03 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 21.03.2013 um 20:58 schrieb Lars Huttar <lars_huttar@sil.org>:

> Hello,
> 
> I reported a Missing Number error back in December (thread at
> http://www.ntg.nl/pipermail/ntg-context/2012/070471.html) but got
> sidetracked on another issue before finding a resolution.
> Now I'm back to the Missing Number error, and I have a short example
> that reproduces it:
> 
>  \define\largefontsize{13pt}
> 
>  % Works fine: \definefont[SerifL][Arial at 13pt]
>  % Leads to error:
>  \definefont[SerifL][Arial at \largefontsize]
> 
>  % "Missing number, treated as zero" error thrown on the following line:
>  \starttext \SerifL{Hello} \stoptext
> 
> Note that the SerifL font definition works fine (no error) if I
> hard-code in "13pt" instead of using an intervening \largefontsize
> definition. But if I hard-code the point size, it would hamper the
> modularity of our font configuration and the use of modes in which
> different size fonts are used.
> 
> Maybe \define is just the wrong command to use when creating an
> identifier for a specified dimension?
> I tried changing it to \def and the error went away!
> 
> I looked up the documentation of \define
> (http://wiki.contextgarden.net/Command/define) and \def, and couldn't
> find any obvious difference, except that \def is TeX and \define is
> ConTeXt. The wiki page I just linked to mentions differences between
> MkII and MkIV, but this error occurs in both (in XeTeX and LuaTeX).
> 
> Can someone help me understand why I should not use \define for this
> case? (Or in general, when I should not use \define?) Or does the
> problem lie somewhere else?

Commands created with \define aren’t expandable, i.e. when the content
of \definefont is passed to Lua \largefontsize remains a TeX macro and isn’t
converted to the dimension. To get a expandable macro use \defineexpandable
to create \largefontsize (untested).

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  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

end of thread, other threads:[~2013-03-21 20:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-21 19:58 "Missing number, treated as zero" error when using \definefont with \define'd dimension Lars Huttar
2013-03-21 20:03 ` Wolfgang Schuster

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