All you need is to subtract 1 to the value of your counter when you use it (in \thedfnv). Here it is done using a temporary counter.
\documentclass[12pt]{article}
\usepackage{amsthm}
\usepackage{amsmath}
\newcounter{dfnq}[section]
\newcounter{dfnv}[dfnq]
\newcounter{tmpcnt}
\renewcommand{\thedfnv}{
\setcounter{tmpcnt}{\value{dfnv}}\addtocounter{tmpcnt}{-1}\thedfnq.\thetmpcnt}
\newtheorem{dfn}[dfnv]{Definition}
\begin{document}
\section{First section}
\stepcounter{dfnq}
% Should display as Definition 1.0
% Actually displays as Definition 1.1
\begin{dfn}
Version 0 of the definition of foo.
\end{dfn}
% Should display as Definition 1.1
% Actually displays as Definition 1.2
\begin{dfn}
Version 1 of the definition of foo.
\end{dfn}
\stepcounter{dfnq}
% Should display as Definition 2.0
% Actually displays as Definition 2.1
\begin{dfn}
Version 0 of the definition of bar.
\end{dfn}
% Should display as Definition 2.1
% Actually displays as Definition 2.2
\begin{dfn}
Version 1 of the definition of bar.
\end{dfn}
\stepcounter{dfnq}
\end{document}
EDIT: a way to get labels to work correctly
- decouple
dfnv form dfnq (not strictly necessary but we'll handle the
dependency manually)
- initialize
dfnv to -1
define a command \nextdef that you will call instead of \stepcounter{dfnq} :
\newcommand{\nextdef}{\stepcounter{dfnq}\setcounter{dfnv}{-1}}
redefine \thedfnv the good old way:
\renewcommand{\thedfnv}{\thedfnq.\arabic{dfnv}}
And voilà, should work correctly.
\documentclass[12pt]{article}
\usepackage{amsthm}
\usepackage{amsmath}
\newcounter{dfnq}[section]
\newcounter{dfnv}
\setcounter{dfnv}{-1}
\renewcommand{\thedfnv}{\thedfnq.\arabic{dfnv}}
\def\nextdef{\stepcounter{dfnq}\setcounter{dfnv}{-1}}
\newtheorem{dfn}[dfnv]{Definition}
\begin{document}
\section{First section}
\stepcounter{dfnq}
% Should display as Definition 1.0
% Actually displays as Definition 1.1
\begin{dfn}\label{defa}
Version 0 of the definition of foo.
\end{dfn}
% Should display as Definition 1.1
% Actually displays as Definition 1.2
\begin{dfn}\label{defb}
Version 1 of the definition of foo.
\end{dfn}
\nextdef
% Should display as Definition 2.0
% Actually displays as Definition 2.1
\begin{dfn}\label{defc}
Version 0 of the definition of bar.
\end{dfn}
% Should display as Definition 2.1
% Actually displays as Definition 2.2
\begin{dfn}\label{defd}
Version 1 of the definition of bar.
\end{dfn}
\nextdef
\ref{defa}
\ref{defb}
\ref{defc}
\ref{defd}
\end{document}
\labelto work? Right now it still gives the old numbers1.1,1.2, etc. – Joshua Meyers May 26 '17 at 07:53\labelworks precisely but things get messed up on the way. I'm adding a workaround. – Christoph Frings May 26 '17 at 10:12