2

When using equation, it shows the equation number on the right of the equation. I want the number (1) to show to the left of the equation:

enter image description here

The code used for generating it is:

$$\mbox{\sc OFFSET}_i=\sum_{j=0}^{i-1} size_j=
S-\sum_{j=i}^{M-1} size_j$$
$$=S-size_i\cdot(M-i)-\sum_{j=i}^{M-1} (size_j-size_i)$$
$$=S-size_i\cdot(M-i)-\sum_{j=i}^{M-1}\sum_{\ell=1}^{k}\ell\cdot \mathds {1}_{size_j-size_i=\ell}$$
$$=S-size_i\cdot(M-i)-\sum_{\ell=1}^{k}2^{k-\ell}\cdot\ell$$
\begin{equation}\label{eq:offset} =S-size_i\cdot(M-i)-(2^{k+1}-k-2) \end{equation}

How can I make it show the equation number on the left?

2
  • 2
    Please don't use $$...$$ it is not LaTeX syntax. As for the eqn number, see the legno class option for the document class you did not tell us anything about. – daleif Feb 4 '15 at 14:23
  • if there is to be only one equation number for such a group, it's more usual to have it either vertically centered, or at the top if it's on the left. is this to be considered a group, or is it really desired to have only the last line numbered? – barbara beeton Feb 4 '15 at 15:00
5

if only one equation number is wanted for a group of related equations, the equation number is conventionally centered vertically, or placed at the top if the number is at the left.

the following example groups the equations with a single number at the center:

\documentclass[tbtags]{article}
\usepackage[leqno]{amsmath}
\usepackage{dsfont}

\newcommand{\isize}{\mathit{size}}

\begin{document}

\begin{equation}
\begin{split}
\text{OFFSET}_i & =\sum_{j=0}^{i-1} \isize_j = S-\sum_{j=i}^{M-1} \isize_j \\

 & =S-\isize_i\cdot(M-i)-\sum_{j=i}^{M-1} (\isize_j-\isize_i) \\
 & =S-\isize_i\cdot(M-i)-\sum_{j=i}^{M-1}\sum_{\ell=1}^{k}\ell\cdot \mathds 1_{\isize_j-\isize_i=\ell} \\
 & =S-\isize_i\cdot(M-i)-\sum_{\ell=1}^{k}2^{k-\ell}\cdot\ell \\
 & =S-\isize_i\cdot(M-i)-(2^{k+1}-k-2) \label{eq:offset}
\end{split}
\end{equation}

\end{document}

output of example code

by adding the tbtags option to amamath:

\usepackage[leqno,tbtags]{amsmath}

the equation number will be placed at the top left:

output of example code

edit: as suggested by egreg, the string "size" has been made into a word using \mathit for better (and more appropriate) appearance; a command \isize was defined to assist the change.

1
  • It should probably be \mathit{size} throughout. – egreg Feb 4 '15 at 16:51
3

If you want something like this

enter image description here

you can use an align environment with \notag in all non numbered lines.

amsmath, leqno option will add equation numbers on left side.

Note: I've changed \mathds{1} with just 1. I don't know command \mathds.

\documentclass{article}
\usepackage[leqno]{amsmath}

\begin{document}

\begin{align}
\text{OFFSET}_i & =\sum_{j=0}^{i-1} size_j = S-\sum_{j=i}^{M-1} size_j \notag \\
 & =S-size_i\cdot(M-i)-\sum_{j=i}^{M-1} (size_j-size_i) \notag \\
 & =S-size_i\cdot(M-i)-\sum_{j=i}^{M-1}\sum_{\ell=1}^{k}\ell\cdot 1_{size_j-size_i=\ell} \notag\\
 & =S-size_i\cdot(M-i)-\sum_{\ell=1}^{k}2^{k-\ell}\cdot\ell \notag \\
 & =S-size_i\cdot(M-i)-(2^{k+1}-k-2) \label{eq:offset}
 \end{align}

\end{document}

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.