\input{drawcommands.tex}
\input{newdrawcommands.tex}

\newcommand{\figureheight}{0}

\newcommand{\usualfigureheader}{
\begin{figure}
\begin{center}
\begin{pspicture}(0,0)(0,\figureheight)
%\psline(-1,\figureheight)(1,\figureheight) \psline(0,\figureheight)(0,-0.5)
}

\newcommand{\imperativefigureheader}{
\begin{figure}[h]
\begin{center}
\begin{pspicture}(0,0)(0,\figureheight)
\psline(-1,\figureheight)(1,\figureheight) \psline(0,\figureheight)(0,-0.5)
}

\newcommand{\opsize}{0.5}

\newcommand{\ourplus}{
\psline[linewidth=1.3pt](-\opsize,0)(\opsize,0)
\psline[linewidth=1.3pt](0,-\opsize)(0,\opsize)
}

\newcommand{\Wfigure}{
\renewcommand{\figureheight}{9.8}
\usualfigureheader
\rput(-0.3,1.4){
\psset{xunit=0.9cm, yunit=0.9cm}
\rput(-2.1,5.5){
\rput(-3.3,0.84){
\rput(0,1.4){
\psdot[linecolor=negativeColor,dotsize=1](0.5,0.5)
\minus
}
\rput(0,0){
\psdot[linecolor=positiveColor,dotsize=1](0.5,0.5)
\plus
}
}
\psset{xunit=0.71cm, yunit=0.71cm}
\rput(0,0){\whatsW
\rput(3.5,-0.5){$w$}
\rput(9.5, 2.5){\equals}
}
}
\psset{xunit=0.42cm, yunit=0.42cm}
\rput(-8,4.7){
\stripeone
\rput(3.5,-0.9){$w_1$}
\rput(11,0){
\rput(-2,2.5){\ourplus}
\stripetwo
\rput(3.5,-0.9){$w_2$}
%\rput(11,0){
%\rput(-2,2.5){\ourplus}
%\stripethree
%}
}
\rput(0,-7){
\rput(-2,2.5){\ourplus}
\stripethree
\rput(3.5,-0.9){$w_3$}
\rput(11,0){
\rput(-2,2.5){\ourplus}
\rput(3.5,-0.9){$w_4$}
\stripefour
}
}
}
}
\end{pspicture}\renewcommand{\captionlabeldelim}{:}\caption{Construction of $w$. The rectangles represent arrays of size $p \times q_1 \times \dots \times q_k$. Each horizontal layer of a rectangle represents an array of size $q_1 \times \dots \times q_k$, and there are $p$ layers (here $p = 5$). The sets $\mcal{H}, \mcal{F}_0, \dots, \mcal{F}_{p-1}$ partition the entries of each layer. The array $w$ is negative on $\mcal{F}_{p-1}$, zero on $\mcal{H}$ and positive elsewhere. The array $w_i$ is negative on $\mcal{F}_i$, positive on $\mcal{F}_{i-1}$ and $\mcal{F}_{i+1}$, and zero elsewhere. Each array is a zero-sum array.}\renewcommand{\captionlabeldelim}{}
\label{W}
\end{center}
\end{figure}
}

