3

I have this:

$0.2 \mu sec = (1 − FR) * 0.1 \mu sec + (0.3 * FR) * 8 millisec + (0.7 * FR) * 20 millisec$ \\

and the result is that all whitespaces are gone, as well as the first minus symbol for example. If needed I can post a pic.

What should I do? This answer did not help.

1 Answer 1

5

The minus sign goes away because you're using the wrong character U+2212 instead of a simple hyphen.

Use siunitx facilities for inputting units.

\documentclass{article}
\usepackage{amsmath}
\usepackage{siunitx}
\usepackage{textgreek}
\sisetup{text-micro=\textmu,math-micro=\text{\textmu}}

\begin{document}
\[
\SI{0.2}{\micro\second} =
  (1 - FR) * \SI{0.1}{\micro\second} + 
  (\num{0.3} * FR) * \SI{8}{\milli\second} + 
  (\num{0.7} * FR) * \SI{20}{\milli\second}
\]

\end{document}

enter image description here

If FR denotes the name of a single variable, then it's better to use \mathit (as noted by Jonas Nyrup in the comments).

\documentclass{article}
\usepackage{amsmath}
\usepackage{siunitx}
\usepackage{textgreek}
\sisetup{text-micro=\textmu,math-micro=\text{\textmu}}

\newcommand\FR{\mathit{FR}}

\begin{document}
\[
\SI{0.2}{\micro\second} =
  (1 - \FR) * \SI{0.1}{\micro\second} +
  (\num{0.3} * \FR) * \SI{8}{\milli\second} +
  (\num{0.7} * \FR) * \SI{20}{\milli\second}
\]

\end{document}

enter image description here

Why is 1 not inside \num? Because it's a small integer, while \num is better used for numbers that may need some formatting. For instance, with

\sisetup{output-decimal-marker={,}}

one would automatically get a comma separator in the decimal numbers in \num or in \SI.

6
  • Thanks. Can you explain why you use \SI and \num? Moreover, you have left the first 1 with nothing. Why?
    – gsamaras
    Jan 16, 2015 at 12:09
  • you do not really need \num in that case. I guess Egrep use \num here because it can convert the decimal into national standard, and there is no decimal on 1
    – daleif
    Jan 16, 2015 at 12:11
  • Thanks @daleif. What about /SI?
    – gsamaras
    Jan 16, 2015 at 12:12
  • 1
    \SI is for typesetting number together with units. Look at egreg's example how µs and ms are typeset upright instead of italics. For more examples, have a look in the manual at page 6 and 7: mirrors.dotsrc.org/ctan/macros/latex/contrib/siunitx/… Jan 16, 2015 at 12:14
  • furthermore, if FR is a constant, some people prefer using \mathit{FR}, as it has a bit less space between F and R, to distinguish it from the product of two variables F and R. Jan 16, 2015 at 12:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .