1

enter image description here

How to use code like this? I need it for explain and summary answer in books. Can help me!

1 Answers1

2

The following is an adapted version of the tornpage environment originally defined by cmhughes in their answer to Torn page effect.

In comparison to the original environment, I have added the small title box in the top left cornenr. I have also slightly changed the colors, restricted the width of the box and removed the drop shadow:

enter image description here

\documentclass{article}
\usepackage[many]{tcolorbox}
\usetikzlibrary{decorations.pathmorphing}
\usetikzlibrary{shadows}
\definecolor{paper}{RGB}{254,246,101}
\usepackage{lipsum}
\newtcolorbox{tornpage}[1]{%
    enhanced jigsaw, % allow page breaks
    frame hidden, % hide the default frame
    overlay={%
        \draw [
            fill=paper!75!white, % fill paper
            draw=red, % boundary colour
            decorate, % decoration
            decoration={random steps,segment length=2pt,amplitude=1pt},
%            drop shadow, % shadow
        ]
        % top line
        (frame.north west)--(frame.north east)--
        % right line
        (frame.north east)--(frame.south east)--
        % bottom line
        (frame.south east)--(frame.south west)--
        % left line
        (frame.south west)--(frame.north west);
    },
    finish={%
        \node[%
            draw=red, 
            rounded corners, 
            fill=paper, 
            anchor=west, 
            xshift=0.25cm, 
            yshift=2pt, 
            minimum width=2cm] at (frame.north west) {#1};},
    % paragraph skips obeyed within tcolorbox
    parbox=false,
    text width=5cm, 
}
\begin{document}
\begin{tornpage}{my title}
    \lipsum[1][1-3]
\end{tornpage}
\lipsum[1]
\end{document}
leandriis
  • 62,593