Generalquestion on equation numbering

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
mollyc
Posts: 1
Joined: Tue Aug 07, 2007 1:30 am

question on equation numbering

Post by mollyc »

Hi. I'm trying to write a Latex document where I have two sets of equations that have different numbering labeling. For example I want one type of equation to be numbered 1,2,3... and another set of equations (interspersed in the same document) with a different numbering scheme, i.e. I, II, III... I have tried the \newcounter command and the \newenvironment command and can get a new numbering scheme but I do not know how to set it up in equation format where the equation is centered and the counter is right justified and they are on the same line, the same way they are in the equation environment. Does anyone have any suggestions??? Thanks.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

craigim
Posts: 28
Joined: Sun Jan 14, 2007 6:19 pm

question on equation numbering

Post by craigim »

Try this code to define a new environment called 'scheme'

Code: Select all

...
\newcounter{SchemeCounter} \renewcommand\theSchemeCounter{\thechapter.\Roman{SchemeCounter}}
\newenvironment{scheme}%
	{\stepcounter{SchemeCounter}\begin{center}\hspace{\fill}$\phantom{(\theSchemeCounter)}}%
	{$\hspace*{\fill}\nolinebreak[3](\theSchemeCounter)\end{center}}
...
\begin{document}
...
\chapter{Test Chapter}
...
\begin{scheme}
Insert equation here
\end{scheme}

It defines a new counter, redefines it to number it by chapter, a period, and then a capital roman numeral

Before starting the environment, step the counter, start centering, and put a rubber space on the left hand side, puts things into math mode, and adds an invisible counter on the left to get the spacing right.

After the environment is over, fill the right with a rubber space, don't allow a line break unless really necessary, and then put the counter in parenthesis.

Hope this helps...
Enjoy!
craigim
Posts: 28
Joined: Sun Jan 14, 2007 6:19 pm

question on equation numbering

Post by craigim »

I messed with this a bit more and got something that is much simpler, but also doesn't break the \label command (which the previous post does).

Replace the previous newenvironment with:

Code: Select all

\newenvironment{scheme}%
	{\stepcounter{SchemeCounter}\[}%
	{\tag{\theSchemeCounter}\]}
To use this version, you need to \usepackage{amsmath}. The previous version doesn't like having a \label, and will refer to the equation counter rather than the custom counter in a \ref{}

For anyone else reading this, in the interest of full disclosure, I share an office with mollyc, but I'm just posting what we figured out after going meticulously through LaTeX Companion 2nd ed. by Mittlebach & Goosens and LaTeX by Leslie Lampoort. I figured that someone else might be interested in our code fu.
Post Reply