2

so what I want to do is make commands that makes mm, in regular font in my equations. So before \begin{document} I have put \newcommand{cm}{\text{cm}} and then it comes up as Latex Error: No \begin{document}. Can someone tell me what I'm doing wrong?

4
  • 5
    Commands begin with a backslash: \newcommand{\cm}{\text{cm}} – Gonzalo Medina Sep 19 '13 at 16:13
  • Could you please edit your question and clarify what exactly you wanted to achieve with this macro. I failed to understand what you are asking for. Anyway, to define a new command you need to write in the syntax \newcommand{cmd}[args]{def}, where cmd must be a command name beginning with a \. So, at least you can put a \ before cm in \newcommand{cm}. – Masroor Sep 19 '13 at 16:15
  • 8
    You may want to look at the siunitx package. – egreg Sep 19 '13 at 16:24
  • Welcome to TeX.SX! You can have a look on our starter guide to familiarize yourself further with our format. – cmhughes Sep 19 '13 at 16:39
4

Well, trying to give a complete answer:

  1. The correct syntax, as described by MMA is:

    \newcommand{<commandname>}[<arguments>]{<definition>}`
    

    Please note that the <commandname> must start with \. Example:

    \newcommand{\acro}[1]{{\normalfont\slshape #1\/}}
    
  2. Since what it seems you are trying to use is units, you should check the siunitx package, as described by egreg.

    The syntax while using the siunitx package is: \SI{quantity}{unit}. For example \SI{3.14}{\metre}

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.