I have a color box (made with tcolorbox
) that holds text, and I want to frame it. Unfortunately, I'm copying a style so I can't use a normal border. The border I want is only on the sides of the box with a dot at each end.
(Like this but black)
I've seen threads on here before that say you can overlay tikz drawings ontop of tcolorboxes
, but that won't work. If what I want to accomplish isn't possible, I'll end up using that but I'd prefer to use an image. Since it's a class, I want it to be as lightweight as possible.
There are two problems. For one, I don't know how to position images overtop something like a tcolorbox
. The second problem is that the height of these boxes is variable (based on the text). I don't want to stretch the border image because I want the dots to remain circle, but I want the actual border part to elongate.
So my actual question:
1) How do I position a graphic precisely following a border (corner as an anchor)?
2) How can I scale my image vertically without stretching the image?
Minimum working example:
\documentclass[10pt,oneside,twocolumn]{book}
\usepackage{tcolorbox}
\usepackage{xcolor}
\usepackage{lipsum}
\definecolor{textbox}{HTML}{D5D2DD}
\newtcolorbox{textbox}{
colframe=textbox,
colback=textbox,
top=1mm, bottom=1mm, left=1.5mm, right=1.5mm,
arc=0mm,
}
\begin{document}
\raggedright
\lipsum[1]
\hfill
\begin{textbox}
\lipsum[2]
\end{textbox}
\hfill
\lipsum[3]
\hfill
\begin{textbox}
\lipsum[4-5]
\end{textbox}
\hfill
\lipsum[6]
\end{document}
Standalone of border:
\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
%\draw[help lines] (-1,-2) grid (1,2);
\node[circle,fill=black,inner sep=1pt] at (0,2) {};
\draw[thick] (0,2) -- (0,-2);
\node[circle,fill=black,inner sep=1pt] at (0,-2) {};
\end{tikzpicture}
\end{document}