% PARALLEL MARK MACROS (PARMARK) version 2.11, % written by Herman Haverkort, 11 april 1995. % See end of file for information on warranty, distribution etc. \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{hhparmrk}[1995/04/11 Parallel marks] \RequirePackage{hhunits}[1995/02/10] \RequirePackage{hhflxbox}[1995/03/23] \RequirePackage{hhutils0}[1995/03/08] \DeclareOption{trafficsigns}{} % obsolete \ProcessOptions % WARNING: This package does not work properly when combined with % hhmuf version 1.00! With later versions there is no problem. % % The parallel mark macros have been designed to mark fragments of text % without interfering with its hierarchical structure. This % can be extremely useful when developing texts which should be judged % and approved repeatly by several people, such as regulations or other % common statements. Recent changes, new proposals etc. could be % marked easy, clearly and beautifully at the same time. Parallel marks % could also be used to indicate levels of importance, confidentiality % etc., without disturbing the optical appearance of the text too much % by using different font sizes etc. % A drawback of the parallel mark macros is that marked text fragments % cannot be split across pages. To make such a split possible, you have % to split the fragment yourself and mark each part seperately. Another % way to enable splits is to use \dopars. Even then though paragraphs % cannot be split. For more explanation on \dopars see below. % % % ============================================================================= % - \bracespan(LEFTSPAN()RIGHTSPAN){TEXT} % % The TEXT may be several paragraphs long. Either (LEFTSPAN( or )RIGHTSPAN) % may be omitted. Both LEFTSPAN and RIGHTSPAN have the following syntax: % {SIGN}WIDTH[OFFSET]{COMMENT} % % The SIGN should be one of the mathematical delimiter symbols which are % constructed with repeatable extensions. Examples are: ), [, |, \rgroup, % \} and \Updownarray. The SIGN is set next to the TEXT, while the COMMENT % is set vertically centered next to the SIGN. The WIDTH specifies the amount % of space which is available for the SIGN and the COMMENT. The WIDTH should % be specified by: % :- which stands for the amount of space necessary if the % COMMENT should not be broken across several lines (the % natural width), or: % :{DIMENSION} which specifies a `hard' width and may force the COMMENT % to be broken across several lines, or: % {UNITNAME}: which stands for the maximum natural width of all % sign-comment combinations set with the same UNITNAME. % The [OFFSET] is optional. If specified it should be a dimension surrounded % by brackets [ and ]. The OFFSET determines the amount of indentation of % the spanned TEXT when compared to surrounding unspanned text. If the % OFFSET is omitted, it is set equal to the WIDTH. % % For compatibility yet another (old) syntax of \bracespan is supported: % \bracespan[SIDE]{SIGN}{OFFSET}{COMMENT}{TEXT} % This has the same meaning as: % \bracespan({SIGN}:-[OFFSET]{COMMENT}({TEXT} if SIDE = l, or % \bracespan){SIGN}:-[OFFSET]{COMMENT}){TEXT} if SIDE = r. % % Furthermore there is a environment variant of \bracespan which consists % of \begin{bracespanned} (with the same arguments as \bracespan, except % for the spanned text) and \end{bracespanned}. % ============================================================================= \newenvironment{bracespanned}% {\begingroup\@h@bspenvironmenttrue\h@Zbspan}% {\h@Ibspan\h@scopecorrection} \def\bracespan{\begingroup\@h@bspenvironmentfalse\h@Zbspan} \def\h@Zbspan{\@ifnextchar[{\h@sspan}{\h@dspan}} \def\h@sspan[#1]#2#3#4{\h@ifstr{#1}l% {\h@dspan({#2}:-[#3]{#4}(}% {\h@dspan){#2}:-[#3]{#4})}} \def\h@dspan{\@ifnextchar){\h@Abspan(.:-(}{\h@Abspan}} \def\h@Abspan(#1({\@ifnextchar){\h@Bbspan(#1(}{\h@Bbspan(#1().:-)}} \def\h@Bbspan(#1#2:{\def\h@bsplsign{#1}\def\h@bspwidth{#2}% \h@ifspecified{#2}{\h@Cbspan-}{\h@Cbspan}} \def\h@Cbspan#1{\@ifnextchar[% {\h@Dbspan{#1}}% {\h@Dbspan{#1}[\h@auto]}} \def\h@Dbspan#1[#2]#3()#4#5:{% \if@noskipsec\leavevmode\fi \par\mufoff % Store left comment in \@tempboxb and left offset in \@tempdimb \h@spansetcomment\h@bsplsign.\h@bspwidth{#1}{#2}{#3}\@tempboxb\@tempdimb \def\h@bsprsign{#4}\def\h@bspwidth{#5}% \h@ifspecified{#5}{\h@Ebspan-}{\h@Ebspan}} \def\h@Ebspan#1{\@ifnextchar[% {\h@Fbspan{#1}}% {\h@Fbspan{#1}[\h@auto]}} \def\h@Fbspan#1[#2]#3){% % Store right comment in \@tempboxc and left offset in \@tempdimc \h@spansetcomment.\h@bsprsign\h@bspwidth{#1}{#2}{#3}\@tempboxc\@tempdimc \if@h@bspenvironment\def\next{\h@Hbspan\ignorespaces}% \else\def\next{\h@Gbspan}\fi\next} \long\def\h@Gbspan#1{\h@Hbspan #1\h@Ibspan} \def\h@Hbspan{% % Store total indentation in \@tempdima \setlength\@tempdima\@tempdimb \addtolength\@tempdima\@tempdimc % Type-set text to be spanned \setbox\@tempboxa\broadboxed\@tempdima\topsqueezeout} \def\h@Ibspan{\h@savelocals\botsqueezeout\endbroadboxed % Determine the vertical shift which is necessary to center the spanning % symbols and comments; store it in \@tempdima \sbox\@tempboxd{\ensuremath{\vcenter{\copy\@tempboxa}}}% \setlength\@tempdima{\ht\@tempboxd}\addtolength\@tempdima{-\ht\@tempboxa}% % Type-set left spanning delimiter together with comment (if present) \sbox\@tempboxb{% \setlength\nulldelimiterspace\z@ \lower\@tempdima\hbox{\ensuremath{\m@th\displaystyle{% \ifdim\wd\@tempboxb>\z@\box\@tempboxb\fi \left\h@bsplsign\vphantom{\copy\@tempboxd}\right.}}}}% % Type-set right spanning delimiter together with comment (if present) \sbox\@tempboxc{% \setlength\nulldelimiterspace\z@ \lower\@tempdima\hbox{\ensuremath{\m@th\displaystyle{% \left.\vphantom{\copy\@tempboxd}\right\h@bsprsign \ifdim\wd\@tempboxc>\z@\box\@tempboxc\fi}}}}% % Determine depth of last line of spanned text \h@getvirtualdepth\@tempboxa % Put it all together \topsqueezein \h@soberhmode \hbox{\kern\@tempdimb\llap{\box\@tempboxb}\box\@tempboxa\rlap{\box\@tempboxc}}% \par \botsqueezein \endgroup % Set \prevdepth to depth of last line of spanned text \prevdepth\h@virtualdepth \muffin \ignorespaces} \newif\if@h@bspenvironment\@h@bspenvironmentfalse \def\h@spansetcomment#1#2#3#4#5#6#7#8{% % Store delimiter at largest possible size in \@tempboxa (including % any surrounding space) \sbox\@tempboxa{% \setlength\nulldelimiterspace\z@ \ensuremath{\m@th\displaystyle{% \h@ifspecified{#6}{\,}{}% \left#1\vphantom{\vrule height\paperheight}\right#2}}}% \h@ifstr-{#4}% {\sbox#7{\mufoff\@makespancomment{#6}}}% % If width is specified, then set the comment in a box with the % specified width minus the width of the largest possible delimiter {\setlength#8{#4}\addtolength#8{-\wd\@tempboxa}% \sbox#7{\ensuremath{\vcenter{\hsize#8\relax\@makespancomment{#6}}}}}% % Calculate the width of the span; that is the width of the comment % plus the width of the largest possible delimiter + surrounding space \setlength#8{\wd#7}% \addtolength#8{\wd\@tempboxa}% % Execute unit width handling \h@ifespecified{#3}{\setlength#8{\unit {#3}:#8}}{}% % If offset was specified, then store the specified value, else leave % it so that the width is kept as offset value. \h@ifstr\h@auto{#5}{}{\setlength#8{#5}}} % ============================================================================= % \@makespancomment defines how a comment next to span is to be type-set. % Redefine it if you like. By default \@makespancomment selects a smaller % font and redefines the \@makemufmark macro which is part of the hhmuf % package. The latter is useful if you want to use hhmuf's multinotes as % comments, but it is not if you want to use multinotes _in_ comments! % The same holds for normal footnotes and redefinition of \@makefnmark. % Note that the hhmuf package is not included automatically by hhparmrk: % if you want to use it you have to include it yourself. % ============================================================================= \long\def\@makespancomment#1{{% \def\@makemufmark##1{\ensuremath{##1}}% \def\@makefnmark##1{\ensuremath{##1}}% \setlength\parindent\z@ \raggedright\tolerance=200\emergencystretch=10pt\small #1\par}} % ============================================================================= % - \markspan(LEFTSPAN()RIGHTSPAN){TEXT} % % The TEXT may be several paragraphs long. Either (LEFTSPAN( or )RIGHTSPAN) % may be omitted. Both LEFTSPAN and RIGHTSPAN have the following syntax: % {UPMARK}[FILL]{LOWMARK}[ALIGNMENT]{MARKSEP}[OFFSET] % % A mark is set next to the text. The mark consists of a upper part, a % lower part and a fill in between. The fill - if specified - should be a % macro that takes one argument: the required size. There is one fill % predefined: \msprule, which sets a vertical rule with width \fboxrule. % The upper part, the lower part and the fill are horizontally aligned % according to the specified ALIGNMENT, which should be l (left), r (right), % i (in), o (out) or c (centered). The specifying of ALIGNMENT is optional; % if omitted the alignment is assumed to be c (centered). i is like r for % left spans while it is like l for right spans. Similarly o is like l % for left spans and like r for right spans. % MARKSEP should be a dimension which specifies the amount of space which % is to be left between the mark and the spanned text. % The [OFFSET] is optional. If specified it should be a dimension surrounded % by brackets [ and ]. The OFFSET determines the amount of indentation of % the spanned TEXT when compared to surrounding unspanned text. If the % OFFSET is omitted, it is set equal to the width of the spanning marks. % % There is a environment variant of \markspan which consists % of \begin{markspanned} (with the same arguments as \markspan, except for the % spanned text) and \end{markspanned}. % ============================================================================= \newenvironment{markspanned}% {\begingroup\@h@mspenvironmenttrue\h@Zmspan}% {\h@Kmspan\h@scopecorrection} \def\markspan{\begingroup\@h@mspenvironmentfalse\h@Zmspan} \def\h@Zmspan{\@ifnextchar){\h@Amspan({}{}\z@(}{\h@Amspan}} \def\h@Amspan(#1({\@ifnextchar){\h@Bmspan(#1(}{\h@Bmspan(#1(){}{}\z@)}} \def\h@Bmspan(#1{\def\h@mspupmark{#1}% \@ifnextchar[{\h@Cmspan}{\h@Cmspan[\h@emptymarkspan]}} \def\h@Cmspan[#1]#2{\def\h@msplfill{#1}\def\h@mspbotmark{#2}% \@ifnextchar[{\h@Dmspan}{\h@Dmspan[c]}} \def\h@Dmspan[#1]#2{\def\h@msplalign{#1}\def\h@msplsep{#2}% \@ifnextchar[{\h@Emspan}{\h@Emspan[\h@auto]}} \def\h@Emspan[#1]()#2{% \if@noskipsec\leavevmode\fi \par\mufoff % Store upper left mark in \@tempboxb, lower left mark in \@tempboxc, % width of left marks in \@tempdimb, left offset in \@tempdimc. \h@spansetmark\h@mspupmark\h@mspbotmark\h@msplsep{#1}% \@tempboxb\@tempboxc\@tempdimb\@tempdimc \def\h@mspupmark{#2}% \@ifnextchar[{\h@Fmspan}{\h@Fmspan[\h@emptymarkspan]}} \def\h@Fmspan[#1]#2{\def\h@msprfill{#1}\def\h@mspbotmark{#2}% \@ifnextchar[{\h@Gmspan}{\h@Gmspan[c]}} \def\h@Gmspan[#1]#2{\def\h@mspralign{#1}\def\h@msprsep{#2}% \@ifnextchar[{\h@Hmspan}{\h@Hmspan[\h@auto]}} \long\def\h@Hmspan[#1]){% \h@spansetmark\h@mspupmark\h@mspbotmark\h@msprsep{#1}% \@tempboxd\@tempboxe\@tempdimd\@tempdime \if@h@mspenvironment\def\next{\h@Jmspan\ignorespaces}% \else\def\next{\h@Imspan}\fi\next} \long\def\h@Imspan#1{\h@Jmspan #1\h@Kmspan} \def\h@Jmspan{% % By now the upper and lower left marks are stored in tempboxb and -c, % while the upper and lower right marks are stored in tempboxd and -e. % Furthermore tempdimb and tempdimc contain the width of the left mark % and the left offset; tempdimd and -e the right mark's width and offset. \setlength\@tempdima\@tempdimc \addtolength\@tempdima\@tempdime \setbox\@tempboxa\broadboxed\@tempdima\topsqueezeout} \def\h@Kmspan{\h@savelocals\botsqueezeout\endbroadboxed % Now \@tempdima will be used to store the total height of \@tempboxa; \setlength\@tempdima{\ht\@tempboxa}\addtolength\@tempdima{\dp\@tempboxa}% % \@tempdime will be used to store the amount of fill necessary % for the left mark \setlength\@tempdime\@tempdima \addtolength\@tempdime{-\ht\@tempboxb}\addtolength\@tempdime{-\ht\@tempboxc}% % Compose the left mark \setbox\@tempboxb\vbox{% \hsize\@tempdimb \offinterlineskip \h@markspanalign l\h@msplalign{\box\@tempboxb}% % Leave out the fill if there is no room \ifdim\@tempdime<\z@\else\h@markspanalign l\h@msplalign{\h@msplfill\@tempdime}\fi \h@markspanalign l\h@msplalign{\box\@tempboxc}}% \sbox\@tempboxb{\lower\ht\@tempboxb\box\@tempboxb}% % Now \@tempdime will be used to store the amount of fill for the right mark \setlength\@tempdime\@tempdima \addtolength\@tempdime{-\ht\@tempboxd}\addtolength\@tempdime{-\ht\@tempboxe}% % Compose the right mark \setbox\@tempboxc\vbox{% \hsize\@tempdimd \offinterlineskip \h@markspanalign r\h@mspralign{\box\@tempboxd}% % Leave out the fill if there is no room \ifdim\@tempdime<\z@\else\h@markspanalign r\h@mspralign{\h@msprfill\@tempdime}\fi \h@markspanalign r\h@mspralign{\box\@tempboxe}}% \sbox\@tempboxc{\lower\ht\@tempboxc\box\@tempboxc}% % Determine depth of last line of spanned text \h@getvirtualdepth\@tempboxa \setlength\@tempdima{\ht\@tempboxa}% % Now put it all together \topsqueezein \h@soberhmode \hbox{% % Realize left offset \kern\@tempdimc % Put left mark on the left (including the specified mark seperation) \llap{\raise\@tempdima\box\@tempboxb\kern \h@msplsep}% \box\@tempboxa % Put right mark on the right (including the specified mark seperation) \rlap{\kern \h@msprsep\raise\@tempdima\box\@tempboxc}}% \par \botsqueezein \endgroup % Set \prevdepth to depth of last line of spanned text \prevdepth\h@virtualdepth \muffin \ignorespaces} \newif\if@h@mspenvironment\@h@mspenvironmentfalse \def\h@spansetmark#1#2#3#4#5#6#7#8{% % Type-set upper and lower marks; make sure they have no depth to ease % further calculations \sbox#5{#1}\sbox#5{\raise\dp#5\box#5}% \sbox#6{#2}\sbox#6{\raise\dp#6\box#6}% % Determine the largest width of the upper and lower marks and store it \setlength#7{\wd#5}% \ifdim#7<\wd#6\setlength#7{\wd#6}\fi % If offset is specified, then store the specified offset, else store % the calculated width increased by the mark seperation \h@ifstr\h@auto{#4}% {\setlength#8#7\addtolength#8{#3}}% {\setlength#8{#4}}} \def\h@markspanalign#1#2#3{% % Translate out/in to left/right or right/left, depending on side which % is handled now (specified in #1). \expandafter\ifx#2o\def\@tempa{#1}\else \expandafter\ifx#2i\ifx l#1\def\@tempa{r}\else\def\@tempa{l}\fi \else\let\@tempa=#2\fi \fi \hbox to \hsize{% \expandafter\ifx\@tempa l\else\hfill\fi #3\expandafter\ifx\@tempa r\else\hfill\fi}} \def\h@emptymarkspan#1{\vphantom{\msprule{#1}}} \def\msprule#1{\vrule height #1 width \fboxrule} % ============================================================================ % TRAPEZIUM FRAMES AND READERS TRAFFIC SIGNS % % Because Frans Goddijn likes them so much I included them in the % basis package: the trapezium frames and the readers traffic signs! % for example: \trafficsign{\trapbox:}{Hi}{Hello world!} would produce % the text "Hello world!", spanned by a round traffic sign saying "Hi". % The traffic sign is supported by a post on a triangular foot and shows up % next to the marked text in the left margin. trafficsigned is the % environment version of \trafficsign. % There exist asterisk version \trafficsign* and trafficsigned* which % make the signed text indent instead of pushing the sign into the margin. % ============================================================================ \def\trapbox{\iframe\@trapbox(170,0){1160}{11pt}\ifrch\ifrcv} \def\@trapbox{% \begin{picture}(1500,1000) \put(200,0){\line(1,0){1100}} \put(1300,0){\line(1,5){200}} \put(1500,1000){\line(-1,0){1500}} \put(0,1000){\line(1,-5){200}} \end{picture}} \def\@trafficsigned#1#2#3{\markspanned(% {#2{\separbox{2pt}{\large\bf #3}}}% [\msprule]% {\sepbox(\z@,1pt,\z@,\z@){\large\ensuremath{\bigtriangleup}}}% {1em}% #1(} \def\@endtrafficsigned{\ifhmode\strut\fi\endmarkspanned} \newenvironment{trafficsigned}% {\@trafficsigned{[\z@]}}{\@endtrafficsigned} \newenvironment{trafficsigned*}% {\@trafficsigned{}}{\@endtrafficsigned} \def\@trafficsign#1#2#3#4{\begin{trafficsigned#1}{#2}{#3}#4\end{traficsigned#1}} \def\trafficsign{\@ifnextchar*\@trafficsign{\@trafficsign{}}} % ============================================================================ % OPTION FRAMES % % \optionframe{BEFORESKIP}{AFTERSKIP}{LABEL}{STUFF} renders stuff in a frame % labelled with a encircled LABEL, which is typically a single character. % BEFORESKIP and AFTERSKIP specify the amount of vertical space to be left % before and after the frame. % This kind of frames is called \optionframes since I first used them % to denote optional passages in regulations which were subject to % discussion yet. % \begin{optionframed}{LABEL}STUFF\end{optionframed} is the environment % version of \optionframe. % ============================================================================ \newenvironment{optionframed}[3]{% \if@noskipsec\leavevmode\fi \par \if@nobreak\else\addvspace{#1}\fi \def\h@of@afterskip{#2}% \fboxsep 3pt \nointerlineskip \hbox\bgroup\sbox\@tempboxa\bgroup\mufoff\begin{broadboxed}{6.8pt}% \@h@nohmodetrue \begin{markspanned} ({\bellybox of@optionlabel:{\separbox{1pt}{\large\bf #3}}}{}{10pt}(% \boxhigh}% {\boxlow\end{markspanned}\end{broadboxed}\egroup \fbox{\box\@tempboxa}\egroup\muffin \par\addvspace\h@of@afterskip\h@scopecorrection} % ============================================================================ % \dopars{MACRO} % % MACRO should be a macro that takes one argument: a paragraph. Instead of % a one argument macro you could also use a multiple argument macro, for % which you specify all arguments but the last one, which is to contain % the paragraph to be type-set. % \dopars sets all following paragraphs using MACRO, until \srapod is % encountered just after a \par (or a empty line). % ============================================================================ \def\dopars#1{\bgroup\def\h@dopar{#1}\ignorespaces\h@dopars} \def\h@dopars{\@ifnextchar\srapod{\egroup\@gobble}{\h@@dopars}} \def\h@@dopars#1\par{\h@dopar{#1\par}\h@dopars} % *********************************************** % * SOME INITIALIZATIONS AND INTERNAL UTILITIES * % *********************************************** \h@newbox\@tempboxb \h@newbox\@tempboxc \h@newbox\@tempboxd \h@newbox\@tempboxe \h@newbox\@discabox \h@newdimen\@tempdimc \h@newdimen\@tempdimd \h@newdimen\@tempdime \h@newdimen\h@virtualdepth \h@newtoks\h@sc@everypar \def\h@getvirtualdepth#1{{% % Determine the depth of the last line of the spanned text \setbox\@discabox\copy#1% \setbox\@discabox\vbox{% \unvbox\@discabox \setbox\@discabox\lastbox \global\h@virtualdepth\dp\@discabox}}} \newif\if@h@nohmode \def\h@soberhmode{\if@h@nohmode\else \everypar{}\setlength\parindent\z@\parshape0\setlength\hangindent\z@ \setlength\leftskip\z@\setlength\linewidth\hsize \leavevmode\fi} \def\h@savelocals{% \global\h@sc@everypar=\everypar \global\let\h@sc@par=\par \global\let\h@sc@@par=\@par \global\let\h@sc@@currentlabel=\@currentlabel} \def\scopecorrection{\h@savelocals\h@scopecorrection} \def\h@scopecorrection{\aftergroup\h@@scopecorrection} \def\h@@scopecorrection{% \everypar=\h@sc@everypar \let\par=\h@sc@par \let\@par=\h@sc@@par \let\@currentlabel=\h@sc@@currentlabel} \providecommand\mufoff{} \providecommand\muffin{} \endinput% ********************** % * WARRANTY, DISTRIBUTION ETC. * % ******************************* % % This is a TeX style file by Herman Haverkort. This file is distributed % in the hope that it will be useful, but without any warranty; without % even the implied warranty of merchantability or fitness for a particular % purpose. The author does not accept any responsability for any damage, % loss, injury, psychosis, annoyance, marital problems, murders etc. which % are caused by this file. % % This style file has not been tested systematically, so there are % probably undiscoverd errors in it. If you find one, if you have % trouble using this file, if you have a suggestion for an extension or % another modification, or if you are just a happy user, please report % it to: % Herman Haverkort % Heyenoordseweg 40 % NL-6813 GA Arnhem % herman@fgbbs.iaf.nl % % You are allowed to change this file, but you are not allowed to distribute % the changed version unless you obey the following: % - give the changed version another file name than the original one; % - record clearly in the changed version: % - the original name of the file; % - its original author; % - that it is a changed version; % - do not remove the restrictions on distributing this file. % % You are not allowed to take money for the distribution or use of either % this file or a changed version, except for a nominal charge for copying % etc. % % Have fun!