1

I have many equations in a document. I used \ [ \ ] for start and end of a math equation. I labeled the equation with \label{eq:1}, referenced with ~\eqref{eq:1}. It was showing just the section number. Can't we label and reference equations defined with \ [ and \ ] and auto numbering enabled ? Is using 'equation' environment the only way ? I needed equation to be numbered by (1) and (1) be displayed at \eqref{eq:1}. Here's my code and output

\documentclass[a4paper,12pt]{report}

\usepackage{amsfonts}

% Math package
\usepackage{amsmath}

% The graphicx package allows you to import JPG and PDF images
\usepackage[pdftex]{graphicx}

\usepackage[T1]{fontenc}
\usepackage{geometry}
\geometry{verbose,a4paper,tmargin=15mm,bmargin=30mm,lmargin=20mm,rmargin=20mm}
\usepackage{graphics}
\usepackage{setspace}
\usepackage{cite}
\usepackage{natbib}
\usepackage{lettrine}
\setcounter{secnumdepth}{5}
\setcounter{tocdepth}{5}
\onehalfspacing

\makeatletter
\newcommand{\LyX}    {L\kern-.1667em\lower.25em\hbox{Y}\kern-.125emX\spacefactor1000}

\makeatother
\begin{document}
\chapter{literature}
\section{Section 1}
\subsection{subsection 1}
\begin{equation}
   V^{m\times n}=G^{m\times3p}P^{3p\times n}
\label{eq:1}
\end{equation}   

Where `$m$' representing number of channels, `$n$' time samples considered, `$p$' number of dipoles considered. ~\eqref{eq:1}.

\end{document}

enter image description here

  • 2
    if there is no equation number what text would you want \ref to make? if you don't want the automatic numbering sequence you can use the amsmath command \tag to supply any other label text which can then be used with label/ref – David Carlisle Nov 10 '16 at 16:25
  • 1
    Equation numbering is done automatically by label number.. But with \ [ \ ] equations are not being numbered. – Wupadrasta Santosh Nov 10 '16 at 16:30
  • yes that is the only difference between \[ and \begin{equation} you use \[ if you do not want a number. what is your question? – David Carlisle Nov 10 '16 at 16:34
  • Note that is a bad idea to use a number in the argument of \label such as \label{eq;1} it works but is confusing as the number is unrelated to any number that is printed, it is just an internal identifier. – David Carlisle Nov 10 '16 at 16:36
4

The equation number is not set by \label, but instead by the equation environment. To reference something, you need to have a label set in the document that is visible to the readers. This is done by equation, but not by \[...\]. So, yes, you need equation (or some other display math environment that also enumerates):

enter image description here

\documentclass{article}

\usepackage{amsmath,lipsum}

\begin{document}

\lipsum[1]
\begin{equation}
  V^{m \times n} = G^{m \times 3p} P^{3p \times n}
  \label{eq:1}
\end{equation}
Where `$m$' represents the number of channels, `$n$' time samples considered, and
`$p$' the number of dipoles considered. See~\eqref{eq:1}.

\end{document}

Additional notes:

  • No blank lines around the equation environment as it forms part of the paragraph structure, and affects the indentation of subsequent paragraphs (but this may be personal preference).

  • Using a backtick and apostrophe as a pair for quoting.

  • Ok, thanks for the information. But when equation is under a section, section number is used for referencing instead of (1) by latex. – Wupadrasta Santosh Nov 10 '16 at 16:45
  • 1
    @WupadrastaSantosh: You need to place \label inside the equation environment. – Werner Nov 10 '16 at 16:45
  • Still, equation is labelled as (2.1), section numbering but not as (1). – Wupadrasta Santosh Nov 10 '16 at 17:17
  • @WupadrastaSantosh: Can you supply a small document that replicates this (unbelievable) behaviour? Something that starts with \documentclass, ends with \end{document} has (say) two sections and an equation environment with a \label in it that I can copy-and-paste-and-compile and see what you're seeing? Perhaps use Pastebin. – Werner Nov 10 '16 at 17:19
  • I have included in the code which behaves unbelievably, in the question.. – Wupadrasta Santosh Nov 10 '16 at 17:31

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.