11

When I am typing a laboratory for physics, I tried using \overline inside SI from the siunitx package, like so:

\begin{align}
\begin{split}
s &= \frac{d}{t}\\
&= \frac{\SI{1.15}{m}}{\SI{1.43}{s}}\\
&= \SI{0.\overline{804195}}{m/s}
\end{split}
\end{align}

But it seems that it does not work when you have \overline inside SI, does anyone know how to fix this?

1
  • Welcome to TeX.sx! Your post was migrated here from Stack Overflow. Please register on this site, too, and make sure that both accounts are associated with each other (by using the same OpenID), otherwise you won't be able to comment on or accept answers or edit your question.
    – Werner
    Feb 8, 2013 at 15:09

2 Answers 2

13

You can also set the number parsing off temporarily.

\documentclass{article}
\usepackage{amsmath,siunitx}

\begin{document}
\begin{align}
\begin{split}
s &= \frac{d}{t}\\
&= \frac{\SI{1.15}{m}}{\SI{1.43}{s}}\\
&= \SI[parse-numbers=false]{0.\overline{804195}}{m/s}
\end{split}
\end{align}
\end{document}

enter image description here

2
  • For a more "canonical" usage of \SI, you may want to write \frac{\SI{1.15}{\meter}}{\SI{1.43}{\second}} and \SI[parse-numbers=false,per-mode=symbol]{0.\overline{804195}}{\meter\per\second}. I.e., let siunitx do the mapping from \meter and \second to the letters m and s.
    – Mico
    Jun 9, 2016 at 9:12
  • 1
    @Mico True but note that the literal mode of siunitx is also canonical as opposed to interpreted mode. The units here don't matter much as overline is the emphasis.
    – percusse
    Jun 9, 2016 at 10:06
4

This does sort-of defeat the purpose of using siunitx, but it's possible with some box manipulation:

enter image description here

\documentclass{article}
\usepackage{siunitx,amsmath}% http://ctan.org/pkg/{siunitx,amsmath}
\begin{document}
\begin{align*}
    s &= \frac{d}{t} \\
     &= \frac{\SI{1.15}{m}}{\SI{1.43}{s}} \\
     &= \rlap{$\phantom{0.}\overline{\phantom{804\,195}}$}\SI{0.804195}{m/s}
\end{align*}
\end{document}

I've pre-set an invisible 0.804\,195 with a visible \overline (only over the necessary part) using a right overlap (a zero-width, left-aligned box). After this, \SI sets things as usual, this time "underneath" the \overline so it looks appropriate.

You must log in to answer this question.

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