2

My MWE,

\documentclass[a4paper,11pt]{article}
\usepackage{empheq}
\usepackage[svgnames]{xcolor}

\definecolor{backcolor}{RGB}{255,255,170}
\newcommand*\mybox[1]{%
\colorbox{backcolor}{\hspace{1em}#1\hspace{1em}}}

\begin{document}

\begin{empheq}[box=\mybox]{align}
V=I \cdot R
\end{empheq}

\end{document}

and displaying

enter image description here

But, that I want the equation in center (without changing place) and its text in nearly right. See below the image,

enter image description here

Is there a solution?

Related to: How to align text to the right in math mode?

and

Text to the right of piecewise equation

Özgür
  • 3,270

1 Answers1

4

One way:

\documentclass[a4paper,11pt]{article}
\usepackage{empheq}
\usepackage[svgnames]{xcolor}

\definecolor{backcolor}{RGB}{255,255,170}
\newcommand*\mybox[1]{%
\colorbox{backcolor}{\hspace{1em}#1\hspace{1em}}}

\begin{document}

\begin{empheq}[box=\mybox]{align}
V &=I \cdot R \rlap{\qquad\text{Some text}}\\
P &= V \cdot I \rlap{\qquad\text{Some text here again}}
\end{empheq}

\end{document}

enter image description here