2

This code for Notepad in post - \documentclass{beamer} or standalone: poster-layout: background and boxes

now i want to change to \documentclass{article} and can resize dimension of box (width, height): set specific width, height (cm)

Minimal code from this above link

\documentclass{article}
\usepackage[a5paper,landscape,left=1.5cm,right=0.3cm,top=0.5cm,bottom=0.5cm]{geometry}
\usepackage{tikz}
\usetikzlibrary{shadows,shapes.geometric}
\usepackage{lipsum}
\usepackage[pages=some]{background}

\backgroundsetup{
scale=1,
color=black,
opacity=0.4,
angle=0,
contents={%
  \includegraphics[width=\paperwidth,height=\paperheight]{example-image}
  }%
}

\definecolor{mybrown}{RGB}{33,34,28}
\definecolor{myyellow}{RGB}{242,226,149}
\definecolor{mygreen}{RGB}{176,232,145}
\definecolor{myblue}{RGB}{61,139,189}
\definecolor{myorange}{RGB}{245,156,74}
\definecolor{mypurple}{RGB}{230,111,148}
\definecolor{myred}{RGB}{215,80,50}

\newcommand\NotePad[3][100]{%
\begin{tikzpicture}
\fill[#2,drop shadow]
  (0,0) {[rounded corners=1.5cm]--
  ++(10,0)} --
  ++(0,10) --
  ++(-10,0) --
  cycle;
\fill[#2!80!black] 
  (9,0) to[out=30,in=-70]
  (9.35,0.75) to[out=-30,in=210]
  (10,1) to[out=240,in=30]
  (9,0);  
\fill[mybrown]
  (5,9.5) circle [radius=0.25cm];
\fill[mybrown!40]
  (5,9.5) circle [radius=0.20cm];
\node[
  cylinder,
  fill=mybrown,
  rotate=#1,
  minimum width=10pt,
  minimum height=18pt
  ] 
  at (5,9.52) {};
\node[text width=9cm,minimum height=8cm] at (5,5)
  {#3};
\end{tikzpicture}%
}

\begin{document}

\NotePad{myyellow}{111Some test text}\quad
\NotePad[90]{mygreen}{Some test text}\quad
\NotePad[68]{myblue}{Some test text}\par\bigskip


\end{document}

Thank in advance

4

pgf keys have been invented in order to allow you to control the parameters of your shape (or whatever). TeX macros with some mandatory parameters do not help to achieve this. So I would recommend rewriting the notepad as a style and setting some initial values of the parameters which you can change as you want, if needed. This MWE stores the notepad parameters in a notepad directory, and I hope you find the example sort of self-explanatory.

\documentclass{article}
\usepackage[a5paper,landscape,left=1.5cm,right=0.3cm,top=0.5cm,bottom=0.5cm]{geometry}
\usepackage{tikz}
\usetikzlibrary{shadows}
\usepackage{lipsum}
\usepackage[pages=some]{background}

\backgroundsetup{
scale=1,
color=black,
opacity=0.4,
angle=0,
contents={%
  \includegraphics[width=\paperwidth,height=\paperheight]{example-image}
  }%
}

\definecolor{mybrown}{RGB}{33,34,28}
\definecolor{myyellow}{RGB}{242,226,149}
\definecolor{mygreen}{RGB}{176,232,145}
\definecolor{myblue}{RGB}{61,139,189}
\definecolor{myorange}{RGB}{245,156,74}
\definecolor{mypurple}{RGB}{230,111,148}
\definecolor{myred}{RGB}{215,80,50}

\tikzset{notepad/.style={path picture={%
\colorlet{mycolor}{\pgfkeysvalueof{/tikz/notepad/color}}
\fill[mycolor,drop shadow]
  (path picture bounding box.south west) {[rounded corners=1.5cm]--
  (path picture bounding box.south east)} --
  (path picture bounding box.north east) --
  (path picture bounding box.north west) --
  cycle;
\fill[mycolor!80!black] 
  ([xshift=-1cm]path picture bounding box.south east) to[out=30,in=-70]
  ++(0.35,0.75) to[out=-30,in=210]
  ([yshift=1cm]path picture bounding box.south east) to[out=240,in=30]
  ([xshift=-1cm]path picture bounding box.south east);  
\fill[mybrown]
  ([yshift=-5mm]path picture bounding box.north) circle [radius=0.25cm];
\fill[mybrown!40]
  ([yshift=-5mm]path picture bounding box.north) circle [radius=0.20cm];
\draw[line width=3mm,line cap=round] 
([yshift=-5mm]path picture bounding box.north) -- ++ 
(\pgfkeysvalueof{/tikz/notepad/pin rotation}:2mm);
},minimum width=\pgfkeysvalueof{/tikz/notepad/width},
minimum height=\pgfkeysvalueof{/tikz/notepad/height},
text width=\pgfkeysvalueof{/tikz/notepad/width}-1cm},
notepad/.cd,
color/.initial=blue,
pin rotation/.initial=100,
width/.initial=5cm,
height/.initial=9cm
}

\begin{document}

\tikz{\node[notepad,notepad/color=myyellow]{111Some test text};}\quad
\tikz{\node[notepad,notepad/color=mygreen,notepad/pin rotation=90,
notepad/width=6cm]{Some test text};}\quad
\tikz{\node[notepad,notepad/color=myblue,notepad/pin rotation=68,
notepad/width=5.5cm]{Some test text};}
\end{document}

enter image description here

  • thank so much. can you please update absoluteposition for notepad? ex: xshift, yshift Thanks – latexforti Mar 26 at 0:07
  • 1
    @latexforti What do you mean by "absolute position"? (You can do something like \tikz[overlay,remember picture[{\node[notepad,notepad/color=myyellow] at (current page.center) {111Some test text};} if that's what you mean. Note that I didn't read the original post.... now I did. Why are you not using the tcolorbox version. This seems to be much better than the plain TikZ version, and allows you to adjust the width and so on.) – marmot Mar 26 at 0:10

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.