I suddenly got an error in my .tex
document in all the equations.
\documentclass[a4paper,openright,12pt]{article}
\usepackage[spanish]{babel}
\usepackage[utf8]{inputenc}
\usepackage{amssymb, amsmath, amsbsy} % simbolitos
\usepackage{upgreek} % para poner letras griegas sin cursiva
\usepackage{cancel} % para tachar
\usepackage{mathdots} % para el comando \iddots
\usepackage{mathrsfs} % para formato de letra
\usepackage{stackrel} % para el comando \stackbin
\usepackage{graphicx}
\usepackage{caption}
\usepackage{chngcntr}
\usepackage{hyperref}
\usepackage[a4paper,hmargin=2cm,vmargin={2cm,2.5cm}]{geometry}
\counterwithin*{equation}{section}
\counterwithin*{equation}{subsection}
\counterwithin*{equation}{subsubsection}
\counterwithin*{figure}{section}
\counterwithin*{figure}{subsection}
\counterwithin*{figure}{subsubsection}
\makeatletter
\renewcommand\theequation{%
\ifnum\value{subsection}>0 \thesubsection.\else
\ifnum\value{section}>0 \thesection.\fi\fi
\ifinenumerate \csname theenum\romannumeral\the\@enumdepth\endcsname\fi%
\arabic{equation}%
}
\AtBeginDocument{%
\renewcommand\theHequation{%
\ifnum\value{subsection}>0 \theHsubsection.\else
\ifnum\value{section}>0 \theHsection.\fi\fi
\ifinenumerate \csname theHenum\romannumeral\the\@enumdepth\endcsname\fi%
\arabic{equation}%
}%
}
\renewcommand\thefigure{%
\ifnum\value{subsection}>0 \thesubsection.\else
\ifnum\value{section}>0 \thesection.\fi\fi
\ifinenumerate \csname theenum\romannumeral\the\@enumdepth\endcsname\fi%
\roman{figure}
}
\AtBeginDocument{%
\renewcommand\theHfigure{%
\ifnum\value{subsection}>0 \theHsubsection.\else
\ifnum\value{section}>0 \theHsection.\fi\fi
\ifinenumerate \csname theHenum\romannumeral\the\@enumdepth\endcsname\fi%
\arabic{figure}%
}%
}
\makeatother
\begin{document}
\begin{equation}
\label{eq:2.1.1}
\nabla \times \textbf{E} = - \frac{\partial \textbf{B}}{\partial t}
\end{equation}
\end{document}
Best Answer
You seem to have copied code from https://tex.stackexchange.com/a/339515/4427 but you forgot some part of it.
I moved some parts to better places; don't forget
fontenc
.