ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Spacing after defined word: beginner's question
@ 2006-12-25 16:45 cormullion
  2006-12-25 17:42 ` Aditya Mahajan
  2006-12-25 18:04 ` Wolfgang Schuster
  0 siblings, 2 replies; 3+ messages in thread
From: cormullion @ 2006-12-25 16:45 UTC (permalink / raw)


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?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Spacing after defined word: beginner's question
  2006-12-25 16:45 Spacing after defined word: beginner's question cormullion
@ 2006-12-25 17:42 ` Aditya Mahajan
  2006-12-25 18:04 ` Wolfgang Schuster
  1 sibling, 0 replies; 3+ messages in thread
From: Aditya Mahajan @ 2006-12-25 17:42 UTC (permalink / raw)


On Mon, 25 Dec 2006, cormullion@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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Spacing after defined word: beginner's question
  2006-12-25 16:45 Spacing after defined word: beginner's question cormullion
  2006-12-25 17:42 ` Aditya Mahajan
@ 2006-12-25 18:04 ` Wolfgang Schuster
  1 sibling, 0 replies; 3+ messages in thread
From: Wolfgang Schuster @ 2006-12-25 18:04 UTC (permalink / raw)


On Mon, 25 Dec 2006 16:45:15 +0000
cormullion@mac.com 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-12-25 18:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-12-25 16:45 Spacing after defined word: beginner's question cormullion
2006-12-25 17:42 ` Aditya Mahajan
2006-12-25 18:04 ` Wolfgang Schuster

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).