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.

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?

share|improve this question
1  
Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. –  karlkoeller Nov 21 '13 at 15:42

2 Answers 2

up vote 4 down vote accepted

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.

share|improve this answer

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

share|improve this answer
    
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 '13 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 '13 at 22:52

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.