Difference between revisions of "autoinsertnextspace"

From Wiki
Jump to navigation Jump to search
m
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
The macro
 
autoinsertnextspace
 
 
The macro {{cmd|autoinsertnextspace}} conditionally adds a space, depending on the next token.  
 
The macro {{cmd|autoinsertnextspace}} conditionally adds a space, depending on the next token.  
 
This is very useful when defining macro commands as short hands for text (or other expressions used within text), since by default TeX ignores spaces after a command macro. Compare the following two definitions.
 
This is very useful when defining macro commands as short hands for text (or other expressions used within text), since by default TeX ignores spaces after a command macro. Compare the following two definitions.
Line 20: Line 18:
 
\stoptext
 
\stoptext
 
</context>
 
</context>
 +
 +
[[Category:Basics]]

Latest revision as of 16:06, 8 June 2020

The macro \autoinsertnextspace conditionally adds a space, depending on the next token. This is very useful when defining macro commands as short hands for text (or other expressions used within text), since by default TeX ignores spaces after a command macro. Compare the following two definitions.

\define\myBla{blablabla\autoinsertnextspace}
\define\myBadBla{blablabla}

\starttext

With \type{\myBla}:

Watch the space after \myBla which makes this sentence meaningful. And watch also the lack of space before the period when we say \myBla.

With \type{\myBadBla}:

Watch the lack of space after \myBadBla which makes this sentence difficult to read. 

\stoptext