correct ms to microsec in cern muon graph
[light-and-matter.git] / lmfigs.sty
blob741da1a41d0ab1c46162185e1a1738e66016c41d
1 % This file contains code for handling figures that can be used not
2 % just by LM but also by SN and DP.
4 %-------------------- minipagefullpagewidth -------------------
5 % if using p{...} stuff, make sure the widths add up to about 162 mm
6 % bugs:
7 % - if the widths of the columns don't add up to the right amount, you can get gaps in the rules
8 % A lot of the ifrightifleft environment's logic has to be duplicated in \margdown -- if changing it here,
9 % change it there as well. This has to be implemented as an environment, so that the label occurs at the
10 % end; otherwise it messes up if it's the first thing on the page, because the label's page number refers
11 % to the previous page.
12 \newcounter{ifrightifleftctr}% only purpose is to distinguish the labels from one another
13 \setcounter{ifrightifleftctr}{0}
14 \newenvironment{ifrightifleft}[2]{%
15 \stepcounter{ifrightifleftctr}%
16 \ifthenelse{\isodd{\pageref{ifrightifleft\theifrightifleftctr}}}{#1}{#2}%
17 }{%
18 \label{ifrightifleft\theifrightifleftctr}%
20 \newenvironment{minipagefullpagewidth}%
22 \begin{ifrightifleft}{}{\hspace{-\marginfigoverhang}}%
23 \begin{minipage}{\pagewidth}
26 \end{minipage}
27 \end{ifrightifleft}
29 %-------------------- figure preferences -------------------
30 % The following three numbers are to make TeX more likely to put figures on the
31 % same page rather than on a separate figures page. Can tinker with these, but
32 % make sure floatpagefraction<topfraction.
33 % Values recommended by the web page I found were 0.85, 0.1, 0.75
34 \renewcommand{\topfraction}{0.99}
35 \renewcommand{\textfraction}{0.01}
36 \renewcommand{\floatpagefraction}{0.98}
38 \newcommand{\mypart}[1]{\part{#1}}
39 %-------------------- my figure commands -------------------
40 % For an example of how to do a figure containing LaTeX text, see fig:hmassratios
41 % in chapter 8.
43 % Force it to start figure numbering afresh with each chapter:
44 \newcommand{\zapcounters}{\setcounter{figctr}{0}}
45 % The following is complicated, because I want to be able to have chapter opener pictures that appear before the
46 % chapter's title:
47 \newcommand{\mychaptercmdsa}{%
48 \renewcommand\cleardoublepage{}%
49 \clearpage
50 \ifodd\c@page
51 \else
52 \hbox{}\newpage
53 \fi
54 \zapcounters
56 \newcommand{\mychaptercmdsb}{%
57 \thispagestyle{fancy}\myeqnspacing\normalfont\normalsize%
59 \newcommand{\mychapter}[3]{\mychaptercmdsa\chapter[#1]{#3}\mychaptercmdsb}
60 %...ignore #2 because only memoir supports it
61 \newcommand{\mychapterwithopener}[3]{%
62 \mychaptercmdsa%
63 \noindent\widefignocaptionnofloat{#1}%
64 {\formatlikecaption{#2}}%
65 \par\chapter{#3}%
66 \mychaptercmdsb%
69 \newcommand{\mychapterwithopenersidecaption}[3]{%
70 \mychaptercmdsa%
71 \noindent\widefigsidecaption{b}{#1}{#2}{labeled}{h}{nofloat}{}{\figprefix\chapdir/figs}%
72 \par\chapter{#3}%
73 \mychaptercmdsb%
74 \addtocounter{figctr}{1}% I don't understand why this is necessary, since it should get zeroed by mychaptercmdsa, which is before the figure.
76 \newcommand{\mychapterwithopenersidecaptionanon}[3]{%
77 \mychaptercmdsa%
78 \noindent\widefigsidecaption{b}{#1}{#2}{anonymous}{h}{nofloat}{}{\figprefix\chapdir/figs}%
79 \par\chapter{#3}%
80 \mychaptercmdsb%
82 \newcommand{\mychapterwithnarrowopenerwidecaption}[3]{%
83 \mychaptercmdsa%
84 \noindent\narrowfigwidecaptionanon{#1}{#2}%
85 \par\chapter{#3}%
86 \mychaptercmdsb%
88 \newcommand{\specialchapterwithopener}[4]{% used in CL, ch. 4, so pool ball hangs off edge, #1=width, #2=figure, #3=caption, #4=title of chapter
89 \mychaptercmdsa%
90 \noindent\widefigspecial{#1}{#2}%
91 {\formatlikecaption{#3}}%
92 \par\chapter{#4}%
93 \mychaptercmdsb%
95 \newcommand{\mychapterwithfullpagewidthopener}[3]{%
96 \mychaptercmdsa%
97 \noindent%
98 \begin{minipagefullpagewidth}%
99 \includegraphics[width=\textwidth]{\figprefix\chapdir/figs/#1}\\
100 \formatlikecaption{#2}%
101 \end{minipagefullpagewidth}%
102 \label{fig:#1}%
103 \par\chapter{#3}%
104 \mychaptercmdsb%
106 \newcommand{\mychapterwithfullpagewidthopenernocaption}[2]{%
107 \mychaptercmdsa%
108 \noindent%
109 \begin{minipagefullpagewidth}%
110 \includegraphics[width=\textwidth]{\figprefix\chapdir/figs/#1}
111 \end{minipagefullpagewidth}%
112 \label{fig:#1}%
113 \par\chapter{#2}%
114 \mychaptercmdsb%
116 \newcommand{\mychapterwithopenernocaption}[2]{%
117 \mychaptercmdsa%
118 \noindent\widefignocaptionnofloat{#1}%
119 \par\chapter{#2}%
120 % The following was what I had in DP instead of the line above. It caused
121 % an error in LM...?
122 % \par\vfill\hspace{-9mm}\noindent\chapter{#2}%
123 \mychaptercmdsb%
125 % Letters for figure number, and no "Figure .." in caption:
126 \newcommand{\hwcaptions}{\def\figurelabel{}}
127 \newcommand{\normalcaptions}{\def\figurelabel{\thefigctr\hspace{1mm}{\scriptsize{/}}\hspace{1mm}}}
128 \normalcaptions
130 \newcommand{\marg}[1]{\margdown{0mm}{#1}}
131 % The \figinindentedcorr length is to fix a problem where marginal figures are offset when used inside an indented
132 % block of text, such as an example. The eg environment changes this length to a nonzero value at the beginning, and
133 % then resets it to zero at the end. Problem:
134 % A figure above(?) or below(?) an eg doesn't benefit from the correction, but gets affected by the neighboring eg.
135 % One solution is to place the figure inside the eg instead. However, don't place it immediately before the
136 % first paragraph of the example, because that introduces extra vertical space.
137 \newlength{\figinindentedcorr}
138 \setlength{\figinindentedcorr}{0mm}
139 \newcommand{\indentedcorrend}{\setlength{\figinindentedcorr}{0mm}}
140 \newcommand{\indentedcorrstart}{\setlength{\figinindentedcorr}{\egindent}}
141 % For reasons I don't understand, it's also necessary to put in a roughly 2-mm correction to the positions of
142 % stuff on left-hand pages. To handle this, the margdown macro duplicates a lot of logic from the
143 % ifrightifleft environment; tried using that env. here, but that breaks wrapfigure.
144 % When the figure is the very first thing on a right-hand page, the ifrightifleft logic seems to mess
145 % up. Solution: never make a figure the very first thing on a page.
146 % If a left-hand figure is too close to the text by a couple of mm, the problem is that the odd/even logic
147 % is messed up, possibly because it's the first figure on the page. May need to recompile book from scratch
148 % to fix it, even after moving fig?
149 \newlength{\fixwrapfigweirdness}
150 \newcommand{\margdown}[2]{%
151 \stepcounter{ifrightifleftctr}%
152 \ifthenelse{\isodd{\pageref{ifrightifleft\theifrightifleftctr}}}{\setlength{\fixwrapfigweirdness}{0mm}}{\setlength{\fixwrapfigweirdness}{-2.9mm}}%
153 % ... for reasons I don't understand, this correction gets scaled down by about a factor of 2.
154 \addtolength{\fixwrapfigweirdness}{-\figinindentedcorr}%
155 %set to a nonzero value by eg
156 % environment; examples: CL, pp. 76 (ion drive), 111 (colliding asteroids)
157 \begin{wrapfigure}{o}[\marginfigoverhang]{0mm}%
158 \makebox[\marginfigwidth][l]{%
159 \hspace{\fixwrapfigweirdness}%
160 \begin{minipage}{\marginfigwidth}
161 \vspace*{#1}
163 \end{minipage}%
165 \end{wrapfigure}%
166 \label{ifrightifleft\theifrightifleftctr}%
168 \newcommand{\formatlikecaption}[1]{%
169 \small{\protect\sansmath\sf{#1}\lmserifmath} %
171 \newcommand{\docaptionnorefstep}[2][l]{%
172 \break%
173 \ifthenelse{\equal{#1}{r}}{\hspace*{\fill}}{}
174 \formatlikecaption{\figurelabel#2}%
175 \hfill%
177 \newcommand{\docaption}[1]{%
178 \refstepcounter{figctr}%
179 \docaptionnorefstep{#1}%
181 % In the following, the optional first argument is appended to the end of
182 % the label. This is necessary sometimes if I'm including the same figure
183 % more than once and want to have separate labels.
184 % This logic is not just simpler than ifrightifleft, it's more reliable, because
185 % the label is really attached to the figure itself, not the place from which
186 % it was created in the text.
187 \newcommand{\fullpagewidthfig}[3][\figprefix\chapdir/figs]{%
188 % #1 = directory (optional)
189 % #2 = name
190 % #3 = caption
191 \ifthenelse{\isodd{\pageref{fig:#2}}}{%
192 \fullpagewidthfigx{#2}{#3}{0mm}{fig}{#1}
194 \fullpagewidthfigx{#2}{#3}{-\marginfigoverhang}{fig}{#1}
197 \newcommand{\fullpagewidthfignocaption}[2][\figprefix\chapdir/figs]{%
198 % #1 = directory (optional)
199 % #2 = name
200 \ifthenelse{\isodd{\pageref{fig:#2}}}{%
201 \fullpagewidthfigx{#2}{}{0mm}{fig}{#1}
203 \fullpagewidthfigx{#2}{}{-\marginfigoverhang}{fig}{#1}
206 \newcommand{\fullpagewidthfigx}[5]{ %
207 \begin{figure}[h]
208 \hspace{#3}%
209 \begin{minipage}{\pagewidth}
210 \includegraphics[width=\pagewidth]{#5/#1}
211 \ifthenelse{\equal{#2}{}}{}{\linebreak[4]\docaption{#2}}
212 \label{#4:#1} %
213 \end{minipage}%
214 \end{figure}
216 \immediate\write18{rm -f ch*.pos}%The \immediate is necessary, because otherwise it deletes it after it's been written.
217 \newcommand{\recordpos}[2]{\pdfsavepos\write18{echo "fig,label=#1,page=\thepage,x=\the\pdflastxpos,y=\the\pdflastypos,at=#2" >>all.pos}}
218 % .... This is called from commands like \fig, etc.
219 \newenvironment{margin}[3]{%
220 % #1 = figure number
221 % #2 = delta-y (in mm, positive=up)
222 % #3 = chapter (so we can figure out which data file to write to)
223 \pdfsavepos\write18{echo "#1,page=\thepage,refx=\the\pdflastxpos,refy=\the\pdflastypos,deltay=#2" >>figfeedback#3}
226 % For the sake of consistency, try not to use anonymousfig in general. However, there's no harm in
227 % using it for discussion question figures, where a caption like ``i / Discussion question A'' looks
228 % goofy anyway.
229 \newcommand{\fig}[4]{ %
230 % #1 = name
231 % #2 = caption
232 % #3 = suffix
233 % #4 = directory
234 \figx{#1}{#2}{#3}{#4}{labeled}%
236 \newcommand{\anonymousfig}[3]{%
237 % #1 = name
238 % #2 = caption
239 % #3 = directory
240 \figx{#1}{#2}{}{#3}{anonymous}%
242 \newcommand{\figx}[5]{ %
243 % #1 = name
244 % #2 = caption
245 % #3 = suffix
246 % #4 = directory
247 % #5 = anonymous or labeled
248 \recordpos{fig:#1#3}{begin}\break % The break is important!!! Without it, we end up recording the height of the *bottom* of the graphic!!
249 \includegraphics[width=\marginfigwidth]{#4/#1}%
250 \recordpos{fig:#1#3}{endgraphic}%
251 % The use of the minipage environment in the folowing looks useless, but it isn't! In most cases, the surrounding textpos
252 % environment's width forces the caption to be the right width, and everything is OK. However, there are some cases
253 % (CL5, starting at 5.3 and ending when CL6 starts) where the stuff inside the figure is inexplicably typeset at the full 113mm
254 % text with unless I put in this minipage. The sloppypar is because fussy mode doesn't really work for such a narrow column of text.
255 \begin{sloppypar}\noindent\begin{minipage}{\marginfigwidth}\noindent%
256 \ifthenelse{\equal{#5}{labeled}}{%
257 \docaption{#2}%
259 \break\formatlikecaption{#2}\hfill%
261 \label{fig:#1#3}% Should be labeled regardless of whether it's anonymous; e.g., might need to refer to it in photo credits.
262 \end{minipage}\end{sloppypar}%
263 \recordpos{fig:#1#3}{endcaption}%
265 % The following is for figures that exist in translated versions. The \figprefix is omitted.
266 \newcommand{\trfig}[3][]{ %
267 \fig{#2}{#3}{#1}{translated}
269 % Note that for textfigs, there's no reason to have a provision for suffixes, since there's
270 % no external graphics file that might be reused.
271 \newcommand{\starttextfig}[1]{%
272 % #1 = name
273 \recordpos{fig:#1}{begintextfig}\break% Without the break, we record the height at the middle of the table, not the top.
275 \newcommand{\finishtextfig}[2]{%
276 % #1 = name
277 % #2 = caption
278 \break\noindent\docaption{%
280 \recordpos{fig:#1}{endtextfig}%
282 \label{fig:#1} %
283 \normalfont\normalsize
285 \newcommand{\starttextbox}[1]{%
286 % #1 = name
287 \recordpos{fig:#1}{begintextfig}\break% Without the break, we record the height at the middle of the table, not the top.
289 \newcommand{\textboxbody}[2]{
290 % #1 = title
291 % #2 = text
292 \noindent%
293 \refstepcounter{textboxctr}
294 \begin{shaded}
295 \noindent \ensuremath{\triangleright} Box \thetextboxctr \quad \textbf{#1}\\
297 \end{shaded}
299 \newcommand{\finishtextbox}[1]{%
300 % #1 = name
301 \break\recordpos{fig:#1}{endtextfig}\label{fig:#1}\label{textbox:#1}\normalfont\normalsize
303 \newcommand{\figref}[1]{\formatfigref{\ref{fig:#1}}}
304 \newcommand{\subfigref}[2]{\figref{#1}/#2}
305 \newcommand{\fignocaption}[2]{%
306 \recordpos{fig:#1}{begin}
307 \includegraphics[width=\marginfigwidth]{#2/#1} %
308 \recordpos{fig:#1}{endgraphic}%
309 \label{fig:#1} %
311 \newcommand{\fignoresize}[2]{ %
312 \includegraphics{\figprefix\chapdir/figs/#1} %
313 \docaption{#2} %
314 \label{fig:#1} %
316 \newcommand{\widefig}[6][h]{ %
317 % #1 -- float location
318 % #2 -- file
319 % #3 -- caption
320 % #4 -- suffix
321 % #5 -- labeled or anonymous
322 % #6 -- directory
323 \spaceabovewidefig
324 \begin{figure}[#1]
325 \recordpos{fig:#2#4}{begin}
326 \includegraphics[width=\textwidth]{#6/#2} %
327 \recordpos{fig:#2#4}{endgraphic}
328 \ifthenelse{\equal{#5}{labeled}}{%
329 \docaption{#3}%
330 \recordpos{fig:#2#4}{endcaption}
332 \formatlikecaption{#3}%
333 \recordpos{fig:#2#4}{endcaption}
335 \label{fig:#2#4} %
336 \end{figure}
338 \newcommand{\widefigspecial}[3][\figprefix\chapdir/figs]{ %
339 % #1 = directory (optional)
340 % #2 = width
341 % #3 = file
342 \spaceabovewidefig
343 \includegraphics[width=#2]{#1/#3} %
344 \label{fig:#3} %
346 \newcommand{\widefignocaptionnofloat}[2][\figprefix\chapdir/figs]{ %
347 % #1 = directory (optional)
348 % #2 = file
349 \noindent\widefigspecial[#1]{\textwidth}{#2}%
351 \newcommand{\inlinefignocaption}[1]{ %
352 \spaceabovewidefig
353 \includegraphics[width=\textwidth]{\figprefix\chapdir/figs/#1}\label{fig:#1}
355 \newcommand{\inlinefignocaptionnoresize}[1]{ %
356 \spaceabovewidefig
357 \includegraphics{\figprefix\chapdir/figs/#1}\label{fig:#1}
359 \newsavebox{\sidecaptionbox}
360 \newsavebox{\includegraphicsbox}
361 \newlength{\xmarginscoot}
362 \newlength{\ymarginscoot}
363 \newlength{\kludge}
364 \newlength{\oddsidemarginscoot}
365 \setlength{\oddsidemarginscoot}{\textwidth}
366 \addtolength{\oddsidemarginscoot}{\marginparsep}
367 \addtolength{\oddsidemarginscoot}{\mysteriousextracolsep}
368 \newlength{\evensidemarginscoot}
369 \setlength{\evensidemarginscoot}{\marginfigwidth}
370 \addtolength{\evensidemarginscoot}{\marginparsep}
371 \addtolength{\evensidemarginscoot}{\mysteriousextracolsep}
372 \newlength{\adjustevensidemargin}
373 \setlength{\adjustevensidemargin}{-3.5mm}
374 \addtolength{\evensidemarginscoot}{\adjustevensidemargin}
375 % ...This is necessary in order to make it line up with margin figs, which are actually too close
376 % to the text for some mysterious reason.
377 % ---------- side captions ------------
378 % The side caption stuff is really evil -- seemingly inconsequential modifications to the code can
379 % have unexpected effects. When making a change to this code, make sure to test as many cases and
380 % combinations of cases as possible:
381 % t, c, and b
382 % odd and even pages
383 % labeled or anonymous
384 % test bar cartoon fig in NP5 -- at end of page, caption tended to get pushed to next page
385 % captions less than 52 mm wide, versus ones that fill the whole margin's width
386 % There are also some constants hardcoded below that should really be computed.
387 % (The ones that *are* computed only apply to the older code that's if'ed out.)
388 % -------------------------------------
389 \newcommand{\widefigsidecaption}[8]{%
390 % not to be called directly
391 % #1 = t to align top of caption with top of figure, c to align centers, b for bottoms
392 % #2 = name of graphic
393 % #3 = caption
394 % #4 = labeled or anonymous
395 % #5 = standard latex positioning stuff, h, t, b
396 % #6 = float or nofloat
397 % #7 = suffix
398 % #8 = directory (would normally be \figprefix\chapdir/figs )
399 \ifthenelse{\equal{#6}{float}}{\begin{figure}[#5]}{}%
400 % If I don't enclose it in this, and make it floating, then it becomes impossible to get the page reference right reliably.
401 \begin{lrbox}{\includegraphicsbox}\begin{minipage}{\textwidth}\includegraphics[width=\textwidth]{#8/#2}\end{minipage}\end{lrbox}%
402 \refstepcounter{figctr}
403 % Note that although it would seem logical to put this code inside the first clause of the following ifthenelse, in fact that
404 % causes strange errors (later figures get same caption as earlier ones).
405 \begin{lrbox}{\sidecaptionbox}\begin{minipage}{\marginfigwidth}%
406 \ifthenelse{\equal{#4}{labeled}}{%
407 \docaptionnorefstep{#3}%
409 \formatlikecaption{#3}
411 \end{minipage}\end{lrbox}%
412 \ifthenelse{\isodd{\pageref{fig:#2#7}}}{%
413 \setlength{\xmarginscoot}{\oddsidemarginscoot}
415 {% even, left-hand page
416 \setlength{\xmarginscoot}{-\evensidemarginscoot}
417 \settowidth{\kludge}{\formatlikecaption{#3}}
418 \ifthenelse{\lengthtest{\kludge < \marginfigwidth}}{
419 \begin{lrbox}{\sidecaptionbox}\begin{minipage}{\marginfigwidth}%
420 \ifthenelse{\equal{#4}{labeled}}{%
421 \docaptionnorefstep[r]{#3}%
423 \formatlikecaption{#3}
425 \end{minipage}\end{lrbox}%
427 \addtolength{\xmarginscoot}{-4mm}% empirical
429 \ifthenelse{\equal{#1}{t}}{
430 \settoheight{\ymarginscoot}{\usebox{\includegraphicsbox}}
431 \settodepth{\kludge}{\usebox{\includegraphicsbox}}
432 \addtolength{\ymarginscoot}{\kludge}
433 \settoheight{\kludge}{\usebox{\sidecaptionbox}}
434 \addtolength{\ymarginscoot}{-\kludge}
436 \ifthenelse{\equal{#1}{b}}{
437 \settodepth{\ymarginscoot}{\usebox{\sidecaptionbox}}
439 \ifthenelse{\equal{#1}{c}}{
440 \settodepth{\ymarginscoot}{\usebox{\includegraphicsbox}}
442 \par
443 \label{fig:#2#7} % need to make sure this lies on same page as fig, otherwise parity is wrong
444 \ifthenelse{\equal{1}{0}}{
445 % old code, sometimes causes caption to go onto next page (as in NP5, bar cartoon)
446 \noindent\usebox{\includegraphicsbox}
447 \raisebox{\ymarginscoot}[0mm][0mm]{\makebox[0mm][l]{\hspace{\xmarginscoot}\usebox{\sidecaptionbox}}}
449 \settodepth{\kludge}{\usebox{\includegraphicsbox}}
450 \addtolength{\ymarginscoot}{-\kludge}
451 \ifthenelse{\isodd{\pageref{fig:#2#7}}}{%
452 % odd, right-hand page
453 \noindent\usebox{\includegraphicsbox}%
454 \makebox[\marginparsep][l]{}%
455 \makebox[3.5mm][l]{}% why??
456 \raisebox{\ymarginscoot}[0mm][0mm]{\makebox[0mm][l]{\usebox{\sidecaptionbox}}}
459 % even, left-hand page
460 \noindent\usebox{\includegraphicsbox}%
461 \makebox[\marginparsep][l]{}%
462 \makebox[4mm][l]{}% why??
463 \raisebox{\ymarginscoot}[0mm][0mm]{\makebox[0mm][l]{\hspace{-184mm}\usebox{\sidecaptionbox}}}
466 \ifthenelse{\equal{#6}{float}}{\end{figure}}{}%
468 % I only use this in a few places (NP, and EM, near pp. 92, 152), and the layouts in those places are tightly defined, so
469 % I don't want this to be floating. However, making it a floating figure was the only way I was ever able to figure out
470 % to get widefigsidecaption to figure out reliably when it was on a left or right page, so this is inherently unreliable.
471 \newcommand{\narrowfigwidecaptionnofloat}[4][t]{%
472 % #1 = t to align top of caption with top of figure, c to align centers, b for bottoms
473 % #2 = name of graphic
474 % #3 = caption
475 % #4 = directory
476 \vspace{2mm}\narrowfigwidecaptionanon[#1]{#2}{\docaptionnorefstep{#3}}{#4}
479 \newcommand{\narrowfigwidecaptionanon}[4][t]{%
480 % See comments under narrowfigwidecaption
481 \spaceabovewidefig
482 \begin{lrbox}{\includegraphicsbox}\begin{minipage}{\marginfigwidth}\includegraphics[width=\marginfigwidth]{#4/#2}\end{minipage}\end{lrbox}%
483 \refstepcounter{figctr}
484 \begin{lrbox}{\sidecaptionbox}\begin{minipage}{\textwidth}\formatlikecaption{#3}\end{minipage}\end{lrbox}%
485 \ifthenelse{\isodd{\pageref{fig:#2}}}{%
486 \setlength{\xmarginscoot}{\oddsidemarginscoot}
488 {% even, left-hand page
489 \setlength{\xmarginscoot}{-\evensidemarginscoot}
490 \settowidth{\kludge}{\formatlikecaption{#3}}
491 \ifthenelse{\lengthtest{\kludge < \textwidth}}{
492 \begin{lrbox}{\sidecaptionbox}\begin{minipage}{\textwidth}\formatlikecaption{#3}\end{minipage}\end{lrbox}%
494 \addtolength{\xmarginscoot}{-4mm}% empirical
496 \ifthenelse{\equal{#1}{t}}{
497 \settoheight{\ymarginscoot}{\usebox{\sidecaptionbox}}
498 \settodepth{\kludge}{\usebox{\sidecaptionbox}}
499 \addtolength{\ymarginscoot}{\kludge}
500 \settoheight{\kludge}{\usebox{\includegraphicsbox}}
501 \addtolength{\ymarginscoot}{-\kludge}
503 \ifthenelse{\equal{#1}{b}}{
504 \settodepth{\ymarginscoot}{\usebox{\includegraphicsbox}}
506 \ifthenelse{\equal{#1}{c}}{
507 \settodepth{\ymarginscoot}{\usebox{\sidecaptionbox}}
509 \par
510 \noindent\usebox{\sidecaptionbox}
511 \raisebox{\ymarginscoot}[0mm][0mm]{\makebox[0mm][l]{\hspace{\xmarginscoot}\usebox{\includegraphicsbox}}}
512 \par
513 \label{fig:#2} %
515 \newcommand{\anonymousinlinefig}[1]{\includegraphics{\figprefix\chapdir/figs/#1}}
516 \newlength{\toccolumnwidth}
517 \setlength{\toccolumnwidth}{77mm}%kludge -- shouldn't hardcode this
519 % Adding decorative figures in table of contents:
520 %%%%%%%%%%%\newcommand{\tocdir}{ch00}
521 \newcommand{\figureintoc}[1]{\par\includegraphics[width=\toccolumnwidth]{\figprefix#1}\par}
522 % ...To use this: \addtocontents{toc}{\protect\figureintoc{myfig}}
523 \newcommand{\figureintocnoresize}[1]{\par\includegraphics{\figprefix#1}\par}
524 % ...only needed if you want the figure to hang over the edge
525 \newcommand{\figureintocscootx}[2]{\par\hspace{#2}\includegraphics[width=\toccolumnwidth]{\figprefix#1}\par}
526 % ...used if you want to put a figure in the middle of a chapter in the toc, as in VW, where the surfer is
527 % in the middle of ch. 3; this is because the toc package is enforcing indentation at this point
528 \newcommand{\figureintocscooty}[2]{\par\vspace{#2}\includegraphics[width=\toccolumnwidth]{\figprefix#1}\par}
529 % ...used at the end of VW's toc, to make the galaxy come out flush at the bottom
531 \newcommand{\spacebetweenfigs}{
532 \vspace{6mm}
534 \newcommand{\smspacebetweenfigs}{
535 \vspace{2mm}
537 \newcommand{\spaceabovewidefig}{\vspace{1mm}}