Replicating a fancy bordered text style in LaTeX

by wrb98   Last Updated August 13, 2019 18:23 PM

I am looking to replicate the following artwork with LaTeX: enter image description here

A border resembling a pencil runs along the left-hand side. The pencil is divided into coloured sections corresponding to different pieces of information. Each piece of text is also given a 'reference' (subtitle) of varying lengths. The coloured rounded rectangular tab surrounding each subtitle should also vary in length to fit the entire subtitle.

How can this be achieved with tikz?

The following code by Marco Daniel can be used as a starting point and achieves a similar (but much simplified) effect where a line is drawn along only the left-hand side of a certain piece of text.

\documentclass[a4paper,10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[x11names, svgnames]{xcolor}
\usepackage[framemethod=tikz]{mdframed}
\usetikzlibrary{calc}
\usepackage{fourier-orns}
\definecolor{warningColor}{named}{Red3}
\tikzset{
  warningsymbol/.style={
      rectangle,
      draw=warningColor,
      fill=white,
      scale=1,
      overlay}
}

\mdfdefinestyle{warning}{%
 hidealllines=true,leftline=true,
 skipabove=12,skipbelow=12pt,
 innertopmargin=0.4em,%
 innerbottommargin=0.4em,%
 innerrightmargin=0.7em,%
 rightmargin=0.7em,%
 innerleftmargin=1.7em,%
 leftmargin=0.7em,%
 middlelinewidth=.2em,%
 linecolor=warningColor,%
 fontcolor=warningColor,%
 firstextra={\path let \p1=(P), \p2=(O) in ($(\x2,0)+0.5*(0,\y1)$) 
                           node[warningsymbol] {\danger};},%
 secondextra={\path let \p1=(P), \p2=(O) in ($(\x2,0)+0.5*(0,\y1)$) 
                           node[warningsymbol] {\danger};},%
 middleextra={\path let \p1=(P), \p2=(O) in ($(\x2,0)+0.5*(0,\y1)$) 
                           node[warningsymbol] {\danger};},%
 singleextra={\path let \p1=(P), \p2=(O) in ($(\x2,0)+0.5*(0,\y1)$) 
                           node[warningsymbol] {\danger};},%
}

\newmdenv[style=warning]{Warning}

\usepackage{lipsum}


\begin{document}
\begin{Warning}
    \lipsum[1]
\end{Warning}
\lipsum[1]

\begin{Warning}
    \lipsum\lipsum[1]
\end{Warning}

\lipsum[1]


\end{document}
Tags : tikz-pgf


Related Questions


Updated April 27, 2019 15:23 PM

Updated December 20, 2018 03:23 AM

Updated November 20, 2018 12:23 PM

Updated December 17, 2018 22:23 PM

Updated December 18, 2018 02:23 AM