# subequations customize arabic numbering in aligned environment

i've a rather simple problem for the experts out there! :)

using subequations, it automatically enumerates the subequations in alphabetic order.

is there a way to obtain instead an arabic-enumeration? like

Eq: ... (1)

Eq: ... (2)

Eq: ... (3.1)

Eq: ... (3.2)

Eq: ... (4)

... and so on

Here is my MWE:

\documentclass[10pt,twoside]{article}
\usepackage{url}
\usepackage{hyperref}
\usepackage{amssymb}
\usepackage{amsthm, etoolbox}
\usepackage[title,titletoc]{appendix}
\usepackage{pdflscape}
\usepackage{mathtools}
\usepackage{multirow}
\usepackage{tabularx}
\usepackage{placeins} % rotating Tables
\usepackage{rotating} % coloring table columns and rows
\usepackage{colortbl}

\newcolumntype{a}{>{\columncolor[gray]{.8}}c}
\newcolumntype{b}{>{\columncolor{white}}c}

\patchcmd{\subequations}{\def\theequation{\theparentequation\alph{equation}}}%
{\def\theequation{\theparentequation.\arabic{equation}}}{}{}

%some shortcut commands ....

\begin{document}

\section{Model}

\begin{subequations}
\begin{align} Y_m &= X P_m^{-\sigma_x} \label{eq:Demand_Yg} \\
Y_s &= X P_s^{-\sigma_x} \label{eq:Demand_Ys}
\end{align}
\end{subequations}

\end{document}


Would it be possible to embed the patch within this chadstyle package? As you see, I've already put in the beginning. Thanks!

%  chadstyle.sty   Chad Jones, 5/1/08
%
%  Chad's style file for nice paper format.
%  Various ideas for this style are taken from
%    -- Matthias Doepke and Michele Tertilt
%    -- Tony Roberts

\special{papersize=8.5in,11in}
%\usepackage{palatino,amssymb,amsfonts,amsmath,latexsym,setspace}
\usepackage{utopia,amssymb,amsfonts,latexsym,setspace}

\usepackage{amsthm, etoolbox}
\patchcmd\subequations
{\theparentequation\alph{equation}}
{\subequationsformat}
{}{}

\newcommand{\subequationsformat}{\theparentequation.\arabic{equation}}

\usepackage[dvips]{graphicx}
\usepackage{fancyhdr}
\usepackage[longnamesfirst]{natbib}

% example file to change the style of LaTeX
% Tony Roberts May 2004
% first colour for latex or pdflatex
\ifx\pdfoutput\@undefined\usepackage[usenames,dvips]{color}
\else\usepackage[usenames,dvipsnames]{color}
% and fix pdf colour problems
\IfFileExists{pdfcolmk.sty}{\usepackage{pdfcolmk}}{}
\fi

% See http://web.njit.edu/~kevin/rgb.txt.html for possibilities

bookmarks=false,
pdfstartview=Fit,  % for fitting entire page; FitW just fits width
pdfview=Fit,       % after traversing a hyperlink
citecolor=Black,
hyperfootnotes=false
]{hyperref}
\usepackage[figure,table]{hypcap} % Correct a problem with hyperref
\urlstyle{rm} %so it doesn't use a typewriter font for url's.

%%%%%%%%%%%%%%%%%%%%%

% Fix title, sections, etc.

\let\LaTeXtitle\title

