2

I was viewing this thread recently, and was struck by a great answer provided by Gonzalo Medina (reproduced below). As good as this was, I think the output would look much better if this answer could be tweaked so that the spiral binder in the output looks more realistic. Two separate examples of binders I'd like to reproduce faithfully are given in the image below (top example and bottom example). I don't think these are possible without significant changes to the given code (especially since putting a gradient fill in the arc is tricky at the best of times). In a failed attempt, I tried using path fading to achieve a basic gradient, but the effect was way too dissimilar to what I wanted and wouldn't show up on my PDF preview (seems to be a Mac issue). I can't think of another way to achieve a gradient that is anything similar to the two images given below, and this is before addressing the issue of having the back part of the binders go behind the paper in a nicer way than that presented in Medina's answer (i.e. with no gaps) and also having the front part of the binder go into the hole in the paper in a more seamless way (see the two examples in the image I provided below)

Nevertheless, I'd be very interested to see some attempts at reproducing these styles of binders from those of you more talented with tikz than I am, starting from the document provided. enter image description here

\documentclass{article}
\usepackage[contents={}]{background}
\usepackage{tikzpagenodes}
\usetikzlibrary{shadows,calc}
\usepackage{lipsum}

\def\ShadowXshift{0.5ex} \def\ShadowYshift{-0.5ex}