\newcommand{\Wonefigure}{
\renewcommand{\figureheight}{9.8}
\usualfigureheader
\rput(-0.3,1.4){
\psset{xunit=0.9cm, yunit=0.9cm}
\rput(-2.1,5.5){
\rput(-3.3,0.84){
\rput(0,1.4){
\psdot[linecolor=negativeColor,dotsize=1](0.5,0.5)
\minus
}
\rput(0,0){
\psdot[linecolor=positiveColor,dotsize=1](0.5,0.5)
\plus
}
}
\psset{xunit=0.71cm, yunit=0.71cm}
\rput(0,0){\stripeonelabeled
\rput(3.5,-0.5){$w_1$}
\rput(9.5, 2.5){\equals}
}
}
\psset{xunit=0.42cm, yunit=0.42cm}
\rput(-8,4.7){
\rput(-5.3,0){
\aone
\rput(3.5,-0.9){$a_0$}
\rput(11,0){
\rput(-2,2.5){\ourplus}
\atwo
\rput(3.5,-0.9){$a_1$}
\rput(11,0){
\rput(-2,2.5){\ourplus}
\athree
\rput(3.5,-0.9){$a_2$}
}
}
}
\rput(0,-7){
\rput(-2,2.5){\ourplus}
\afour
\rput(3.5,-0.9){$a_3$}
\rput(11,0){
\rput(-2,2.5){\ourplus}
\rput(3.5,-0.9){$a_4$}
\afive
}
}
}
}
\end{pspicture}\renewcommand{\captionlabeldelim}{:}\caption{Construction of $w_1$. The rectangles represent arrays of size $p \times q_1 \times \dots \times q_k$ as in Fig$.$ \ref{W}, with each horizontal layer representing an array of size $q_1 \times \dots \times q_k$. The array $a_i$ is positive on the intersection of $\mcal{F}_0$, $\mcal{F}_2$ with layers $i$, $i+1$ and negative on the intersection of $\mcal{F}_1$ with layers $i$, $i+1$. Each array is a zero-sum array.}\renewcommand{\captionlabeldelim}{}
\label{Wone}
\end{center}
\end{figure}
}

\newcommand{\firstFigure}{
\renewcommand{\figureheight}{3.89}
\usualfigureheader
\psset{xunit=0.77cm, yunit=0.77cm}
\rput(-8,0){\arrayoo}
\rput(1,0){\arrayaa}
\end{pspicture}\renewcommand{\captionlabeldelim}{:}\caption{A partition of the $5 \times 7$ array based on the indices of the entries; entries of index 0 mod $P = 7$ are in $\mH$, entries of index $> iP$ and $< (i+1)P$ are in $\F_i$.}\renewcommand{\captionlabeldelim}{}
\label{firstF}
\end{center}
\end{figure}
}

\newcommand{\signPatternsWsFigure}{
\renewcommand{\figureheight}{7.6}
\usualfigureheader
\psset{xunit=0.6cm, yunit=0.6cm}
\rput(0,7.5){
\rput(-8.3,0){\arrayWone}
\rput(1.3,0){\arrayWtwo}
}
\rput(0,0.6){
\rput(-8.3,0){\arrayWthree}
\rput(1.3,0){\arrayWfour}
}
\end{pspicture}\renewcommand{\captionlabeldelim}{:}\caption{The positive and negative supports of $w_1$, $w_2$, $w_3$, $w_4$; entries with $+$'s are positive, entries with $-$'s are negative, blank entries are 0.}\renewcommand{\captionlabeldelim}{}
\label{signWs}
\end{center}
\end{figure}
}

\newcommand{\signPatternsAsFigure}{
\renewcommand{\figureheight}{7.6}
\usualfigureheader
\psset{xunit=0.6cm, yunit=0.6cm}
\rput(0,7.5){
\rput(-8,0){\arrayAzero}
\rput(1,0){\arrayAone}
}
\rput(0,0.6){
\rput(-12.5,0){\arrayAtwo}
\rput(-3.5,0){\arrayAthree}
\rput(5.5,0){\arrayAfour}
}
\end{pspicture}\renewcommand{\captionlabeldelim}{:}\caption{The positive and negative supports of $a_0, \ldots, a_4$.}\renewcommand{\captionlabeldelim}{}
\label{signAs}
\end{center}
\end{figure}
}

\newcommand{\bigCRTFigure}{
\renewcommand{\figureheight}{3.03}
\usualfigureheader
\psset{xunit=0.6cm, yunit=0.6cm}
\rput(-12.5,0){\arrayKGBone}
\rput(-3.5,0){\arrayKGBtwo}
\rput(5.5,0){\arrayKGBthree}
\end{pspicture}\renewcommand{\captionlabeldelim}{:}\caption{The mapping from the $3 \times 5 \times 7$ array to $\zz_{105}$ given by the CRT.}\renewcommand{\captionlabeldelim}{}
\label{bigCRT}
\end{center}
\end{figure}
}

