Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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} 

 \newchessgame[setwhite={Pg3,Ph4,Kf2}, addblack={ph6,kd6}]

 \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}
share|improve this question

3 Answers 3

up vote 3 down vote accepted

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.

share|improve this answer
    
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}
...

or alternatively with your current header

\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

share|improve this answer
    
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}}%
     {\pgfpointadd
      {\pgfpoint{\len@board@tempx}{\len@board@tempy}}%
      {\pgfpointxy{0.5}{-0.5}}}%
     {\pgfpointadd
       {\pgfpoint{\len@board@tempx}{0pt}}%
       {\pgfpointxy{0.5}{0.5}}}%
     {\pgfpointadd
       {\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
  \board@pgf@addmarkground{\def\board@pgf@style@textfont{#1}}%
 \fi
 \ifUFCB@locfill@usebackpgf
  \board@pgf@addbackground{\def\board@pgf@style@textfont{#1}}%
 \fi}%

\define@key[UFCB]{glofill}{textfont}{% D
  \board@do@l@addto@macro\board@val@savedkeylist{,textfont=#1}}%

\makeatother
share|improve this answer
    
Hi Ulrike. I want to thank you again for writing the chessboard package. I would not have known how to put numbers on the board without your package and the documentation that comes with it. –  Michael Wijaya Dec 24 '10 at 19:08
    
I am not sure what to do after putting the code on my preamble. I tried getting rid of \fontsize... from my chessboard parameter, but the numbers get distorted. Could you try explaining again what it does? –  Michael Wijaya Dec 24 '10 at 19:13
    
Simply use \chessboard[...,textfont=your font commands, text=1,...] –  Ulrike Fischer Dec 25 '10 at 11:44
    
This is great! The code is easier to maintain now that I just need to declare the font setting once. I just have one more comment. When I first tried it, I only deleted the font setting for one of the squares. The number for that square is displayed correctly, but not so everywhere else. It seems that "text=\fontsize{1.2ex}{1.2ex}\bfseries \sffamily 4" does not override the local setting. –  Michael Wijaya Dec 26 '10 at 2:35
    
How do you highlight a piece of code in a comment? –  Michael Wijaya Dec 26 '10 at 2:39

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.