2

I am about to submit a report in my college and I am required to do some formatting to equations.

As if it was not clear enough, they want me to have equations numbered like they were table or figures, I mean they want me to number equations like: Equation. 1.1, instead of just (1.1)

I have worked this out a little renewing the \theequationcommand to \renewcommand{\theequation}{Ecuación \thechapter.\arabic{equation}} but I have to issues:

  • I need to get rid of parentheses.
  • When doing cross references I get the word Ecuación printed.

I've read through the amsmath documentation but did not find anything that could help me, How could this be solved?

\documentclass[a4paper, 12pt]{report}
\usepackage[utf8]{inputenc}
\usepackage[spanish,mexico]{babel}
\usepackage{amsmath}
\renewcommand{\theequation}{Ecuación \thechapter.\arabic{equation}}
\begin{document}
    \chapter{Test}

    See test equation \eqref{eq:test}
    \begin{equation}
        a+b=c^2 \label{eq:test}
    \end{equation}
\end{document}
Paul Lara
  • 727
  • 1
    https://tex.stackexchange.com/q/343997/172164 or https://tex.stackexchange.com/q/310289/172164 could help you. Especially the mathtools \newtagform solution from the second link could be on interest to you. – TivV Jan 31 '20 at 23:51
  • Unrelated to your question: With a current LaTeX installation, you don't need to load inputenc, since utf8 encoding is now the default. – schtandard Feb 01 '20 at 00:03

2 Answers2

4

Not too sure of what you want about cross-references, but here is how to do it, as far as I've understood: for the parentheses, you can use the \newtagform and \usetagform commands from mathtools. For the references, just use \ref instead of \eqref. I added an example of the defaul \cref from cleveref, which can be customised.

Note: if you also load hyperref, cleveref has to be loaded after the former package, and both have to be loaded at the end of the preamble.

\documentclass[a4paper, 12pt]{report}
\usepackage[utf8]{inputenc}
\usepackage[spanish,mexico]{babel}
\usepackage{mathtools}

\usepackage{cleveref}

\newtagform{Eq}{Ecuación\;}{}
\usetagform{Eq}

\begin{document}

    \chapter{Test}

    See test \ref{eq:test} or, with cleveref: see \cref{eq:test}
    \begin{equation}
        a+b=c^2 \label{eq:test}
    \end{equation}

\end{document} 

enter image description here

Bernard
  • 271,350
2

The equation tag is formatted by the macro \tagform@ with the default definition

\def\tagform@#1{\maketag@@@{(\ignorespaces#1\unskip\@@italiccorr)}}

You can redefine it to use the desired format.

Regarding your second point: \eqref is intended to output the equation number in the same format as it appears in the equation tag (using \tagform@). If you only want the number of the equation without any formatting, just use \ref instead.

\documentclass[a4paper, 12pt]{report}

\usepackage[spanish,mexico]{babel}
\usepackage{amsmath}

\makeatletter
  \renewcommand*\tagform@[1]{\maketag@@@{Ecuación~\ignorespaces #1\unskip\@@italiccorr}}
\makeatother

\begin{document}

\chapter{Test}

See test equation \eqref{eq:test}
\begin{equation}
    a+b=c^2 \label{eq:test}
\end{equation}

You can also just reference the equation number: \ref{eq:test}

\end{document}
schtandard
  • 14,892