3

i'm using the skak-package for some chess notation in a presentation. My only issue: How can i highlight various squares on the chessboard? Basic:

\documentclass[12pt]{beamer}
\usepackage{skak}

\begin{document}
\begin{frame}
\newgame
\fenboard{8/8/8/3Q4/8/8/8/8 w - - 0 0} % FEN-notation, only one Queen
\showboard
\end{frame}
\end{document}

For example, i want to show the possible movements for a Queen on the board. I've tried the \highlight{} command (see below), but it throws errors.

\documentclass[12pt]{beamer}
\usepackage{skak}

\begin{document}
\begin{frame}
\newgame
\fenboard{8/8/8/3Q4/8/8/8/8 w - - 0 0} % FEN-notation, only one Queen
\showboard
\highlight{d4,d6}
\end{frame}
\end{document}

Shown Error: !Undefined control sequence. <recently read> \c@lor@to@ps l.49 \end{frame}. I use Texmaker with PdfLatex.

So, whats wrong?

3
  • Welcome to TeX.SX! The skak package seems to need pstricks which, by itself, is not compatible with pdflatex
    – egreg
    Dec 4 '14 at 12:00
  • See tex.stackexchange.com/questions/8413/…
    – egreg
    Dec 4 '14 at 12:01
  • Thanks! I tried xelatex: no errors, but also no highlighting. Then trying latex->dvips->ps2pdf showed everything - but: The highlighting is just a black border around the selected squares. Is there an option to color the square?
    – norb
    Dec 4 '14 at 12:09
4

For the highlighting skak uses pstricks and you must load skak with the ps-Option:

 \usepackage[ps]{skak}

But I would suggest to use chessboard instead which will work with pdflatex:

\documentclass[12pt]{beamer}
\usepackage{skak} %or xskak
\usepackage{chessboard}
\begin{document}
\begin{frame}
\newgame
\chessboard[setfen=8/8/8/3Q4/8/8/8/8 w - - 0 0,
            pgfstyle=border,markfields={d4,d6},
            color=blue!50,
            colorbackfield=c5,
            pgfstyle=color,
            opacity=0.5,
            color=red,
            markfield={d5}] 
\end{frame}
\end{document}

enter image description here

3
  • Thanks! You are right, chessboard is a better choice for my needs. Thanks for the Example!
    – norb
    Dec 4 '14 at 12:40
  • Why is there a blank square in the bottom right and how would I get rid of it?
    – SomeT
    Oct 31 '20 at 22:04
  • @SomeT that indicated that white is to move. Check the documentation of chessboard if you want to disable it. Oct 31 '20 at 22:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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