diff --git a/clock_disparity/ghost_node.py b/clock_disparity/ghost_node.py index e2c8617..0510219 100644 --- a/clock_disparity/ghost_node.py +++ b/clock_disparity/ghost_node.py @@ -19,7 +19,7 @@ def hash_to_int(h): o = (o << 8) + c return o -NOTARIES = 75 +NOTARIES = 100 SLOT_SIZE = 6 EPOCH_LENGTH = 25 diff --git a/clock_disparity/ghost_test.py b/clock_disparity/ghost_test.py index ed5a381..318f725 100644 --- a/clock_disparity/ghost_test.py +++ b/clock_disparity/ghost_test.py @@ -59,6 +59,7 @@ nx.draw_networkx_nodes(G, pos, nodelist=sigs.keys(), node_size=5, node_shape='o' nx.draw_networkx_nodes(G, pos, nodelist=unjustified.keys(), node_size=10, node_shape='o',node_color='0.75') nx.draw_networkx_nodes(G, pos, nodelist=justified.keys(), node_size=16, node_shape='o',node_color='y') nx.draw_networkx_nodes(G, pos, nodelist=finalized.keys(), node_size=25, node_shape='o',node_color='g') +# nx.draw_networkx_labels(G, pos, {h: n.scores.get(h, 0) for h in n.blocks.keys()}, font_size=5) blockedges = [(u,v) for (u,v) in edges if G[u][v]['color'] == 'b'] otheredges = [(u,v) for (u,v) in edges if G[u][v]['color'] == '0.75'] diff --git a/papers/pricing/arydshln.sty b/papers/pricing/arydshln.sty new file mode 100644 index 0000000..e69de29 diff --git a/papers/pricing/commath.sty b/papers/pricing/commath.sty new file mode 100644 index 0000000..e69de29 diff --git a/papers/pricing/marvosym.sty b/papers/pricing/marvosym.sty new file mode 100644 index 0000000..e69de29 diff --git a/papers/pricing/nips10submit_e.sty b/papers/pricing/nips10submit_e.sty new file mode 100644 index 0000000..5a296e5 --- /dev/null +++ b/papers/pricing/nips10submit_e.sty @@ -0,0 +1,236 @@ +%%%% NIPS Macros (LaTex) +%%%% Style File +%%%% Dec 12, 1990 Rev Aug 14, 1991; Sept, 1995; April, 1997; April, 1999 + +% This file can be used with Latex2e whether running in main mode, or +% 2.09 compatibility mode. +% +% If using main mode, you need to include the commands +% \documentclass{article} +% \usepackage{nips10submit_e,times} +% as the first lines in your document. Or, if you do not have Times +% Roman font available, you can just use +% \documentclass{article} +% \usepackage{nips10submit_e} +% instead. +% +% If using 2.09 compatibility mode, you need to include the command +% \documentstyle[nips10submit_09,times]{article} +% as the first line in your document. Or, if you do not have Times +% Roman font available, you can include the command +% \documentstyle[nips10submit_09]{article} +% instead. + +% Change the overall width of the page. If these parameters are +% changed, they will require corresponding changes in the +% maketitle section. +% +\usepackage{eso-pic} % used by \AddToShipoutPicture + +\renewcommand{\topfraction}{0.95} % let figure take up nearly whole page +\renewcommand{\textfraction}{0.05} % let figure take up nearly whole page + +% Define nipsfinal, set to true if nipsfinalcopy is defined +\newif\ifnipsfinal +\nipsfinalfalse +\def\nipsfinalcopy{\nipsfinaltrue} +\font\nipstenhv = phvb at 8pt % *** IF THIS FAILS, SEE nips10submit_e.sty *** + +% Specify the dimensions of each page + +\setlength{\paperheight}{11in} +\setlength{\paperwidth}{8.5in} + +\oddsidemargin 0in % Note \oddsidemargin = \evensidemargin +\evensidemargin 0in +\marginparwidth 0.07 true in +%\marginparwidth 0.75 true in +%\topmargin 0 true pt % Nominal distance from top of page to top of +%\topmargin 0.125in +\topmargin -0.625in +\addtolength{\headsep}{0.25in} +\textheight 9.0 true in % Height of text (including footnotes & figures) +\textwidth 6.5 true in % Width of text line. +\widowpenalty=10000 +\clubpenalty=10000 + +% \thispagestyle{empty} \pagestyle{empty} +\flushbottom \sloppy + +% We're never going to need a table of contents, so just flush it to +% save space --- suggested by drstrip@sandia-2 +\def\addcontentsline#1#2#3{} + +% Title stuff, taken from deproc. +\def\maketitle{\par +\begingroup + \def\thefootnote{\fnsymbol{footnote}} + \def\@makefnmark{\hbox to 0pt{$^{\@thefnmark}$\hss}} % for perfect author + % name centering +% The footnote-mark was overlapping the footnote-text, +% added the following to fix this problem (MK) + \long\def\@makefntext##1{\parindent 1em\noindent + \hbox to1.8em{\hss $\m@th ^{\@thefnmark}$}##1} + \@maketitle \@thanks +\endgroup +\setcounter{footnote}{0} +\let\maketitle\relax \let\@maketitle\relax +\gdef\@thanks{}\gdef\@author{}\gdef\@title{}\let\thanks\relax} + +% The toptitlebar has been raised to top-justify the first page + +% Title (includes both anonimized and non-anonimized versions) +\def\@maketitle{\vbox{\hsize\textwidth +\linewidth\hsize \vskip 0.1in \toptitlebar \centering +{\LARGE\bf \@title\par} \bottomtitlebar % \vskip 0.1in % minus +\ifnipsfinal + \def\And{\end{tabular}\hfil\linebreak[0]\hfil + \begin{tabular}[t]{c}\bf\rule{\z@}{24pt}\ignorespaces}% + \def\AND{\end{tabular}\hfil\linebreak[4]\hfil + \begin{tabular}[t]{c}\bf\rule{\z@}{24pt}\ignorespaces}% + \begin{tabular}[t]{c}\bf\rule{\z@}{24pt}\@author\end{tabular}% +\else + \begin{tabular}[t]{c}\bf\rule{\z@}{24pt} +Anonymous Author(s) \\ +Affiliation \\ +Address \\ +\texttt{email} \\ +\end{tabular}% +\fi +\vskip 0.3in minus 0.1in}} + +\renewenvironment{abstract}{\vskip.075in\centerline{\large\bf +Abstract}\vspace{0.5ex}\begin{quote}}{\par\end{quote}\vskip 1ex} + +% sections with less space +\def\section{\@startsection {section}{1}{\z@}{-2.0ex plus + -0.5ex minus -.2ex}{1.5ex plus 0.3ex +minus0.2ex}{\large\bf\raggedright}} + +\def\subsection{\@startsection{subsection}{2}{\z@}{-1.8ex plus +-0.5ex minus -.2ex}{0.8ex plus .2ex}{\normalsize\bf\raggedright}} +\def\subsubsection{\@startsection{subsubsection}{3}{\z@}{-1.5ex +plus -0.5ex minus -.2ex}{0.5ex plus +.2ex}{\normalsize\bf\raggedright}} +\def\paragraph{\@startsection{paragraph}{4}{\z@}{1.5ex plus +0.5ex minus .2ex}{-1em}{\normalsize\bf}} +\def\subparagraph{\@startsection{subparagraph}{5}{\z@}{1.5ex plus + 0.5ex minus .2ex}{-1em}{\normalsize\bf}} +\def\subsubsubsection{\vskip +5pt{\noindent\normalsize\rm\raggedright}} + + +% Footnotes +\footnotesep 6.65pt % +\skip\footins 9pt plus 4pt minus 2pt +\def\footnoterule{\kern-3pt \hrule width 12pc \kern 2.6pt } +\setcounter{footnote}{0} + +% Lists and paragraphs +\parindent 0pt +\topsep 4pt plus 1pt minus 2pt +\partopsep 1pt plus 0.5pt minus 0.5pt +\itemsep 2pt plus 1pt minus 0.5pt +\parsep 2pt plus 1pt minus 0.5pt +\parskip .5pc + + +%\leftmargin2em +%\leftmargin0pc +\leftmargini\leftmargin \leftmarginii 2em +\leftmarginiii 1.5em \leftmarginiv 1.0em \leftmarginv .5em + +%\labelsep \labelsep 5pt + +\def\@listi{\leftmargin\leftmargini} +\def\@listii{\leftmargin\leftmarginii + \labelwidth\leftmarginii\advance\labelwidth-\labelsep + \topsep 2pt plus 1pt minus 0.5pt + \parsep 1pt plus 0.5pt minus 0.5pt + \itemsep \parsep} +\def\@listiii{\leftmargin\leftmarginiii + \labelwidth\leftmarginiii\advance\labelwidth-\labelsep + \topsep 1pt plus 0.5pt minus 0.5pt + \parsep \z@ \partopsep 0.5pt plus 0pt minus 0.5pt + \itemsep \topsep} +\def\@listiv{\leftmargin\leftmarginiv + \labelwidth\leftmarginiv\advance\labelwidth-\labelsep} +\def\@listv{\leftmargin\leftmarginv + \labelwidth\leftmarginv\advance\labelwidth-\labelsep} +\def\@listvi{\leftmargin\leftmarginvi + \labelwidth\leftmarginvi\advance\labelwidth-\labelsep} + +\abovedisplayskip 7pt plus2pt minus5pt% +\belowdisplayskip \abovedisplayskip +\abovedisplayshortskip 0pt plus3pt% +\belowdisplayshortskip 4pt plus3pt minus3pt% + +% Less leading in most fonts (due to the narrow columns) +% The choices were between 1-pt and 1.5-pt leading +%\def\@normalsize{\@setsize\normalsize{11pt}\xpt\@xpt} % got rid of @ (MK) +\def\normalsize{\@setsize\normalsize{11pt}\xpt\@xpt} +\def\small{\@setsize\small{10pt}\ixpt\@ixpt} +\def\footnotesize{\@setsize\footnotesize{10pt}\ixpt\@ixpt} +\def\scriptsize{\@setsize\scriptsize{8pt}\viipt\@viipt} +\def\tiny{\@setsize\tiny{7pt}\vipt\@vipt} +\def\large{\@setsize\large{14pt}\xiipt\@xiipt} +\def\Large{\@setsize\Large{16pt}\xivpt\@xivpt} +\def\LARGE{\@setsize\LARGE{20pt}\xviipt\@xviipt} +\def\huge{\@setsize\huge{23pt}\xxpt\@xxpt} +\def\Huge{\@setsize\Huge{28pt}\xxvpt\@xxvpt} + +\def\toptitlebar{\hrule height4pt\vskip .25in\vskip-\parskip} + +\def\bottomtitlebar{\vskip .29in\vskip-\parskip\hrule height1pt\vskip +.09in} % +%Reduced second vskip to compensate for adding the strut in \@author + +% Vertical Ruler +% This code is, largely, from the CVPR 2010 conference style file +% ----- define vruler +\makeatletter +\newbox\nipsrulerbox +\newcount\nipsrulercount +\newdimen\nipsruleroffset +\newdimen\cv@lineheight +\newdimen\cv@boxheight +\newbox\cv@tmpbox +\newcount\cv@refno +\newcount\cv@tot +% NUMBER with left flushed zeros \fillzeros[] +\newcount\cv@tmpc@ \newcount\cv@tmpc +\def\fillzeros[#1]#2{\cv@tmpc@=#2\relax\ifnum\cv@tmpc@<0\cv@tmpc@=-\cv@tmpc@\fi +\cv@tmpc=1 % +\loop\ifnum\cv@tmpc@<10 \else \divide\cv@tmpc@ by 10 \advance\cv@tmpc by 1 \fi + \ifnum\cv@tmpc@=10\relax\cv@tmpc@=11\relax\fi \ifnum\cv@tmpc@>10 \repeat +\ifnum#2<0\advance\cv@tmpc1\relax-\fi +\loop\ifnum\cv@tmpc<#1\relax0\advance\cv@tmpc1\relax\fi \ifnum\cv@tmpc<#1 \repeat +\cv@tmpc@=#2\relax\ifnum\cv@tmpc@<0\cv@tmpc@=-\cv@tmpc@\fi \relax\the\cv@tmpc@}% +% \makevruler[][][][][] +\def\makevruler[#1][#2][#3][#4][#5]{\begingroup\offinterlineskip +\textheight=#5\vbadness=10000\vfuzz=120ex\overfullrule=0pt% +\global\setbox\nipsrulerbox=\vbox to \textheight{% +{\parskip=0pt\hfuzz=150em\cv@boxheight=\textheight +\cv@lineheight=#1\global\nipsrulercount=#2% +\cv@tot\cv@boxheight\divide\cv@tot\cv@lineheight\advance\cv@tot2% +\cv@refno1\vskip-\cv@lineheight\vskip1ex% +\loop\setbox\cv@tmpbox=\hbox to0cm{{\nipstenhv\hfil\fillzeros[#4]\nipsrulercount}}% +\ht\cv@tmpbox\cv@lineheight\dp\cv@tmpbox0pt\box\cv@tmpbox\break +\advance\cv@refno1\global\advance\nipsrulercount#3\relax +\ifnum\cv@refno<\cv@tot\repeat}}\endgroup}% +\makeatother +% ----- end of vruler + +% \makevruler[][][][][] +\def\nipsruler#1{\makevruler[12pt][#1][1][3][0.993\textheight]\usebox{\nipsrulerbox}} +\AddToShipoutPicture{% +\ifnipsfinal\else +\nipsruleroffset=\textheight +\advance\nipsruleroffset by -3.7pt + \color[rgb]{.7,.7,.7} + \AtTextUpperLeft{% + \put(\LenToUnit{-35pt},\LenToUnit{-\nipsruleroffset}){%left ruler + \nipsruler{\nipsrulercount}} + } +\fi +} diff --git a/papers/pricing/subfigure.sty b/papers/pricing/subfigure.sty new file mode 100644 index 0000000..d3aaa76 --- /dev/null +++ b/papers/pricing/subfigure.sty @@ -0,0 +1,446 @@ +%$% subfigure.sty +%$% Subfigure/table command for use with the LaTeX figure environment. +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% Copyright (C) 1988-1995 Steven Douglas Cochran. +%%% +%%% The subfigure style is made available for academic and research +%%% purposes only. No commercial license is hereby granted. Copying +%%% and other reproduction is authorized only for research, education, +%%% and other non-commercial purposes. No warranties, either +%%% expressed or impiled, are made regarding the operation, use, or +%%% results of the subfigure style. +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% @LaTeX-style-file{ +%%% Author = "Steven Douglas Cochran", +%%% Version = "2.0 (LaTeX209 version)", +%%% Date = "1995 Mar 06", +%%% Time = "12:43:14 EDT", +%%% Filename = "subfigure.sty", +%%% Address = "Digital Mapping Laboratory +%%% School of Computer Science +%%% Carnegie-Mellon University +%%% 5000 Forbes Avenue +%%% Pittsburgh, PA 15213-3891 +%%% USA", +%%% Telephone = "(412) 268-5654", +%%% FAX = "(412) 268-5576", +%%% checksum = "23098 438 1899 18286", +%%% Email = "sdc+@CS.CMU.EDU (Internet)", +%%% CodeTable = "ISO/ASCII", +%%% Keywords = "LaTeX, float, figure, table", +%%% Supported = "yes", +%%% Abstract = "LaTeX document-style option for +%%% providing support for the inclusion of +%%% small `sub' figures and tables. It +%%% simplifies the positioning, captioning +%%% and labeling of them within a single +%%% figure or table environment.", +%%% DocString = "The checksum field above contains a CRC-16 +%%% checksum as the first value, followed by +%%% the equivalent of the standard UNIX wc +%%% (word count) utility output of lines, +%%% words, and characters. This is produced +%%% by Robert Solovay's checksum utility." +%%% } +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% $Log: subfigure.sty,v $ +%$% Revision 2.0 95/03/06 12:43:14 sdc +%$% This version of `subfigure' is the first to be ported to LaTeX2e +%$% (with backward compatibility to LaTeX 2.09). "\subfigure" and +%$% "\subtable" are now identical and the environment controls +%$% internal differences between them. Now, the caption setting +%$% portion of "\@subfloat" is broken into the separate macros +%$% "\@makesubfigurecaption" and "\@makesubtablecaption" to allow a +%$% separate hook for the modification of how the caption is +%$% constructed and to allow the table and figure captions to be +%$% different. In addition, support of the `normal', `hang', +%$% `center', `centerlast', 'nooneline'; `scriptsize', \ldots, +%$% `Large'; `up', `it', `sl', `sc', `md', `bf', `rm', `sf', and `tt' +%$% package options were added for compatibility with the caption.sty +%$% by H.A. Sommerfeldt.} +%$% +%$% Revision 1.6 93/05/13 12:58:34 sdc +%$% Changed to use the \thefigure macro in building the referenced +%$% label. The old form caused a problem when used with the +%$% report.sty as pointed out by Andrew Anselmo +%$% (anselmo@cumesb.mech.columbia.edu). Also modified to restrict +%$% the scope of the subfigure \label to the body of the subfigure. +%$% Added \@thesubfigure to allow a separate labeling of the +%$% subfigure in the figure and in the text. By default it is the +%$% same as \thesubfigure with space appended. Added some hooks to +%$% print the subfigure captions to the list-of-figures file if +%$% desired. Finally, added the corresponding support for sub-tables +%$% as well as sub-figures. NOTE: the optional caption is now a +%$% moving argument and any fragile commands that appear in the +%$% caption must be preceded by a \protect (just like that of the +%$% \caption command). +%$% +%$% Revision 1.5 92/08/11 23:13:12 sdc +%$% Fixed a bug which caused an problem with captions that contained +%$% expressions like \sqrt; This was pointed out by Tom Scavo +%$% (scavo@cie.uoregon.edu). A separate bug was fixed which caused +%$% different sized captions to be misaligned; This problem was +%$% pointed out by Simon Marshall (S.Marshal@Hull.ac.uk). Also +%$% cleaned up the code a mite and *changed* the figure spacing so that +%$% if no optional section is given, then the figure is only followed +%$% by \subfigbottomskip and not that plus (\subfigcapskip + \strut +%$% height). This should make it easier to adjust spacing as desired. +%$% +%$% Revision 1.4 92/06/27 10:40:34 sdc +%$% Added a hack to allow the \label command to be used within the +%$% body of the subfigure giving a reference label in the form +%$% \arabic{thefigure}\thesubfigure. Added standard file header for +%$% style. +%$% +%$% Revision 1.3 90/10/22 17:04:28 cochran +%$% Changed test for empty caption inside of \@subfigure to compare +%$% tokens and not the caption vs. \@empty. The former (incorrect) +%$% test caused an error when the first two letters of the caption +%$% were the same. +%$% +%$% Revision 1.2 89/08/30 07:18:29 cochran +%$% Added a separate bottom margin and expanded the comments. +%$% +%$% Revision 1.1 88/11/02 11:03:46 cochran +%$% Initial revision. +%$% +%$% 05 Mar 86 cochran@dworkin.usc.edu (USC-IRIS) +%$% Created. +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%$% Usage: \documentstyle[...,subfigure,...]{...} +%$% +%$% \subfigure[CAPTIONtext]{FIGUREbox} +%%% +%%% Creates a subfigure box with an optional CAPTION under a FIGURE. +%%% The FIGURE is centered with \subfigtopskip of vertical space added +%%% above. If there is a CAPTION, then \subfigcapskip vertical space +%%% is added below the FIGURE followed by the CAPTION. Finally, +%%% \subfigbottomskip of vertical space added at the bottom. +%%% +%%% If a CAPTION is given (including a null CAPTION `[]') then the +%%% subfigure is labeled with a counter formatted by the macro +%%% `\thesubfigure' which returns `(a)', `(b)', etc. If desired, +%%% this macro may be redefined. The counter used for labeling the +%%% subfigures is `subfigure' and is incremented for each subfigure +%%% regardless of whether a CAPTION was printed. +%%% +%$% \subfigure[CAPTIONtext]{FIGUREbox} +%%% +%%% The subtable command is symmetric to the subfigure command defined +%%% above. +%%% +%%% One example of use is to surround the figure in a center +%%% environment or to specifying \centering: +%%% +%%% *---------* +%%% \newcommand{\goodgap}{% | .. . | *---------* +%%% \hspace{\subfigtopskip}% | . . | | . . . | +%%% \hspace{\subfigbottomskip}} | .. . . | | . . .. | +%%% ... *---------* *---------* +%%% \begin{figure}% (a) First (b) Second +%%% \centering Figure +%%% \subfigure[First]{...}\goodgap +%%% \subfigure[Second Figure]{...}\\ *---------* +%%% \subfigure[Third]{\label{3figs-c}...}% | . .. . | +%%% \caption{Three Subfigures.} | . .. . | +%%% \label{3figs} *---------* +%%% \end{figure} (c) Third +%%% ... Figure 1. Three Subfigures. +%%% Figure~\ref{3figs} contains +%%% two top `subfigures' and Figure 1 contains two top `sub- +%%% Figure~\ref{3figs-c}. figures' and Figure 1(c). +%%% +%%% A second example is to change the way that the subfigures are labeled +%%% and to have the subfigure captions printed in the list-of-figures. +%%% +%%% \renewcommand{\thesubfigure}{\thefigure.\arabic{subfigure}} +%%% \makeatletter +%%% \renewcommand{\@thesubfigure}{\thesubfigure:\space} +%%% \renewcommand{p@subfigure}{} +%%% \makeatother +%%% ... +%%% \setcounter{lofdepth}{2} +%%% \listoffigures +%%% ... +%%% \begin{figure}% +%%% \begin{center}% +%%% \subfigure[First]{% *--------------* *--------------* +%%% \label{fig:first}% | .. . . | | . ... .. . . | +%%% ...}% | . . . . | | . . . . .. | +%%% \goodgap | .. . . . . | | . . . .. .. | +%%% \subfigure[Second]{% *--------------* *--------------* +%%% \label{fig:second}% +%%% ...}% 1.1: First 1.2: Second +%%% \end{center}% +%%% \caption{Two Subfigures.} Figure 1. Two Subfigures. +%%% \end{figure} +%%% ... See subfigures 1.1 and 1.2. +%%% See subfigures \ref{fig:first} +%%% and \ref{fig:second}. +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% Options: +%%% +%%% I. Subfloat caption shape. +%%% By default the caption paragraphs are centered under the +%%% subfigure or table with a little indentation at each side. +%%% There are three options that may be used to change the shape +%%% of the centered paragraph -- they only have an effect when the +%%% caption is more than one line long. These should be set in +%%% the preamble of your LaTeX file: +%%% +%%% \subcaphangtrue Causes the label to be a hanging +%%% indentation to the caption paragraph. +%%% \subcapcentertrue Causes each line of the paragraph +%%% to be separately centered. +%%% \subcapcenterlasttrue Causes the last line only to be +%%% centered. +%%% \subcapnooneline If a caption fits on one line it +%%% will, by default, be centered. +%%% This option left-justifies the one +%%% line caption. +%%% +%%% The hang option may be used in addition to either center +%%% option. (If both center options are true it is the same as if +%%% only the \subcapcenter was true.) +%%% +%%% +%%% II. Subfloat label font. +%%% The subfloat label font may be separately set by changing the +%%% definition of \subcaplabelfont. For example: +%%% +%%% \newcommand{\subcaplabelfont}{\it} +%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%%% +%%% Identification +%%% +\ifx\if@compatibility\undefined\else + \NeedsTeXFormat{LaTeX2e} + \ProvidesPackage{subfigure}[2005/03/06 v2.0 subfigure package] + \typeout{Package: subfigure 2005/03/06 v2.0} +\fi + +%%% +%%% Initialization and Shared constants +%%% +\newif\ifsubcaphang +\newif\ifsubcapcenter +\newif\ifsubcapcenterlast +\newif\ifsubcapnooneline + +%% +%% Common values (mention of `subfig' in names is for upward compatibility) +%% +\newcommand{\subfigtopskip}{10pt} % Length from the top of the subfloat + % box to the begining of the FIGURE box. +\newcommand{\subfigbottomskip}{10pt} % Length from the bottom of the CAPTION + % to the bottom of the subfloat. +\newcommand{\subfigcapskip}{10pt} % Length from the bottom of the FIGURE box + % to the begining of the CAPTION. +\newcommand{\subfigcapmargin}{10pt} % Indentation of the caption from the + % sides of the subfloat box (This should + % always be positive). +\newcommand{\subcapsize}{} % Size of the CAPTION font. +\newcommand{\subcaplabelfont}{} % Font of the caption label. + +%% +%% Subfigure values +%% +\newcounter{subfigure}[figure] % Subfigure counter. +\def\thesubfigure{(\alph{subfigure})} % Generate CAPTION label (text). +\newcommand{\@thesubfigure}{% % Generate CAPTION label (figure). + {\subcaplabelfont\thesubfigure}\space} +\let\p@subfigure\thefigure % Figure number for \label. + +\let\ext@subfigure\ext@figure % Default SubFigure file extension. +\newcommand{\l@subfigure}{% % How to print an LOF subfigure line. + \@dottedxxxline{\ext@subfigure}{2}{3.9em}{2.3em}} +\newcounter{lofdepth} % LOF depth counter. +\setcounter{lofdepth}{1} % Default is to NOT print an LOF line. + +%% +%% Subtable values +%% +\newcounter{subtable}[table] % Subtable counter. +\def\thesubtable{(\alph{subtable})} % Generate CAPTION label (text). +\newcommand{\@thesubtable}{% % Generate CAPTION label (figure). + {\subcaplabelfont\thesubtable}\space} +\let\p@subtable\thetable % Figure number for \label. + +\let\ext@subtable\ext@table % Default SubTable file extension. +\newcommand{\l@subtable}{% % How to print an LOT subtable line. + \@dottedxxxline{\ext@subtable}{2}{3.9em}{2.3em}} +\newcounter{lotdepth} % LOT depth counter. +\setcounter{lotdepth}{1} % Default is to NOT print an LOT line. + + +%% +%% Declaration of options +%% +\ifx\if@compatibility\undefined + \subcaphangfalse + \subcapcenterfalse + \subcapcenterlastfalse + \subcapnoonelinefalse + \def\subcapsize{\footnotesize} +\else + \DeclareOption{normal}{% + \subcaphangfalse + \subcapcenterfalse + \subcapcenterlastfalse} + \DeclareOption{hang}{\subcaphangtrue} + \DeclareOption{center}{\subcapcentertrue} + \DeclareOption{centerlast}{\subcapcenterlasttrue} + \DeclareOption{nooneline}{\subcapnoonelinetrue} + \DeclareOption{isu}{\ExecuteOption{hang}} + \DeclareOption{anne}{\ExecuteOption{centerlast}} + + \DeclareOption{scriptsize}{\renewcommand{\subcapsize}{\scriptsize}} + \DeclareOption{footnotesize}{\renewcommand{\subcapsize}{\footnotesize}} + \DeclareOption{small}{\renewcommand{\subcapsize}{\small}} + \DeclareOption{normalsize}{\renewcommand{\subcapsize}{\normalsize}} + \DeclareOption{large}{\renewcommand{\subcapsize}{\large}} + \DeclareOption{Large}{\renewcommand{\subcapsize}{\Large}} + \DeclareOption{up}{\renewcommand{\subcaplabelfont}{\upshape}} + \DeclareOption{it}{\renewcommand{\subcaplabelfont}{\itshape}} + \DeclareOption{sl}{\renewcommand{\subcaplabelfont}{\slshape}} + \DeclareOption{sc}{\renewcommand{\subcaplabelfont}{\scshape}} + \DeclareOption{md}{\renewcommand{\subcaplabelfont}{\mdseries}} + \DeclareOption{bf}{\renewcommand{\subcaplabelfont}{\bfseries}} + \DeclareOption{rm}{\renewcommand{\subcaplabelfont}{\rmfamily}} + \DeclareOption{sf}{\renewcommand{\subcaplabelfont}{\sffamily}} + \DeclareOption{tt}{\renewcommand{\subcaplabelfont}{\ttfamily}} + + \ExecuteOptions{normal,footnotesize} + \ProcessOptions +\fi + + +%%% +%%% Define the subfigure and subtable commands +%%% +\newcommand{\subfigure}{% + \bgroup + % Since the table caption is usually generated later, we + % must locally anticipate the future value of its counter. + \advance\csname c@\@captype\endcsname\@ne + \refstepcounter{sub\@captype}% + \leavevmode + \@ifnextchar [% + {\@subfloat{sub\@captype}}% + {\@subfloat{sub\@captype}[\@empty]}} +\let\subtable\subfigure + +%%% +%%% Define the common subfloat macro +%%% +\def\@subfloat#1[#2]#3{% + \setbox\@tempboxa \hbox{#3}% + \@tempdima=\wd\@tempboxa + \vtop{% + %% Put the top spacing and the figure in the top box + \vbox{% + \vskip\subfigtopskip + \box\@tempboxa}% + %% Now skip down and add the caption paragraph + %% (unless #2 == \@empty) + \ifx \@empty#2\relax \else + \vskip\subfigcapskip + \@subcaption{#1}{#2}% + \fi + %% Finally add the bottom spacing. + \vskip\subfigbottomskip}% + \egroup} + +\newcommand{\@subfigcaptionlist}{} + +\newcommand{\@subcaption}[2]{% + \begingroup + \let\label\@gobble + \def\protect{\string\string\string}% + \xdef\@subfigcaptionlist{% + \@subfigcaptionlist,% + {\protect\numberline {\@currentlabel}% + \noexpand{\ignorespaces #2}}}% + \endgroup + \@nameuse{@make#1caption}{\@nameuse{@the#1}}{#2}} + +\newcommand{\@makesubfigurecaption}[2]{% + \setbox\@tempboxa \hbox{% + \subcapsize + \ignorespaces #1% + \ignorespaces #2}% + \@tempdimb=-\subfigcapmargin + \multiply\@tempdimb\tw@ + \advance\@tempdimb\@tempdima + \hbox to\@tempdima{% + \hfil + \ifdim \wd\@tempboxa >\@tempdimb + \subfig@caption{#1}{#2}% + \else\ifsubcapnooneline + \subfig@caption{#1}{#2}% + \else + \box\@tempboxa + \fi\fi + \hfil}} + +\let\@makesubtablecaption\@makesubfigurecaption + +\newcommand{\subfig@caption}[2]{% + \ifsubcaphang + \sbox{\@tempboxa}{% + \subcapsize + \ignorespaces #1}% + \addtolength{\@tempdimb}{-\wd\@tempboxa}% + \usebox{\@tempboxa}% + \subfig@captionpar{\@tempdimb}{#2}% + \else + \subfig@captionpar{\@tempdimb}{#1#2}% + \fi} + +\newcommand{\subfig@captionpar}[2]{% + \parbox[t]{#1}{% + \strut + \ifsubcapcenter + \setlength{\leftskip}{\@flushglue}% + \setlength{\rightskip}{\@flushglue}% + \setlength{\parfillskip}{\z@skip}% + \else\ifsubcapcenterlast + \addtolength{\leftskip}{0pt plus 1fil}% + \addtolength{\rightskip}{0pt plus -1fil}% + \setlength{\parfillskip}{0pt plus 2fil}% + \fi\fi + \subcapsize + \ignorespaces #2}} + +%%% +%%% Generalized wrapper for the \@dottedtocline macro. This checks for +%%% the level based on the output file (#1) and not using only +%%% \@tocdepth. +%%% +\newcommand{\@dottedxxxline}[6]{% + \ifnum #2>\@nameuse{c@#1depth}\else + \@dottedtocline{0}{#3}{#4}{#5}{#6} + \fi} + +%%% +%%% Finally, wrap the \@caption macro to dump any sub-captions saved +%%% after calling the standard \@caption. +%%% +\let\subfig@oldcaption\@caption + +\long\def\@caption#1[#2]#3{% + \subfig@oldcaption{#1}[{#2}]{#3}% + \@for \@tempa:=\@subfigcaptionlist \do {% + \ifx\@empty\@tempa\relax \else + \addcontentsline + {\@nameuse{ext@sub#1}}% + {sub#1}% + {\@tempa}% + \fi}% + \gdef\@subfigcaptionlist{}} +\endinput + +%%% +%%% End of file `subfigure.sty'. diff --git a/papers/pricing/units.sty b/papers/pricing/units.sty new file mode 100644 index 0000000..e69de29 diff --git a/papers/pricing/virgil_env.sty b/papers/pricing/virgil_env.sty new file mode 100644 index 0000000..afece65 --- /dev/null +++ b/papers/pricing/virgil_env.sty @@ -0,0 +1,297 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Virgil's LaTeX Environment macros +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% All of the macros and packages Virgil uses to make LaTeX experiences more pleasant +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\ProvidesPackage{virgil_env} + + +% For debugging during document creation +%\usepackage{showkeys} + +\usepackage{microtype} + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Packages that often need to be turned ON/OFF +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% We need amssymb for the symbol \lessgtr. However, it likes to conflict with other stuff ): +\usepackage{amssymb} % AMS symbols. Disabled because it likes to conflict with other stuff. + +% Decimal point alignment of numeric cells +\usepackage{dcolumn} + +\usepackage{amsmath} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% End Packages that often need to be turned ON/OFF +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Figure out what to do with these later +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%Remove space to the vertical edges: +%\begin{tabular}{@{}lll@{}} + +%\usepackage{calc} + +%% Adds pretty caligraphy fonts +%\usepackage{mathrsfs} +%\usepackage{amsfonts} +%\usepackage{euler} +%\DeclareMathAlphabet{\mathcalligra}{T1}{calligra}{m}{n} +%\DeclareMathAlphabet{\mathpzcm}{OT1}{pzcm}{mb}{it} +%\DeclareMathAlphabet{\mathpzc}{OT1}{pzc}{m}{it} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% add ifthen powers +\usepackage{ifthen} + +% add color powers +\usepackage[usenames,dvipsnames]{color} + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Fonts + text options +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\usepackage{ lmodern } % I prefer this over times +%\usepackage{ times } % default + +\usepackage{parskip} % more skipping options + +% Support non-english characters +%\usepackage[utf8]{inputenc} +%\usepackage[T1]{fontenc} + +%\usepackage[T1]{fontenc} + +%\usepackage{baskervald} +%\usepackage{bookman} % a nice text font + +%\usepackage{fontspec,xunicode} +%\setmainfont{Baskerville} + + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Enable Graphics +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\usepackage{graphicx} % Takes the ``[draft]'' option in \document class + +\DeclareGraphicsExtensions{.pdf,.eps,.png,.jpg} % search for .pdf, then .eps, then .pngs, then .jpg + +% look in these subdirectories for graphics referenced by \includegraphics +% each entry must end with a / +\graphicspath{{figs/}{figures/}{images/}{./}} + + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Bibliography options +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% natbibspacing availabe at: http://dcwww.camd.dtu.dk/~schiotz/comp/LatexTips/natbibspacing.sty +%\usepackage{natbib} +%\usepackage{natbibspacing} +%\bibliographystyle{plain} +%\bibliographystyle{unsrt} +%\bibliographystyle{nature} +%\bibliographystyle{apa} +%\bibliographystyle{mslapa} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Math and Symbol packages +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\usepackage{amsmath, mathtools} % you always want this + +\usepackage{amsthm} % for theorems + +% enables bold greek letters in math mode using the \bm{...} command. Supersedes package `amsbsy'. +%% Enables blackboard-bold letters +%\usepackage{bbold} % for \textbb{} +%\usepackage{bm} +%\usepackage{bbm} % blackboard bold with \mathbbm{} +\usepackage{bm} + +%\usepackage{, wasysym} % lots of fancy symbols +\usepackage{commath} +\usepackage{marvosym} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Better page-formatting options +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\usepackage{afterpage} % better-behaved page-formating + +%\usepackage{fancyhdr} % Change header and footer on any page + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Better Math +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\usepackage{array} % replacement for eqnarray. Must be BEFORE \usepackage{arydshln} +\usepackage{units} % for \nicefrac{\alpha}{\beta} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Prettier tables +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\usepackage{booktabs} % for much better looking tables +\usepackage{arydshln} % For dashed-lines in tables + + + + +%%%%% Adds a downward line "closing" what's inside the square-root. +% New definition of square root: +% it renames \sqrt as \oldsqrt +\let\oldsqrt\sqrt +% it defines the new \sqrt in terms of the old one +\def\sqrt{\mathpalette\DHLhksqrt} +\def\DHLhksqrt#1#2{% +\setbox0=\hbox{$#1\oldsqrt{#2\,}$}\dimen0=\ht0 +\advance\dimen0-0.2\ht0 +\setbox2=\hbox{\vrule height\ht0 depth -\dimen0}% +{\box0\lower0.4pt\box2}} + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% More customizable Figures +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\usepackage{float} % necessary for fancy positioning + +%\usepackage{wrapfig} % wrap text around your figures +%\usepackage{subfig} % supercedes subfigure + +% provides the capability to rename Figure -> Fig. throughout document +% supercedes \usepackage{caption}. +%\usepackage{ccaption} + +%\usepackage{boxedminipage} % for floating boxes. Haven't used this much. + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% More customizable Lists +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Better symbols custom enumerative lists, define any symbol you'd like +%\usepackage{enumitem} + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Custom Symbols +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% \xspace at the end of custom macros never fucks up spacing. +% example of best practice: \newcommand{\apples}{\textsf{AppLeS}\xspace} +\usepackage{xspace} + + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Text formatting +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% for different styles of underlines +% \usepackage{ulem} \normalem % \normalem is to keep \emph{} italics instead of underlined. +\newcommand{\redwuline}[1]{ {\color{red}{ \uwave{\textcolor{black}{#1}} } } } +\newcommand{\orangewuline}[1]{ {\color{BurntOrange}{ \uwave{\textcolor{black}{#1}} } } } + +% In-line lists. I've never used this but here's the package for it +%\usepackage{paralist} +%\textbf{\itshape Inline lists}, which are sequential in nature, just like enumerated +%lists, but are \begin{inparaenum}[\itshape a\upshape)] +%\item formatted within their paragraph; +%\item usually labelled with letters; and +%\item usually have the final item prefixed with `and' or `or', +%\end{inparaenum} like this example. + + + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% For prettier citations and hyperlinks +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%\usepackage[pdftex, colorlinks=true, +% bookmarksnumbered=true, +% bookmarksopen=true, +% bookmarksopenlevel=3, +% pdfstartview=FitV, +% linkcolor=blue, +% citecolor=blue, +% urlcolor=black, +% ]{hyperref} + +%\usepackage[colorlinks=true, +% bookmarksnumbered=true, +% bookmarksopen=true, +% bookmarksopenlevel=3, +% pdfstartview=FitV, +% linkcolor=blue, +% citecolor=blue, +% urlcolor=black, +% ]{hyperref} + + +% if \url isn't defined yet, define it using the `url' package. Else do nothing +\ifthenelse{ \isundefined{\url} } { \usepackage{url} }{} + +\usepackage{cite} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Special customizations that I like +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Makes the tables prettier +%\renewcommand{\arraystretch}{1.05} + + + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% SAVETREES - space saving options +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% You'd probably want to put this right before your \documentclass{} in your .tex file +% options: normaltitle, normalmargins, normalsections, normallists, normalfloats, normalindent, , normalleading, normalbib, normalbibnotes +% use everything +%\usepackage[]{savetrees} +%\usepackage[]{savetrees} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% For multi-line comments +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\usepackage{verbatim} +\newcommand*{\bcomment}{ \begin{comment} } +\newcommand*{\ecomment}{ \end{comment} } +%\newcommand{\bCOMMENT}{ \begin{comment} } +%\newcommand{\eCOMMENT}{ \end{comment} } +%\newcommand*{\comment}[1]{} +%\newcommand{\COMMENT}[1]{} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Abbreviations you'll always want +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\newcommand*{\TODO}[1]{{\centering {\sffamily \color{red} #1} \vskip10pt }} +\newcommand*{\todo}[1]{{\sffamily [{\color{red} #1}]}} +\newcommand*{\question}[1]{{\sffamily [{\color{blue} #1}]}} +\newcommand*{\new}[1]{ {\color{RoyalPurple} #1} } +\newcommand*{\fix}[1]{{\sffamily [{\textnormal{\color{red} #1}}]}} + + +%----------------------------------------------------------------------------- +% Cross references +%----------------------------------------------------------------------------- +% The following code defines how you make references to figures, tables, etc... +% It is defined in one place only, and can be modified for all references +% in the document at the same time. +% Instead of typing each time: "see Fig. \ref{myfig}" you can create a command +% \figref which will do the job. Then in text you only type \figref{myfig} and LaTeX +% will do the rest. +\newcommand{\tblref}[1]{Table~\ref{#1}} +\newcommand{\figref}[1]{Fig.~\ref{#1}} +\newcommand{\equref}[1]{(\ref{#1})} + +%\newcommand{\Tblref}[1]{Table~\ref{#1}} +%\newcommand{\Figref}[1]{Figure~\ref{#1}} + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + diff --git a/papers/pricing/wrapfig.sty b/papers/pricing/wrapfig.sty new file mode 100644 index 0000000..02ae0cb --- /dev/null +++ b/papers/pricing/wrapfig.sty @@ -0,0 +1,107 @@ +% +% W R A P F I G . S T Y +% +% Copyright (C) 1991,1992 by Donald Arseneau +% These macros may be freely transmitted, reproduced, or modified for +% non-commercial purposes provided that this notice is left intact. +% +% Environment "wrapfigure" to manually place a figure at the side +% of the page and wrap text around it. +% +% \begin{wrapfigure}[36]{r}{3in}
<\caption> etc. \end{wrapfigure} +% -- - --- +% [number of narrow lines] {left or right} {width of figure} +% +% Usage: +% This is a different type of *non-floating* figure environment for LaTeX. +% A figure of the specified width appears on the left or right (as specified) +% of the page. LaTeX will try to wrap text around the figure leaving a gap of +% \columsep by producing a number of short lines of text. LaTeX calculates +% the number of short lines needed based on the height of the figure plus +% the length \intextsep. You can override this guess by giving the optional +% argument specifying the number of shortened lines (counting each displayed +% equation as 3 lines). Cautions: +% o Wrapfigure should not be used inside another environment (e.g., list) +% o It does work in two-column format, but that would be silly. +% o Since it does not float, it may be out of sequence with floated figures. +% o The automatic rules (lines) that may be placed above or below floats +% are ignored here. You must insert the rules manually. +% +% Placement: +% LaTeX will not move a wrapfigure to the best place, so it is up to YOU +% to position it well. Any changes to the document can ruin your careful +% positioning so wrapfigures should be positioned just before printing a +% final copy. Here are the rules for good placement: +% o The environment should be placed so as to not run over a page boundary. +% o Only ordinary text should have to flow past the figure; no section +% titles please. Equations are acceptable if they fit. +% o It is convenient to give \begin{wrapfigure} just after a paragraph has +% ended. But if you want to start in the middle of a paragraph, you must +% put the environment between two words where there is a natural linebreak +% (like "must" and "put" above). +% +\newcount \WF@wrappedlines % used globally + +\def\wrapfigure{\@ifnextchar[{\WF@raptfig}{\WF@raptfig[-1]}} + +\def\WF@raptfig[#1]#2#3{\relax\ifx\par\@@par\else\typeout + {WARNING: wrapfigure used inside another environment.}\fi + \ifnum#10>\z@ % 10*num. lines specified (0 if blank) + \global\WF@wrappedlines#1\global\advance\WF@wrappedlines\@ne + \else % calc num. lines later + \global\WF@wrappedlines\z@ + \fi + \ifvmode % Between paragraphs: Start new one. Text will be indented... + \noindent \aftergroup\indent % after the \endgroup of \end{wrapfigure} + \else % In paragraph: End this one so it doesn't look ended; start new one. + {\unskip\parfillskip\z@skip\par\penalty\interlinepenalty + \parskip\z@skip\noindent}% text will start with no indentation + \fi \hbox to \z@\bgroup % llap or rlap depending on {l} or {r} parameter. + \@tempdimb\hsize \advance\@tempdimb-#3 \advance\@tempdimb-\columnsep + \if r#2\relax% fig on right + \@tempdima\z@ % no hanging indentation + \kern-#3\kern\hsize % position to the right of the text, past gutter + \def\@tempa{\hss}% figure overlaps space to the right + \else % fig on left + \@tempdima#3\advance\@tempdima\columnsep % indent past figure + \hss % figure overlaps space to the left + \def\@tempa{\kern\columnsep}% position to left of the gap + \fi + \xdef\WF@wrapil{\the\@tempdima \the\@tempdimb}% indentation and length + \setbox\z@\vtop\bgroup \hsize=#3\relax \hrule \@height\z@ + \@parboxrestore + \def\@captype{figure}% set up figure +} + +\def\endwrapfigure{\leftline{}\egroup % ensure \hsize wide + \ifnum \WF@wrappedlines=\z@ % measure figure box to count lines + \@tempdima\dp\z@ \advance\@tempdima\intextsep + \divide\@tempdima\baselineskip + \global\WF@wrappedlines\@tempdima \global\advance\WF@wrappedlines\tw@ + \fi \dp\z@\z@ \box\z@ % smash the vtop + \@tempa\egroup \aftergroup\WF@startwrapping \global\@ignoretrue} + +\def\WF@startwrapping{\everypar{\WF@setwrapping}\WF@setwrapping + \def\WF@savedclubp{\the\clubpenalty}\clubpenalty\@M % prevent bad pagebreak + \def\WF@restoretol{\tolerance\the\tolerance}\tolerance\@M + \def\par{\@@par \clubpenalty\WF@savedclubp % will wrap more than one + \global\advance\WF@wrappedlines-\prevgraf % paragraph if necessary + \ifnum\WF@wrappedlines<\tw@ \everypar{}\let\par\@@par\WF@restoretol\fi + }} +% Create \parshape command +\def\WF@setwrapping{\@tempcnta\@ne \let\@tempb\relax \def\@tempc{}% + \@whilenum \@tempcnta<\WF@wrappedlines\do{% repeated indentation, length + \edef\@tempc{\@tempc\@tempb}\advance\@tempcnta\@ne + }\let\@tempb\WF@wrapil \parshape \WF@wrappedlines \@tempc \z@ \hsize} +% +% 1992: change boxing so there is no height. +% interim version: added \@parboxrestore +% +% Send problem reports to asnd@Reg.TRIUMF.CA +% +% test integrity: +% brackets: round, square, curly, angle: () [] {} <> +% backslash, slash, vertical, at, dollar, and: \ / | @ $ & +% hat, grave, acute (apostrophe), quote, tilde, under: ^ ` ' " ~ _ + +