2

I want equations (2) and (3) to be labeled as (1a) and (1b)

\documentclass[12pt,a4paper,table,usenames, dvipsnames]{book}
\usepackage[table]{xcolor}
\definecolor{def}{RGB}{66,103,178}
\usepackage{empheq}
\usepackage[most]{tcolorbox}
\newtcbox{\mymath}[1][]{%
nobeforeafter, math upper, tcbox raise base,
enhanced, colframe=blue!30!black,
colback=def!20, boxrule=1pt,
#1}

\begin{document}

Some text…
\begin{empheq}[box={\mymath[colback=Bittersweet!20]}]{equation}
(x-x_0)^2+(y-y_0)^2+(z-z_0)^2=R^2
\end{empheq}

Some text…
\begin{empheq}[box={\mymath[colback=Bittersweet!20]}]{equation}
x^2+y^2+z^2+Ax+By+C z=0
\end{empheq}

Some text…
\begin{empheq}[box={\mymath[colback=Bittersweet!20]}]{equation}
x^2+y^2+z^2=R^2
\end{empheq}

\end{document}
  • 1
    Welcome to TeX SX! This is not clear at all. What would you like to have, precisely? – Bernard Jan 22 '19 at 19:47
  • Welcome to TeX.SX! As Bernard says it is not at all clear what you want to do. Further, can you please expand the code snippet that you have posted to a full minimal working example. A MWE should compile and be as small as possible to demonstrate your problem. it's much easier to help you if we have full working code to start from. – Andrew Jan 22 '19 at 21:17
  • environment subequations from asmath package is your friend – Zarko Jan 23 '19 at 0:44
  • Possible duplicate: How to reference equations using letters and numbers (due to the accepted answer) – Werner Jan 23 '19 at 1:28
2

see if the following example gives what you looking for:

documentclass[12pt,a4paper,table,usenames, dvipsnames]{book}
\usepackage[table]{xcolor}
\definecolor{def}{RGB}{66,103,178}
\usepackage{empheq}% it call `amsmath
\usepackage[most]{tcolorbox}
\newtcbox{\mymath}[1][]{%
nobeforeafter, math upper, tcbox raise base,
enhanced, colframe=blue!30!black,
colback=def!20, boxrule=1pt,
#1}

\begin{document}

Some text…
\begin{subequations}\label{eq:my equations}  % <---
\begin{empheq}[box={\mymath[colback=Bittersweet!20]}]{equation}
(x-x_0)^2+(y-y_0)^2+(z-z_0)^2=R^2
\end{empheq}

Some text…
\begin{empheq}[box={\mymath[colback=Bittersweet!20]}]{equation}
x^2+y^2+z^2+Ax+By+C z=0
\end{empheq}

Some text…
\begin{empheq}[box={\mymath[colback=Bittersweet!20]}]{equation}
x^2+y^2+z^2=R^2
\end{empheq}
\end{subequations} % <---

\end{document}
| improve this answer | |
  • That's exactly what I needed! – Dimitrios Sykias Jan 23 '19 at 5:35
  • 1
    @DimitriosSykias, than you can accept this answer with clicking on check mark at top left side of answer :-) – Zarko Jan 23 '19 at 9:32

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.