summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2006-01-13 00:00:51 +0000
committerKarl Berry <karl@freefriends.org>2006-01-13 00:00:51 +0000
commit90bfe7ab0718d7fe0df62567df246fbfd5d7fda8 (patch)
tree703e07ebac17b2888973367d1270ee106bff6c93 /Master
parent02a049d3adc5f29b63b1c0b0ce75900be2c1589c (diff)
notes
git-svn-id: svn://tug.org/texlive/trunk@1143 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/tex/latex/notes/notes.sty220
1 files changed, 220 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/notes/notes.sty b/Master/texmf-dist/tex/latex/notes/notes.sty
new file mode 100644
index 00000000000..de3ad0dcf34
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/notes/notes.sty
@@ -0,0 +1,220 @@
+%%
+%% 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'.