ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Unexpected emergency stop
@ 2018-02-09 18:03 Tim Steenvoorden
  2018-02-09 19:49 ` Otared Kavian
  0 siblings, 1 reply; 5+ messages in thread
From: Tim Steenvoorden @ 2018-02-09 18:03 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

Dear all,

After some time I’m back to ConTeXt and I dug up some old macros. I used to
define a \see macro to automatically insert labels like “chapter”, "figure"
etc. in front of a reference based on the structure of the label. Below
you'll find its definition.

It worked in MKIV about two years ago, nevertheless, now ConTeXt hangs when
placing punctuation after the command. I.e. TeX hangs with an emergency
stop (“*" on the terminal) after all files have been processed (after
cont-yes.mkiv is closed).

What am I doing wrong that such a thing happens?

I’m on macOS 10.13.3 with minimals beta 2018.02.09 00:04.

Cheers,
Tim


––––––

\starttext

\definemacro\see[#1:#2]
  {\dosee{#1}{#2}}

\starttexdefinition dosee #1#2
  \doifdefinedelse{in#1}
    {\getvalue{in#1}[#1:#2]}
    {\writestatus{references}{reference format in#1 not defined}
     \in[#1:#2]}
\stoptexdefinition % #3 is optional and gobbled by \in

\definereferenceformat[inchp]
  [text=\word{\labeltext{chapter}}]

\setuplabeltext[en]
  [chapter=Chapter~]

\chapter[chp:first]{First}

Works:
\see[chp:first]

Hangs:
\see[chp:first],

\stoptext

––––––
-- 
----
T.J. Steenvoorden, MSc

PhD Candidate | Radboud University Nijmegen
Faculty of Science | Department of Software Science
Mercator 1 Building | Room 01.08
Toernooiveld 212 | 6525 EC | Nijmegen | The Netherlands
+31 24 365 22 91 | t.steenvoorden@cs.ru.nl

[-- Attachment #1.2: Type: text/html, Size: 2902 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] 5+ messages in thread

* Re: Unexpected emergency stop
  2018-02-09 18:03 Unexpected emergency stop Tim Steenvoorden
@ 2018-02-09 19:49 ` Otared Kavian
  2018-02-10 11:44   ` Tim Steenvoorden
  0 siblings, 1 reply; 5+ messages in thread
From: Otared Kavian @ 2018-02-09 19:49 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

Hi Tim,

Welcome back to ConTeXt!
When one defines a command, in particular when using the brackets […], it is wise to put a percent sign at the end of the line if one changes the line on which the macro is defined.
In your case, saying

\definemacro\see[#1:#2]%
	{\dosee{#1}{#2}}

suppresses the problem you are reporting (at least here on my machine running MacOS 10.13.3 and the latest beta as yours).

Best regards: OK 

> On 9 Feb 2018, at 19:03, Tim Steenvoorden <tim.steenvoorden@gmail.com> wrote:
> 
> Dear all,
> 
> After some time I’m back to ConTeXt and I dug up some old macros. I used to define a \see macro to automatically insert labels like “chapter”, "figure" etc. in front of a reference based on the structure of the label. Below you'll find its definition.
> 
> It worked in MKIV about two years ago, nevertheless, now ConTeXt hangs when placing punctuation after the command. I.e. TeX hangs with an emergency stop (“*" on the terminal) after all files have been processed (after cont-yes.mkiv is closed).
> 
> What am I doing wrong that such a thing happens?
> 
> I’m on macOS 10.13.3 with minimals beta 2018.02.09 00:04.
> 
> Cheers,
> Tim
> 
> 
> –––––– 
> 
> \starttext
> 
> \definemacro\see[#1:#2]
>   {\dosee{#1}{#2}}
> 
> \starttexdefinition dosee #1#2
>   \doifdefinedelse{in#1}
>     {\getvalue{in#1}[#1:#2]}
>     {\writestatus{references}{reference format in#1 not defined}
>      \in[#1:#2]}
> \stoptexdefinition % #3 is optional and gobbled by \in
> 
> \definereferenceformat[inchp]
>   [text=\word{\labeltext{chapter}}]
> 
> \setuplabeltext[en]
>   [chapter=Chapter~]
> 
> \chapter[chp:first]{First}
> 
> Works:
> \see[chp:first]
> 
> Hangs:
> \see[chp:first],
> 
> \stoptext
> 
> –––––– 
> -- 
> ----
> T.J. Steenvoorden, MSc
> 
> PhD Candidate | Radboud University Nijmegen
> Faculty of Science | Department of Software Science
> Mercator 1 Building | Room 01.08
> Toernooiveld 212 | 6525 EC | Nijmegen | The Netherlands
> +31 24 365 22 91 | t.steenvoorden@cs.ru.nl <mailto:t.steenvoorden@cs.ru.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://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________


[-- Attachment #1.2: Type: text/html, Size: 5772 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] 5+ messages in thread

* Re: Unexpected emergency stop
  2018-02-09 19:49 ` Otared Kavian
