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.

How do I label part of an equation using the same counter as for equations? For example,

\begin{align}
x^2+bx+c&=x^2+bx+\frac{b^2}{4}-\frac{b^2}{4}+c \label{eq:1}\\
&=(x+b/2)^2+\underbrace{(-\frac{b^2}{4}+c)}{(*)} \label{eq:2}
\end{align}
The quantity~\ref{eq:2}...

produces

labeling

But I want the (2) to appear where the (*) is. (I.e., I want to use the equation counter but place the label in an arbitrary location, which is under the underbrace here.)

Thanks in advance.

share|improve this question
    
You don't want (2) on the right most place? –  Harish Kumar Apr 6 at 15:44
    
Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. –  Christian Hupfer Apr 6 at 16:01
    
I don't want (2) in the rightmost place, so Herbert's answer was what I was looking for. –  Holden Apr 6 at 17:09

2 Answers 2

up vote 4 down vote accepted
\documentclass{article}
\usepackage{mathtools}
\begin{document}

\begin{align}
  x^2+bx+c &= x^2+bx+\frac{b^2}{4}-\frac{b^2}{4}+c \label{eq:1}\\
           &= (x+b/2)^2+\underbrace{(-\frac{b^2}{4}+c)}_{%
             \stepcounter{equation}\mbox{(\theequation)}} \nonumber
\end{align}
\addtocounter{equation}{-1}\refstepcounter{equation}\label{eq:2}

The quantity~\ref{eq:2}...
\end{document}

enter image description here

share|improve this answer

Like this?

\documentclass{article}
\usepackage{amsmath}
\newcommand*\myeqno{\addtocounter{equation}{1}\theequation\addtocounter{equation}{-1}}
\begin{document}
  \begin{align}
x^2+bx+c&=x^2+bx+\frac{b^2}{4}-\frac{b^2}{4}+c \label{eq:1}\\
&=(x+b/2)^2+\underbrace{(-\frac{b^2}{4}+c)}_{%
             \displaystyle(\myeqno)} \label{eq:2}
\end{align}
The quantity~\ref{eq:2}...
\end{document}

enter image description here

share|improve this answer

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.