我有以下自定义环境设置:
\documentclass{llncs}
\usepackage{graphicx}
\usepackage[most]{tcolorbox}
\usepackage{adjustbox}
\newtcolorbox{titlebox}[5]{enhanced,center,colframe=black,colback=white,boxrule={#3},arc={#2},auto outer arc,%
breakable,pad at break*=5pt,vfill before first,before={\par\medskip\noindent},after={\par\medskip},top=12pt,left=4pt,%
enlarge top by=7pt,%enlarge bottom by=7pt,%
title={\rule[-.3\baselineskip]{0pt}{\baselineskip}\normalsize\sffamily\bfseries #1}, varwidth boxed title*=-30pt,
attach boxed title to top left={yshift=-10pt,xshift=10pt}, coltitle=black,
boxed title style={colback=white,boxrule={#5},arc={#4},auto outer arc}
}
\newenvironment{experiment}[1]{%
\begin{small}\begin{titlebox}{{\normalfont \textbf{Experiment}} \normalfont #1}{2.5pt}{1pt}{3.5pt}{1pt}}
{\end{titlebox}\end{small}}
\begin{document}
\begin{environment}{Real}{Ideal}
Left text & Right Text
\end{environment}
\end{document}
问题是我想修改我的环境,以便将框水平分成大小相同的两半,并且在两边的左侧我希望有文本“实验”后面跟着给定的输入。我还希望能够以某种方式在分割框的两边书写。或者,应该有一个垂直条,将框分成两部分。有什么想法可以做到这一点?大致如下(因此当前框被复制为具有两个部分):
答案1
您可以使用与以下相同的方法https://tex.stackexchange.com/a/433142/36296并使用字幕:
\documentclass{article}
\usepackage{lipsum}
\usepackage[most]{tcolorbox}
\usepackage{tikz}
\newtcolorbox{openningbox}[2]{
colback = white,
colframe = black,
before upper = \tcbsubtitle{\tikz{\node[draw=black,fill=white,thick,rounded corners,font=\bfseries\color{black}]{Experiment #1};}},
before lower = \tcbsubtitle{\tikz{\node[draw=black,fill=white,thick,rounded corners,font=\bfseries\color{black}]{Experiment #2};}},
subtitle style = {
enhanced,
interior hidden,
frame hidden,
top=-0.8cm,
},
sidebyside,
sidebyside align = top,
enhanced,
segmentation style = {solid,line width=2pt}
}
\begin{document}
\begin{openningbox}{Real}{Ideal}
\lipsum*[1]
\tcblower
\lipsum*[2]
\end{openningbox}
\end{document}