# How can one bound a selection of items (as below) using a pair of vertical parallel lines?

The following represents the elements of a theorem which I want to highlight from start to finish between a pair of vertical parallel lines.

1. A block of text.
2. An equation - not necessarily numbered.
3. A graphic from an eps file at scale 1.00
4. Some more text.

It appears that tcolorbox and tikz - being drawing tools - are not appropriate for such a requirement, whereas mdframed would be ideal; but it is not often mentioned.

This would seem to apply to a number of applications. Could someone direct me to the correct syntax, please>

\begin{tikzpicture}[draw=DarkBlue, line width=1.0pt,
inner sep=12pt, inner ysep=6pt]
\node at (0,0) [rectangle,draw,fill=LightBlue]{%
\begin{minipage}[t]{118mm}% Items 1, 2, 3, 4 as in my original question. I want only the left and right lines to appear. Tried adapting the line commented-out below, but cannot control placement.
\vspace{2pt}%
\draw [line width=0.25mm, red ] (0,-1) -- (2,-1) node [right] {\SI{0.25}{\milli\meter}};;
\end{minipage}};
\end{tikzpicture}

• It would be helpful if you showed a visual example, even done with external software, to show what you want to achieve. – Alenanno Jan 12 '16 at 14:01
• \begin{tikzpicture}[draw=DarkBlue,line width=1.0pt,inner sep=12pt,inner ysep=6pt] \node at (0,0) [rectangle,draw,fill=LightBlue]{ % \begin{minipage}[t]{118mm} % Items 1, 2, 3, 4 as in my original question. I want only the left and right lines to appear. Tried adapting the line commented-out below, but cannot control placement.\vspace{2pt} % \draw [line width=0.25mm, red ] (0,-1) -- (2,-1) node [right] {\SI{0.25}{\milli\meter}};; \end{minipage}}; \end{tikzpicture} – keith77777 Jan 12 '16 at 14:26
• Do you mean a line on the left margin and the other line on the right margin? Should it be one pair for each element.? Or for the whole theorem? – Bernard Jan 12 '16 at 14:49
• As bounded by a rectangle of width, say 100mm, but with the top and bottom boundaries open. It does not matter about page breaks. – keith77777 Jan 12 '16 at 15:20
• mdframed does indeed have the ability to do what you want, and the manual contains the necessary information to generate that configuration. (i've done something similar but more complex; it's too much different to just copy the code.) but i've come around to thinking that tcolorbox would probably have been easier and perhaps more manageable, so i suggest you take a look at that too, as proposed in the answer by ignasi. – barbara beeton Jan 12 '16 at 16:37

I don't understand why tcolorbox is not suited for that so I propose a solution with this package. It includes a captioned figure with caption package.

\documentclass{article}
\usepackage[most]{tcolorbox}
\usepackage{lipsum}
\usepackage{lmodern}
\usepackage{graphicx}
\usepackage{caption}

\newtcolorbox{mybox}[1][]{%
breakable,
notitle,
colback=blue!10!white,
colframe=blue!60!black,
sharp corners,
boxsep=0pt,
left=12pt, right=12pt,
top=6pt, bottom=6pt,
boxrule=0pt,leftrule=1pt,rightrule=1pt,
#1
}

\begin{document}

\lipsum[1]

\begin{mybox}

Some previous text: \lipsum[2]

An unnumbered equation:
$\sin^2 x + \cos^2 x = 1$

A numbered equation:
$$\sin^2 x + \cos^2 x = 1$$

A figure with caption:
{\par\centering
\includegraphics[width=.75\textwidth]{example-image}
\captionof{figure}{This is a figure inside a \texttt{tcolorbox}}
\par}

Some more text: \lipsum[4]
\end{mybox}
\end{document}


• Ignasi - you said previously that because a figure is a "floating object" - not just a graphic - tcolorbox could not give a complete solution, whereas mdframed could. That is why I posed the new question. – keith77777 Jan 13 '16 at 13:51
• @keith77777 A "floating object" and a "figure with caption" are different things. The second one is possible with tcolorbox with caption package help as is shown in my updated example. By the way, mdframed detects if it used inside a float or not which is also different from declaring a float inside a framed environment. – Ignasi Jan 13 '16 at 14:41
• \begin{mybox} \begin{tcolorbox} [width=106.4mm,colframe=DarkRed,colback=LightCream,top=2pt,bottom=2pt,left=2.2pt,right=2.2pt,arc=2pt,boxrule=1.0pt] % left=2.8pt, right=2.4pt \centering {\par\centering \includegraphics[width=.25\textwidth]{example-image} \captionof{subfigure}{This is a figure inside a \texttt{tcolorbox}} \par} {\par\centering \includegraphics[width=.25\textwidth]{example-image} \captionof{subfigure}{This is a second figure inside a \texttt{tcolorbox}} \par} \end{tcolorbox} \captionof{figure}{Main caption for two sub-figs} \end{mybox} – keith77777 Jan 13 '16 at 17:31
• I have imitated your syntax to include sub figs, and it appears to work. One last point: what is it that controls the vertical positioning of the sub captions, please? Thanks again. – keith77777 Jan 13 '16 at 17:39
• @keith77777 According to page 13 in caption documentation, it seems that skip option determines distance between figure and caption. – Ignasi Jan 13 '16 at 20:56