[NTG-context] \autoinsertedspace fails

Hans Hagen j.hagen at freedom.nl
Thu Jan 5 10:35:02 CET 2023


On 1/5/2023 4:21 AM, Rik Kabel via ntg-context wrote:
> 
> On 2023-01-04 18:45, Hans Hagen wrote:
>> On 1/4/2023 11:10 PM, Rik Kabel via ntg-context wrote:
>>> No change with the latest (2023.01.04).
>>>
>>> Is this a problem with what I am doing, or a bug?
>> well, it's new and not thtat tested ... we need to specify it
>>
>> This\optionalspace fails unexpectedly with autoinsertedspace.\par
>> This\optionalspace \emph{fails unexpectedly} with autoinsertedspace.\par
>>
>> there can be more variants, like do we want to remove preceding spaces?
>>
>> we already have:
>>
>> This\optionalspace, fails unexpectedly with autoinsertedspace.\par
>> This\optionalspace, \emph{fails unexpectedly} with autoinsertedspace.\par
>> This\optionalspace fails unexpectedly with autoinsertedspace.\par
>> This\optionalspace \emph{fails unexpectedly} with autoinsertedspace.\par
> 
> 
> \optionalspace works correctly (that is, as I want it to) for all of my 
> use cases under both MkIV and LMTX. Is there any reason that this should 
> not be used in user documents?
> 
> I do wonder what characters are considered "punctuation" for the purpose 
> of suppressing the next space. The standard six sentence termination 
> characters (?!.:;,) are honored, and so are many others (quotation 
> marks, including guillemot, square and curly braces, and parens). But 
> sentence opening characters (¿¡) are as well. Vertical bars (|¦) and 
> basic mathematical characters (+-=*) are not treated as punctuation. 
> Where (in the source or manuals) are these to be found?
> 
> As far as removing leading spaces, I do not see that it is necessary, 
> but it may help create more readable sources.
> 
> Thank you for the fix.
Here is a more lmtx-ish variant:

\starttexdefinition tolerant protected BD #=#*#=
    \removeunwantedspaces
    \space % insert a space
    (
    \ifparameter#2\or
        #1|–|#2
    \orelse\ifparameter#1\or
        #1–
    \else
        {\red I NEED A DATE OR DATES!}
    \fi
    )
    \autoinsertedspace
\stoptexdefinition

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------



More information about the ntg-context mailing list