\startframed spurious whitespace
There appears to be a bug with \startframed. In the following example, the instance with no optional argument sets correctly, while with the use of an optional argument (even empty []) a whitespace is introduced before the text. \starttext \startframed[] Why a space? \stopframed \startframed This is ok. \stopframed \stoptext -- Rik
Am 23.07.2014 03:20, schrieb Rik Kabel:
There appears to be a bug with \startframed. In the following example, the instance with no optional argument sets correctly, while with the use of an optional argument (even empty []) a whitespace is introduced before the text.
\starttext \startframed[] Why a space? \stopframed
TeX reads "\startframed[] Why a space? \stopframed" A linebreak is replaced by a space and spaces at the beginning of a line are ignored by default. Without the optional [] TeX reads "\startframed Why a space? \stopframed" The first space is "eaten" by TeX while parsing the macro name. \startframed[]% ignore the space Why a space? \stopframed It is the same behaviour as for \startframed{} ...
\startframed This is ok. \stopframed \stoptext
This is also not correct, you should use: \startframed This is ok.% \stopframed \stoptext Otherwise you'll get a space after the dot. Herbert
On 2014-07-23 02:20, Herbert Voss wrote:
Am 23.07.2014 03:20, schrieb Rik Kabel:
There appears to be a bug with \startframed. In the following example, the instance with no optional argument sets correctly, while with the use of an optional argument (even empty []) a whitespace is introduced before the text.
\starttext \startframed[] Why a space? \stopframed TeX reads "\startframed[] Why a space? \stopframed" A linebreak is replaced by a space and spaces at the beginning of a line are ignored by default. Without the optional [] TeX reads "\startframed Why a space? \stopframed" The first space is "eaten" by TeX while parsing the macro name.
\startframed[]% ignore the space Why a space? \stopframed
It is the same behaviour as for \startframed{} ...
Yes. TeX does read it that way. I have written LaTeX packages and know the issues. ConTeXt, on the other hand, makes an extra effort, at least with the start/stop commands, to do it differently. That is one of the primary benefits, to my mind, of using \starttexdefinition...\stoptexdefinition instead of \def. Perhaps I am extending my expectation of that improved behavior to \startframed[], but it is not, I think, an unreasonable hope.
\startframed This is ok. \stopframed \stoptext
This is also not correct, you should use:
\startframed This is ok.% \stopframed \stoptext
Otherwise you'll get a space after the dot.
In a real document I would likely use \par or a blank line at that point, but I was trying to provide a DWE (demonstrative working example), if not a MWE, to show the issue with the leading space. Line-feed hiding with % does not belong in the content of the document unless one chooses to drop back to TeX instead of writing within the ConTeXt package.
Herbert
-- Rik
participants (2)
-
Herbert Voss
-
Rik Kabel