10

I'm using the following preamble

\documentclass[10pt]{article}

\usepackage{graphicx}
\usepackage{colortbl}
\usepackage[table]{xcolor}
\usepackage[many]{tcolorbox}

\usepackage{XCharter}
\usepackage[T1]{fontenc}

\newtcolorbox{learng}{
  breakable,
  enhanced,
  arc=0pt,
  outer arc=0pt,
  colframe=titlegrammar,
  colback=titlegrammar!03,
  overlay unbroken and first={
    \node[
      draw=titlegrammar,
      fill=titlegrammar,
      rotate=270,
      anchor=north west,
      text=white,
      font=\bfseries
    ]
    at (frame.north west)
    {LEARN THIS!};
  }
}

\definecolor{titlegrammar}{RGB}{255,128,0}

\begin{document}

\begin{learng}
text goes here
\end{learng}

\end{document}

This generates a similar box:

enter image description here

If you look closely to the picture, you'll see some kind of grid yielded. I'd like to replicate that result. Is it possible?


After having my question answered, I made some modifications and the result is as follows:

enter image description here

1 Answer 1

11

Use the underlay={...} option with \fill[...] and a \filldraw for the grid. I have used some opacity value to reduce the intensity of the colour, but this depends on personal views, of course.

Since tcolorbox uses TikZ in the background, basically all TikZ operations are possible.

The white lines are exaggerated here on purpose for demonstration only!

Basically, only the colframe colour needs to be specified, all other values are using tcbcol@frame then.

\documentclass[10pt]{article}

\usepackage{graphicx}
\usepackage{colortbl}
\usepackage[table]{xcolor}
\usepackage[most]{tcolorbox}

\usepackage{blindtext}
\usepackage{XCharter}
\usepackage[T1]{fontenc}

\definecolor{titlegrammar}{RGB}{255,128,0}
\newtcolorbox{learng}{
  breakable,
  enhanced,
  arc=0pt,
  outer arc=0pt,
  colframe=titlegrammar,
  colback=tcbcol@frame!03,
  overlay unbroken and first={
    \node[
      draw=tcbcol@frame,
      fill=tcbcol@frame,
      rotate=270,
      anchor=north west,
      text=white,
      font=\bfseries
    ]
    at (frame.north west)
    {LEARN THIS!};
  },
  underlay={\begin{tcbclipinterior}
      \fill[tcbcol@frame,opacity=0.4] (interior.south west) rectangle (interior.north east);
      \filldraw[help lines,step=5mm,line width=2pt,white,shift={(interior.north west)}]
      (interior.south west) grid (interior.north east);
    \end{tcbclipinterior}}
}


\begin{document}

\begin{learng}
\blindtext
\end{learng}
\end{document}

enter image description here

2
  • Ok, it's getting closer to what I want. I saw again the picture and I realised that the lines of the grids are white and the background is orange, can you yield that?
    – Schwale
    Commented Feb 14, 2016 at 14:58
  • @Ustanak: See the update (exaggerated ;-))
    – user31729
    Commented Feb 14, 2016 at 15:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .