0

This question already has an answer here:

I have noticed today that the LaTeX would compile regardless if I put curly brackets or not. What I mean is this: I would usually write in maths mode \frac{1}{2} however latex also compiles if I write \frac 1 2 i.e. without using the curly brackets. Of course it gives me error if I don't give two arguments and just type something like \frac 1.

It saves me a lot of effort to write without using the curly brackets in particular because they are located in such a bad position in the keyboard and require either Alt+Ctrl or AltGr. What are the other advantages/disadvantages of writing without curly brackets.

marked as duplicate by Community Jul 31 '15 at 15:45

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Try \frac 12 4 – Au101 Jul 31 '15 at 15:28
  • Regardless? :D:D Welcome to TeX.SX! – user31729 Jul 31 '15 at 15:29
  • Use a US keyboard - layout -- then {} are quite easy to type. And the advantage is a much clearer syntax to have {}, especially when looking through code written by others – user31729 Jul 31 '15 at 15:30
  • 1
    @gonenc you can do all sorts of things eg $x^\frac12$ works like $x^{\frac{1}{2}}$ but it makes it much harder to read and if you do this for long enough you will one day forget and change x^9 to x^10 (everybody has done this:-) and it makes your document much harder to parse with any system that isn't a full tex engine (so most tex to html converters for example) – David Carlisle Jul 31 '15 at 15:38
  • 1
    Related: tex.stackexchange.com/questions/155226/… – egreg Jul 31 '15 at 15:38
1

The curly braces are needed for arguments longer than 1 character, e.g. \frac{10}{17}.

If you write \frac1017, this will be interpreted as \frac{1}{0}17.

  • I know that it typeset that way. The question is would it be of disadvantage if I write eg.\frac 1 2 instead of \frac{1}{2} – Gonenc Mogol Jul 31 '15 at 15:32
  • @gonenc No, it's the same, but it's much less readable. – egreg Jul 31 '15 at 15:34
  • Most people would discourage the use of \frac12 as it will cause an error if you change the expression to 11/2 later on and forget to add the braces to form \frac{11}{2}. Nevertheless, I use it quite often, because it is faster and simpler. The same holds for x^2 vs. x^{2}. – Philipp Imhof Jul 31 '15 at 15:35

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