Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Before Xerox, five carbons were the maximum extension of anybody's ego.


computers / comp.text.tex / Customizing Eq numbers within align environment

SubjectAuthor
* Customizing Eq numbers within align environmentDave94705
`- Re: Customizing Eq numbers within align environmentUlrike Fischer

1
Customizing Eq numbers within align environment

<c07327b4-053a-4f34-bbbe-45bb24c342ean@googlegroups.com>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=3648&group=comp.text.tex#3648

  copy link   Newsgroups: comp.text.tex
X-Received: by 2002:ae9:eb4b:: with SMTP id b72mr7784779qkg.497.1622559191993; Tue, 01 Jun 2021 07:53:11 -0700 (PDT)
X-Received: by 2002:a37:aacb:: with SMTP id t194mr2125644qke.423.1622559191776; Tue, 01 Jun 2021 07:53:11 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!news.uzoreto.com!tr2.eu1.usenetexpress.com!feeder.usenetexpress.com!tr3.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.text.tex
Date: Tue, 1 Jun 2021 07:53:11 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=45.30.90.187; posting-account=TEWWXwoAAABVTlovvE5oUyiszPAiy7tz
NNTP-Posting-Host: 45.30.90.187
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <c07327b4-053a-4f34-bbbe-45bb24c342ean@googlegroups.com>
Subject: Customizing Eq numbers within align environment
From: david.jo...@gmail.com (Dave94705)
Injection-Date: Tue, 01 Jun 2021 14:53:11 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 56
 by: Dave94705 - Tue, 1 Jun 2021 14:53 UTC

I have numerous equations within an align environment which I want to have numbered as EqNa, EqNb, ..... I cut and pasted a solution I found for the equation environment and it does what I want numbering wise but it errors out and I cannot figure out why. Any suggestions greatly appreciated.

I assume fixing the error will result in the final equation being correctly numbered 5 also. Thanks

\documentclass{article}
\usepackage{amsmath}
\begin{document}

\newcounter{defcounter}
\setcounter{defcounter}{0}
\newenvironment{myequation}{%
\addtocounter{equation}{-1}
\refstepcounter{defcounter}
\renewcommand\theequation{D\thedefcounter}
\begin{equation}}
{\end{equation}}

\begin{equation}
y = a x + b
\end{equation}

\begin{myequation}
y = \alpha x + \beta
\end{myequation}
\newcounter{eqNumHold}\setcounter{eqNumHold}{0}
\newcounter{subEq}\setcounter{subEq}{0}

\newenvironment{myalign}{%
\setcounter{subEq}{0}
\refstepcounter{equation}
\setcounter{eqNumHold}{\value{equation}}
\refstepcounter{subEq}
\renewcommand\theequation{%
\theeqNumHold\alph{subEq}%
\addtocounter{equation}{-1}}
\begin{align}}
{\setcounter{equation}{\value{eqNumHold}}\end{align}}

\begin{align}
y_1 & = a_1 x + b_1 \\
y_2 & = a_2 x + b_2
\end{align}

\begin{myalign}
y_1 & = \alpha_1 x + \beta_1 \\
y_2 & = \alpha_2 + \beta_2
\end{myalign}

$$ E = mc^2 $$
\end{document}

Re: Customizing Eq numbers within align environment

<1phm71j8c1pdc.dlg@nililand.de>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=3649&group=comp.text.tex#3649

  copy link   Newsgroups: comp.text.tex
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: new...@nililand.de (Ulrike Fischer)
Newsgroups: comp.text.tex
Subject: Re: Customizing Eq numbers within align environment
Date: Tue, 1 Jun 2021 17:42:29 +0200
Lines: 21
Message-ID: <1phm71j8c1pdc.dlg@nililand.de>
References: <c07327b4-053a-4f34-bbbe-45bb24c342ean@googlegroups.com>
Reply-To: news3@nililand.de
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
X-Trace: individual.net KtR1ism1ev8AtSzOkQAN9gObf3JgZ9iJPyeT9T0Is8cAXoIEf7
Cancel-Lock: sha1:Bn8NoaLuAExYTw5XpCmDQwZvEsE=
User-Agent: 40tude_Dialog/2.0.15.41de
 by: Ulrike Fischer - Tue, 1 Jun 2021 15:42 UTC

Am Tue, 1 Jun 2021 07:53:11 -0700 (PDT) schrieb Dave94705:

> but it errors out and I cannot figure out why. Any
> suggestions greatly appreciated.

Use \align/\endalign

\newenvironment{myalign}{%
\setcounter{subEq}{0}
\refstepcounter{equation}
\setcounter{eqNumHold}{\value{equation}}
\refstepcounter{subEq}
\renewcommand\theequation{%
\theeqNumHold\alph{subEq}%
\addtocounter{equation}{-1}}
\align}
{\setcounter{equation}{\value{eqNumHold}}\endalign}

--
Ulrike Fischer
http://www.troubleshooting-tex.de/

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor