# Floating a chess diagram on the next column

My second chess diagram does not fit on the first column, so LaTeX increased paragraph spacing on the first column. This does ensure that the second diagram appears exactly on top of the second column. However, I prefer to keep the standard paragraph spacing, and the best solution I could come up with is to use \vfill to fill in the space. Here are my two questions:

1. When I tried to use \columnbreak instead of \vfill, I received an error message saying that it is an undefined control sequence. Would \columnbreak and \vfill have given the same result in this case?
2. How can I ask LaTeX to put in as much text as possible with normal paragraph spacing on the first column before displaying the second diagram on the second column? The second diagram will then be out of order, but I can put a put a caption on it.
\documentclass[10pt,twocolumn]{article}

\usepackage{xskak}
\usepackage{chessboard}

\begin{document}

\thispagestyle{empty}

\begin{center}
\textbf{Chiburdanizde - Watson} \\
\textit{Brussels 1987}
\end{center}

\begin{center}

\chessboard[
pgfstyle=border, linewidth = 0.03em, markfield=f5, color=red,
pgfstyle= {[base,at={\pgfpoint{0pt}{-0.4ex}}]text},
text=\fontsize{1.2ex}{1.2ex}\bfseries \sffamily 1, markfield=f4,
text=\fontsize{1.2ex}{1.2ex}\bfseries \sffamily 2, markfield=g4,
text=\fontsize{1.2ex}{1.2ex}\bfseries \sffamily 2, markfield=e4,
text=\fontsize{1.2ex}{1.2ex}\bfseries \sffamily 3, markfield=f3,
text=\fontsize{1.2ex}{1.2ex}\bfseries \sffamily 4, markfield=e3,
color=black,
pgfstyle= {[base,at={\pgfpoint{0pt}{-0.4ex}}]text},
text=\fontsize{1.2ex}{1.2ex}\bfseries \sffamily 1, markfield=h5,
text=\fontsize{1.2ex}{1.2ex}\bfseries \sffamily 1, markfield=e6,
text=\fontsize{1.2ex}{1.2ex}\bfseries \sffamily 2, markfield=f6,
text=\fontsize{1.2ex}{1.2ex}\bfseries \sffamily 3, markfield=g6,
text=\fontsize{1.2ex}{1.2ex}\bfseries \sffamily 3, markfield=e7,
text=\fontsize{1.2ex}{1.2ex}\bfseries \sffamily 4, markfield=f7]

\end{center}

The diagram above illustrates the system of corresponding squares in the pawn endgame.  If the kings are on corresponding squares, say white king on f4 and black king on e6, then whoever it is to move is in zugzwang.  In addition, White wins if he can maneuver his king to the key square f5.

\fenboard{8/8/3k3p/8/7P/6P1/5K2/8 w - - 0 57}
\styleC

\mainline{57. Kf3?}

This allows Black to put White in zugzwang with his next move.  From the diagram, it is clear that White wins after \variation{1. Ke3} as the black king cannot reach the corresponding square f7 in one move.

\mainline{57... Ke7! 58.Kf4 Ke6 59.g4}

White altered the pawn structure, so we need a new diagram of corresponding squares.  It is now a battle for the key squares d5, e5, and f5.

\vfill

\begin{center}

\chessboard[
mover=false,
pgfstyle=border, linewidth = 0.03em, markregion=d5-f5, color=red,
pgfstyle= {[base,at={\pgfpoint{0pt}{-0.4ex}}]text},
text=\fontsize{1.2ex}{1.2ex}\bfseries \sffamily 1, markfields={d4,d2},
text=\fontsize{1.2ex}{1.2ex}\bfseries \sffamily 2, markfields={e4,e2},
text=\fontsize{1.2ex}{1.2ex}\bfseries \sffamily 3, markfield=f2,
text=\fontsize{1.2ex}{1.2ex}\bfseries \sffamily 4, markfields={d3,d1},
text=\fontsize{1.2ex}{1.2ex}\bfseries \sffamily 5, markfields={e3,e1},
text=\fontsize{1.2ex}{1.2ex}\bfseries \sffamily 6, markfields={f3,f1},
color=black,
pgfstyle= {[base,at={\pgfpoint{0pt}{-0.4ex}}]text},
text=\fontsize{1.2ex}{1.2ex}\bfseries \sffamily 1, markfields={d6,d8},
text=\fontsize{1.2ex}{1.2ex}\bfseries \sffamily 2, markfield=e8,
text=\fontsize{1.2ex}{1.2ex}\bfseries \sffamily 3, markfields={f6,f8},
text=\fontsize{1.2ex}{1.2ex}\bfseries \sffamily 4, markfield=d7,
text=\fontsize{1.2ex}{1.2ex}\bfseries \sffamily 5, markfield=e7,
text=\fontsize{1.2ex}{1.2ex}\bfseries \sffamily 6, markfield=f7,
margintop=false]

