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}
2
  • What does \unit (and \CL and \OL) look like/do?
    – Werner
    Commented Dec 16, 2013 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 :-) Commented Dec 16, 2013 at 19:13

1 Answer 1

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

2
  • 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 :-) Commented Dec 16, 2013 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
    Commented Dec 17, 2013 at 1:56

You must log in to answer this question.

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