0

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.

cgnieder
  • 66,645

1 Answers1

3

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}
Runar
  • 6,082
  • thank you, @clemens . I just couldn't remember where I've read it. – Runar Jun 23 '16 at 11:08
  • 1
    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}. – Mico Jun 23 '16 at 11:33
  • 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. – Runar Jun 23 '16 at 11:39
  • 2
    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. – Torbjørn T. Jun 23 '16 at 12:45
  • @TorbjørnT. I guess I could have been a bit more clear about this in my suggestions, both for \SI and align. – Runar Jun 23 '16 at 12:49
  • 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. – Torbjørn T. Jun 23 '16 at 13:02
  • Yes, the \phantom seems pointless but I was trying to align two equations, so it came handy – Petros Mourouzis Jun 23 '16 at 15:16