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.

When I used in theorem environment, I found that \ref{} didn't point to what I labeled. For example, I used \label{1.1.1} and \ref{1.1.1}, but it turned out to be Theorem 1.1. I don't know why? Anybody hep me? Thanks.

\documentclass{book}

\usepackage{amsmath}

\usepackage{amsthm}

\newtheoremstyle{plain}

  {\topsep}   % ABOVESPACE

  {\topsep}   % BELOWSPACE

  {\itshape}  % BODYFONT

  {0pt}       % INDENT 

  {\bfseries} % HEADFONT

  { }         % HEADPUNCT

  {5pt plus 1pt minus 1pt} 

  {\thmname{#1}~\thmnumber{#2}\thmnote{(#3)}}

\newtheorem{theorem}{Theorem}


\begin{document}

\chapter{}

\section{Word}

\begin{theorem}\label{1.1.1}This is good.

\end{theorem}

By theorem (\ref{1.1.1}), this word is also good.

\end{document}
share|improve this question
    
It's best to give some contextual reference to the \label, as in \label{good-thm}, rather than \label{1.2.3}. –  Werner Sep 3 at 5:56

1 Answer 1

\label and \ref have nothing to do with how theorem numbers are created and displayed. To get 1.1.1, you need to number theorems within sections. This is done by the optional argument in

\newtheorem{theorem}{Theorem}[section]  %<--- here

Code:

\documentclass{book}

\usepackage{amsmath}

\usepackage{amsthm}

\newtheoremstyle{plain}
  {\topsep}   % ABOVESPACE
  {\topsep}   % BELOWSPACE
  {\itshape}  % BODYFONT
  {0pt}       % INDENT
  {\bfseries} % HEADFONT
  { }         % HEADPUNCT
  {5pt plus 1pt minus 1pt}
  {\thmname{#1}~\thmnumber{#2}\thmnote{(#3)}}

\newtheorem{theorem}{Theorem}[section]


\begin{document}

\chapter{}

\section{Word}

\begin{theorem}\label{1.1.1}This is good.

\end{theorem}

By theorem (\ref{1.1.1}), this word is also good.

\end{document}

enter image description here

As an aside, it is not a good idea to use specific numbers in \label. Use some key which you can remember and the key show connection to the theorem as in this example

\begin{theorem}\label{thm:fermat}

\[x^n + y^n = z^n, \qquad xyz \neq 0 \]............

\end{theorem}

By theorem (\ref{thm:fermat}), this word is also good.
share|improve this answer
    
Sorry. That's not where I made a mistake. I just put \ref{1.1.1}\label{1.1.1} somewhere later. I finally found it. Anyway, thank you very much. –  ksj03 Sep 3 at 15:04
    
@ksj03 Sorry my crystal ball fell down and broke ;-) –  Harish Kumar Sep 3 at 22:32

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.