1

Herein in my given code, I am having four equations which are getting numbered as, 1a, 1b, 2a and 2b respectively. I want them to get numbered as 1a, 1b, 1b and 1c (because if you check then eq.1b and eq.2a are the same). Unfortunately, I'm having to use one line of text in between, since I want to propagate a certain logic which causes a change in the equation form, hence I'm having to break the align and the subequation environment which is causing this issue. Is there some way around this? Or is there any suggestion from the experienced guys at this portal as to how I cold write it any better? I am extremely new to Latex and I'm writing my first report using it.

\documentclass{article}
\usepackage{mathtools}

\begin{document}
\begin{subequations}
\begin{align}
  \vec{a}\cdot\vec{b} &=\pi\\
  (\vec{a_1}+\vec{a_2})\cdot(\vec{b_1}+\vec{b_2}) &=\pi
\end{align}
\end{subequations}  
since $\vec{a_1}\cdot\vec{b_2}$ and $\vec{a_2}\cdot\vec{b_1}$ is equal to zero, hence
\begin{subequations}
\begin{align}
(\vec{a_1}+\vec{a_2})\cdot(\vec{b_1}+\vec{b_2}) &=\pi\\
\vec{a_1}\cdot\vec{b_1}+\vec{a_2}\cdot\vec{b_2} &=\pi
\end{align}
\end{subequations}
\end{document}
  • Welcome to TeX.SX! – Bobyandbob Sep 23 '17 at 12:19
  • @Bobyandbob Thanks a lot. Was there something wrong with the question with regards to the etiquette of the forum. Kindly don't erefrain from educating me, I know I will make mistakes, I have made them in SE Physics and SE math as well – ubuntu_noob Sep 23 '17 at 12:24
  • no, everything is fine! – Bobyandbob Sep 23 '17 at 12:28
3

subequations can enclose text. it only influence on equation numbering:

\documentclass{article}
\usepackage{mathtools}

\begin{document}
\begin{subequations}
\begin{align}
  \vec{a}\cdot\vec{b} &=\pi\\
  (\vec{a_1}+\vec{a_2})\cdot(\vec{b_1}+\vec{b_2}) &=\pi
\end{align}
since $\vec{a_1}\cdot\vec{b_2}$ and $\vec{a_2}\cdot\vec{b_1}$ is equal to zero, hence
\begin{align}
(\vec{a_1}+\vec{a_2})\cdot(\vec{b_1}+\vec{b_2}) &=\pi\\
\vec{a_1}\cdot\vec{b_1}+\vec{a_2}\cdot\vec{b_2} &=\pi
\end{align}
\end{subequations}
\end{document}

enter image description here

edit: it seems that the problem is retyping equation (1b). i don't see any reasons to do this, i would simply escape this repetition and wrote as:

\documentclass{article}
\usepackage{mathtools}

\begin{document}
\begin{subequations}
    \begin{align}
  \vec{a}\cdot\vec{b} &=\pi
            \label{eq:step-1}   \\
  (\vec{a_1}+\vec{a_2})\cdot(\vec{b_1}+\vec{b_2}) &=\pi
            \label{eq:step-2}
\intertext{since $\vec{a_1}\cdot\vec{b_2}$ and $\vec{a_2}\cdot\vec{b_1}$ is equal to zero, hence \eqref{eq:step-2} becomes}
\vec{a_1}\cdot\vec{b_1}+\vec{a_2}\cdot\vec{b_2} &=\pi
            \label{eq:step-3}
    \end{align}
\end{subequations}
\end{document}

where for text between equations is used intertext{...}. with this all three equation is aligned at sign =:

enter image description here

in \intertext{...} i add \eqref{eq:step-2} becomes only for show that you can equation (1b) refered, if you wish. without this addition the evaluation is also very clear (to my taste).

if you persist with repetition of equation (1b) and give it the same number as it has, than you can try:

\documentclass{article}
\usepackage{mathtools}

\begin{document}
\begin{subequations}
    \begin{align}
  \vec{a}\cdot\vec{b} &=\pi
            \label{eq:step-1}   \\
  (\vec{a_1}+\vec{a_2})\cdot(\vec{b_1}+\vec{b_2}) &=\pi
            \label{eq:step-2}
\intertext{since $\vec{a_1}\cdot\vec{b_2}$ and $\vec{a_2}\cdot\vec{b_1}$ is equal to zero, hence}
\addtocounter{equation}{-1} % <---- added
  (\vec{a_1}+\vec{a_2})\cdot(\vec{b_1}+\vec{b_2}) &=\pi\\
\vec{a_1}\cdot\vec{b_1}+\vec{a_2}\cdot\vec{b_2} &=\pi
            \label{eq:step-3}
    \end{align}
\end{subequations}
\end{document}

enter image description here

  • But, you see, even then, equations 1b and 1c are the same, so could I reuse the 1b tag in some way?? – ubuntu_noob Sep 23 '17 at 12:22
  • 1
    well, then i didn't understand you question. you don't like to type equation 1b twice .... this can be done by storing it in a save box, but this require more effort than simply copied it :). i rather would't type it again. – Zarko Sep 23 '17 at 12:27
  • 1
    @ubuntu_noob, see edit of my answer. – Zarko Sep 23 '17 at 13:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.