更改记事本的宽度,高度

更改记事本的宽度,高度

此代码适用于帖子中的记事本 - \documentclass{beamer} 或独立版本:海报布局:背景和方框

现在我想更改为 \documentclass{article} 并可以调整框的尺寸(宽度,高度):设置特定的宽度,高度(厘米)

上述链接中的最少代码

\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}

预先感谢

答案1

pgf 键的发明是为了允许您控制形状(或其他任何东西)的参数。具有一些强制参数的 TeX 宏无助于实现这一点。因此,我建议将记事本重写为一种样式,并设置一些参数的初始值,如果需要,您可以根据需要更改这些参数。此 MWE 将记事本参数存储在记事本目录中,我希望您发现该示例有点不言自明。

\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}

在此处输入图片描述

相关内容