3

I didn't find a solution about how to add units to equations.

I have my code

\begin{equation}
  \eta = \frac{\Phi}{P}      [lm \cdot W^{-1}]
  \label{eq:mv}
\end{equation}

which is centered by default. I need this:

  1. Add some wide space (about 2 or 3 centimeters) between \eta = \frac{\Phi}{P} and [lm \cdot W^{-1}].
  2. Keep the alignment for the first part only \eta = \frac{\Phi}{P} so this would be centered and the other part would be right to it.

Can you give me a hint, please?

1
  • 1
    Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. Nov 21, 2013 at 15:42

2 Answers 2

4

As far as I understand:

\documentclass{article}

\begin{document}

You have:

\begin{equation}
  \eta = \frac{\Phi}{P}      [lm \cdot W^{-1}]
  \label{eq:mv}
\end{equation}

You want:

\begin{equation}
  \eta = \frac{\Phi}{P}     \makebox[0pt][l]{\hspace{3cm} $[\mathrm{lm} \cdot \mathrm{W}^{-1}]$}
  \label{eq:mv}
\end{equation}

\end{document}

enter image description here

Please observe that units are typeset in normal font, not the math one.

An alternative way of aligning is the option fleqn, changing centering of equations to common indentation of them.

3

You can also try this, slightly different, using the mathtools package (and SIunitx for units):

\documentclass{article}
\usepackage[utf8]{inputenc}   
\usepackage[T1]{fontenc}   
\usepackage[showframe]{geometry}   
\usepackage{mathtools}   
\usepackage{siunitx}

\begin{document}%  
You have: 

\begin{equation}  
  \eta = \frac{\Phi}{P}      [lm \cdot W^{-1}]  
  \label{eq:mv}  
\end{equation}

You want: 

\begin{align}  
\hspace{1in} \eta & = \frac{\Phi}{P} \hspace{1in} \mathllap{[\si{\lumen\watt^{-1}]}}  
  \label{eq:mv}  
\end{align}

\end{document}

which gives this:enter image description here

2
  • It's easier with \mathrlap{\hspace{.5in}(\si{\lumen\watt^{-1}})} and no \hspace{1in} at the left. Do you see why? The units should go in parentheses rather than in brackets, I believe.
    – egreg
    Nov 21, 2013 at 20:46
  • Oh yes! My solution makes a gap of 1in minus the width of the unit – in the present case more or less ½in.
    – Bernard
    Nov 21, 2013 at 22:52

You must log in to answer this question.

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