2

I am trying to label an equation so I can refer to it later on in the text but the label will not show up. The reference later on in the text recognizes the reference but I actually need the (1) to show up next to my equation. I have tried changing position and using \textit but none of these have worked for me

On line 8 of the code after \label{eq:1}, no (1) appears on the PDF. How can I make it show?

    \begin{equation*}
t_{0,k} =
\left\{
    \begin{array}{11}
        1 & \text{if } k = 0\\
        0 & \mbox{otherwise}
    \end{array}
\right.**\label{eq:1}**
\end{equation*}\\
From equation \eqref{eq:1}................(this works fine)....
2
  • note that the argument of \label is unrelated to any number that is used for the equation. It is a bad idea to use labels like eq:1 as that may make a human reader think that it is equation 1. the \label argument is just an internal identifier used for cross referencing. Nov 11, 2016 at 16:57
  • also don't use \\ after \end{equation} the \eqref{eq:1} you comment works fine but it will be returning the current section number not an equation number, as you have used it in equation* which is unnumbered. Nov 11, 2016 at 16:59

1 Answer 1

3

The star form of environment equation* is not numbered, therefore the \label has no equation number to refer to. Using equation instead of equation* should fix the issue.

Example:

\documentclass[a5paper]{article}
\usepackage{amsmath}
\begin{document}
  \begin{equation}
    \label{eq:1}
    t_{0,k} =
    \begin{cases}
      1 & \text{if } k = 0\\
      0 & \mbox{otherwise}
    \end{cases}
  \end{equation}

  From equation \eqref{eq:1} \dots
\end{document}

Result

6
  • Thank you, how come you have used cases here and not array? Also why would we use the * option? This is the one I used from my notes so don't understand why it doesn't work. Sorry - I am quite new to LaTex
    – harry55
    Nov 11, 2016 at 15:33
  • @harry55 cases is designed for just this purpose. And one doesn't always want or need to number all equations, and for the equations that shouldn't have a number you can use the starred version. Nov 11, 2016 at 15:40
  • @harry55 For example, the documentation of amsmath is available as amsldoc.pdf. Environment equation* is explained in section "3.2 Single equations", and environment cases is shown in section "3.7 Alignment building blocks". Nov 11, 2016 at 15:42
  • @TorbjørnT I understand the * now, that's clear. But even just using \begin{equation} with the array commands, it still did not work. My notes only provide me with the array option not the cases so it would be good to know why the array option didn't work?
    – harry55
    Nov 11, 2016 at 15:52
  • @harry55 The contents of the equation (array or cases) does not matter for the numbering. My example can be compiled, see, whether it works for you. Make a similar example for your case, that does not work. Nov 11, 2016 at 15:54

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.