1

I am using the llncs document class and I need to set the counter for the environment 'remark', so that when I use \begin{remark} ... \end{remark} I obtain Remark 1 wherever I am in the document.

How can I do it? Is it possible to define a new counter and then force remark to use that one?

P.S. I should not define a new environment

EDIT

I am sorry but maybe I did not explain myself very well: I do not want to fix the counter of the remark to be always 1. I just want it to start from 1, and then increase normally. So the first remark will be Remark 1, the second will be Remark 2, and so on. As it is now, it seems the remark environment is sharing the counter with theorems, corollaries, etc. and I do not want this.

Here is a MWE:

\documentclass[11pt,envcountsame,a4paper]{llncs}

\usepackage[english]{babel}
\usepackage{url}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
%\usepackage{amsthm}
\usepackage{graphicx}
\usepackage{hyperref}

\numberwithin{theorem}{section}
\numberwithin{lemma}{section}
\numberwithin{definition}{section}
\numberwithin{equation}{section}
\numberwithin{figure}{section}
\numberwithin{corollary}{section}


\linespread{1.2}

\begin{document}

\section{My first section}

\begin{theorem}
Here I state a very interesting theorem
\end{theorem}

\begin{lemma}
Here I state a very interesting lemma
\end{lemma}

\begin{definition}
Here I state a very interesting definition
\end{definition}

\begin{remark}
And here I would like to state a very interesting remark, numbered as Remark 1
\end{remark}


\end{document}
10
  • You want to put the counter on hold?
    – user31729
    Commented Feb 5, 2016 at 9:03
  • No, I want everything to be "normal" but the remark environment to start from 1, regardless of what has already happened in the rest of the document.
    – minomic
    Commented Feb 5, 2016 at 9:04
  • I don't see a sharing with theorem etc. environment! llncs does use \newaliascnt, that's true, however
    – user31729
    Commented Feb 5, 2016 at 9:28
  • I neither. So make a complete example that demonstrates your problem. Commented Feb 5, 2016 at 9:29
  • @UlrikeFischer: Apparently, the envcountsame option is the culprit
    – user31729
    Commented Feb 5, 2016 at 9:31

2 Answers 2

2

Update

If the envcountsame document class option is given, all llncs defined theorems use the theorem counter as shared counter.

Now, envcountsame enables \newaliascnt, defining an alias counter, which in turn checks (for this question relevant) for \c@remark if it already exists. In order to decouple remark from theorem, \c@remark must be \relaxed and redefined as a new counter.

\documentclass[envcountsame]{llncs}


\makeatletter
\if@envcntsame
\let\c@remark\relax
\newcounter{remark}
\fi
\makeatother

\begin{document}

\begin{remark}
A remark
\end{remark}

\begin{theorem}
Foo
\end{theorem}

\begin{theorem}
Another Foo
\end{theorem}
\begin{remark}
  Another remark
\end{remark}

\begin{remark}
Yet another remark
\end{remark}



\begin{remark}
And now another counter value for remark after resuming
\end{remark}


\end{document}

enter image description here

Old stuff...

I doubt the usability of setting remark counter to 1, but here is a way with \AtBeginEnvironment

\documentclass{llncs}

\usepackage{xpatch}

\AtBeginEnvironment{remark}{\setcounter{remark}{0}}

\begin{document}

\begin{remark}
A remark
\end{remark}

\section{Foo}

\begin{remark}
  Another remark
\end{remark}

\begin{remark}
Yet  Another remark
\end{remark}


\end{document}

Another possibility using xassoccnt and its Suspend feature

\documentclass{llncs}

\usepackage{xassoccnt}

\setcounter{remark}{1} % Set it to 1 
\SuspendCounters{remark} % suspend it 

\begin{document}

\begin{remark}
A remark
\end{remark}

\section{Foo}

\begin{remark}
  Another remark
\end{remark}

\begin{remark}
Yet another remark
\end{remark}

\ResumeSuspendedCounters{remark}


\begin{remark}
And now another counter value for remark after resuming
\end{remark}


\end{document}

enter image description here

2
  • The newaliascnt solution worked perfectly for me. Than you!
    – minomic
    Commented Feb 5, 2016 at 10:03
  • @minomic: Actually, \newaliascnt isn't necessary at all. See the update
    – user31729
    Commented Feb 5, 2016 at 10:15
1

This sounds like a complete senseless requirement. Why using a number at all then? But if you want:

\documentclass{llncs}

\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage[T1]{fontenc}

\renewcommand\theremark{1}
\begin{document}
\begin{remark}
abc
\end{remark}

\begin{remark}
abc
\end{remark}

\end{document}

enter image description here

1
  • Maybe I did not explain the problem very well: please, see the edit in the question
    – minomic
    Commented Feb 5, 2016 at 9:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .