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
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. Usemathtools
, which loadsamstools
, both of which has some really great functions for writing math. Especiallyalign
-environment is really useful. For single line equations, useequations
-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 asL · O · D
. See Which command should I use for textual subscripts in math mode?
Suggested Output
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}
Related videos on Youtube
Author by
Petros Mourouzis
Updated on August 01, 2022Comments
-
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 over 7 yearsyou shouldn't use
eqnarray
. Seeamsmath
andmathtools
. Thealign
-environment is especially useful. -
egreg over 7 yearsJust
3.3\frac{...}{...}
: what's the problem? -
Mico over 7 yearsWhat's the significance, or purpose, of the three
\phantom{0}
directives? -
Petros Mourouzis over 7 yearsI am using \phantom{0} to align two equations, the one beneath the other.
-
-
cgnieder over 7 years
-
Runar over 7 yearsthank you, @clemens . I just couldn't remember where I've read it.
-
Mico over 7 yearsI think it's more "canonical" to write
\SI[per-mode=symbol]{0.1}{\nano\gram\per\micro\liter}
than0.1\phantom{0} \si{\ng/\uL}
. -
Runar over 7 yearsPersonally, 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. over 7 yearsI 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 usingalign
for a single-line equation should be avoided (there is a question about this somewhere), theequation
environment would be better. -
Runar over 7 years@TorbjørnT. I guess I could have been a bit more clear about this in my suggestions, both for
\SI
andalign
. -
Torbjørn T. over 7 yearsI 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 over 7 yearsYes, the \phantom seems pointless but I was trying to align two equations, so it came handy