而不是通常的括号“()”。
这是我的 MWE:
\documentclass[11pt,fleqn]{book}
\usepackage[english]{babel}
\usepackage{xcolor}
\usepackage{amsmath,amsfonts,amssymb,amsthm}
\usepackage[most]{tcolorbox}
\definecolor{ocre}{RGB}{243,102,25}
\definecolor{mygray}{RGB}{243,243,244}
\tcbset{myformula/.style={
arc=0pt,
outer arc=0pt,
colback=mygray,
colframe=ocre,
boxrule=0.8pt,
left=2pt,
right=2pt,
highlight math style={
arc=0pt,
outer arc=0pt,
colback=mygray,
colframe=red.
}
}
}
\newenvironment{spread}[1]{%
\advance\jot#1% indeed
}{%
\ignorespacesafterend
}
\begin{document}
\chapter{This is how it all began}
\section{Introduction}
\begin{tcolorbox}[ams align,myformula]
LT~&\approx~\frac{400}{F_{c}}(1-log_{10}|\Delta F|)\\
\Delta F~&=~\frac{Frequency~Tolerance}{Frequency~Jump}\nonumber
\end{tcolorbox}
\end{document}
答案1
您可以重新定义内部\tagform@
;原始定义是
\def\tagform@#1{\maketag@@@{(\ignorespaces#1\unskip\@@italiccorr)}}
我用的是\fcolorbox
:
\makeatletter
\def\tagform@#1{\fcolorbox{ocre}{mygray}{\maketag@@@{\ignorespaces\textcolor{ocre}{#1}\unskip\@@italiccorr}}}
\makeatother
完整代码:
\documentclass[11pt,fleqn]{book}
\usepackage[english]{babel}
\usepackage{xcolor}
\usepackage{amsmath,amsfonts,amssymb,amsthm}
\usepackage[most]{tcolorbox}
\definecolor{ocre}{RGB}{243,102,25}
\definecolor{mygray}{RGB}{243,243,244}
\tcbset{myformula/.style={
arc=0pt,
outer arc=0pt,
colback=mygray,
colframe=ocre,
boxrule=0.8pt,
left=2pt,
right=2pt,
highlight math style={
arc=0pt,
outer arc=0pt,
colback=mygray,
colframe=red.
}
},
}
\newenvironment{spread}[1]{%
\advance\jot#1% indeed
}{%
\ignorespacesafterend
}
\makeatletter
\def\tagform@#1{\fcolorbox{ocre}{mygray}{\maketag@@@{\ignorespaces\textcolor{ocre}{#1}\unskip\@@italiccorr}}}
\makeatother
\begin{document}
\chapter{This is how it all began}
\section{Introduction}
A cross-reference using \verb!\ref!: \ref{equ:test}\par\noindent
A cross-reference using \verb!\eqref!: \eqref{equ:test}
\begin{tcolorbox}[ams align,myformula]
LT~&\approx~\frac{400}{F_{c}}(1-log_{10}|\Delta F|) \label{equ:test}\\
\Delta F~&=~\frac{Frequency~Tolerance}{Frequency~Jump}\nonumber
\end{tcolorbox}
\end{document}
答案2
这是一个简单的解决方案mathtools
及其\newtagform
命令:
\documentclass[11pt,fleqn]{book}
\usepackage[english]{babel}
\usepackage{xcolor}
\usepackage{mathtools,amsfonts,amssymb,amsthm}
\newtagform{boxed}[\fboxrule=0.6pt\fcolorbox{ocre}{ocre!15!}]{\color{ocre}}{}
\usepackage[most]{tcolorbox}
\definecolor{ocre}{RGB}{243,102,25}
\definecolor{mygray}{RGB}{243,243,244}
\tcbset{myformula/.style={
arc=0pt,
outer arc=0pt,
colback=mygray,
colframe=ocre,
boxrule=0.8pt,
left=2pt,
right=2pt,
highlight math style={
arc=0pt,
outer arc=0pt,
colback=mygray,
colframe=red.
}
}
}
\newenvironment{spread}[1]{%
\advance\jot#1% indeed
}{%
\ignorespacesafterend
}
\begin{document}
\chapter{This is how it all began}
\section{Introduction}
\usetagform{boxed}
\begin{tcolorbox}[ams align,myformula]
LT~&\approx~\frac{400}{F_{c}}(1-log_{10}|\Delta F|)\label{coloureq}\\
\Delta F~&=~\frac{Frequency~Tolerance}{Frequency~Jump}\nonumber
\end{tcolorbox}
\ref{coloureq}
\eqref{coloureq}
\end{document}