%% %% This is file `notes.sty', %% generated with the docstrip utility. %% %% The original source files were: %% %% notes.dtx (with options: `package') %% %% Copyright (C) 2002 Duncan Webb %% This program can be redistributed and/or modified under the terms %% of the LaTeX Project Public License Distributed from CTAN %% archives in directory macros/latex/base/lppl.txt; either %% version 1 of the License, or any later version. %% %% \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{notes} [2002/10/29 v1.0.1 (Duncan Webb)] \RequirePackage{graphics} \newskip\noteskipamount \noteskipamount=6pt plus 4pt minus 0pt \newdimen\textwidth \textwidth=\hsize \newdimen\marparsep \marparsep=4pt \newdimen\rulewd \rulewd=0.4pt \newdimen\ruleht \ruleht=0.4pt \newdimen\iconwd \iconwd=0.8cm \newdimen\iconht \iconht=0.8cm \newdimen\textwd \textwd=.8\textwidth \newdimen\vframegap \vframegap=3pt \newdimen\hframegap \hframegap=6pt \newif\if@debug@ \DeclareOption{debug}{% \global\@debug@true }% \newif\if@frames@ \DeclareOption{frames}{% \global\@frames@true }% \ProcessOptions* \newcounter{notecnt} \setcounter{notecnt}{0} \newdimen\containerwd \newdimen\textframeht \newdimen\iconframeht \newdimen\containerht \newdimen\notesmargin \newdimen\dbgrulewd \dbgrulewd=0pt \newdimen\dbgruleht \dbgruleht=0pt \if@frames@ \dbgrulewd=0.01pt \dbgruleht=0.01pt \fi \def\noteskip{\vskip\noteskipamount} \def\boxdbg#1{\hbox{% \vrule width \dbgrulewd\vbox{% \hrule height \dbgruleht% \hbox{#1}\hrule height \dbgruleht% }% \vrule width \dbgrulewd}% } \def\buildtextframe#1{% \vbox{% \hrule height \ruleht% \hbox{% \vrule width \rulewd\kern\vframegap% \vbox{\kern\hframegap#1\kern\hframegap}% \kern\vframegap\vrule width \rulewd% }% \hrule height \ruleht% }% } \def\buildiconbox#1{ \if@debug@ \raisebox{0pt}[0pt][0pt]{\makebox[0pt][c]{\tiny\thenotecnt}}% \fi \vbox{% \hsize \iconwd \noindent \hbox to \iconwd{% \hfil\resizebox*{\iconwd}{\iconht}{\includegraphics{#1}}\hfil% }% }% } \def\buildiconframe#1{% \vbox to \iconht{\vfil\hbox{\buildiconbox{#1}}\vfil}% }% \def\calccontainerht#1#2{ \ifnum #1 > #2 #1 \else #2 \fi } \def\buildvcontainer#1#2{% \boxdbg{\vbox to #1{\vfil#2\vfil}} } \def\buildcontainer#1#2{% \if@twoside \ifodd\count0 \hbox to \containerwd{% \hskip\notesmargin\hfil#1\hfil\hskip\marparsep#2% } \else \hbox to \containerwd{ #2\hskip\marparsep\hfil#1\hfil\hskip\notesmargin% } \fi \else %single sided \hbox to \containerwd{% #2\hskip\marparsep\hfil#1\hfil\hskip\notesmargin% } \fi } \newbox\iconframe \newbox\textframe \newbox\iconcontainer \newbox\textcontainer \newbox\container \newbox\notesbox \newdimen\pageleft \newdimen\notesboxht \def\buildnotes#1#2{% \stepcounter{notecnt} \if@debug@ \typeout{NOTE \thenotecnt \space started} \fi \setbox\textframe=\buildtextframe{#1} \setbox\iconframe=\buildiconframe{#2} \containerht=\calccontainerht{\ht\iconframe}{\ht\textframe} % check the page remaining \notesboxht=\containerht \advance\notesboxht by \dbgruleht \advance\notesboxht by \dbgruleht \advance\notesboxht by \dbgruleht \advance\notesboxht by \dbgruleht \advance\notesboxht by \dbgruleht \advance\notesboxht by \dbgruleht \noteskip % this forces the pagetotal to be updated \pageleft=\pagegoal \advance\pageleft by -\pagetotal \advance\pageleft by -\noteskipamount % \advance\pageleft by -\notesboxht \advance\pageleft by -\noteskipamount % \advance\pageleft by \pageshrink % I'm not sure about this % increase the space left on the page by a magic number. \advance\pageleft by 0.87083pt \if@debug@ \typeout{pageleft(0)=\the\pageleft} \typeout{wd textframe=\the\wd\textframe} \typeout{wd iconframe=\the\wd\iconframe} \fi \setbox\textcontainer=\buildvcontainer{\containerht}{\box\textframe} \setbox\iconcontainer=\buildvcontainer{\containerht}{\box\iconframe} \notesmargin=\marparsep \advance\notesmargin by \wd\iconcontainer % calc the container width \containerwd=\textwidth \containerwd=355pt % \textwidth can be strange \advance\containerwd by \notesmargin \advance\containerwd by \notesmargin \if@debug@ \typeout{notesboxht=\the\notesboxht} \typeout{containerht=\the\containerht} \typeout{containerwd=\the\containerwd} \typeout{pageshrink(1)=\the\pageshrink} \typeout{pagetotal(1)=\the\pagetotal} \typeout{pageleft(1)=\the\pageleft} \typeout{textframeht=\the\textframeht} \typeout{iconframeht=\the\iconframeht} \typeout{wd iconcontainer=\the\wd\iconcontainer} \fi % if there is insufficient space left eject the page \ifnum \pageleft < 0 \eject \fi % build the container box \setbox\container=\vbox{% \buildcontainer{\boxdbg{\copy\textcontainer}}{% \boxdbg{\copy\iconcontainer}% }% } \setbox\notesbox=\boxdbg{\copy\container} \notesboxht=\ht\notesbox \if@debug@\typeout{notesboxht=\the\notesboxht}\fi % build the container box \moveleft \notesmargin\copy\notesbox\noteskip % check the page remaining \pageleft=\pagegoal \advance\pageleft by -\pagetotal \advance\pageleft by -\notesboxht \if@debug@ \typeout{pagetotal(2)=\the\pagetotal} \typeout{pageleft(2)=\the\pageleft} \typeout{NOTE \thenotecnt \space finished} \fi } \newbox\notebox \newenvironment{importantnote}% {% \begingroup% \setbox\notebox=\vbox\bgroup\hsize\textwd\noindent\bgroup\it% }{ \egroup \egroup \buildnotes{\box\notebox}{hand} \endgroup% } \newenvironment{warningnote}% {% \begingroup% \setbox\notebox=\vbox\bgroup\hsize\textwd\noindent\bgroup\it% }{ \egroup \egroup \buildnotes{\box\notebox}{warn} \endgroup% } \newenvironment{informationnote}% {% \begingroup% \setbox\notebox=\vbox\bgroup\hsize\textwd\noindent\bgroup\it% }{ \egroup \egroup \buildnotes{\box\notebox}{info} \endgroup% } \endinput %% %% End of file `notes.sty'.