15

Here is my MWE:

\documentclass[a4paper, 12pt]{report}
\usepackage{amssymb, amscd}
\begin{document}
    \chapter{Test}

    \begin{table}[h]
        \center
        \caption{Test}
        \begin{tabular}{l | r}
            Two & 2 \\
            Four & 4
        \end{tabular}
    \end{table}

    Test equation:
    \begin{equation}
        a+b=c^2
    \end{equation}
\end{document}

It produces this:

enter image description here

Now I would like to change equation numbering style. I want (1-1) instead of (1.1). How can I do that? Also, I want to preserve numbering style for tables and figures (Table 1.1:) , I don't want (Table 1-1:)

  • 5
    You can try to redefine \theequation with \renewcommand{\theequation}{\thechapter--\arabic{equation}}. :) – Paulo Cereda Jun 30 '12 at 14:20
21

I was looking for some hints in the amsmath documentation and found the following trick (adapted, of course):

\usepackage{amsmath}
\renewcommand{\theequation}{\thechapter--\arabic{equation}}

If we look at the original definition of \theequation, we can find that it's more robust than our first attempt:

\long macro:->\ifnum \c@chapter >\z@ \thechapter .\fi \@arabic \c@equation

we can easily redefine it accordingly:

\makeatletter
\long\def\theequation{\ifnum \c@chapter > \z@ \thechapter --\fi \@arabic \c@equation}
\makeatother

Interestingly enough, there's another approach with the etoolbox package:

\usepackage{etoolbox}
\patchcmd{\theequation}{.}{--}{}{}

Equation

There we go. :)

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.