1

I am relatively new working with LaTeX and I don't know how to solve this problem.

I have several equations that I wrote in a general form, but when writing them, I want to show that the general form is just a generalization for three specific formulas; i.e.

I have this

enter image description here

but I want to have this:

enter image description here

P.S: I could use the command tag like in this post Customize equation numbering for Equation environment?, but I have over 60 equations and I could not use the command tag for each line individually (Also, there could be multiple errors doing it manually) Can someone help me please?

My MWE is:

 \documentclass[a4paper,12pt]{article} \usepackage[spanish]{babel} \usepackage[latin1]{inputenc} \usepackage{amsmath} \begin{document} \begin{equation} E=mc^2 \end{equation} \end{document} 

EDIT: For more clarity, I put some equations with subscript (j) and others not; and those with subscript I want to be counted not as just one equation; but from n (number of previous equation) to j (from 1 to 3).I know how to set this MANUALLY, but that wouldn't be efficient nor exent of mistakes since we are talking of over 100 equations in different sections). An example is:

enter image description here

My MWE is the following:

\begin{document} \begin{equation} F=ma \end{equation} \begin{equation} E=m_{j}c^2 \tag{2), (3), (4} \end{equation} \setcounter{equation}{4} \begin{equation} A=B+C \end{equation} \begin{equation} D_{j}= E_{j} + F_{j} \tag{6), (7), (8} \end{equation} \end{document} 
10
  • Welcome! \begin{equation} E=mc^2 \tag{1),(2),(3} \end{equation} gives you that output. (I am not sure I understand the purpose, though. Maybe you want to explain where the numbers derive from such that one can provide a more automatic solution?) Commented Nov 9, 2019 at 0:24
  • Can you describe the how you come up with 3 equation numbers next to the equation? Will there always be 3, or sometimes 2 and then occasionally 1? Please elaborate. Anything is possible, but we need some specifics in terms of the use case. Commented Nov 9, 2019 at 1:45
  • @Schrödinger'scat I only put tag to put an example; this would work with one line. However, I have multiple lines and I need the counter to work (for some lines n+1; for others n+3) Commented Nov 9, 2019 at 9:21
  • @Werner There would be some lines that will count as just one equation (counter: n+1 being n the previous equation number counted) ; others for three (n + 3) Commented Nov 9, 2019 at 9:24
  • 1
    @IgnacioRuizNestosa How are you going to refer to these multi-label equations? That is, if this equation has the label \label{eq:Einstein}, what should \eqref{eq:Einstein} give you? Commented Nov 9, 2019 at 9:49

3 Answers 3

1

I'm not sure it's a good idea, particularly if you never refer to a single case. You can just refer to “Equations (1)”, which will give readers the hint that they're more than one.

Anyway, here's an implementation that also allows to refer to a single equation from the bunch.

\documentclass{article} \usepackage{amsmath,xparse} \ExplSyntaxOn \NewDocumentCommand{\multinumber}{mo} { \addtocounter{equation}{-1} \seq_clear:N \l__ignacio_multinumber_seq \int_step_inline:nn { #1 } { \refstepcounter{equation} \IfValueT{#2}{ \use:c{ ltx@label } {#2-##1} } \seq_put_right:Nx \l__ignacio_multinumber_seq { (\theequation) } } \tag* { \seq_use:Nn \l__ignacio_multinumber_seq { ,~ } } \addtocounter{equation}{1} } \ExplSyntaxOff \begin{document} References: \ref{Einstein} (global), \ref{Einstein-1} (first) \begin{equation} F=ma \end{equation} \begin{equation}\label{Einstein} E=m_{j}c^2 \multinumber{3}[Einstein] \end{equation} \begin{equation} A=B+C \end{equation} \begin{equation} D_{j}= E_{j} + F_{j} \multinumber{3} \end{equation} \end{document} 

enter image description here

1
  • Thank you @egreg! It works perfect! Commented Nov 9, 2019 at 21:06
0

Not sure if it is a good idea use a tag as a reference, because then, it should be counted or not? Is 1+2+3=4 or it is simply 1+2+3? What the reader must expect for the next equation, 4 or 5? That is, the sequence must be 1,2,3,1+2+3,4,... or maybe 1,2,3,1+2+3(=4),5...?.

Anyway, for the first case, is possible using \label{} and \ref{}, and for the second, you must add also a \addtocounter{equation}{1} in the 4th (1+2+3) equation:

mwe

\documentclass{article} \usepackage[spanish]{babel} \usepackage{amsmath} \usepackage[colorlinks]{hyperref} \begin{document} Siendo la masa ... \begin{equation}\label{a} m = \gamma m_0 = \frac{m_0}{\sqrt{1-v^2/c^2}} \end{equation} Y el momento linear es bla bla ... \begin{equation}\label{b} E = \sqrt{p^2c^2+m^2c^4} = \gamma mc^2 \end{equation} Por lo dicho anteriormente, .... \begin{equation}\label{c} \gamma = \frac{1}{\sqrt{1-(\frac{v}{c})^2}} \approx 1+ \frac{1}{2} \left(\frac{v}{c} \right)^2 \end{equation} Entonces, juntándolo todo \eqref{d} llegamos a: \begin{equation}\label{d} %\addtocounter{equation}{1} E=mc^2 \tag{\ref{a},\ref{b},\ref{c}} \end{equation} Lo que está tan claro como que 2 y 2 son: \begin{equation}\label{e} 2+2=22 \end{equation} \end{document} 
2
  • Hi @Fran. Please refer to the edited part of the question for more clarity. Commented Nov 9, 2019 at 10:35
  • @IgnacioRuizNestosa Then you want \tag{\theequation, \addtocounter{equation}{1}\theequation, \addtocounter{equation}{1}\theequation} but then cannot be referenced properly in text! Commented Nov 9, 2019 at 10:54
0

This allows you to add multiple equation numbers via a command \multitag.

\documentclass[a4paper,12pt]{article} \usepackage[spanish]{babel} \usepackage[latin1]{inputenc} \usepackage{mathtools} \newcounter{iloop} \newcounter{imax} \newcommand{\MultiNum}{\edef\temp{}% \setcounter{iloop}{0}\loop% \stepcounter{iloop}% \ifnum\value{iloop}<\value{imax}% \edef\temp{\temp\number\value{equation}),(}\refstepcounter{equation}% \repeat% \edef\temp{\temp\number\value{equation}}% \refstepcounter{equation}} \newcommand\multitag[1][1]{\setcounter{imax}{#1}% \MultiNum% \tag{\temp}} \begin{document} Einstein \begin{equation}\label{eq:Einstein} E=mc^2 \multitag[3] \end{equation} Photon \begin{equation}\label{eq:Photon} E=h\nu \multitag[2] \end{equation} Thermo \begin{equation} E=TS \end{equation} Wrong \begin{equation}\label{eq:Wrong} E=mc^3 \end{equation} \eqref{eq:Wrong} is wrong, \eqref{eq:Einstein} is correct, and so is \eqref{eq:Photon}. \end{document} 

enter image description here

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.