How to multiply a fraction

3,393

Is this what you are after? Your problem was in the dollar signs around 3.3. You don't need to do add dollar signs when already inside a math-environment. Besides, 3.3 can be written both in normal text mode and in math.

Output

enter image description here

Code

\documentclass[11pt]{article}
\usepackage{fontspec}
\usepackage{siunitx}
\usepackage{mathtools}
\begin{document}
\begin{equation}
    \phantom{0}LOD = 3.3 \cdot \frac{\phantom{0}S}{N} = 0.1\phantom{0} \si{\ng\per\uL}
\end{equation} 
\end{document}

Suggestions

  • Don't use eqnarray. It has lots of problems. See The TUGboat-article by Lars Madsen. Use mathtools, which loads amstools, both of which has some really great functions for writing math. Especially align-environment is really useful. For single line equations, use equations-environment.
  • Use siunitx for getting consistent spacing and notation. I like to write all numerals with it, it makes it so much easier to change the look of everything.
  • You don't need all those \phantom-stuff, most likely.
  • When writing words or abbreviations in math, use \mathrm, otherwise, LOD would mathematically read out as L · O · D. See Which command should I use for textual subscripts in math mode?

Suggested Output

enter image description here

Suggested Code

\documentclass[11pt]{article}
\usepackage{fontspec}
\usepackage{siunitx}
\usepackage{mathtools}
\sisetup{per-mode=symbol} % or fraction, among others
\begin{document}
\begin{equation}
    LOD = \num{3.3} \cdot \frac{S}{N} = \SI{0.1}{\ng\per\uL}
\end{equation} 
\end{document}
Share:
3,393

Related videos on Youtube

Petros Mourouzis
Author by

Petros Mourouzis

Updated on August 01, 2022

Comments

  • Petros Mourouzis
    Petros Mourouzis over 1 year

    I have an equation in which inside I have a fraction. I want to put a number (3.3) that indicates multiplication.

    \begin{eqnarray}
    
    \phantom{0}LOD = \frac{\phantom{0}S}{N} = 0.1\phantom{0} \si{\ng/\uL}
    \end{eqnarray} 
    

    I tried \phantom{0}LOD = $3.3$\frac{\phantom{0}S}{N} = 0.1\phantom{0} but it doesn't compile.

    • Runar
      Runar over 7 years
      you shouldn't use eqnarray. See amsmath and mathtools. The align-environment is especially useful.
    • egreg
      egreg over 7 years
      Just 3.3\frac{...}{...}: what's the problem?
    • Mico
      Mico over 7 years
      What's the significance, or purpose, of the three \phantom{0} directives?
    • Petros Mourouzis
      Petros Mourouzis over 7 years
      I am using \phantom{0} to align two equations, the one beneath the other.
  • cgnieder
    cgnieder over 7 years
  • Runar
    Runar over 7 years
    thank you, @clemens . I just couldn't remember where I've read it.
  • Mico
    Mico over 7 years
    I think it's more "canonical" to write \SI[per-mode=symbol]{0.1}{\nano\gram\per\micro\liter} than 0.1\phantom{0} \si{\ng/\uL}.
  • Runar
    Runar over 7 years
    Personally, I always do that, but I have only done it because I think in words, and not the actual letters. But some other people really like thinking in the abbreviations, and therefore writing it like that. I am sure it must be confusing, but I guess its a matter of taste.
  • Torbjørn T.
    Torbjørn T. over 7 years
    I think @Mico's main point was that \SI (capital letters) is for writing a number with a unit, whereas \si (lower case) is for writing a standalone unit (e.g. in the axis labels of a plot). Here there is a number with a unit, so one should use \SI{0.1}{\ng\per\ul} (using abbreviations or not). I also think that \phantom{0} gives a too large space, \, would be better, but \SI already does that. Finally, one could point out that using align for a single-line equation should be avoided (there is a question about this somewhere), the equation environment would be better.
  • Runar
    Runar over 7 years
    @TorbjørnT. I guess I could have been a bit more clear about this in my suggestions, both for \SI and align.
  • Torbjørn T.
    Torbjørn T. over 7 years
    I have to admit I didn't really read the text, I only looked at your code example (where you still have \si), so I didn't see that you had recommended \SI already. The first \phantom also seems very pointless, though we don't have the whole context.
  • Petros Mourouzis
    Petros Mourouzis over 7 years
    Yes, the \phantom seems pointless but I was trying to align two equations, so it came handy