1

I am getting warnings regarding my claims and claim proofs along the lines of:

pdfTeX warning (ext4): destination with the same identifier (name{claimcount.1}) has been already use d, duplicate ignored

\AtBegShi@Output ...ipout \box \AtBeginShipoutBox \fi \fi l.38 \end{document} ] (./duplicate identifier.aux) ) (see the transcript file for additional information)<

Everything compiles well, but I'd nevertheless like to get rid of the warnings. For reference, the above is the result of the code (MWE)

\documentclass[a4paper,hidelinks,oneside]{book}
\usepackage[utf8]{inputenc}

\usepackage{amsmath,amsthm,chngcntr,csquotes,hyperref}

\newcounter{theorem} \numberwithin{theorem}{chapter}
\newcounter{claimcount} 
\setcounter{claimcount}{0}
\newtheorem{claim}[claimcount]{Claim}

{\AtBeginEnvironment{proof}{\setcounter{claimcount}{0}}
\theoremstyle{remark}
\newcounter{cproofcount}
\setcounter{cproofcount}{0}
\AtBeginEnvironment{proof}{\setcounter{cproofcount}{0}}
\newtheorem{cproof/}[cproofcount]{Proof of Claim}}

\newenvironment{cproof}
  {\renewcommand{\qedsymbol}{$\dashv$}%
   \pushQED{\qed}\begin{cproof/}}
  {\popQED\end{cproof/}}
%

\title{}
\author{}
\date{}

\begin{document}

\begin{claim} \end{claim}
\begin{cproof} \end{cproof}

\begin{proof}
\begin{claim}
\end{claim}
\end{proof}
\end{document}

I want to count claims and their proofs within each proof environment, so that the numbering does not continue throughout different theorems. Now, the above works, but I get a number of warnings equal to the number of claims within proofs. How can I achieve this while avoiding the warning?

  • So you want to be able to use claim outside of a proof as well as inside? – moewe May 29 '18 at 14:44
  • @moewe Not really, I went with that example because I needed more than one claim to get the warning – Reveillark May 29 '18 at 14:46
  • OK. How are cproof and proof supposed to work? In particular I don't quite understand why there are so many \AtBeginEnvironment in the group(!) after the definition of claim. – moewe May 29 '18 at 14:46
  • @moewe Within a theorem proof, I want to have claims with their respective proofs. The double \AtBeginEnvironment is due to me having two different counters, one for the claims (claimcount) and one for their proofs (cproofcount), and I want these to reset within each (theorem) proof environment. I am not well versed in the use of counters, so my code is probably terrible. – Reveillark May 29 '18 at 14:57
  • OK, I'll cook something up and post an answer and then you can tell me what I got wrong. – moewe May 29 '18 at 14:59
1

We can count proofs with an invisible counter and use LaTeX's \@addtoreset to start counting the claims in each proof anew.

I have also reworked your definitions a bit. You can now use cproof directly after a claim to produce a Proof of Claim x. If you use the optional argument to cproof you can give a different number. This might be useful in case you want to state several claims first and prove them later. You can use \label and \ref to get the correct numbering in that case.

\documentclass[a4paper,hidelinks,oneside]{book}
\usepackage[utf8]{inputenc}

\usepackage{amsmath,amsthm,chngcntr,csquotes,hyperref}

\newtheorem{theorem}{Theorem}[chapter]

\newcounter{proofcount}
\AtBeginEnvironment{proof}{\stepcounter{proofcount}}% count the proofs
\newtheorem{claim}{Claim}
\makeatletter                  % reset the claim counter each time proofcount is
\@addtoreset{claim}{proofcount}% increased, effectively this restarts the claims
\makeatother                   % at 1 for each proof

\theoremstyle{remark}
\makeatletter
% \rev@cproofmark will hold the number of the claim we set out to prove
\newtheorem*{cproof/}{Proof of Claim \rev@cproofmark}

% cproof now has an optional argument to feed it the number of the claim
% we want to prove, if the argument is not given the number of the last claim is used
% code for the optional argument by David Carlisle 
% https://tex.stackexchange.com/a/217763/35864
\newenvironment{cproof}[1][\@nil]
  {\def\@tmp{#1}%
   \ifx\@tmp\@nnil
       \def\rev@cproofmark{\theclaim}% no optional argument: take last claim
    \else
       \let\rev@cproofmark\@tmp% take the argument
    \fi
   \renewcommand{\qedsymbol}{$\dashv$}%
   \pushQED{\qed}\begin{cproof/}}
  {\popQED\end{cproof/}}
\makeatother

\begin{document}
\chapter{Lorem}
\begin{theorem}
Ipsum dolor
\[ 1+1=2\]
\end{theorem}
\begin{proof}
\begin{claim}
Foo
\end{claim}
\begin{cproof}% here the numebr is picked up automatically
Foo
\end{cproof}
\begin{claim}
Bar
\end{claim}
\begin{cproof}
Foo
\end{cproof}
\end{proof}
\begin{theorem}
Ipsum dolor
\[ 2+2=4\]
\end{theorem}
\begin{proof}
\begin{claim}\label{claim:two:one}
Foo
\end{claim}
\begin{claim}\label{claim:two:two}
Bar
\end{claim}
\begin{cproof}[\ref{claim:two:one}]% manual numbering
Foo
\end{cproof}
\begin{cproof}[\ref{claim:two:two}]
Foo
\end{cproof}
\end{proof}
\end{document}

enter image description here

  • I just tested the code in my document and it works flawlessly, thank you very much! I had to google some stuff but I think I more or less understand what's going on. Again, thanks! – Reveillark May 29 '18 at 15:33

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.