答案1
您可以使用\fcolorbox
\documentclass[12pt]{article}
\usepackage[leqno]{mathtools}
\usepackage[svgnames]{xcolor}
\newcommand\customtag[1]{\tag*{\qquad\fcolorbox{orange}{Cornsilk}{\textcolor{orange}{\footnotesize\textbf{#1}}}}}
\begin{document}
A second-linear differential equation has the form
\begin{equation}
P(x)\frac{d^2y}{dx^2}+Q(x)\frac{dy}{dx}+R(x)y=G(x)\customtag{1}
\end{equation}
\end{document}