I want to show a few equations in a row as I solve an integration, then number the final unsimplified equation and use the number in the next line.

  \frac{a+2\pi}2-\frac{a}2+\frac1{4n}\sin(2an)-\frac1{4n}\sin(2an+4n\pi)\numberthis\label{unsimplified integral of sine squared}\\
  \sin(x+2\pi)\equiv\sin(x)\implies\ref{unsimplified integral of sine squared}=\frac{a+2\pi-a}2

This gives me the error

LaTeX Warning: Reference `unsimplified integral of sine squared' on page 6 undefined

  • labels is not meant for issues with \label ;-) – user31729 Oct 6 '17 at 21:23
  • Off-topic: I would use \eqref instead of \ref to create the cross-reference to the numbered equation. – Mico Oct 6 '17 at 21:30
  • @Mico why's that? And how do I implement it if it has advantages? – theonlygusti Oct 6 '17 at 21:34
  • @theonlygusti - If you change \ref to \eqref, LaTeX will encase the number 1 in parentheses. This might be helpful to your readers, who might otherwise be puzzling over the apparent claim that 1=\pi... – Mico Oct 6 '17 at 21:38
  • 1
    @Mico I was going to just write the brackets myself. Using eqref looks better though, i assume it was designed for this. – theonlygusti Oct 6 '17 at 21:41

LaTeX's \label-\ref mechanism employs the \refstepcounter macro to (a) increment the specified counter and (b) enable the argument of \label to be associated with the most-recently-incremented counter variable.

Thus, simply change




and you're in business.

  • 1
    Perfect, will accept in 3 mins. Super concise yet thorough, that's pretty awesome actually! – theonlygusti Oct 6 '17 at 21:21
  • 1
    @theonlygusti: The 3 mins have passed ... ;-) – user31729 Oct 6 '17 at 21:28
  • @ChristianHupfer - You got the OP's attention! :-) – Mico Oct 6 '17 at 21:30

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.