Difference between revisions of "autoinsertnextspace"

From Wiki
Jump to navigation Jump to search
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.

Revision as of 19:45, 27 August 2015

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