\newcommand{\bigPartitionFigure}{
\renewcommand{\figureheight}{3.03}
\usualfigureheader
\psset{xunit=0.6cm, yunit=0.6cm}
\rput(-12.5,0){\arrayKGBoneLower}
\rput(-3.5,0){\arrayKGBtwoLower}
\rput(5.5,0){\arrayKGBthreeLower}
\end{pspicture}\renewcommand{\captionlabeldelim}{:}\caption{Partitioning the $3 \times 5 \times 7$ array.}\renewcommand{\captionlabeldelim}{}
\label{bigPartition}
\end{center}
\end{figure}
}

\newcommand{\wOneSupFig}{
\renewcommand{\figureheight}{3.03}
\usualfigureheader
\psset{xunit=0.6cm, yunit=0.6cm}
\rput(-12.5,0){\WoneSignPatOne}
\rput(-3.5,0){\WoneSignPatThree}
\rput(5.5,0){\WoneSignPatTwo}
\end{pspicture}\renewcommand{\captionlabeldelim}{:}\caption{The positive and negative supports of $w_1$.}\renewcommand{\captionlabeldelim}{}
\label{wOneBig}
\end{center}
\end{figure}
}

\newcommand{\AZeroFig}{
\renewcommand{\figureheight}{3.03}
\usualfigureheader
\psset{xunit=0.6cm, yunit=0.6cm}
\rput(-12.5,0){\TheAZeroOne}
\rput(-3.5,0){\TheAZeroTwo}
\rput(5.5,0){\TheAZeroThree}
\end{pspicture}\renewcommand{\captionlabeldelim}{:}\caption{The positive and negative supports of $a_0$. The leftmost layer gives the positive and negative supports of the $5 \times 7$ array $u_0$.}\renewcommand{\captionlabeldelim}{}
\label{AZero}
\end{center}
\end{figure}
}

