Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question

migrated from stackoverflow.com Feb 8 '13 at 10:05

This question came from our site for professional and enthusiast programmers.

    
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 '13 at 15:09

2 Answers 2

up vote 10 down vote accepted

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

share|improve this answer

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.