# No counter defined error

When I try to compile in my laptop a (synced) tex file wich is perfectly compiling in my desktop computer I get the message:

"! LaTeX Error: No counter 'd' defined."

I reinstalled and updated MikTeX and packages, and deleted aux files, but the problem persists.

Does anybody know what can be the problem and how to solve it?

Thank you very much.

Edit: I think I isolated a bit the problem. A MWE follows:

    \documentclass[11pt]{article}

% mypackages.sty

% STANDARD PACKAGES -------------------------------------------------------
%\RequirePackage{../../../_config_LaTeX/my_packages}

% mypackages.sty

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

% AMS
\usepackage{amsmath}
\usepackage{mathtools}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsthm}

\usepackage{stmaryrd}
\usepackage{mathabx}

\usepackage[protrusion=true,expansion=true]{microtype}
\usepackage{enumitem}
\usepackage{float}         % controls figure positions
\usepackage{cleveref}
\usepackage{todonotes}

% THEOREMS -------------------------------------------------------
\newtheorem{thm}{Theorem}[section]
\newtheorem{defn}[thm]{Definition}

% ----------------------------------------------------------------
\begin{document}

\begin{defn}
This is a definition.
\end{defn}

\end{document}


Concretely, the issues are:

• If I compile the code like this, it works.

• If I include all the packages in "mypackages.sty", and substitute then by \RequirePackage{../../../_config_LaTeX/my_packages} then I get the error:

"! LaTeX Error: No counter 'd' defined."

• If I then remove "[thm]" from "\newtheorem{defn}[thm]{Definition}", then it compiles well again.

• I am only having this problem in my laptop, in my desktop computer everything compiles well.

Hope that these indications help.

• Without seeing code this is difficult to tell. I don't know a package or class, that uses d as a counter name – user31729 Jun 10 '16 at 20:01
• it means you have gone \setcounter{d}{42} without going \newcounter{d} if you do not get an error on the other computer, it is executing different code. – David Carlisle Jun 10 '16 at 20:07
• unrelated to your question but \rm has been deprecated since latex2e came out in 1993, but if you do use it it does not take an argument so the syntax is {\rm xxx} not \rm{xxx] – David Carlisle Jun 10 '16 at 21:48
• The MWE runs without error, add \listfiles and then run it on the two machines and compare the file lists at the end of each log. – David Carlisle Jun 12 '16 at 19:56
• Then there is an error in that local file. – David Carlisle Jun 12 '16 at 21:40