# Is xskak compatible with wrapfig?

I would like to show some (chess) moves, wrapping them around the resulting chessboard. The following code:

\documentclass[twocolumn]{article}

\usepackage{xskak}
\usepackage{wrapfig}
\usepackage{lipsum}
%\raggedright

\begin{document}

\newchessgame

\setchessboard{tinyboard,
showmover=false,
marginwidth=0pt,
labelleft=false,
labelbottom=false}

\hidemoves{1. e4 e5 2. Nf3 Nc6 3. Bb5 a6 4. Ba4 Nf6 5. O-O Be7 6. Re1
b5 7. Bb3 O-O 8. a4 Bb7 9. d3 Re8 10. Nbd2 Bf8}

\begin{wrapfigure}{r}{80pt}
\chessboard
\end{wrapfigure}
%\lipsum[1]
\variation{1. e4 e5 2. Nf3 Nc6 3. Bb5 a6 4. Ba4 Nf6 5. O-O Be7 6. Re1
b5 7. Bb3 O-O 8. a4 Bb7 9. d3 Re8 10. Nbd2 Bf8}

\end{document}


produces the following, where the moves get in the way of the board. However, normal text flows nicely, as you can see uncommenting the lipsum line. How could I get the moves to flow around the board?

-

The problem is that all the printing is done inside a group and so also the paragraph starts inside the group. This seems to be the cause of the problem. As soon as you print something before the game it works. You can e.g. use \leavevmode\variation{...} or \leavevmode\printchessgame. I will add the \leavevmode to \printchessgame, but I can't change \variation as this command comes from the skak package.

-

\documentclass[twocolumn]{article}
\usepackage{xskak}

\begin{document}

\newchessgame[id=A]
\mainline{1.d4 Nf6 2.c4 c6?!}

\chessboard

\xskakset{id=A}
\resumechessgame[newvar]
\noindent
\variation{2... e6 3. Nc3 Bb4 4. Nf3 d5 5. c5 O-O 6. Bd2}
(\variation{2... c6 3. Nc3 d5 4. Nf3 dxc4 5. e4 b5 6. Bf4})

\end{document}

-
This places the moves before and after the diagram, not to the side as requested in the post. –  Andrew Swann Jan 28 '14 at 9:35

Perhaps like this:

\documentclass{article}
\usepackage{xskak,chessboard}
\title{Variasi xskak}
\usepackage[
top=1in,
left=3.5cm,
right=2.5cm
]{geometry}
\begin{document}

\newchessgame[id=A]
\mainline{1.d4 Nf6 2.c4 c6?!}

\xskakset{id=A}
\resumechessgame[newvar]
\setchessboard{boardfontsize=16pt,labelfontsize=8pt}
\chessboard
\variation{2... e6 3. Nc3 Bb4 4. Nf3 d5 5. c5 O-O 6. Bd2}

\end{document}

-