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