6

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.

2

1 Answer 1

6

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.

5
  • 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, 2014 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, 2014 at 22:19
  • MathJax does accept \[...\], but StackExchange has disabled it because of bad interactions with Markdown. Feb 20, 2014 at 18:13
  • @DavideCervone They should disable $$ and favor \begin{displaymath} or \begin{equation} instead.
    – egreg
    Feb 20, 2014 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. Feb 20, 2014 at 21:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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