5

I know that tcolorbox can have dashed border. However the stripes are rectangular. But is it possible to change the rectangles to parallelograms (45 angled) with inner and outer border as well, such as

enter image description here

5

You can try with a tcboxedraster which contains only one tcolorbox. The envolving box contains the pattern and the inner box covers part of it imitating the slanted dash.

The pattern definition was taken from using pattern inside tikz shapes with dropped shadows

\documentclass{article}
\usepackage[most]{tcolorbox}
\usepackage{lipsum}

\usetikzlibrary{patterns}

\makeatletter
\tikzset{% customization of pattern
         % based on <m.wibrow@gm...> - 2013-03-24 07:20: 
        hatch distance/.store in=\hatchdistance,
        hatch distance=5pt,
        hatch thickness/.store in=\hatchthickness,
        hatch thickness=5pt
        }
\pgfdeclarepatternformonly[\hatchdistance,\hatchthickness]{north east hatch}% name
    {\pgfqpoint{-1pt}{-1pt}}% below left
    {\pgfqpoint{\hatchdistance}{\hatchdistance}}% above right
    {\pgfpoint{\hatchdistance-1pt}{\hatchdistance-1pt}}%
    {
        \pgfsetcolor{\tikz@pattern@color}
        \pgfsetlinewidth{\hatchthickness}
        \pgfpathmoveto{\pgfqpoint{0pt}{0pt}}
        \pgfpathlineto{\pgfqpoint{\hatchdistance}{\hatchdistance}}
        \pgfusepath{stroke}
    }
\makeatother

\tikzset{
    Pattern/.style={
        pattern=north east hatch,
        pattern color=black,
        hatch distance=15pt, 
        hatch thickness=5pt
    }
}

\begin{document}
\begin{tcboxedraster}[%
    raster columns=1,
    colframe=black,
    colback=white,
    ]{
    enhanced,
    colframe=black, 
    colback=white,
    underlay={%
        \begin{tcbclipinterior}
            \fill[Pattern] (frame.north west) rectangle (frame.south east);
        \end{tcbclipinterior}
        }
    }
\begin{tcolorbox}
\lipsum[1]
\end{tcolorbox}
\end{tcboxedraster}
\end{document}

enter image description here

  • 1
    thanks! how do you know all this stuff? – Faceb Faceb Jul 4 '18 at 17:04
  • 2
    Reading packages documentation and trying to answer questions here. – Ignasi Jul 4 '18 at 17:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.