[texworks] New Command question from beginner

Philip TAYLOR P.Taylor at Rhul.Ac.Uk
Sun Nov 25 23:39:46 CET 2012



Schor, Robert H wrote:

> \newcommand{VIs}{VI\hspace{1pt}s}

> Is there a way to define the command so that the characters being output
> will “respect” subsequent white space?  [I’ve done a quick Google
> search, but am new enough to TeX and LaTeX to not know what search terms
> to use].

All control words eat spaces by default (a control word consists of
a leading escape character followed by one or more letters).  There
is no simple way of avoiding this behaviour as it occurs before your
code has any chance to exercise control.  Therefore you have to
resort to workarounds such as

1) Use the control word in braces :

	Labview makes considerable use of {\VIs} in <whatever>

2) Follow the control word with braces :

	Labview makes considerable use of \VIs{} in <whatever>

3) Make the control word a delimited macro :

	\def \VIs.{VI\hskip 1 pt s}

and then use it accordingly (and consistently)

	Labview makes considerable use of \VIs. in <whatever>

4) Eschew mnemonic names and make use of a control symbol instead :

	\def \1{VI\hskip 1 pt s}

	Labview makes considerable use of \1 in <whatever>

5) Give up raw TeX markup and use HTML-like markup instead :

	\catcode `\< = \active
	\def <#1>{\csname #1\endcsname}

	Labview makes considerable use of <VIs> in <whatever>

Probably many more, but they may give you some ideas.  None rely
on intrinsic LaTeX functionality, all are Plain-TeX based.

Philip Taylor



More information about the texworks mailing list