8

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

10

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

  • 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? – Alejandro Feb 14 '16 at 14:58
  • @Ustanak: See the update (exaggerated ;-)) – user31729 Feb 14 '16 at 15:14

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.