-1

i wrote in an equation environment, however, the right equation number is not displayed! it displays (2.1), which is wrong because this is my first equation. I think it took the section number as a first value.

Any idea how to solve this?

my code:

\begin{equation}
      \overrightarrow { \rm \nabla }  \cdot [\varepsilon \overrightarrow{ \rm (r)} \nabla \varphi \overrightarrow{ \rm (r) }] = - \frac{1}{\varepsilon_0} \left [ \rho^{fixed} \overrightarrow{ \rm (r) } + e \sum_{i}^{n} C_{i}^{b} exp ( - \frac{ez_i}{kT} \varphi \overrightarrow{ \rm (r) } ) \right ]
 \end{equation}
3
  • 2
    it is impossible to test a fragment, please show a complete small document that has the problem. note that \rm has not been defined in latex by default since 1993. Commented Jan 31, 2022 at 17:53
  • \documentclass{article} \begin{document} \begin{equation} \overrightarrow { \rm \nabla } \cdot [\varepsilon \overrightarrow{ \rm (r)} \nabla \varphi \overrightarrow{ \rm (r) }] = - \frac{1}{\varepsilon_0} \left [ \rho^{fixed} \overrightarrow{ \rm (r) } + e \sum_{i}^{n} C_{i}^{b} exp ( - \frac{ez_i}{kT} \varphi \overrightarrow{ \rm (r) } ) \right ] \end{equation} \end{document} runs without error and makes this output Commented Jan 31, 2022 at 17:56
  • Your document class presumably numbers equations within sections. Commented Jan 31, 2022 at 17:57

1 Answer 1

0

I assume you either defined it in the beginning of your document or you use a document class that specifies it itself accordingly. Anyhow, you can use the chngcntr package to manually define how the counting is done.

Here an MWE with the numbering done without the section number:

\documentclass[12pt]{article}

\usepackage{chngcntr}
\counterwithout{equation}{section}

\begin{document}

\section{Section One}

This is some text in Section 1.

\section{Section Two}

This is some text in Section 2. And here comes your equation:
\begin{equation}
      \overrightarrow { \rm \nabla }  \cdot [\varepsilon \overrightarrow{ \rm (r)} \nabla \varphi \overrightarrow{ \rm (r) }] = - \frac{1}{\varepsilon_0} \left [ \rho^{fixed} \overrightarrow{ \rm (r) } + e \sum_{i}^{n} C_{i}^{b} exp ( - \frac{ez_i}{kT} \varphi \overrightarrow{ \rm (r) } ) \right ]
 \end{equation}

\end{document}

And here an MWE with the numbering done with the section number:

\documentclass[12pt]{article}

\usepackage{chngcntr}
\counterwithin{equation}{section}

\begin{document}

\section{Section One}

This is some text in Section 1.

\section{Section Two}

This is some text in Section 2. And here comes your equation:
\begin{equation}
      \overrightarrow { \rm \nabla }  \cdot [\varepsilon \overrightarrow{ \rm (r)} \nabla \varphi \overrightarrow{ \rm (r) }] = - \frac{1}{\varepsilon_0} \left [ \rho^{fixed} \overrightarrow{ \rm (r) } + e \sum_{i}^{n} C_{i}^{b} exp ( - \frac{ez_i}{kT} \varphi \overrightarrow{ \rm (r) } ) \right ]
 \end{equation}

\end{document}
4
  • thank you all for your input. it worked fine with "\usepackage{chngcntr}"
    – sphero
    Commented Jan 31, 2022 at 18:35
  • You should be aware that about four years ago the chngcntr package functionality was incorporated in the LaTeX kernel. Besides, \rm has been deprecated for almost 30 years and should not be used.
    – egreg
    Commented Jan 31, 2022 at 21:01
  • @egreg is right, so you do not have to load the chngcntr package, you can simply use \counterwithout{equation}{section} directly as well
    – Jack
    Commented Jan 31, 2022 at 21:44
  • @KhalidHelmy: If the answer solved your problem, you may want to accept the answer by clicking the checkmark
    – Jack
    Commented Jan 31, 2022 at 21:49

You must log in to answer this question.

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