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 in constant search for an alternative to LaTeX, but it seems I am stuck for it for a long time, and I am trying to see the bright side of it.

The other day one thought struck me, I think, LaTeX is missing many reasonable defaults, especially math environment. For example, it is very unlikely that you have three variables named l, o and g at the same time, and you are writing product of those three variables in that order. But still you have to write \log to indicate you meant the function log(). In other words, when someone writes log, they (almost) always mean the log function.

Same is true for parentheses and braces, in math environment when one uses a parenthesis again they most probably mean a \left(. I know, I can introduce my own \( commands but again they are not by default.

Because I am using LaTeX mostly for math typesetting, I am only aware of those kind of non-defaults. My question is why are the things are not designed such that these most basic, fundamental things are not handled by default? I read that Knuth is considered math typesetting specialist, he should have noticed these burdens while he is using TeX in my opinion.

share|improve this question
8  
In programming languages where the string log is interpreted as "the logarithmic function", you probably have to say l*o*g to denote the product of three variables. Generally ( should not be \left(; if you're used to this, you're on a wrong direction. –  egreg Jan 25 '12 at 21:18
29  
Why should TeX go through all the trouble to check if a character sequence like "l" "o" "g" correspond to some "default"? Do you know how much more complex this would make a compiler? TeX is from the early 80s where computer resources where limited. What's the big problem to add a simple `\` in front of it? I'm really sometimes shocked about the laziness of some modern computer users. –  Martin Scharrer Jan 25 '12 at 21:19
9  
@MartinScharrer: Totally agree with you about complexity, but I don't think it is laziness, just a normal frustration when one is learning things. It is natural to try to wonder why things don't just work as you would expect, and I think it is an important part of learning to try to understand why. –  Peter Grill Jan 25 '12 at 21:30
4  
This seems more like a rant than a genuine question. –  KennyPeanuts Jan 26 '12 at 1:20
8  
The TeX SE is a very friendly crowd, but you are likely to be treated as hostile when you frame your question argumentatively. If you're interested in why TeX's parser requires backslashes, that's a good question. But you've presumed that your feature request is "basic" and "fundamental" and so "reasonable" that it should already be implemented, and that puts everyone on the defensive. –  Matthew Leingang Jan 26 '12 at 14:02
show 5 more comments

6 Answers 6

up vote 50 down vote accepted

Well, to answer your question. The behaviour is reasonable, because it is consistent. I use, besides \log, the functions \det, \tr, \tg, \inv, \abs, etc. If you made the "most-used" ones "backslash-less", then you don't know which ones have backslash and which don't. As well, some of us generate automated LaTeX codes and such exceptions would change our work to a true hell.

For parentheses, you get into serious troubles with things like [0,1[ for semi-open intervals, or even [0,1) for that.

Remember, LaTeX is good because it is consistent hence predictable, once you learn the basics.

share|improve this answer
    
Word has no problem parsing [0, 1) the correct way, though you need a \right to get the same effect with [0, 1[. Still, an actual opening-closing pair is trivial (once you have Unicode, of course, which TeX didn't know anything about until recently). And you still need \operatorname{foo} for those that LaTeX doesn't have an own command. –  Joey Jan 27 '12 at 8:19
    
@Joey \operatorname is not a good command for general use, better put \DeclareMathOperator{\foo}{foo} in the preamble. –  tohecz Jan 27 '12 at 16:30
    
@tohecz You are right when there is a symbol used several times; however, occasionally there is a unique occurrence and then I prefer \operatorname. Actually \DeclareMathOperator invokes \operatorname. –  marczellm Jan 18 '13 at 21:33
add comment

When designing something for general purpose use it does not make sense to assume that you want log to be upright roman, as opposed to the default italics that are used in math mode. If that were the case, then someone else would need a method to specify the product of l, o, and g. There are also just way too many functions and new ones are added now and then.

It is more important to have defined rules and be consistent rather than having too many special cases. While you probably mean left( when you write (, probaably is not enough to assume that is what you mean. Again, this assumption would necessitate having to say something like \paren when one just wanted a regular (, and someone else would complain that why can't a ( just be a (.

Basically it comes down to specify what you really mean, so as to minimize confusion when TeX does its job.

share|improve this answer
add comment

Playing devil's advocate, the opposite could also be expected down the line: What if you actually had three variables l, o and g that you want separated and (La)TeX required you use use them as \separate{l}\separate{o}\separate{g}? Of course, I'm exaggerating the use of some "really special" function \separate. The same goes for not always wanting \left( when you type (, for whatever reason.

As such, nothing is assumed, giving the end user freedom over manipulation down to the highest detail.

The nath package is an example that might be in favour of your "assume some basic defaults" notion. As stated in the package description on CTAN,

[nath] delivers a particular context-dependent presentation on the basis of a rather coarse context-independent notation. Highlighted features [include]: depending on the context, the command \frac produces either built-up or case or solidus fractions, with parentheses added whenever required for preservation of the mathematical meaning; delimiters adapt their size to the material enclosed, rendering \left and \right almost obsolete.

So, it provides some "assumptions" in your mathematical use so you don't have to worry or think about it anymore. But it may not always be perfect, and what then?

share|improve this answer
3  
You could just use l o g, similar to what the eqn preprocessor for troff uses. –  Aditya Jan 25 '12 at 21:20
1  
btw: my two cents: I don't like the output of $$(\sum_{i=1}^n x^i)$$ and $$(\int\limits_{i=1}^n x^i)$$ with the nath package, I would prefer some horizontal space and a bit larger parentheses :-/ To get a professional output, you have to put a bit more effort to the code, and LaTeX is about being professional. –  tohecz Jan 25 '12 at 21:22
    
@Aditya: As mentioned, I used some exaggeration to illustrate the alternative viewpoint... –  Werner Jan 25 '12 at 21:23
3  
@tohecz: Nath goes to considerable efforts to make sure that the parenthesis are smaller. In \left\sum_{i=1}^n x^i \right), the parenthesis are too large and look ugly. –  Aditya Jan 25 '12 at 21:26
1  
@tohecz See this answer, for example. –  egreg Jan 25 '12 at 21:37
show 5 more comments

With ConTeXt MkIV, you can use the calcmath module to use such shortcuts. For example:

\usemodule[calcmath]

\starttext                                                                 
\calcmath{log(x/(1+x))}
\stoptext

gives

enter image description here

share|improve this answer
add comment

In the initial TEXDR.AFT that Knuth wrote to describe the new system he was proposing, he did not use back slashes for “keywords”, but relied on them being “chosen so that match English words, since they can appear intermixed with normal text.” In the next draft, TEX.ONE slash was introduced as an escape character “to indicate control mode rather than text mode”, this change was not explained (though the next draft has a note to forget the first the first draft if you have seen it), presumably he found the idea of reserved keywords not so good, but at least we know he didn’t overlook it :)

share|improve this answer
2  
In a language used for typesetting, reserved words should never appear as ones that a user would like to typeset; or one has to confine the "strings to be typeset" mostly like Postscript does. –  egreg Jan 18 '13 at 22:49
add comment

There are several good answers here already, but it's worth adding that some of Donald Knuth's thoughts on this are set out in an article that appeared in the Bulletin of the AMS in 1979.

share|improve this answer
    
cool reading material! –  tohecz Jan 26 '12 at 14:08
add comment

protected by Martin Scharrer Jan 25 '12 at 21:23

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

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