1

I need that the line numbering in an equation would be: 1, 2, 3, ... and k (instead of default numbering 1, 2, 3, 4, 5). How can I do that?

MWE:

\documentclass[]{article}

\begin{document}

\begin{eqnarray}
1 \\
2 \\
3 \\
... \\
k
\end{eqnarray}

\end{document}

1
2

This is what the AMS math \tag command is for.

\documentclass{article}
\usepackage{mathtools}
\newcommand{\tagdots}{\tag*{$\lower.2ex\hbox{\smash\vdots}\phantom0$}}
\begin{document}
\begin{align}
1 \\
2 \\
3 \\
\cdots \tagdots\\
k \tag{$k$}
\end{align}
\end{document}

enter image description here

Note that \tag{x} sets x between parentheses, and in text mode. I've used $k$ above to get a label looking like a math-mode letter.

Use the star-form, \tag* if you don't want the parentheses.

But with a narrow label, you may need some adjustments to get something neatly centred horizontally and vertically. Here I have hidden this complexity in a new \tagdots command.

5
  • there's really too much space above the \vdots -- they should be centered vertically. \smash closes up the space too much (these dots are taller than a capital letter, and they're not centered on the math axis, which is too bad); the space between (3) and (k) is reduced to what it would be if an "ordinary" tag were present (forced by the phantom parentheses). – barbara beeton Mar 20 '15 at 18:32
  • @barbarabeeton, yes you are right - perhaps it would be better to write a tagdots command... – Thruston Mar 20 '15 at 19:15
  • If you replace \cdots with \makebox*{3}{\cdots} (from the small makebox package), the \cdots will be centred in their column. – Bernard Mar 20 '15 at 19:53
  • @Bernard, yes but I think they were just a placeholder in the OP example. – Thruston Mar 20 '15 at 21:35
  • @Thruston: Maybe, maybe not… – Bernard Mar 20 '15 at 21:42

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.