4

how I can number my equations in this form:

Equation1; Equation2; Equation3; Equation4 (4a-d)

while all of them are located in the same line

\begin{subequations}\label{eq:35}
\begin{align}
u(0)=u_1; \qquad \phi(0)=-\phi_1; \qquad u(L)=u_2; \qquad \phi(L) = -\phi_2,
\end{align}
\end{subequations}
Werner
  • 603,163
  • 2
    Welcome to TeX SX! Could you more precise? The numbering is not clear to me. – Bernard Jul 19 '16 at 14:02
  • I have four equations which should be labeled as 4a, 4b, 4c and 4d. since all of them are positioned in the same line, I was wondering how I can label all of them in this (4a-d) form. 4 is the number an arbitrary number. – KratosMath Jul 19 '16 at 14:04
  • If you just want to label them: \usepackage{amsmath} and do \tag{4a-d}. If you want the counter to be autoincremented (so that if you add a different displayed equation before you will automatically change from 4 to 5, and if you want reasonable outputs when you say \ref, then it will need more work. Please be precise about all the features you will need. – Willie Wong Jul 19 '16 at 14:06
  • I edited the question, I dont know how to be more precise – KratosMath Jul 19 '16 at 14:09

3 Answers3

7

The following will display what you want, but only allow you to refer to all four together, but not individually like (4a) or (4c).

\documentclass{article}
\usepackage{amsmath}

\begin{document}
First put in a normal equation
\begin{equation}
    E = mc^2 
\end{equation}
Then the weird one:
\begin{equation}
u(0)=u_1; \qquad \phi(0)=-\phi_1; \qquad u(L)=u_2; \qquad \phi(L) = -\phi_2, 
\refstepcounter{equation}\tag{\theequation a-d}\label{eq:35}
\end{equation}
The above is \eqref{eq:35}. Then another one to make sure the numbering is ok.
\begin{equation}
    K = \frac12 mv^2
\end{equation}
\end{document}

enter image description here


Version 2: if you want to refer to individual ones, you can do worse than steal from egreg.

\documentclass{article}
\usepackage{amsmath}

\AtBeginDocument{\let\latexlabel\label}

\begin{document}
First put in a normal equation
\begin{equation}
    E = mc^2 
\end{equation}
Then the weird one:
\begin{subequations}\label{eq:all}
\[
    \refstepcounter{equation}\latexlabel{eq:partA}
    \refstepcounter{equation}\latexlabel{eq:partB}
    \refstepcounter{equation}\latexlabel{eq:partC}
    \refstepcounter{equation}\latexlabel{eq:partD}
u(0)=u_1; \qquad \phi(0)=-\phi_1; \qquad u(L)=u_2; \qquad \phi(L) = -\phi_2, 
\tag{\ref{eq:partA}--\ref{eq:partD}}
\]
\end{subequations}
The above is \eqref{eq:all}, which is composed of \eqref{eq:partA}, \eqref{eq:partB}, \eqref{eq:partC}, \eqref{eq:partD}. Then another one to make sure the numbering is ok.
\begin{equation}
    K = \frac12 mv^2
\end{equation}
\end{document}

Writing it like this you get separate reference points for the entire set eq:all and the individual ones.

enter image description here

Willie Wong
  • 24,733
  • 8
  • 74
  • 106
  • exactly what I was searching for.... thanks – KratosMath Jul 19 '16 at 14:18
  • 2
    For the sake of typography, I think the label should be generated as \tag{\theequation a--d} rather than as \tag{\theequation a-d}. That way, the connector between "a" and "d" will be an en-dash rather than a simple hyphenation character. – Mico Jul 19 '16 at 14:58
1

Is it something like this you want? I define a tabequation environment:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}%
 \usepackage{array, tabularx, mathtools}
\usepackage[showframe]{geometry}

\newcolumntype{E}[1]{>{\equation}>{\hsize=#1\hsize}X<{\endequation}}
\newcolumntype{Y}{>{\equation}X<{\endequation}}
\newcolumntype{P}[1]{>{\equation}p{#1\linewidth}<{\endequation}}

\newenvironment{tabequations}[1]{%
\vspace{\abovedisplayskip}\par\noindent\setlength\tabcolsep{2pt}\setlength\abovedisplayskip{0pt}
\tabularx{\linewidth}{#1}}%
{\endtabularx\par}

\begin{document}

Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text.%

\setcounter{equation}{3}%

\begin{subequations}
  \begin{tabequations}{*{4}{Y}}
    x = y & z = t & u = v & a = b
  \end{tabequations}
\end{subequations}

\end{document} 

enter image description here

Bernard
  • 271,350
1

Since the four short equations would appear to form some kind of group, what is the point of creating fake separate labels? Either treat them as a single entity (with a single equation number), or assign individual labels -- (1a), (1b), etc -- to each one of them.

enter image description here

\documentclass{article}
\usepackage{amsmath} % for 'subequations' environment

\begin{document}

\bigskip\noindent
\begin{subequations}
Four equations placed side by side, each one labelled individually:
\par\noindent
\begin{minipage}{0.21\textwidth}
\begin{equation}\label{eq:a} u(0)=u_1 \end{equation}
\end{minipage}\hfill
\begin{minipage}{0.24\textwidth}
\begin{equation}\label{eq:b} \phi(0)=-\phi_1 \end{equation}
\end{minipage}\hfill
\begin{minipage}{0.21\textwidth}
\begin{equation}\label{eq:c} u(L)=u_2 \end{equation}
\end{minipage}\hfill
\begin{minipage}{0.24\textwidth}
\begin{equation}\label{eq:d} \phi(L) = -\phi_2 \end{equation}
\end{minipage}
\par\noindent
\end{subequations}

\bigskip\noindent
And a normal equation:
\begin{equation} \label{eq:trivial}
1+1=2
\end{equation}
\end{document}

\documentclass{article}
\usepackage{amsmath} % for 'subequations' environment

\begin{document}

\bigskip\noindent
\begin{subequations}
Four equations placed side by side, each one labelled individually:
\par\noindent
\begin{minipage}{0.21\textwidth}
\begin{equation}\label{eq:a} u(0)=u_1 \end{equation}
\end{minipage}\hfill
\begin{minipage}{0.24\textwidth}
\begin{equation}\label{eq:b} \phi(0)=-\phi_1 \end{equation}
\end{minipage}\hfill
\begin{minipage}{0.21\textwidth}
\begin{equation}\label{eq:c} u(L)=u_2 \end{equation}
\end{minipage}\hfill
\begin{minipage}{0.24\textwidth}
\begin{equation}\label{eq:d} \phi(L) = -\phi_2 \end{equation}
\end{minipage}
\par\noindent
\end{subequations}

\bigskip\noindent
And a normal equation:
\begin{equation} \label{eq:trivial}
1+1=2
\end{equation}
\end{document}
Mico
  • 506,678
  • @WillieWong - Thanks. I'm afraid I can't recall such a posting right now, but if I do come across it, I will let you know. – Mico Jul 19 '16 at 16:04