\newcommand{\pathFig}{
\renewcommand{\figureheight}{3.5}
\usualfigureheader
\psset{xunit=0.7cm, yunit=0.7cm}
\rput(-3.5,0){\examplePath}
\end{pspicture}\renewcommand{\captionlabeldelim}{:}\caption{An example path found using the algorithm of Proposition \ref{path}. The `$\times$' marks the start $(x_0,y_0)$ of the path. The entry with two incoming arrowheads is the entry $(x_0,r)$.}\renewcommand{\captionlabeldelim}{}
\label{pathmac}
\end{center}
\end{figure}
}

\newcommand{\TwistedFig}{
\renewcommand{\figureheight}{3.77}
\usualfigureheader
\psset{xunit=0.62cm, yunit=0.62cm}
\rput(-3,0){

\psset{linewidth=0pt}
\psset{linewidth=0.1pt,linearc=.2}
\rput(5,5){\pspolygon[fillstyle=solid,fillcolor=negativeColor](0,0)(0,1)(1,1)(1,0)}
\pspolygon[fillstyle=solid,fillcolor=positiveColor,linearc=0.2](4,0)(2,0)(2,2)(0,2)(0,4)(0,5)(1,5)(1,3)(3,3)(3,1)(5,1)(5,0)
\pspolygon[fillstyle=solid,fillcolor=positiveColor,linearc=0.2](6,4)(4,4)(4,6)(5,6)(5,5)(6,5)
\pspolygon[fillstyle=solid,fillcolor=negativeColor,linearc=0.2](5,0)(5,1)(3,1)(3,3)(1,3)(1,5)(0,5)(0,6)(2,6)(2,4)(4,4)(4,2)(6,2)(6,0)
\psset{linewidth=0.5pt,linecolor=gray}
\multirput(1,0){7}{\psline[linecolor=darkgray](0,0)(0,6)}
\multirput(0,1){7}{\psline[linecolor=darkgray](0,0)(6,0)}
\psset{linecolor=black,linewidth=1.4pt}
\psline(5,0.3)(5,0)(4,0)(2,0)(2,2)(0,2)(0,4)(0,5)(0.3,5)
\pspolygon(5,0)(5,1)(3,1)(3,3)(1,3)(1,5)(0,5)(0,6)(2,6)(2,4)(4,4)(4,2)(6,2)(6,0)
\pspolygon(6,4)(4,4)(4,6)(5,6)(5,5)(6,5)
\psline(5.7,5)(6,5)(6,6)(5,6)(5,5.7)
\psset{linewidth=1.6pt}
\rput(2.5,2.5){\psline(-0.2,-0.2)(0.2, 0.2)}
\rput(2.5,2.5){\psline(-0.2, 0.2)(0.2,-0.2)}

\rput(-0.7,5.5){$\B$}
\rput(-0.7,4.5){$\A$}
\psset{linewidth=0.9pt}
\psline(0.2,5.5)(-0.4,5.5)
\psline(0.2,4.5)(-0.4,4.5)

}
\end{pspicture}\renewcommand{\captionlabeldelim}{:}\caption{An example of disjoint sets $\A$, $\B$ crossing every row and column of a $6 \times 6$ array with a point in $\A \cup \B$ (marked by an $\times$) that is in no $\A$-$\B$ alternating path.}\renewcommand{\captionlabeldelim}{}
\label{twisted}
\end{center}
\end{figure}
}

\newcommand{\bigfigone}{
\renewcommand{\figureheight}{10}
\usualfigureheader
%\imperativefigureheader
\psset{xunit=0.67cm, yunit=0.67cm}
\rput(-2.9,5.8){\bigfigonecommand
\rput(-7.5,7.66){
\rput(0,0){$L_2$}
\rput(0,-1){$L_1$}
\rput(0,1){$L_3$}
}
\rput(9.7,-5.52){
\rput(0,0.5){$\underbrace{\qquad}$}
\rput(0.1,0){$R^+$}
\rput(1.25,0){
\rput(0,0.5){$\underbrace{\qquad}$}
\rput(0.1,0){$R^-$}
}
}
}
\end{pspicture}
\renewcommand{\captionlabeldelim}{:}\caption{Construction of a zero-sum function $f$ on $\zz^2$ with positive support $\G_0'$ and negative support $\G_1'$. The points in $\zz^2$ (not shown) have unit squares centered around them (shown). The $x$ and $y$ axes are flipped to match the orientation of Fig$.$ \ref{bigPartition}. The point $(i,j) \in \zz^2$ is labeled with the number $\langle (i,j),(Q_1,Q_2)\rangle = 21i + 15j$, shown in its square; $\G_0'$ is the set of points whose label is between $0$ and $P = 35$ and $\G_1'$ is the set of points whose label is between $P$ and $2P$. The area $\ov{\G_0'}$, in light grey, is the set of cells around points in $\G_0'$, and the area $\ov{\G_1'}$, in dark grey, is the set of cells around points in $\G_1'$. 
%cells in $\ov{\G_0'}$ are in light grey, the cells in $\ov{G_1'}$ are in dark grey. 
Three parrallel equidistant lines $L_1$, $L_2$, $L_3$ contained in $\ov{\G_0'} \cup \ov{\G_1'}$ are drawn, with the property that each cell in $\ov{\G_0'}$ has a larger area of intersection with the region $R^+$ between $L_1$ and $L_2$ than with the region $R^-$ between $L_2$ and $L_3$, and each cell in $\ov{\G_0'}$ has a larger area of intersection with $R^-$ than with $R^+$. The value of $f$ at $x \in \zz^2$ is then defined to be $f(x) = \vol(\ov{x}\cap R^+) - \vol(\ov{x} \cap R^-)$, where $\ov{x}$ is the square (cell) centered at $x$ and $\vol(\cdot)$ is area.}
%the array $u_0$ via construction of a zero-sum function $f$ on $\zz^2$ with positive support $\G_0'$ and negative support $\G_1'$.}
\renewcommand{\captionlabeldelim}{}
\label{bfone}
\end{center}
\end{figure}
}


\newcommand{\braceheight}{3}

\newcommand{\bracehook}{
\pscustom[linewidth=0pt,fillstyle=solid,fillcolor=black]{
\psline(1.35,0)(1.35,-1)(1,-1)(1,0)
\pscurve(0.9,0.3)(0.76,0.53)(0.5,0.79)(0.1,1)(0,1.04)(0.1,1.06)(0.54,0.95)(0.87,0.76)(1.19,0.4)(1.3,0.2)
}
}

\newcommand{\bracehookdown}{
\pscustom[linewidth=0pt,fillstyle=solid,fillcolor=black]{
\psline(1.35,0)(1.35,1)(1,1)(1,0)
\pscurve(0.9,-0.3)(0.76,-0.53)(0.5,-0.79)(0.1,-1)(0,-1.04)(0.1,-1.06)(0.54,-0.95)(0.87,-0.76)(1.19,-0.4)(1.3,-0.2)
}
}

\newcommand{\bracehalf}{
\psset{xunit=0.07cm, yunit=0.07cm}
\rput(0,\braceheight){\bracehook}
\pspolygon[linewidth=0pt,fillstyle=solid,fillcolor=black](1,1)(1,\braceheight)(1.35,\braceheight)(1.35,1)
\rput(2.35,1){\rput{180}(0,0){\bracehook}}
\rput(2.35,-1){\rput{180}(0,0){\bracehookdown}}
\pspolygon[linewidth=0pt,fillstyle=solid,fillcolor=black](1,-1)(1,-\braceheight)(1.35,-\braceheight)(1.35,-1)
\rput(0,-\braceheight){\bracehookdown}
\psset{xunit=0.67cm, yunit=0.67cm}
}



\newcommand{\bigfigtwo}{
\renewcommand{\figureheight}{10}
\usualfigureheader
%\imperativefigureheader
\psset{xunit=0.67cm, yunit=0.67cm}
\rput(-2.9,5.8){\bigfigtwocommand
\rput(-4.05,9.2){
\rput(0,0){$L_2$}
\rput(-1.18,0){$L_1$}
\rput(1.18,0){$L_3$}
}
\rput(13.5,-3.9){
%\rput{0}(-0.1,0){$\left.\frac{{\tiny 1}}{\frac{1}{2}}\right\}$}
%\rput{0}(-0.1,0){$\left.\frac{\vspace{1in}}{2^{2^2}}\right\}$}
\rput{0}(-0.4,0){\bracehalf}
\rput(0.29,0){$R^+$}
\rput(0,0.9){
\rput{0}(-0.4,0){\bracehalf}
\rput(0.29,0){$R^-$}
}
}
}
\end{pspicture}
\renewcommand{\captionlabeldelim}{:}\caption{Construction of a zero-sum function $f$ on $\zz^2$ with positive support $\G_2' = \{(i,j): 2P < iQ_1 + jQ_2 < 3P\}$ (cells $\ov{\G_2'}$ in light grey) and negative support $\G_3' = \{(i,j): 3P < iQ_1 + j Q_2 < 4P\}$ (cells $\ov{\G_3'}$ in dark grey). The construction is similar to that of Fig.~\ref{bfone} except for the presence of blank cells intersecting $R^+$, $R^-$ (corresponding to points $(i,j)$ with $iQ_1 + jQ_2 = 3P = 105$). Because $L_2$ passes through the center of these cells, $f(x) = \vol(\ov{x}\cap R^+) - \vol(\ov{x} \cap R^-)$ still has support $\G_2' \cup \G_3'$.}
\renewcommand{\captionlabeldelim}{}
\label{bftwo}
\end{center}
\end{figure}
}
