0

I want numbered the third (blue) equation in out of box. what do I do?

Attractive Boxed Equations

1
  • Welcome to TeX.SX! Which third blue box equation?
    – user31729
    Jun 20, 2016 at 6:17

1 Answer 1

3

You can choose:

enter image description here

\documentclass{article}

\usepackage{amsmath}
\usepackage{empheq}
\usepackage[most]{tcolorbox}

\tcbset{colframe=blue!30!black, colback=blue!30, boxrule=1pt}

\newtcbox{\mymath}[1][]{%
    nobeforeafter, math upper, tcbox raise base,
    enhanced
    #1}

\begin{document}

\begin{empheq}[box=\mymath]{equation*}
    c_i = \langle\psi|\phi\rangle
\end{empheq}

\begin{empheq}[box=\mymath]{equation}
    c_i = \langle\psi|\phi\rangle
\end{empheq}

\begin{tcolorbox}
\begin{equation}
    c_i = \langle\psi|\phi\rangle
\end{equation}
\end{tcolorbox}

\begin{tcolorbox}
\begin{equation*}
    c_i = \langle\psi|\phi\rangle
\end{equation*}
\end{tcolorbox}

\end{document}
6
  • 1
    thank you, it work in a single file just like above. But in my file again i have an equation without numbering
    – Baruch
    Jun 20, 2016 at 6:49
  • 4
    @user108438 I don't want to be rude, but how can we deduce this problem from your question? would you mind to edit your question and better explain what's the problem and the desired result? You could even write the equation you want to box, or even better, include it inside a complete minimal working example (MWE). Thanks.
    – Ignasi
    Jun 20, 2016 at 7:03
  • Sorry for bad explain! Your commands are worked in a single file correctly. However, when I put them in my file, again I have an equation without numbering. Maybe I used many package that are conflict together. \begin{empheq}[box=\mymath]{equation} ‎L‎\y‎=‎\b‎‎‎ ‎‎\quad‎‎‎ ‎\quad ‎‎‎‎‎‎U\x=‎\y‎‎ \end{empheq}
    – Baruch
    Jun 20, 2016 at 7:15
  • @user108438 Let me insist: This description doesn't help. I don't know what packages are you using, I don't know how is written your equation, ... Please, write a Minimal working (or not) example. This means some code starting from \documentclass to \end{document} including the relevant and only relevant parts of your file. In this case it seems that between \begin{document} and \end{document} it just need to include the failing equation. Once you have this file, include in your question and we will better help you.
    – Ignasi
    Jun 20, 2016 at 7:34
  • I found my problem! I use xepersian package. It is a package for Persian writing. Unfortunately, I can't remove this package, because I am writing a Persian book. In the other hand I need a numbered formula in a colored box. It is a bad situation for me.
    – Baruch
    Jun 20, 2016 at 8:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .