Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Does a space always belong after pt, e.g. as used in \hskip1pt? If a space is used, are there situations where a space will appear where it is not intended? If no space is used, will pt be unrecognized, e.g., if a letter immediately follows, as in 1ptThe?

share|improve this question
add comment

2 Answers 2

up vote 15 down vote accepted

By the syntax rules of TeX, any length specification allows an optional space after it which is ignored.

The space is always looked for performing macro expansion, which ends when a space or another unexpandable token is found. A space token is then ignored.

So \hskip1pt Then and \hskip1ptThen are perfectly equivalent (but the latter requires a tiny bit of machine work more than the former, because the token T must be put back in the input stream).

However, you should remember that a <skip> specification doesn't end with the 1pt tokens: TeX looks also for a possible plus keyword (or minus, which is looked for after plus <dimen> anyway. So

\hskip1pt plus two

is not equivalent to

\hskip1pt\relax plus two

The former will result in a Missing number error.

So it's best to end incomplete <skip> specifications with \relax, particularly when they are in a macro that might be expanded when there's no full control of the following tokens (see exercise 27.4 in the TeXbook).

share|improve this answer
add comment

The following should answer your question:

enter image description here

\documentclass{article}
\setlength{\parindent}{0pt}% Just for this example
\begin{document}
aaa\hskip20ptbbb \par
aaa\hskip20pt bbb \par
aaa\hskip 20ptbbb \par
aaa\hskip 20pt bbb \par
aaa\rule{20pt}{.4pt}bbb
\end{document}​

It boils down to readability of your code. In that sense, separating lengths from other document elements ("option" 2 & 4 above) makes sense.

Of course, if your editor has syntax highlighting, then perhaps you can live with all possibilities.

share|improve this answer
2  
Even if OP's editor has syntax highlighting, one cannot be sure editors of everybdy who might want to change the file have. Therefore code reability is important even if editor can make a non-readable code better. –  Boris Apr 4 '12 at 2:25
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.