[NTG-context] starttexdefinition error in standalone, works in TL2013

Wolfgang Schuster schuster.wolfgang at gmail.com
Sat Mar 1 13:32:17 CET 2014


Am 27.02.2014 um 05:08 schrieb Rik Kabel <context at rik.users.panix.com>:

> The following code processes cleanly under TL2013 and fails with ConTeXt  ver: 2014.02.14 17:07 MKIV beta  fmt: 2014.2.16  int: english/english. I suspect a regression, but I am also open to being told that I am doing things incorrectly.

The \starttexdefinition was extended after the texlive release to support keywords like global or expanded and has therefore changed since then. The reason why it fails is that context passes the argument to Lua where they are parsed and at this point macros like your \EndTranslation are expanded. Even though this can be fixed I think it’s better to use the normal \def command when you want to create delimited commands.

> I also notice that it fails (even under TL2013) if a space is inserted after [#SETUP] in the doTrans intro. I thought that spaces should be allowed in \starttexdefinition -- is this only in the body and not the parameter description?

No, spaces between arguments aren’t ignored but no spaces are added at the end of each line in the replacement text.

\starttexdefinition Test #1 #2
  “#2” “#1”
\stoptexdefinition

\starttext

\Test ab cd

\stoptext

BTW: It’s better to follow contexts rules and use start/stop for environments, this way you can make use of the buffer mechanism to store text.

\unexpanded\def\startTranslation
  {\begingroup
   \dosingleempty\dostartTranslation}

\def\dostartTranslation[#1]%
  {\iffirstargument
     \getrawparameters[Translation][setups=,language=en,#1]%
   \fi
   \grabbufferdata[Translation][startTranslation][stopTranslation]}

\def\stopTranslation
  {\language[\Translationlanguage]%
   \Translationsetups
   (\,\getbufferdata[Translation]\removeunwantedspaces\,)%
   \endgroup}

\starttext

\startTranslation[language=nl]
It betrays a slow-witted mentality to pursue the streams, but not to see the sources of things.
\stopTranslation

\stoptext

Wolfgang


More information about the ntg-context mailing list