[NTG-context] Spacing after defined word: beginner's question

Aditya Mahajan adityam at umich.edu
Mon Dec 25 18:42:26 CET 2006


On Mon, 25 Dec 2006, cormullion at mac.com wrote:

> This must be a beginner's question, but I can't find the answer to it 
> in the manuals...

:) Read below.

> Take this ConTeXt source:
> 
> --
> \def\Acme{%
> 	{\ss\sc ACME}}
> 
> Welcome from \Acme. \Acme make fine products.
> 
> When this is made into a PDF, it looks like this:
> --
> Welcome from ACME. ACMEmake fine products.
>
> [snip]
>
> What am I doing wrong?

You are not doing anything wrong. This is how TeX operates. A macro 
with no argument gobbles the spaces after it. One way to ensure that 
you get a space is to tell TeX that you are done with the macro, for 
example

Welcome from \Acme. \Acme{} makes fine products.

or

Welcome from \Acme. \Acme\ makes fine products.

After a while you get used to adding a \ where you want. There is an 
automated way, but it is (and will remain) undocumented. You can 
append \autoinsertnextspace at the end of your macro. So, something 
like

\def\Acme{{\ss\sc ACME}\autoinsertnextspace}

The reason that this is undocumented is because it makes it harder for 
other parsers to parse TeX.

BTW, ConTeXt has a sorting and "abbreviation" mechanism for the kind 
of thing that you are doing. With \definesorting or \abbreviation, you 
can also get a list of logos or list of abbreviations free of cost :). 
Look up the manual for details. And as a futher incentive, you can use

\setupsorting[logo][next=\autoinsertnextspace]

to get the behaviour you want.

Aditya


More information about the ntg-context mailing list