\end{center}

\mainline{59... Kf6 60.Kf3 Ke7?}

Watson explained in \textit{New in Chess} that his blunder was due to extreme time pressure.  From the diagram, we see that the only move for Black is \variation{60... Kf7}.

\mainline{61.Ke3! Kf7 62.Kd4 Kf6 63.Kd5 Ke7 64.Ke5 Kf7 65.Kf5 Kg7 66.Ke6 Kg6 67. h5+ Kg5 68.Kf7 Kxg4 69.Kg6 Kf4 70.Kxh6}

and Black resigned.

\end{document}

-

Have you tried making these floating figures? Replacing the \begin{center} ... \end{center} environment with

\begin{figure}[ht]
\centering
...
\end{figure}


should do the job.

-
Thanks Joseph. It never occurred to me to use the figure enviroment for some reason. I suppose the diagram is a figure after all. – Michael Wijaya Dec 24 '10 at 18:58

Use \newpage instead of \columnbreak. However, I would use something like this:

\twocolumn[\centering\textbf{Chiburdanizde --- Watson}\\
\textit{Brussels 1987}]
...
\newpage
\vspace*{1pt}
...


\newpage
\phantom{\parbox{\linewidth}{\begin{center}\textbf{Chiburdanizde --- Watson}\\
\textit{Brussels 1987}\end{center}\smallskip}}


if your chess boards can be at another place then use the figure environment

-
Thanks for the clarification. I wonder where I got the idea to use \columnbreak. That command is simply not defined. – Michael Wijaya Dec 24 '10 at 19:04

That's not an answer to your actual problem but looking at your example I think I should have introduced a way to set the font for the text in a more general way. I don't think that it is possible to smuggle it in the pgfstyle command as the internal command from pgf (\pgftext) sets its keys to late), but if you insert the following code in your preamble you should be able to use the key textfont=\fontsize{1.2ex}{1.2ex}\bfseries \sffamily either locally in a chessboard or in \setchessboard.

I would be glad to hear if it works and if you like the handling and the naming of the key. If yes I will add the code to the next version.

\makeatletter
\def\board@pgf@style@textfont{}

\cbDefinePgfFieldStyle{text}{%
\ifthenelse%
{\boolean{\XKV@UFCB@locset@inverse@value}}%
{\pgftext[rotate=180,#2]{\normalfont\board@pgf@style@textfont\board@pgf@curtext}}%
{\pgftext[#2]{\normalfont\board@pgf@style@textfont\board@pgf@curtext}}}%

\cbDefinePgfRegionStyle{text}{%
\pgfextractx{\len@board@tempx}{{\pgfpointanchor{#1}{center}}}%
\pgfextracty{\len@board@tempy}{{\pgfpointanchor{#1}{center}}}%
\pgftransformshift
{\pgfpointintersectionoflines
{\pgfpointxy{-0.5}{0.5}}%
{\pgfpoint{\len@board@tempx}{\len@board@tempy}}%
{\pgfpointxy{0.5}{-0.5}}}%
{\pgfpoint{\len@board@tempx}{0pt}}%
{\pgfpointxy{0.5}{0.5}}}%
{\pgfpoint{0pt}{\len@board@tempy}}%
{\pgfpointxy{-0.5}{-0.5}}}}%
\ifthenelse%
{\boolean{\XKV@UFCB@locset@inverse@value}}%
{\pgftext[rotate=180,#2]{\normalfont\board@pgf@style@textfont\board@pgf@curtext}}%
{\pgftext[#2]{\normalfont\board@pgf@style@textfont\board@pgf@curtext}}}%

\define@key[UFCB]{locfill}{textfont}{% D
\ifUFCB@locfill@usemarkpgf
\fi
\ifUFCB@locfill@usebackpgf

Simply use \chessboard[...,textfont=your font commands, text=1,...] – Ulrike Fischer Dec 25 '10 at 11:44