@ 2018-02-10 11:44   ` Tim Steenvoorden
  2018-02-10 12:45     ` Wolfgang Schuster
  0 siblings, 1 reply; 5+ messages in thread
From: Tim Steenvoorden @ 2018-02-10 11:44 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

Thanks Otared! Works like a charm!

Out of curiosity, could you explain the mechanics behind this? I know it is
a commonly used trick in TeX macro definitions, but I don’t know how it
changes TeX’s understanding of the tokes it parses.

Cheers,
Tim

Op vr 9 feb. 2018 om 20:50 schreef Otared Kavian <otared@gmail.com>:

> Hi Tim,
>
> Welcome back to ConTeXt!
> When one defines a command, in particular when using the brackets […], it
> is wise to put a percent sign at the end of the line if one changes the
> line on which the macro is defined.
> In your case, saying
>
> \definemacro\see[#1:#2]%
> {\dosee{#1}{#2}}
>
> suppresses the problem you are reporting (at least here on my machine
> running MacOS 10.13.3 and the latest beta as yours).
>
> Best regards: OK
>
> On 9 Feb 2018, at 19:03, Tim Steenvoorden <tim.steenvoorden@gmail.com>
> wrote:
>
> Dear all,
>
> After some time I’m back to ConTeXt and I dug up some old macros. I used
> to define a \see macro to automatically insert labels like “chapter”,
> "figure" etc. in front of a reference based on the structure of the label.
> Below you'll find its definition.
>
> It worked in MKIV about two years ago, nevertheless, now ConTeXt hangs
> when placing punctuation after the command. I.e. TeX hangs with an
> emergency stop (“*" on the terminal) after all files have been processed
> (after cont-yes.mkiv is closed).
>
> What am I doing wrong that such a thing happens?
>
> I’m on macOS 10.13.3 with minimals beta 2018.02.09 00:04.
>
> Cheers,
> Tim
>
>
> ––––––
>
> \starttext
>
> \definemacro\see[#1:#2]
>   {\dosee{#1}{#2}}
>
> \starttexdefinition dosee #1#2
>   \doifdefinedelse{in#1}
>     {\getvalue{in#1}[#1:#2]}
>     {\writestatus{references}{reference format in#1 not defined}
>      \in[#1:#2]}
> \stoptexdefinition % #3 is optional and gobbled by \in
>
> \definereferenceformat[inchp]
>   [text=\word{\labeltext{chapter}}]
>
> \setuplabeltext[en]
>   [chapter=Chapter~]
>
> \chapter[chp:first]{First}
>
> Works:
> \see[chp:first]
>
> Hangs:
> \see[chp:first],
>
> \stoptext
>
> ––––––
> --
> ----
> T.J. Steenvoorden, MSc
>
> PhD Candidate | Radboud University Nijmegen
> Faculty of Science | Department of Software Science
> Mercator 1 Building | Room 01.08
> Toernooiveld 212 | 6525 EC | Nijmegen | The Netherlands
> +31 24 365 22 91 | t.steenvoorden@cs.ru.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://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
>
> ___________________________________________________________________________________

-- 
----
T.J. Steenvoorden, MSc

PhD Candidate | Radboud University Nijmegen
Faculty of Science | Department of Software Science
Mercator 1 Building | Room 01.08
Toernooiveld 212 | 6525 EC | Nijmegen | The Netherlands
+31 24 365 22 91 | t.steenvoorden@cs.ru.nl

[-- Attachment #1.2: Type: text/html, Size: 7835 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] 5+ messages in thread

* Re: Unexpected emergency stop
  2018-02-10 11:44   ` Tim Steenvoorden
@ 2018-02-10 12:45     ` Wolfgang Schuster
  2018-02-10 12:57       ` Tim Steenvoorden
  0 siblings, 1 reply; 5+ messages in thread
From: Wolfgang Schuster @ 2018-02-10 12:45 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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


> Tim Steenvoorden <mailto:tim.steenvoorden@gmail.com>
> 10. Februar 2018 um 12:44
> Thanks Otared! Works like a charm!
>
> Out of curiosity, could you explain the mechanics behind this? I know 
> it is a commonly used trick in TeX macro definitions, but I don’t know 
> how it changes TeX’s understanding of the tokes it parses.

When you create a new commands like this

     \def\mycommand[#1]{...}

the brackets are delimiters for the argument of the command, i.e. when 
TeX sees
\mycommand it looks for [ and grabs everything intill ] as as argument. 
When you
out now a space (or start a new line) after ] in your definition of the 
command, e.g.

     \def\mycommand[#1] {...}

TeX looks now for “] ” (right bracket followed by a space) as delimiter for
the argument of your command.

Wolfgang

[-- Attachment #1.2: Type: text/html, Size: 1890 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] 5+ messages in thread

* Re: Unexpected emergency stop
  2018-02-10 12:45     ` Wolfgang Schuster
@ 2018-02-10 12:57       ` Tim Steenvoorden
  0 siblings, 0 replies; 5+ messages in thread
From: Tim Steenvoorden @ 2018-02-10 12:57 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

Thanks Wolfgang, that’s a clear and easy explanation!

Cheers,
Tim
Op za 10 feb. 2018 om 13:46 schreef Wolfgang Schuster <
schuster.wolfgang@gmail.com>

>
> Tim Steenvoorden <tim.steenvoorden@gmail.com>
> 10. Februar 2018 um 12:44
>
> Thanks Otared! Works like a charm!
>
> Out of curiosity, could you explain the mechanics behind this? I know it
> is a commonly used trick in TeX macro definitions, but I don’t know how it
> changes TeX’s understanding of the tokes it parses.
>
>
> When you create a new commands like this
>
>     \def\mycommand[#1]{...}
>
> the brackets are delimiters for the argument of the command, i.e. when TeX
> sees
> \mycommand it looks for [ and grabs everything intill ] as as argument.
> When you
> out now a space (or start a new line) after ] in your definition of the
> command, e.g.
>
>     \def\mycommand[#1] {...}
>
> TeX looks now for “] ” (right bracket followed by a space) as delimiter for
> the argument of your command.
>
>
> 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
>
> ___________________________________________________________________________________

-- 
----
T.J. Steenvoorden, MSc

PhD Candidate | Radboud University Nijmegen
Faculty of Science | Department of Software Science
Mercator 1 Building | Room 01.08
Toernooiveld 212 | 6525 EC | Nijmegen | The Netherlands
+31 24 365 22 91 | t.steenvoorden@cs.ru.nl

[-- Attachment #1.2: Type: text/html, Size: 4517 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] 5+ messages in thread

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

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-09 18:03 Unexpected emergency stop Tim Steenvoorden
2018-02-09 19:49 ` Otared Kavian
2018-02-10 11:44   ` Tim Steenvoorden
2018-02-10 12:45     ` Wolfgang Schuster
2018-02-10 12:57       ` Tim Steenvoorden

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