\makeatletter \define@key{educnotebook}{spiralnumber}{\def\SpiralNumber{#1}} \define@key{educnotebook}{nbcolorbg}{\def\NbColorBg{#1}} \define@key{educnotebook}{minorgridcolor}{\def\MinorGridColor{#1}} \define@key{educnotebook}{majorgridcolor}{\def\MajorGridColor{#1}} \define@boolkey{educnotebook}{majorgrid}[false]{ \ifKV@educnotebook@majorgrid \def\DrawMajorGrid{ \path[clip,rounded corners=10pt] ([xshift=-30pt,yshift=20pt]current page text area.north west) rectangle ([xshift=30pt,yshift=-20pt]current page text area.south east); \draw[\MajorGridColor,opacity=0.3] ([xshift=30pt,yshift=-20pt]current page text area.south east) grid[step=10mm] ([xshift=-30pt,yshift=20pt]current page text area.north west); } \else \def\DrawMajorGrid{\relax} \fi } \define@boolkey{educnotebook}{minorgrid}[false]{ \ifKV@educnotebook@minorgrid \def\DrawMinorGrid{ \path[clip,rounded corners=10pt] ([xshift=-30pt,yshift=20pt]current page text area.north west) rectangle ([xshift=30pt,yshift=-20pt]current page text area.south east); \draw[\MinorGridColor,opacity=0.3] ([xshift=30pt,yshift=-20pt]current page text area.south east) grid[step=1mm] ([xshift=-30pt,yshift=20pt]current page text area.north west); } \else \def\DrawMinorGrid{\relax} \fi } \define@choicekey+{educnotebook}{spiralposition}[\val\nr]{left,right,top}[left]{% \ifcase\nr\relax \def\SpiralPosition{ ([xshift=9pt,yshift=3pt-\Valor\textheight/(\SpiralNumber-1)]current page text area.north west) } \def\RotateAngle{0} \or \def\SpiralPosition{ ([xshift=-9pt,yshift=-5pt-\Valor\textheight/(\SpiralNumber-1)]current page text area.north east) } \def\RotateAngle{180} \def\ShadowXshift{-0.5ex} \def\ShadowYshift{-0.5ex} \or \def\SpiralPosition{ ([yshift=-19pt,xshift=5pt+\Valor*\textwidth/(\SpiralNumber-1)]current page text area.north west) } \def\RotateAngle{270} \fi }{}

\setkeys{educnotebook}{ nbcolorbg=white, minorgrid=false, majorgrid=false, minorgridcolor=black!20, majorgridcolor=black!60, spiralposition=left, spiralnumber=15 } \def\RotateAngle{0} \def\ShadowXshift{0.5ex} \def\ShadowYshift{-0.5ex}

\makeatother

\tikzset{ spiral/.pic={ \draw[rotate=\RotateAngle, draw=black, left color=black!70, right color=black!60, middle color=gray!40 ] (-1.1,-0.35) rectangle ++(10pt,10pt); \draw[ rotate=\RotateAngle, double=gray!80, double distance=1pt, ] (-1,-0.2) arc (40:-250:10pt and 2pt); \draw[ rotate=\RotateAngle, double=gray!80, double distance=1pt, ] (-1,-0.05) arc (40:-250:10pt and 2pt); } }

\newcommand\EducNotebook[1][]{% \begingroup \AddEverypageHook{% \setkeys{educnotebook}{#1}% \backgroundsetup{ scale=1, opacity=1, color=black, angle=0, contents={ \tikz[remember picture,overlay] { \draw[rounded corners=10pt,fill=\NbColorBg,drop shadow={shadow xshift=\ShadowXshift, shadow yshift=\ShadowYshift}] ([xshift=-30pt,yshift=20pt]current page text area.north west) rectangle ([xshift=30pt,yshift=-20pt]current page text area.south east); \foreach \Valor in {0,1,...,\numexpr\SpiralNumber-1\relax} \pic at \SpiralPosition {spiral}; \DrawMajorGrid \DrawMinorGrid }
} } \BgMaterial } \endgroup }

\EducNotebook

\begin{document} \lipsum[1-4] \end{document}

wrb98
  • 876

1 Answers1

5
\documentclass{article}
\usepackage[a4paper, hmargin=2cm, tmargin=4cm, bmargin=2cm]{geometry}
\usepackage{lipsum}
\usepackage{tikz}
\usepackage{tikzpagenodes}
\usetikzlibrary{shadings, fadings, shadows}
\colorlet{bgdcolor}{teal!20}
\tikzset{
spiral/.pic={
\shade[top color=black!80, bottom color=bgdcolor] (-0.39,-0.79) circle[radius=0.28];
\draw[black!10, path fading=north] (-0.39,-0.79) circle[radius=0.28];
\clip (-0.67,-0.79) arc[start angle=-180, end angle=0, radius=0.28] -- (0.36,0.00) -- (0.36,0.94) -|cycle;
\shade[top color=black!90, bottom color=black!90, middle color=black!20] (0.00,0.88) .. controls (0.16,0.85) and (0.27,0.25) .. (0.27,0.00) -- (0.00,0.00) .. controls (-0.02,0.32) and (-0.05,0.53) .. (-0.15,0.73) -- cycle (0,-0.4);
\shade[top color=black!90, bottom color=black!80, middle color=white] (0.00,0.92) .. controls (-0.32,0.71) and (-0.38,-0.34) .. (-0.23,-1.08) -- (-0.52,-1.08) .. controls (-0.61,-0.43) and (-0.64,0.61) .. (-0.29,0.92) -- cycle (0,2);
\draw[black!10, path fading=north] (0.00,0.88) .. controls (0.16,0.85) and (0.27,0.25) .. (0.27,0.00) -- (0.00,0.00) .. controls (-0.02,0.32) and (-0.05,0.53) .. (-0.15,0.73) -- cycle (0,-0.4);
\shade[top color=black!50, bottom color=black!90, middle color=black!20] (0.02,0.92) .. controls (0.11,0.91) and (0.25,0.62) .. (0.30,0.00) -- (0.23,0.00) .. controls (0.19,0.49) and (0.08,0.89) .. (-0.03,0.84) .. controls (-0.27,0.72) and (-0.35,-0.43) .. (-0.21,-1.06) -- (-0.28,-1.08) .. controls (-0.45,-0.11) and (-0.28,0.95) .. (0.02,0.92) -- cycle;
\draw[black!10, path fading=south] (0.02,0.92) .. controls (0.11,0.91) and (0.25,0.62) .. (0.30,0.00) -- (0.23,0.00) .. controls (0.19,0.49) and (0.08,0.89) .. (-0.03,0.84) .. controls (-0.27,0.72) and (-0.35,-0.43) .. (-0.21,-1.06) -- (-0.28,-1.08) .. controls (-0.45,-0.11) and (-0.28,0.95) .. (0.02,0.92) -- cycle;
}}
\begin{document}
\pagestyle{empty}
\pagecolor{bgdcolor}
\begin{tikzpicture}[remember picture, overlay]
\fill[white, drop shadow={shadow xshift=0.3cm, shadow yshift=-0.3cm}] ([xshift=-1cm] current page text area.south west) rectangle ([xshift=1cm, yshift=2cm]current page text area.north east);
\path ([yshift=2cm]current page text area.north west) -- ([xshift=1cm, yshift=2cm]current page text area.north east) foreach \t in {0, 0.05, ..., 1} {pic [pos=\t] {spiral}};
\end{tikzpicture}
\section{Introduction}
\lipsum[2-4]
\end{document}

enter image description here

Zoom on a shaded spiral

  • Your question is a repeat(asking for better output). It has not been closed probably because of the visual interesting appeal. I am no longer interested(for me it would be repeat work), but others might give it a go in a different way. – hpekristiansen Feb 25 '24 at 10:27
  • For future readers wondering about my comment above - it was an answer to OP, telling me to do the second picture if I wanted him to accept. -So because of my insolence, I got a downvote instead of an accept. – hpekristiansen Feb 26 '24 at 14:29