From e0c6872cf40896c7be36b11dcc744620f10adf1d Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 2 Sep 2019 13:46:59 +0900 Subject: Initial commit --- usergrps/uktug/baskervi/5_4/hhstyles.tex | 736 +++++++++++++++++++++++++++++++ 1 file changed, 736 insertions(+) create mode 100644 usergrps/uktug/baskervi/5_4/hhstyles.tex (limited to 'usergrps/uktug/baskervi/5_4/hhstyles.tex') diff --git a/usergrps/uktug/baskervi/5_4/hhstyles.tex b/usergrps/uktug/baskervi/5_4/hhstyles.tex new file mode 100644 index 0000000000..b966bc2e97 --- /dev/null +++ b/usergrps/uktug/baskervi/5_4/hhstyles.tex @@ -0,0 +1,736 @@ +%\usepackage{hhmuf,hhflxbox} % for presentation +%\usepackage{hhcount} % for presentation +%\usepackage{amssymb,epic,curves} % for illustrations +%\usepackage{verbatim} % for verbatim displaying of examples +%\usepackage{xspace} % for ease of typing + +\makeatletter + +% The following has been copied from my personal tools style file hhutils.sty +% (NB: This is _not_ the same file as the public style file hhutils0.sty!) + +\def\={\verb=} +\def\<#1>{\macroname{#1}} +\def\:{\linebreak[1]} + +% The following input definitions used for examples: + +% \input hhst11a.tex and hhst11b.tex are input where needed +% \input hhst12a.tex up to hhst12e.tex are input where needed +\input hhst22a.tex +% hhst22b.tex, hhst22c.tex and hhst22d.tex are input where they are needed +\input hhst22e.tex +% hhst23a.tex is input where needed +\input hhst24a.tex +% hhst24b.tex is input where needed +\input hhst32a.tex +\input hhst32b.tex +\input hhst32c.tex + +\def\dashbox(#1,#2)(#3,#4){ + \dashline{40}(#1,#2)(#1,#4)\dashline{40}(#1,#4)(#3,#4) + \dashline{40}(#1,#2)(#3,#2)\dashline{40}(#3,#2)(#3,#4)} +\def\hmeasure(#1,#2)(#3,#4){ + \put(#1,#2){\makebox(0,0)[l]{$\blacktriangleleft$}} + \put(#3,#4){\makebox(0,0)[r]{$\blacktriangleright$}} + \drawline(#1,#2)(#3,#4)} +\def\vmeasure(#1,#2)(#3,#4){ + \put(#1,#2){\makebox(0,0)[b]{$\blacktriangledown$}} + \put(#3,#4){\makebox(0,0)[t]{$\blacktriangle$}} + \drawline(#1,#2)(#3,#4)} + +\def\fancycolumn#1#2#3#4#5#6#7#8{% + \sbox#1{% + \sfrcalclength{#2}{#3}{#4}% + \def\\##1;##2;{\vrule height\@tempdimq width ##1pt\kern ##2pt}% + \\0.05;0.15;\\0.60;0.44;\\1.11;0.65;\\1.45;0.77;\\1.57;0.77;% + \\1.45;0.65;\\1.11;0.44;\\0.60;0.15;\\0.05;0;}% + \sfrsetoffsets{15pt}{#3}{#4}#5#6#7#8}% +\def\fancytympan#1#2#3#4#5#6#7#8{% + \sbox#1{% + \sfrcalclength{#2}{#3}{#4}% + \unitlength\@tempdimq + \vbox{\hsize\@tempdimq\offinterlineskip + \hbox{\begin{picture}(1,0.1) + \thicklines + \put(0,0){\line(1,0){1}} + \put(0,0){\line(5,1){0.5}} + \put(0.5,0.1){\line(5,-1){0.5}} + \thinlines + \put(0.5,0.05){\circle*{0.072}} + \end{picture}} + \hbox{\vrule width\@tempdimq height 2pt}}}% + \sfrsetoffsets{\ht#1}{#3}{#4}#5#6#7#8}% + +% THE FOLLOWING DEFINITION IS ALSO INCLUDED VERBATIM AS AN EXAMPLE! +\newenvironment{templeboxed}{% + \begin{sframed}% + [1]\fancycolumn[2]\fancytympan[1]\fancycolumn[-]\- + \begin{separboxed}{3pt} + \begin{broadboxed}{30pt} +}{% + \end{broadboxed}% + \end{separboxed}% + \end{sframed}% +} + +\makeatother + + + +\title[\hhmuf, \hhflxbox\ and \hhcount packages]{HH Gets Carried Away: the \hhmuf, \hhflxbox\ and \hhcount packages} +\author[Herman Haverkort]{Herman Haverkort\\\emph{Email}: \texttt{herman@fgbbs.iaf.nl}} +\begin{Article} + +\begin{abstract} +\end{abstract} + +In this article I present some of the features of three packages, +\hhmuf, \hhflbox\ and \hhcount, that I have written recently. However, +this presentation is far from complete. A more detailed manual and +the packages themselves can be obtained from the author at {\sc fgbbs} +(tel. +31 85 21 70 41) or CTAN +(\path|macros/latex/contrib/supported/hh|. \hhmuf\ offers `multinotes' +---special cheery footnotes to be used in special situations, +including so-called `forbidden environments'. \hhflxbox's provides +self-scaling frames: encircling macros are provided but you can define +whatever features you like by means of the macros provided. Finally +\hhcount is presented: macros to handle simple and composite counters +in a fancy way. \scheiding + +\section{Some Features of the \hhmuf Package} + +\subsection{Reusable Footnotes and Recycled Markers} + +Suppose you have to typeset some tables containing many entries which are +amplified by footnotes outside the table. Several entries, possibly but not +necessarily in the same table, refer to the same footnote. +If references to the same footnote appear in different tables on different +pages, the footnote text should be set on all pages involved, +while the footnote marker should be the same each time the footnote is +set. The first to avoid unnecessary turning over, the second to avoid +confusion. + +Typesetting such tables is not very easy in basic \LaTeX. A relatively easy +way to do the job is probably as follows:\begin{enumerate} +\item first get markers for all the footnotes and define macros to set + the footnote markers; +\item then define a macro \ which typesets the footnotes; +\item then typeset the tables, using the macros defined in the steps + mentioned above; +\end{enumerate} +Here is some example input: + +\verbatiminput{hhst11a.tex} +And the resulting output: + +\input hhst11a.tex + +This article is too short to demonstrate it, but when typesetting multiple +tables this way problems are likely to arise. If you typeset +another table on the same page, calling \ again will cause the +footnote texts to be typeset twice on the same page. If you typeset +another table on another page, {\em all} table footnote texts will be +typeset on that page, even if the table which is on that page does +not refer to all of them. + +The \hhmuf package solves these problems, although the solution of +the twice-on-the-same-page problem may be buggy in rare contexts. +If you use the \hhmuf package you can replace the previous listing by +the following: + +\verbatiminput{hhst11b.tex} +And get this result: + +\input hhst11b.tex + +You will note that \=\mufhire= {\it label\/}\=:{={\it footnote text\/}\=}= +is used to define footnotes. Its opponent is, of course, +\=\muffire= {\it label\/}\=:=, which undefines footnotes, while +\=\muf= {\it label\/}\=:{}= is used to set previously defined +footnotes. As shown in the example, \=\muf=\:\=:{={\it footnote text\/}\=}= +can be used to set incidental footnotes. \=\muf=\:\=:{={\it footnote text\/}\=}= +actually acts as an abbreviation for hiring, typesetting and firing +an incidental note. Thus it is well-suited for setting normal in-text +footnotes. + +\hhmuf does not use common footnote markers. Most common sets of +symbols have a well-defined order which makes them ill-suited for +\hhmuf since the \hhmuf macros do not respect that order. +While defining footnotes, markers are assigned in turn. Thus there is +no need to restart footnote numbering every chapter or every page, +because you never run out of markers, unless you hire a lot of them +without ever firing any. Restarting footnote numbering does +not make sense anyway because there is no such +thing as a {\em first} marker. + +The set of markers used by \hhmuf can be fully specified by the user, +either by selecting one of the predefined sets or by compiling a new one. +The predefined sets are the following: +\begin{center} +\begin{tabular}{|l|l|}\hline + set name & markers included\\ +\hline\hline + black & $\bullet$\,$\blacklozenge$\,$\blacktriangledown$\,$\clubsuit + $\,$\blacksquare$\,$\blacktriangle$\,$\blacktriangleleft$\,$\spadesuit$\\ +\hline + circlox & $\oslash$\,$\odot$\,$\boxtimes$\,$\oplus$\,$\square$\,$\circledast$\,$\boxminus + $\,$\otimes$\,$\circledcirc$\,$\boxdot$\,$\circleddash$\,$\boxplus$\\ +\hline + fuss & $\ast$\,$\diamondsuit$\,$\circledast$\,$\divideontimes$\,$\sharp + $\,$\star$\,$\clubsuit$\,$\aleph$\,$\infty$\,$\circlearrowleft$\\ +\hline + geometry & $\blacklozenge$\,$\square$\,$\blacktriangledown$\,$\vartriangle$\,$\blacksquare + $\,$\triangleleft$\,$\blacktriangle$\,$\lozenge$\,$\blacktriangleleft$\,$\triangledown$\\ +\hline + misc & $\spadesuit$\,$\triangle$\,$\ominus$\,$\clubsuit$\,$\times + $\,$\diamondsuit$\,$\otimes$\,$\wr$\,$\odot$\,$\vee + $\,$\oplus$\,$\infty$\,$\star$\,$\oslash$\,$+$\,$\triangleleft$\,$\top$\,$\bullet$\,$\nabla$\\ +\hline + music & $\sharp$\,$\flat$\,$\natural$\\ +\hline + strokes & $\top$\,$\times$\,$\curlyvee$\,$+$\,$\veebar$\,$\nshortparallel$\,$\barwedge$\,$\wr$\\ +\hline +\end{tabular} +\end{center} +For details see the documentation in the package file. + +\subsection{The Forbidden Environment Problem} + +Suppose I typed several pieces of text that have to be typeset all +in the same special way. For that purpose I (re)defined an environment +\envirname{specialtext}: + +\verbatiminput{hhst12a.tex} +\newenvironment{specialtext}{}{}\input hhst12a.tex +\input hhst12b.tex +Then I defined a package option in the package I used to typeset +my document. If I specified that option when loading the package, +then \envirname{specialtext} would be defined as follows: + +\verbatiminput{hhst12c.tex} +\input hhst12c.tex +Now problems arise. I typeset the same text again: +\input hhst12b.tex +The paragraph is shown framed all right, but something went wrong with +the footnote. With the new definition of \envirname{specialtext}, +the footnote suddenly appears in a `forbidden' environment and therefore it +actually disappears. Although the in-text marker is typeset, there is +no note at the foot of the page. + +While writing this article I discovered Kresten Krab Thorup's style +file {\tt ftn.sty}\rlap{,}\footnote{Available at {\sc ctan} as +{\tt macros/latex209/contrib/misc/ftn.sty}} +which attempts to solve this problem but does so +quite buggily. Footnotes disappear when forbidden environments are nested. +When multiple footnotes are type-set in forbidden environments, footnotes +are repeated and their numbering is wrong. A modified version of +{\tt ftn.sty} exists (by Zdenek Wagner), which solves the repetition problem +correctly, and suppresses incorrect numbers by omitting them: at least that +is what I got. I tried to contact Krab Thorup about making +{\tt ftn.sty} more robust, but have not so far succeeded. +Nevertheless Krab Thorup's style file contained some very useful ideas, +which I combined with my own ideas to construct a set of macros which +seem to be quite robust. I will now show you the result: how easy it is +to use \hhmuf's footnotes in forbidden environments. + +The kind of unpleasant surprises presented above is easy to prevent when +typesetting footnotes with \ instead of \, +as in: + +\verbatiminput{hhst12d.tex} +When using the first definition of \envirname{specialtext}, this +yields: +\input hhst12a.tex +\input hhst12d.tex +In the following example the second definition of \envirname{specialtext} +is used, but I added one line of code to `protect' the environment: + +\verbatiminput{hhst12e.tex} + +And here is the result: +\input hhst12e.tex +\input hhst12d.tex + +Without changing the text in my document, I could redefine +\envirname{specialtext} to use forbidden environments in such a way +that my footnotes did not disappear. \ did the job. + +\subsection{Shortcomings: \envirname{minipage} Fans Beware!} +\hhmuf does not support \envirname{minipage}s yet. If \ is used +in a \envirname{minipage} environment, the footnote will be placed +at the foot of the `master page' instead of under the \envirname{minipage}! + +\scheiding + +\section{The \hhflxbox Package} +\hhflxbox contains a number of boxing macros. The kernel consists of +\