[Tex/LaTex] Building custom text-box using tikz

boxestikz-pgf

I'm trying to build a Dungeons and Dragons style LaTeX-Template and would like to recreate a certain box-style as seen here:

box

Using tikz I managed to recreate the rough shape but I don't have any idea how to…

  • scale the box vertically so it fits the text
  • put the text into the box which automatically linebreaks to fit the right margin

Any help would be very appreciated :-).

MWE:

\documentclass[10pt,twoside]{article}
\usepackage{multicol}
\usepackage{tikz}   %for quotebox
    \let\svtikzpicture\tikzpicture              %remove left indent for tikz picture
    \def\tikzpicture{\noindent\svtikzpicture}   %remove left indent for tikz picture

\begin{document}
\begin{multicols}{2}

\begin{tikzpicture}
\path [fill=gray] (0,0) rectangle (\linewidth,10em);
\draw [red, thick] (0,0) -- (0,10em);
    \draw [red,fill] (0,0) circle [radius=0.05];
    \draw [red,fill] (0,10em) circle [radius=0.05];
\draw [red,thick] (\linewidth,0) -- (\linewidth,10em);
    \draw [red, fill] (\linewidth,0) circle [radius=0.05];
    \draw [red, fill] (\linewidth,10em) circle [radius=0.05];
\node at (1em,5em) {text};
\end{tikzpicture}
\end{multicols}
\end{document}

Best Answer

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}