我的 MWE:
\documentclass[a4paper]{article}
\usepackage[most]{tcolorbox}
\usepackage{xcolor, soul}
\usepackage{amsthm}
\definecolor{columbiablue}{rgb}{0.61, 0.87, 1.0}
\newcommand{\highlight}[1]{\colorbox{columbiablue!60}{$\displaystyle #1$}}
\newtheoremstyle{definition}
{0.8cm}
{0.8cm}
{}
{0.4cm}
{\bfseries}
{.}
{0.4cm}
{}
\theoremstyle{definition}
\newtheorem{definition}{{%
\setlength{\fboxrule}{2pt}
\fcolorbox{columbiablue}{orange!30}{Definition}
}}[section]
\usepackage{tikz}
\usetikzlibrary{decorations.pathmorphing,calc}
\newtcolorbox{mycolorbarmarg}[2]{
enlarge left by=4cm,
enhanced, blank, breakable,
overlay = {
\foreach \t in {0,...,#1}{
\draw[decorate,ultra thick, #2]
([xshift=-3-\t mm]frame.north west)
--
([xshift=-3-\t mm]frame.south west);
},
}
}
\begin{document}
\section{Section number one}
\sethlcolor{columbiablue}
\begin{definition}{Name of def}
\begin{mycolorbarmarg}{0}{red}
Some text text text text text text text text text text
\[\highlight{\left(f,g\right) = \int_a^b f(x)g(x)dx}\]
\end{mycolorbarmarg}
\end{definition}
\end{document}
我想要实现的目标(如何继续红线直到定义2
,并继续颜色框到定理的编号1
?):
感谢您的任何帮助!
答案1
拥有sidebyside
和\tcboxmath
编辑:与\newcommand
和\newtcolorbox
代码
\documentclass[a4paper]{article}
\usepackage{showframe}
\usepackage[most]{tcolorbox}
\definecolor{columbiablue}{rgb}{0.61, 0.87, 1.0}
\newtcolorbox{mybox}{
width=1\textwidth,
enhanced,
frame hidden,
left=0pt,
right=0pt,
top=0pt,
bottom=0pt,
%colback=white,%<--- uncomment
sidebyside,righthand width=0.6\textwidth,
sidebyside align=top,
sidebyside gap=1em,
segmentation style={draw=columbiablue,solid,line width=4pt},
}
\newcommand{\highlight}[1]{
\begin{equation*}
\tcboxmath[enhanced,
frame hidden,colback=columbiablue!60]%
{#1}
\end{equation*}}
\newcommand{\mytitle}[1]{\hfill\fcolorbox{columbiablue}{orange!30}{\textbf{\textit{#1}}}}
\setlength{\fboxrule}{2pt}
\begin{document}
\begin{mybox}
\mytitle{Theorem 12.1.}
\tcblower
Definition
\highlight{\left(f,g\right) = \int\limits_a^b f(x)g(x)dx}
\end{mybox}
\end{document}
答案2
经过一点手动编码并取得成果(顺便说一句,不是最好的)
\documentclass[a4paper]{article}
\usepackage[russian,english,ukrainian]{babel}
\usepackage[most]{tcolorbox}
\usepackage{xcolor, soul}
\usepackage{amsthm}
\usepackage{ commath }
\definecolor{columbiablue}{rgb}{0.61, 0.87, 1.0}
\newcommand{\highlight}[1]{\colorbox{columbiablue!60}{$\displaystyle #1$}}
\usepackage{tikz}
\usetikzlibrary{decorations.pathmorphing,calc}
\newtcolorbox{mycolorbarmarg}[2]{
%enlarge left by=4cm,
enhanced, blank, breakable,
overlay = {
\foreach \t in {0,...,#1}{
\draw[decorate,ultra thick, #2]
([xshift=-3-\t mm]frame.north west)
--
([xshift=-3-\t mm]frame.south west);
},
}
}
\begin{document}
\begin{minipage}[t]{0.30\textwidth}
\setlength{\fboxrule}{2pt}
\fcolorbox{columbiablue}{orange!30}{\textbf{\textit{Означення 12.1.}}}
\end{minipage}
\hfill
\begin{minipage}[t]{0.7\textwidth}
\vspace{-0.56cm}
\begin{mycolorbarmarg}{0}{columbiablue}%!90!black}
\vspace{0.15cm}
Definitionn
\begin{equation*}
\highlight{\left(f,g\right) = \int\limits_a^b f(x)g(x)dx}
\end{equation*}
\end{mycolorbarmarg}
\end{minipage}
\end{document}