1%%% ==================================================================== 2%%% @LaTeX-style-file{ 3%%% filename = "here.sty", 4%%% version = "1.01", 5%%% date = "12 June 1992", 6%%% time = "15:26:24 BST", 7%%% author = "David Carlisle", 8%%% address = "Computer Science Department 9%%% Manchester University 10%%% Oxford Road 11%%% Manchester 12%%% England 13%%% M13 9PL", 14%%% telephone = "+44 61 275 6139", 15%%% FAX = "+44 61 275 6236", 16%%% checksum = "51873 214 1175 8528", 17%%% email = "carlisle@cs.man.ac.uk (Internet)", 18%%% codetable = "ISO/ASCII", 19%%% keywords = "LaTeX, figure, table, floats", 20%%% supported = "yes", 21%%% docstring = " 22%%% 23%%% here.sty 24%%% 25%%% A LaTeX style option giving floats a [H] option, 26%%% meaning `do not float', or `PUT IT HERE'. 27%%% 28%%% Documentation requires Mittelbach's doc.sty. 29%%% 30%%% The checksum field above was produced by 31%%% Robert Solovay's checksum utility.", 32%%% } 33%%% ==================================================================== 34% 35% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 36% * Version 1, 13 Sept 1991 37% * Version 1.01, added \vbox accidently omitted from previous version. 38% 39% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 40%<*x> 41% This file may be used without modification as a style (.sty) file. 42% 43% If you have Mittelbach's doc.sty, this file may be formatted with a 44% command like: 45% latex here.sty 46% 47% If you have the Mittelbach/Duchier/Braams docstrip utility, you may 48% produce a faster loading .sty file. Rename this file to: here.doc 49% Then run this file through *plain* TeX: 50% tex here.doc 51% This should produce the file here.sty. 52% If you do not have plain TeX on your system, you can trick LaTeX into 53% doing the work as follows: 54% latex \def\fmtname{plain} \input here.doc 55% Note that you may need to quote the arguments here to stop your 56% operating system treating the \ characters incorrectly. 57% 58% latex here.doc 59% Will produce a typeset version of the documentation, as above. 60% 61% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 62\def\plain{plain}\ifx\fmtname\plain\csname fi\endcsname 63 \def\batchfile{here.doc} 64 \input docstrip 65 \preamble 66 67 Do not distribute the stripped version of this file. 68 The checksum in the header refers to the documented version. 69 70 \endpreamble 71 \generateFile{here.sty}{t}{\from{here.doc}{}} 72 \endinput 73\fi 74% 75\ifcat a\noexpand @\let\next\relax\else\def\next{% 76 \documentstyle[here,doc]{article}\MakePercentIgnore}\fi\next 77% 78%\def\eatmodule<#1>{}\eatmodule 79%</x> 80% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 81% 82% \textwidth=355pt ^^A Allow macrocode text with 72 columns. 83% \CodelineIndex ^^A Code lines numbered. 84% \DisableCrossrefs ^^A No Cross references. 85% \MakeShortVerb{\|} ^^A |\foo| works like \verb+\foo+ 86% 87% \title{here.sty} 88% \author{D. P. Carlisle} 89% \date{12 June 1992} 90% \begin{document} 91% \maketitle 92% \begin{abstract} 93% {\tt here.sty} gives environments such as {\tt figure} and {\tt table} 94% a {\tt [H]} option which means `PUT IT HERE'. As opposed to the 95% standard {\tt [h]} option which means `You may put it here if you 96% wish'. 97% \end{abstract} 98% 99% \begin{figure}[H] 100% This figure will not float, even if this causes a bad page break. 101% \caption{It may be captioned as usual.} 102% \end{figure} 103% 104% Many people have problems with \LaTeX's floating environments. A 105% common complaint is that all the environments appear at the end of the 106% document (or chapter). Many users try to correct this behaviour by 107% using the {\tt [h]} option. Incorect use of this option, in particular 108% using just {\tt [h]} rather than a more liberal option such as {\tt 109% [hp]} actually makes the problem worse! 110% 111% \LaTeX\ will only position a float (even one with the {\tt [h]} 112% option) in a position which does not violate the rules for float 113% placement set by the document style. These rules are determined by the 114% following parameters: 115% 116% \begin{table}[H] 117% \begin{tabular}{lp{220pt}} 118% |\c@topnumber|& Number of floats allowed at the top of a 119% column.\\ 120% |\topfraction|& Fraction of column that can be devoted to 121% floats.\\ 122% |\c@dbltopnumber|\\ \verb|\dbltopfraction|& Same as above, but for 123% double-column floats.\\ 124% |\c@bottomnumber|\\ \verb|\bottomfraction|& Same as above for 125% bottom of page.\\ 126% |\c@totalnumber|& Number of floats allowed in a single column,\\ 127% & including in-text floats.\\ 128% |\textfraction|& Minimum fraction of column that must contain 129% text.\\ 130% |\floatpagefraction|& Minimum fraction of page that must be taken 131% up by a float page.\\ 132% |\dblfloatpagefraction|&As above, for double-column floats. 133% \end{tabular} 134% \caption{\LaTeX`s float placement parameters} 135% \end{table} 136% 137% The default settings (in {\tt article.doc} for {\tt article} style) 138% for these parameters make it difficult to set floats if the document 139% has a lot of small floats. The result is that \LaTeX\ `holds them 140% back' in the hope of finding a better place later. At the end of the 141% document (or at a |\clearpage|) it gives up and outputs all the 142% remaining floats. 143% 144% It may be seen from the above paragraph that the `correct' way to 145% handle float problems is to write a style file modifying these 146% parameters, however for many purposes, authors to not want a float at 147% all, they just use the {\tt figure} or {\tt table} environments to get 148% the correct spacing, and a counter that may be referenced. This style 149% option provides an easy solution in this case. If the {\tt [H]} option 150% is specified, the environment will not float even if it causes a bad 151% page break, or breaks the rules specified in the above parameters. The 152% main drawback is that if the [H] option is used in one figure, and the 153% following figure uses the {\tt [t]} option, then the second figure may 154% float in front of the first. 155% 156% Note that the {\tt [H]} should not be used in conjunction with the 157% other options. {\tt [Htp]} is not allowed by this style. The {\tt h} 158% option may still be used, so {\tt [htp]} is OK. 159% \typeout{End of the Introduction and Examples.} 160% \typein[\answer]% 161% {Do you want an annotated listing of the macro definitions (y/n) ?} 162% \def\next{y}\ifx\answer\next\else\expandafter\stop\fi 163% 164% \section{The Macros} 165% First we make sure that this file is only loaded once. 166% \begin{macrocode} 167\ifx\@Hxfloat\@Hundef\else\expandafter\endinput\fi 168% \end{macrocode} 169% 170% \begin{macro}{\@Hxfloat} 171% Now we can save the original version of |\@xfloat|. 172% \begin{macrocode} 173\let\@Hxfloat\@xfloat 174% \end{macrocode} 175% \end{macro} 176% \begin{macro}{\@xfloat} 177% The new version of |@xfloat| looks for a |[H]| argument. 178% If it is present |\@HHfloat| is called, otherwise the original macro 179% (renamed to |\@Hfloat|) is called. 180% \begin{macrocode} 181\def\@xfloat#1[{\@ifnextchar{H}{\@HHfloat{#1}[}{\@Hxfloat{#1}[}} 182% \end{macrocode} 183% \end{macro} 184% \begin{macro}{\@HHfloat} 185% First gobble the |[H]|. Note that {\tt H} should not be used in 186% conjunction with the other placement options, nor as the value of the 187% default placement, as set in |\fps@|{\it type}. 188% \begin{macrocode} 189\def\@HHfloat#1[H]{% 190% \end{macrocode} 191% Locally redefine the end of the environment. 192% \begin{macrocode} 193\expandafter\let\csname end#1\endcsname\end@Hfloat 194% \end{macrocode} 195% Add the vertical space, and define |\caption|. Also reset 196% |\parindent| for compatibility with the standard {\tt [h]} option. 197% \begin{macrocode} 198\vskip\intextsep\vbox\bgroup\def\@captype{#1}\parindent\z@ 199% \end{macrocode} 200% The final |\ignorespaces| is needed to gobble any spaces or newlines 201% after the {\tt[H]} tokens. 202% \begin{macrocode} 203\ignorespaces} 204% \end{macrocode} 205% \end{macro} 206% \begin{macro}{\end@Hfloat} 207% Add the same vertical space as would be added by a float placed with 208% {\tt[h]}. 209% \begin{macrocode} 210\def\end@Hfloat{\egroup\vskip \intextsep} 211% \end{macrocode} 212% \end{macro} 213% \end{document} 214