I'm looking for a way to have double vertical lines along the left side of
a paragraph.
It can be done by framed
package,
but I don't like its spacing (see picture.)
The aim is that tcolorbox
produces,
but I don't like to use TikZ because
it slows down compilation
(I will use rule frequently.)
I saw
This question,
which asked a way to produce breakable vertical rule in Plain TeX,
but the spacing is like one by framed
.
I also tried mdframed
package (without TikZ), but it
produced boxes like framed
and double lines are not supported
(without TikZ or PSTricks.)
So how can it be done without TikZ?
Thanks
Output
The lines are page frames obtained by showframe
.
Difference (Added)
- 'With
framed
' has space between top frame and has no space between bottom. - 'With
tcolorbox
' has no space between top and has space between bottom. In other words, the line ends precisely at the place where the content ends.
Code
\documentclass{article}
\usepackage{framed}
\usepackage{tikz}
\usepackage{tcolorbox}
\tcbuselibrary{xparse,skins,breakable}
\usepackage{lipsum}
\usepackage{showframe}
\newenvironment{leftvert}{%
\def\FrameCommand{%
\kern 1.75pt \vrule width 1.9pt \kern .7pt \vrule width 1.9pt\hspace{\dimexpr 2em-6.25pt}%
} \MakeFramed {\advance\hsize-\width \FrameRestore}%
}{\endMakeFramed}
\newtcolorbox{tleftvert}{%
parbox=false,
breakable,
blanker,
left=2em,
borderline west={2pt}{3pt}{double},
}
\begin{document}
\begin{leftvert}
\lipsum[1-10]
\end{leftvert}
\begin{tleftvert}
\par
\lipsum[1-10]
\end{tleftvert}
\end{document}
Another example (Added)
javi_gg1 wrote:
The way I see it, in both cases the rule begins and ends exactly where the text begins and ends. The difference is that, with
tcolorbox
, both text and rule are aligned to the top of the page frame, while withframed
both are aligned to the bottom of the page frame.
I give another example to show it's not true.
Edit: I put this example here so that we can easy to see wrong bottom spacing. So I still have wrong spacing with texts without math.
\begin{document}
\begin{leftvert}
\lipsum[1-3]
\newpage
\begin{equation}
\begin{split}
some &= long\\ &= long\\ &= long\\ &= long\\ &= long\\ &= long\\
&= long\\ &= long\\ &= long\\ &= long\\ &= long\\ &= long\\
&= equation.
\end{split}
\end{equation}
\end{leftvert}
\newpage
\begin{tleftvert}
\par
\lipsum[1-3]
\begin{equation}
\begin{split}
some &= long\\ &= long\\ &= long\\ &= long\\ &= long\\ &= long\\
&= long\\ &= long\\ &= long\\ &= long\\ &= long\\ &= long\\
&= equation.
\end{split}
\end{equation}
\end{tleftvert}
\end{document}
blankest
option to your boxes and then drawing of frames will omitted and remove the option later on in the final releasetcolorbox
, both text and rule are aligned to the top of the page frame, while withframed
both are aligned to the bottom of the page frame.