Building custom text-box using tikz

I had the same idea as Christian, but as my implementation looks a bit more like the original, I'm posting another answer.

\documentclass{article}
\usepackage[most]{tcolorbox}
\definecolor{background}{HTML}{FCF9EE}
\definecolor{linecolor}{HTML}{581810}

\begin{document}
\begin{tcolorbox}[
    enhanced,
    boxsep=0.25ex,
    arc=0mm,
    borderline west={1pt}{-0.5pt}{linecolor},
    borderline east={1pt}{-0.5pt}{linecolor},
    colback=background,
    colframe=background,
    overlay={
          \foreach \n in {north east,north west,south east,south west}
          {\draw [linecolor, fill=linecolor] (frame.\n) circle (2pt); }; }]
\begin{description}
    \item[Dungeon Master (DM):] OK, one at a time. Phillip, you are looking at the gargoyles?
    \item[Phillip:] Yeah. Is there any hint they might be creatures and not     decorations?
    \item[DM:] Make an Intelligence check.
    \item[Phillip:] Does my Investigation skill apply?
    \item[DM:] Sure!
    \item[Phillip (rolling a d20):] Ugh. Seven.
    \item[DM:] They look like decorations to you. And Amy, Riva is checking out the drawbridge?
\end{description}
\end{tcolorbox}
\end{document}

tcolorbox


EDIT:

As you probably want to use this box multiple times in your document it makes sense to define a new environment based on tcolorbox like this:

\newtcolorbox{dungeonbox}{enhanced,
    boxsep=0.25ex,
    arc=0mm,
    borderline west={1pt}{-0.5pt}{linecolor},
    borderline east={1pt}{-0.5pt}{linecolor},
    colback=background,
    colframe=background,
    overlay={
      \foreach \n in {north east,north west,south east,south west}
        {%
        \draw [linecolor, fill=linecolor] (frame.\n) circle (2pt);
        };
    }
}

You can then easily use it like this:

\begin{dungeonbox}
...
\end{dungeonbox}

Here is tcolorbox with overlay additions etc. It's breakable.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage[most]{tcolorbox}
\usepackage{blindtext}

\newlength{\vertlinewidth}
\setlength{\vertlinewidth}{1pt}
\newlength{\vertlineoffset}
\setlength{\vertlineoffset}{-5pt}
\newlength{\circleradius}
\setlength{\circleradius}{3pt}
\newlength{\circleoffset}
\setlength{\circleoffset}{0pt}


\definecolor{dungeoncolor}{RGB}{255,0,0}

\newtcolorbox{dungeonbox}[1][]{enhanced jigsaw,frame hidden,boxrule=0pt,
  breakable,
  sharp corners,
  drop lifted shadow,
  colback=white!90!black,
  borderline vertical={\vertlinewidth}{\vertlineoffset}{dungeoncolor},
  overlay={opacity=1.0,
    \node (A) at (frame.north west) {};\draw[fill,dungeoncolor] ($(A) + (\vertlineoffset-\vertlinewidth+0.5\circleradius,\circleoffset+\circleradius)$) circle (\circleradius);
    \node (B) at (frame.south west) {};\draw[fill,dungeoncolor] ($(B) + (\vertlineoffset-\vertlinewidth+0.5\circleradius,-\circleoffset-\circleradius)$) circle (\circleradius);
    \node (C) at (frame.south east) {};\draw[fill,dungeoncolor] ($(C) + (-\vertlineoffset+\vertlinewidth-0.5\circleradius,-\circleoffset-\circleradius)$) circle (\circleradius);
    \node (D) at (frame.north east) {};\draw[fill,dungeoncolor] ($(D) + (-\vertlineoffset+\vertlinewidth-0.5\circleradius,\circleoffset+\circleradius)$) circle (\circleradius);},
  #1
}

\begin{document}

\begin{dungeonbox}
\blindtext[10]
\end{dungeonbox}
\end{document}

enter image description here


You can fill in the text at the same instant when you make the rectangle. Use the fact that nodes are by default rectangle shaped(?). Tikz auto magically sizes the rectangle. Since you seem to want only vertical resising, specify the horizontal size of the box. For that, you can specify the width of the text so that Tikz knows where to break long sentences (text width =). There is probably an easy way to draw the red lines and the circles automatically by specifying node /.style, but I do not know how to do it. I used the corners of the rectangle node by using the anchors such as north east etc to position the red lines and circles.

\documentclass[10pt,twoside]{article}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
% make a node (rectangle)
% filled with gray
% occuplying half the current \textwidth
% name it mybox for reffering later
% add the text to it right away so that tikz can 
% calculate how big the box should be
\node [fill=gray, text width=0.5\textwidth] (0,0) (mybox)
{%
\begin{description}
\item [dungeon master] says Hi.
\item [player one] says Hi.
\item [player two] says Hi.
\item [player three] says Hi.
\end{description}
};
%use the above node's anchors to position the red lines and circles
\draw [red, thick] (mybox.south west) -- (mybox.north west);
    \draw [red,fill] (mybox.south west) circle [radius=0.05];
    \draw [red,fill] (mybox.north west) circle [radius=0.05];
\draw [red,thick] (mybox.south east) -- (mybox.north east);
    \draw [red, fill] (mybox.south east) circle [radius=0.05];
    \draw [red, fill] (mybox.north east) circle [radius=0.05];
\end{tikzpicture}
\end{document}

DandD

Tags:

Boxes

Tikz Pgf