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.

I am sure this is indicative of a more general idea, but I noticed that if I put in

 $$\text hello$$
 $$\text {hello}$$

 $$\cal OU$$
 $$\cal {OU}$$

to my tex and compile I get the following output

enter image description here

Clearly in the first case the \text command has only affected the first character unless braces are used, whereas in the other case all charcters are affected.

Is there a reason as to why these behave differently? Is there a general rule as to which commands will act which way?

Thanks for any help in advance. Also, I am not sure which tag to use - please do add anything relevant.

share|improve this question
1  
related: The scope of LaTeX commands –  barbara beeton Feb 19 at 22:11
1  
the recommended command to get calligraphic is \mathcal which like \text takekes an argument \mathcal{A} not {\cal A} –  David Carlisle Feb 19 at 22:13

1 Answer 1

up vote 6 down vote accepted

This difference in behavior has been taken into account almost twenty years ago, when LaTeX2e was released (later simply called LaTeX).

The command \cal has been deprecated since June 1994, and \mathcal is to be preferred. Like \text, \mathcal is a command with an argument and its effect holds only for the material in braces that follows it.

So

$\text{hello}\ne\mathcal{O}$

is valid and supported input. By rule of TeX, if a command with argument is not followed by {, the first token is used as the argument. This is why the manual insists that arguments should always be enclosed in braces.

Notice also that $$ is not to be used in LaTeX. The manual doesn't mention it; people use it, but they're wrong.

share|improve this answer
    
Thank you for the answer and for letting me know about mathcal. And I know about $$, but mathjax doesn't seem to accept [..] yet, so when I am online I am not in that habit. –  Joe Tait Feb 19 at 22:17
    
@JoeTait I consider a big nuisance that MathJax doesn't accept \[...\], but there may be technical reasons for this. –  egreg Feb 19 at 22:19
    
MathJax does accept \[...\], but StackExchange has disabled it because of bad interactions with Markdown. –  Davide Cervone Feb 20 at 18:13
    
@DavideCervone They should disable $$ and favor \begin{displaymath} or \begin{equation} instead. –  egreg Feb 20 at 20:46
    
At this point it is probably too late, as there is substantial content with $$, and from the standpoint of ease of typing, I suspect most users on the SE sites that offer MathJax would prefer $$ to the longer \begin{...} forms. These are mainly people trying to get some math into their posts, not TeX purists as I would expect is more the case here. In any case, I have nothing to do with making the decisions at SE. –  Davide Cervone Feb 20 at 21:26

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.