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

2006-12-25 Thread cormullion
This must be a beginner's question, but I can't find the answer to it  
in the manuals...

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.
--

- because I didn't have a space in the definition, I don't get a  
space in the second sentence, but the period didn't interfere with  
the execution of the first occurrence. But if I put a space in the  
definition after the 'E', I get this:

--
Welcome from ACME . ACME make fine products.
--

- and there's a space after the first 'E', which I don't want, even  
though there is now a space after the second...

What am I doing wrong?
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


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

2006-12-25 Thread Aditya Mahajan
On Mon, 25 Dec 2006, [EMAIL PROTECTED] 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
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


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

2006-12-25 Thread Wolfgang Schuster
On Mon, 25 Dec 2006 16:45:15 +
[EMAIL PROTECTED] wrote:

 This must be a beginner's question, but I can't find the answer to it  
 in the manuals...
 
 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.
 --
 
 - because I didn't have a space in the definition, I don't get a  
 space in the second sentence, but the period didn't interfere with  
 the execution of the first occurrence. But if I put a space in the  
 definition after the 'E', I get this:
 
 --
 Welcome from ACME . ACME make fine products.
 --
 
 - and there's a space after the first 'E', which I don't want, even  
 though there is now a space after the second...
 
 What am I doing wrong?

Hi ???,

TeX ignores spaces after commands. This is now problem when your
command is before an period, comma ...,but it will it up the next space
in a sentence.

You can write you sentence in the following ways:
  Welcome from \Acme. \Acme\ make fine products.
  Welcome from \Acme. \Acme{} make fine products.
  Welcome from \Acme. {\Acme} make fine products.

There is also a predefined command to define and setup your own
abbreviations and syonyms. You can find an example at page 55 in the
beginners manual (ma-cb-en.pdf).

Wolfgang
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context