4

I need a different numbering style for equations in the Supplementary Material, for example use

(S.1)

instead of

(1.1)

It works manually with \tag{S.1} but is there a way to change the style for the whole document to (1) keep numbering automatic, (2) be able to use automatic cross referencing between main text and supplementary text?

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{mathtools}
\begin{document}
\begin{equation}\tag{S.1}
\bar\gamma_M:=\frac{1}{\alpha+\alpha'}, \quad  \bar\gamma_Z:=\frac{1}{\gamma+\gamma'}.
\end{equation}
\end{document}
2
  • Welcome to TeX.SX! Please don't post code fragments. Instead, put your fragments into a complete compilable document that shows the problem.
    – BambOo
    Sep 17, 2019 at 16:21
  • 1
    Thanks. Hope that's better.
    – Elsa
    Sep 17, 2019 at 16:36

2 Answers 2

4

Just change the definition of \theequation when the supplementary material starts.

\documentclass{article}
\usepackage{mathtools}

\numberwithin{equation}{section}

\begin{document}

\section{Main material}

We have an equation
\begin{equation}\label{main}
0=0
\end{equation}
that will be used in~\eqref{suppl}.

\section{Supplementary material}
\renewcommand{\theequation}{S.\arabic{equation}}

This equation is clearer than~\eqref{main}
\begin{equation}\label{suppl}
\bar\gamma_M=\frac{1}{\alpha+\alpha'}, \quad  \bar\gamma_Z=\frac{1}{\gamma+\gamma'}.
\end{equation}
but more difficult.

\end{document}

enter image description here

If you introduce the supplementary material with \section*, add also

\setcounter{equation}{0}

after the \renewcommand line.

0

A simple solution with \newtagform and \usetagform, from mathtools. However note tha cross referencing will have to be done by hand:

\documentclass{article}

\usepackage[utf8]{inputenc}
\usepackage{mathtools}
\newtagform{supplementary}[S.]()
\counterwithin*{equation}{section}

\begin{document}

\begin{equation} \label{eq}
\bar\gamma_M:=\frac{1}{\alpha+\alpha'}, \quad \bar\gamma_Z:=\frac{1}{\gamma+\gamma'}.
\end{equation}

\section{Supplementary material}
\usetagform{supplementary}
\begin{equation} \label{eq-S}
\bar\gamma_M:=\frac{1}{\alpha+\alpha'}, \quad \bar\gamma_Z:=\frac{1}{\gamma+\gamma'}.
\end{equation}

\end{document}

enter image description here

7
  • Is there a way to do it so that I'll be able to use the xr package for automatic cross referencing?
    – Elsa
    Sep 17, 2019 at 16:42
  • Also I get the error message "! Undefined control sequence. \couterwithin" when I compile your code. Any idea why?
    – Elsa
    Sep 17, 2019 at 16:47
  • Did you forget to type the first n from \counterwithin? Or is your LaTeX installation up-to-date?
    – Bernard
    Sep 17, 2019 at 17:09
  • For you first comment, I don't know, as I never used xr.
    – Bernard
    Sep 17, 2019 at 17:14
  • No I mistyped here sorry but I copied pasted your code.
    – Elsa
    Sep 17, 2019 at 19:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .