ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* \quad confusion
@ 2018-12-27  9:43 Floris van Manen
  2018-12-27 10:08 ` Henri Menke
  2018-12-27 10:13 ` Wolfgang Schuster
  0 siblings, 2 replies; 4+ messages in thread
From: Floris van Manen @ 2018-12-27  9:43 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 416 bytes --]

When trying to typeset, luatex kept complaining about incorrect parameters for ‘minus’.
There is no \minus command in the source however.
So it turns out that the combination of using \quad with ‘plus’, 'minus', and some more make the error appear.
If i rewrite minus by {minus} the error does not show up either.


\starttext
\quad minuskel
\stoptext


Where do i go wrong?

Thanks.
Floris


[-- Attachment #1.2: Message signed with OpenPGP using GPGMail --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 492 bytes --]

___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: \quad confusion
  2018-12-27  9:43 \quad confusion Floris van Manen
@ 2018-12-27 10:08 ` Henri Menke
  2018-12-27 10:12   ` Henri Menke
  2018-12-27 10:13 ` Wolfgang Schuster
  1 sibling, 1 reply; 4+ messages in thread
From: Henri Menke @ 2018-12-27 10:08 UTC (permalink / raw)
  To: ntg-context

On 12/27/18 10:43 PM, Floris van Manen wrote:
> When trying to typeset, luatex kept complaining about incorrect parameters for ‘minus’.
> There is no \minus command in the source however.
> So it turns out that the combination of using \quad with ‘plus’, 'minus', and some more make the error appear.
> If i rewrite minus by {minus} the error does not show up either.

That's because the skips in spac-hor.mkiv are defined like this

    \unexpanded\def\enskip{\hskip.5\emwidth}
    \unexpanded\def\quad  {\hskip  \emwidth}
    \unexpanded\def\qquad {\hskip 2\emwidth}

The syntax for the \hskip primitive is

    \hskip<glue>

and the definition of <glue> is

    <dimen>plus<dimen>minus<dimen>

So “\quad minuskel” will expand to “\hskip\emwidth minuskel”.  You see
what's going to happen?  The “minus” will be interpreted as part of the
glue definition but no <dimen> is following it, so you get an error.  To
fix the bug, the definitions in spac-hor.mkiv have to changed

    \unexpanded\def\enskip{\hskip.5\emwidth\relax}
    \unexpanded\def\quad  {\hskip  \emwidth\relax}
    \unexpanded\def\qquad {\hskip 2\emwidth\relax}

As a temporary workaround you can also just copy them into your document.

> 
> 
> \starttext
> \quad minuskel
> \stoptext
> 
> 
> Where do i go wrong?
> 
> Thanks.
> Floris
> 
> 
> ___________________________________________________________________________________
> 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://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________
> 

___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: \quad confusion
  2018-12-27 10:08 ` Henri Menke
@ 2018-12-27 10:12   ` Henri Menke
  0 siblings, 0 replies; 4+ messages in thread
From: Henri Menke @ 2018-12-27 10:12 UTC (permalink / raw)
  To: ntg-context

On 12/27/18 11:08 PM, Henri Menke wrote:
> On 12/27/18 10:43 PM, Floris van Manen wrote:
>> When trying to typeset, luatex kept complaining about incorrect parameters for ‘minus’.
>> There is no \minus command in the source however.
>> So it turns out that the combination of using \quad with ‘plus’, 'minus', and some more make the error appear.
>> If i rewrite minus by {minus} the error does not show up either.
> 
> That's because the skips in spac-hor.mkiv are defined like this
> 
>     \unexpanded\def\enskip{\hskip.5\emwidth}
>     \unexpanded\def\quad  {\hskip  \emwidth}
>     \unexpanded\def\qquad {\hskip 2\emwidth}
> 
> The syntax for the \hskip primitive is
> 
>     \hskip<glue>
> 
> and the definition of <glue> is
> 
>     <dimen>plus<dimen>minus<dimen>
> 
> So “\quad minuskel” will expand to “\hskip\emwidth minuskel”.  You see
> what's going to happen?  The “minus” will be interpreted as part of the
> glue definition but no <dimen> is following it, so you get an error.  To
> fix the bug, the definitions in spac-hor.mkiv have to changed
> 
>     \unexpanded\def\enskip{\hskip.5\emwidth\relax}
>     \unexpanded\def\quad  {\hskip  \emwidth\relax}
>     \unexpanded\def\qquad {\hskip 2\emwidth\relax}
> 
> As a temporary workaround you can also just copy them into your document.

There is even a comment in the TeXbook about this exact issue.

\danger Horizontal glue is created in the same way, but with ^|\hskip|
instead of\/ ^|\vskip|. For example, plain \TeX\ defines ^|\enskip| as an
abbreviation for the command `|\hskip.5em\relax|'; this skips
horizontally by
one ``^{en},'' i.e., by exactly half of an em in the current font. There
is no
stretching or shrinking in an |\enskip|. The control sequence ^|\relax|
after `|.5em|' prevents \TeX\ from thinking that a ^{keyword}
is present, in case the text following |\enskip| just happens to begin
with `|plus|' or `|minus|'.

> 
>> 
>> 
>> \starttext
>> \quad minuskel
>> \stoptext
>> 
>> 
>> Where do i go wrong?
>> 
>> Thanks.
>> Floris
>> 
>> 
>> ___________________________________________________________________________________
>> 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://context.aanhet.net
>> archive  : https://bitbucket.org/phg/context-mirror/commits/
>> wiki     : http://contextgarden.net
>> ___________________________________________________________________________________
>> 
> 

___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: \quad confusion
  2018-12-27  9:43 \quad confusion Floris van Manen
  2018-12-27 10:08 ` Henri Menke
@ 2018-12-27 10:13 ` Wolfgang Schuster
  1 sibling, 0 replies; 4+ messages in thread
From: Wolfgang Schuster @ 2018-12-27 10:13 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Floris van Manen

Floris van Manen schrieb am 27.12.18 um 10:43:
> When trying to typeset, luatex kept complaining about incorrect parameters for ‘minus’.
> There is no \minus command in the source however.
> So it turns out that the combination of using \quad with ‘plus’, 'minus', and some more make the error appear.
> If i rewrite minus by {minus} the error does not show up either.
>
> \starttext
> \quad minuskel
> \stoptext
>
> Where do i go wrong?

There is nothing wrong with your example but the definition for \quad isn’t.

The \quad command uses the \hskip primitive which accepts besides the 
normal values which is inserted between the content also a variable part 
to shrink or stretch the inserted space. This variable part uses the 
“plus” and “minus” keywords (e.g. \hskip 1em minus .2em) which leads to 
the problem in your case.

One could stop TeX from parsing for the optional keywords with a 
delimiter for the \hskip command but this delimiter is missing in the 
definition for \quad. I’ll send a fix to the dev list and the problem 
should be fixed in the next beta but for the meantime you can add \relax 
after \quad (i.e. \quad\relax ...) to get rid of the error.

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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

end of thread, other threads:[~2018-12-27 10:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-27  9:43 \quad confusion Floris van Manen
2018-12-27 10:08 ` Henri Menke
2018-12-27 10:12   ` Henri Menke
2018-12-27 10:13 ` 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).