How would i go about adding a vertical line next to my example environment like in this post: Example environment?. The reason I have not just copied the environment from that post is that, it isn't possible(at least to my knowledge) to label and refer to that environment.
\documentclass{memoir}
\usepackage[most]{tcolorbox}
\newcounter{testexample}
\usepackage{xparse}
\usepackage{lipsum}
\def\exampletext{Eksempel} % If English
\NewTColorBox[use counter=testexample]{testexamplebox}{O{}o}{%
% Example Frame Start
empty,% Empty previously set parameters
title={\exampletext\ \thetcbcounter: #1},% use \thetcbcounter to access the
% Attaching a box requires an overlay
attach boxed title to top left,
% Ensures proper line breaking in longer titles
minipage boxed title,
% (boxed title style requires an overlay)
boxed title style={empty,size=minimal,toprule=0pt,top=4pt,left=3mm,overlay=
{}},
coltitle=colexam,fonttitle=\bfseries, before=\par\medskip\noindent,parbox=false,boxsep=0pt,left=3mm,right=0mm,top=2pt,breakable,pad at break=0mm,
before upper=\csname @totalleftmargin\endcsname0pt, % Use instead of
parbox=true. %This ensures parskip is inherited by box.
% Handles box when it exists on one page only
overlay unbroken={\draw[colexam,line width=5pt] ([xshift=-0pt]title.north
west) -- ([xshift=-0pt]frame.south west); },
% Handles multipage box: first page
overlay first={\draw[colexam,line width=5pt] ([xshift=-0pt]title.north west)
-- ([xshift=-0pt]frame.south west); },
% Handles multipage box: middle page
overlay middle={\draw[colexam,line width=5pt] ([xshift=-0pt]frame.north west)
-- ([xshift=-0pt]frame.south west); },
% Handles multipage box: last page
overlay last={\draw[colexam,line width=5pt] ([xshift=-0pt]frame.north west) -
- ([xshift=-0pt]frame.south west); },%
IfValueTF={#2}{#2}{},
}
\NewDocumentEnvironment{testexample}{O{}O{}}
{%
\colorlet{colexam}{red!55!black} % Global example color
\begin{testexamplebox}[#1][#2]
}{\end{testexamplebox}\endlist}
\begin{document}
\lipsum[1]
\begin{testexample}[Latin Text][label=ex:latintext]
\lipsum[2]
\end{testexample}
I'm here refering to example \ref{ex:latintext}
\end{document}
What i would like to add is this:


kaoboxenvironment from thekaobookdocument class. If you try to use an enumerate environment inside of akaobox, this solution will cause the bullets and items to display outside (left of) the kaobox. Is there any workaround? https://tex.stackexchange.com/questions/604550/vertical-line-next-to-example-environment-changes-indentation-of-itemize-and-enu – EthanAlvaree Jul 11 '21 at 00:51