2

I want to define a new counter for numbering some headlines. I also would like to reference them. So, if I label the headline 3, then \ref should just return the number 3.

Unfortunately, all other references seem to be broken now. Take a look at the following code:

\documentclass[11pt,a4paper]{scrreprt}
\usepackage[utf8]{inputenc}

\newcounter{LPCounter}

\newcommand{\LP}[2]{\refstepcounter{LPCounter}\label{#2} \noindent \textbf{LP \theLPCounter: #1}}


\begin{document}

\chapter{Chapter}
\section{Section}

\LP{A}{lpA}

\LP{B}{lpB}

\begin{table}[h]\label{test}
\textit{I am a table.}
\end{table}

Here is LP 1: \ref{lpA}, and here is LP 2: \ref{lpB}. Here is the table: \ref{test}

\end{document}

The output now looks somehow like

Here is LP 1: 1, and here is LP 2: 2. Here is the table: 2.

So, instead of "1.1" I get "2". Why is that?

Ruben
  • 13,448
Paul85
  • 21

0 Answers0