2

I have the following custom environment setup:

\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}

The problem is that I want to modify my environment in such a way that it splits the box horizontally into two halves of equal size, and on the left of both sides I want to have the text "Experiment" followed by the given input. I also want to be able to write on both sides of the divided box somehow. Optionally, there should be a vertical bar where the division of the box into two parts happens. Any ideas how to do that? Something along these lines (so the current box kind of replicated to have two parts):

enter image description here

4
  • Can you add a sketch how the result should look like? Commented May 30, 2023 at 12:41
  • @samcarter_is_at_topanswers.xyz I added a picture now, sorry my drawing skills are not good, but basically two have kind of two copies of the box I have now, and to be able to write on left and right halves.
    – pixel
    Commented May 30, 2023 at 12:47
  • Thanks! This makes your question much clearer! Commented May 30, 2023 at 12:50
  • Compare tex.stackexchange.com/q/685636/47927 Commented May 30, 2023 at 13:12

1 Answer 1

6

You could use the same approach as in https://tex.stackexchange.com/a/433142/36296 and use subtitles:

\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}

enter image description here

9
  • Thanks. Can I somehow make the dashed line solid like the border or just remove it?
    – pixel
    Commented May 30, 2023 at 17:11
  • 1
    @pixel The tcolorbox documentation has example how to change the line style. Search for segmentation style Commented May 30, 2023 at 18:33
  • Adding something like segmentation style=solid at the end of your newtcolorbox does not do anything.
    – pixel
    Commented May 31, 2023 at 9:49
  • @pixel See my updated answer Commented May 31, 2023 at 9:55
  • Thanks, it works nicely now. One final question, it it possible to push subtitles and start of the text a bit to the left? More precisely, to change the margins from top bottom and down?
    – pixel
    Commented May 31, 2023 at 10:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .