3

I need to supply the unit of the formulas I use, in square brackets, right aligned. I use the align environment. I have tried several things, like manually changing the style of the equation numbering to include the units, but I need to be able to toggle the units.

Any ideas on how to do this? Example of how I would like this feature to work:

\begin{align}
 \CL(s) &= \frac{\OL(s)}{1 + \OL(s)}
    \unit{kg}
\end{align}
  • What does \unit (and \CL and \OL) look like/do? – Werner Dec 16 '13 at 19:12
  • \unit is a hypothetical macro to typeset and right-align the units. \CL and \OL are just macros for math-itallic CL and OL. Open-loop and closed-loop :-) – Joakim B Petersen Dec 16 '13 at 19:13
1

Remarks

You didn't provide \CL nor \OL, so I defined my own. You can use && to skip to a new column in align.

Implementation

\documentclass{article}
\pagestyle{empty} %for cropping
\usepackage{amsmath,units}
\newcommand{\CL}{CL} % You didn't provide \CL
\newcommand{\OL}{OL} % You didn't provide \OL
\begin{document}
\begin{align}
    \CL(s) &= \frac{\OL(s)}{1 + \OL(s)} && [\CL] = \unit{kg}
\end{align}
\end{document}

Output

enter image description here

  • Nice! But not quite what I was looking for. I think i wasnt specific enough. I would like the [CL] = kg to align in all equations, so that for all equations it is horizontally aligned. Otherwise it looks really weird :-) – Joakim B Petersen Dec 16 '13 at 19:26
  • 1
    Take a look at the siunitx package. You can use it to compose units out and inside the mathmode, it's very useful. – Aradnix Dec 17 '13 at 1:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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