\let\LaTeX@startsection\@startsection
\renewcommand{\@startsection}[6]{\LaTeX@startsection%

% Fix periods at end of section numbers
%\renewcommand \thesection {\@arabic\c@section.}
%\renewcommand\thesubsection   {\thesection\@arabic\c@subsection.}
%\renewcommand\thesubsubsection{\thesubsection \@arabic\c@subsubsection.}

% Margin, Paragraph Setup
\onehalfspacing
\textheight=23cm \textwidth=17cm \topmargin=-8.5mm
%default: \textheight=22cm \textwidth=16cm \topmargin=-6.5mm
\oddsidemargin=3mm \evensidemargin=3mm
%\setlength{\parindent}{0em}
%\setlength{\parskip}{1.5ex plus0.5ex minus0.5ex}
%\setlength{\parsep}{0pt}
\setlength{\parskip}{0pt}

% This is how to control linespacing using setspace
% (\singlespacing or doublespacing just call this command)
\setstretch{1.4}

\pagestyle{fancy}
\cfoot[]{}

{\color{ChadGreen}{\uppercase {\footnotesize #2}}}  % Short title
}

% Make hyperlinks jump more accurately
\makeatletter
\newcommand\org@hypertarget{}
\let\org@hypertarget\hypertarget
\renewcommand\hypertarget[2]{%
} \makeatother

% Spacing in Tables and Figures
%\renewcommand{\tabcolsep}{1pt}   % space between columns
\renewcommand{\arraystretch}{1.5} % space between rows
\addtolength{\textfloatsep}{0pt} % space between floats and text

\newcommand{\spc}[0]{\vspace{.1in}}
\newcommand{\fignote}[2]{\begin{center}\parbox[c]{#1}{\footnotesize #2} \end{center}}
\newcommand{\tabnote}[2]{\begin{center}\parbox[c]{#1}{\footnotesize #2} \end{center}}


Dear all, I've found the solution to the problem using chadstyle package. I've simply included the command within the subequation environment:

 \documentclass[10pt,twoside]{article}
\usepackage{amsthm, etoolbox}
.
.
.
\begin{document}
.
.
.
\begin{subequations}
\newcommand{\subequationsformat}{\theparentequation.\arabic{equation}}
\begin{align}
a = b \\
c = d
\end{align}
\end{subequations}
.
.
.
\end{document}


Thanks for your time and all the suggestions! Best, E

-
Welcome to TeX.SX! Please give us a minimal code which shows your subequations. We don't want to guess around here. – LaRiFaRi Jul 7 '14 at 9:24
Dear LaRiFaRi, thanks for your quick reply. unfortunately, it's not working! – esco Jul 7 '14 at 9:55
You are missing one backslash after \label{eq:Demand_Yg}  – LaRiFaRi Jul 7 '14 at 10:42
What is hiding in chadstyle.sty? – Andrew Swann Jul 7 '14 at 10:49
You can see the importance of a minimal example: the information about the presence of hyperref was essential. – egreg Jul 7 '14 at 10:59

The amsmath package doesn't provide an interface for changing the appearance of the equation numbers in subequations, but we can add one with etoolbox:

\documentclass{article}
\usepackage{amsmath,etoolbox}

\patchcmd\subequations
{\theparentequation\alph{equation}}
{\subequationsformat}
{}{}

\newcommand{\subequationsformat}{\theparentequation.\arabic{equation}}

\begin{document}

Some text
$$1=1$$
some text
\begin{subequations}
\begin{gather}
2=2\\
3=3
\end{gather}
\end{subequations}
some text
$$0=0$$

\end{document}


Basically I remove the default setting passing control to a macro that's user definable. Modify \subequationsformat to suit your taste.

With hyperref it's slightly more complicated in that the patch has to be done before loading hyperref.

\documentclass[10pt,twoside]{article}
\usepackage{url}
\usepackage{amssymb}
\usepackage{amsthm, etoolbox}
\usepackage[title,titletoc]{appendix}
\usepackage{pdflscape}
\usepackage{mathtools}
\usepackage{multirow}
\usepackage{tabularx}
\usepackage{placeins} % rotating Tables
\usepackage{rotating} % coloring table columns and rows
\usepackage{colortbl}

\patchcmd\subequations
{\theparentequation\alph{equation}}
{\subequationsformat}
{}{}

\usepackage{hyperref}

\newcolumntype{a}{>{\columncolor[gray]{.8}}c}
\newcolumntype{b}{>{\columncolor{white}}c}

\newcommand{\subequationsformat}{\theparentequation.\arabic{equation}}

%some shortcut commands ....

\begin{document}

\section{Model}

\begin{subequations}
\begin{align} Y_m &= X P_m^{-\sigma_x} \label{eq:Demand_Yg}\\
Y_s &= X P_s^{-\sigma_x} \label{eq:Demand_Ys}
\end{align}
\end{subequations}

\ref{eq:Demand_Yg}

\end{document}


None of your packages should be loaded after hyperref. Check with those you have in chadstyle (I can't know what's in it).

-
chadstyle is simply a customized package for layout and font style. – esco Jul 7 '14 at 11:20

The subequations environment has the format hard coded in to it, so it is not so straightforward to change. The simplest solution is to patch the definition:

\documentclass{article}

\usepackage{amsmath}
\usepackage{etoolbox}

\patchcmd{\subequations}{\def\theequation{\theparentequation\alph{equation}}}%
{\def\theequation{\theparentequation.\arabic{equation}}}{}{}

\begin{document}

$$a = b$$

\begin{subequations}
\begin{align}
c &=d \\
e &=f
\end{align}
\end{subequations}

\begin{align}
g &= h\\
i &= j
\end{align}

\end{document}

-
I've tried without chadstyle package, and it works!!! Thanks to all of you! – esco Jul 7 '14 at 12:13
would it be possible to add this chadstyle package, and someone takes a brief look at it to see if it's possible to embed the patch somewhere there? Thanks! – esco Jul 7 '14 at 12:15
If it is not too big then you can add the code to your question. – Andrew Swann Jul 7 '14 at 13:01
Dear Andrew, I've added the code in my answer. Best, E – esco Jul 7 '14 at 13:52