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.

In this answer, \@ is used after a period and before an \xspace, presumably to indicate that the preceding period (in "etc.") was not sentence-final.

In these tips, \@ is used before a period and after capital letters, to indicate that the preceding capital letters are sentence final.

Since \@ is rather difficult to search for online, I thought I'd try to ask here: what exactly does \@ do, and how do you use it properly/consistently? For instance, how should you input the following farcical sentence?

Languages like JS, HTML, etc. were not used by King Henry III.

EDIT: I'm accepting Barbara's answer below as it (and the comments on it) indicate the initial intent of \@: "the period which follows is sentence-final". Its counterpart is \  (slash-space), which says "the period which precedes is sentence-medial". Egreg's answer explains in far more detail exactly how \@ and \spacefactor work to cause the effects seen by \@ and \  after lower- and upper-case letters and punctuation. Both are very helpful answers.

Two correct answers to my made-up sentence above is

Languages like JS, HTML, etc.\ were not used by King Henry III\@.
Languages like JS, HTML, etc.\@ were not used by King Henry III\@.

The former is arguably "better style", while the latter demonstrably produces the correct result even if it seems less consistent about placement of \@ versus periods. And a safe but slightly redundant answer blindly adds \@ before every comma:

Languages like JS\@, HTML\@, etc.\ were not used by King Henry III\@.

This last one is amenable to macro-izing: \def\acronym#1{\textbf{#1}\@\xspace} (or whatever style you'd prefer), where the \xspace disappears if the next character is punctuation, and the \@ ensures that subsequent punctuation thinks it follows a lowercase word and not an uppercase initial.

share|improve this question
add comment

2 Answers

up vote 16 down vote accepted

i find the cited answer rather confusing, if not out-and-out backwards. \@ before punctuation says that the period does fall at the end of a sentence. to quote from the latex manual (p.170):

\@ Causes an "end-of-sentence" space after punctuation when typed before the punctuation character. Needed only if the character preceding the punctuation character is not a lowercase letter or a number.

so your farcical sentence is input as

Languages like JS, HTML, etc.\ were not used by King Henry III\@.

only one \@, and that after a capital I.

share|improve this answer
3  
@Martin -- obviously i can't argue that @egreg's answer is wrong, since it demonstrably produces the desired result. but perhaps you will be sympathetic to my contention that it is misguided, since it embodies exactly the trickery that causes beginners to reject (la)tex as being too arcane. i find it much more defensible to recommend \ for something that doesn't end a sentence, and \@ for something that does. –  barbara beeton Jul 7 '11 at 18:53
2  
Yes , I agree with you. \@ and the underlying \spacefactor also confused me as an advanced user. I personally stopped a while ago to use \ie and write i.e.\ instead. It also avoids all the hassle with \xspace and the definition of a new macro. –  Martin Scharrer Jul 7 '11 at 18:59
2  
Would there be harm in putting \@ before the commas? I ask primarily because in my document, I am typesetting language names in a separate font, so I have macros like \def\JS{\textsf{JS}}, and I'd like to harden that macro against subsequent punctuation, such that I could write "\JS, \HTML, and \CSS; also \XML." and have it Just Work for all punctuation. I can figure out how to code \ or \@ depending on the following characters, but I just need to know which to use :) –  Ben Lerner Jul 7 '11 at 19:13
1  
@barbara: after etc. there should be \ . –  egreg Jul 8 '11 at 22:29
1  
@Pouya -- the manual is available only in print; it is the original manual LaTeX: A Document Preparation System, User's Guide and Reference Manual, by Leslie Lamport, 2nd edition, Addison-Wesley, 1994. if you're a tug member, a discount is available through the tug bookstore. –  barbara beeton Jun 9 at 14:22
show 6 more comments

The macro simply says

\spacefactor 1000

Under \nonfrenchspacing, capital letters set the space factor to 999 and, by rule, the space factor never jumps from a value less than 1000 to a value greater than 1000. On the other hand, a comma sets the space factor to 1250, the period to 3000 and so on for other punctuation signs.

So with JS,, the space factor after the comma is 1000

J (999) S (999) , (1250->1000)

while with JS,\@ one has

J (999) S (999) , (1250->1000) \@ (1000)

and with JS\@, we get

J (999) S (999) \@ (1000) , (1250)

so that the right syntax is the latter.

Let's consider e.g., e.g.\@ and e.g\@.:

e (1000) . (3000) g (1000) . (3000) , (1250)
e (1000) . (3000) g (1000) . (3000) \@ (1000)
e (1000) . (3000) g (1000) \@ (1000) . (3000)

so the right syntax is the middle one. However, a comma just after the second period would make \@ unnecessary.

You should type your phrase as

Languages like JS\@, HTML\@, etc.\@ were not used by King Henry III\@.

otherwise the space after the commas would not expand (factor 1.25) and the space after etc. would (factor 3000), which is not desired.

The simplest thing is to go \frenchspacing and forget about this.

share|improve this answer
    
So the code in my answer is fine? (Besides the use of \xspace, which you don't like if I remember correctly) –  Martin Scharrer Jul 7 '11 at 18:33
2  
@Martin Yes, e.g.\@\xspace is correct, barring \xspace, of course. :-) –  egreg Jul 7 '11 at 19:17
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.