2

Below is a typical code for a chess diagram that you see around here:

\documentclass[border=12pt]{standalone}
\usepackage{skak}
\usepackage{chessboard}
\def\mainlinestyle{\bfseries}
\def\variationstyle{}

\begin{document}
\newgame

\styleA

\hidemoves{1.g4 e5 2.f3 Qh4}
\chessboard
\end{document}

Here is my question. How can 1. Attach a caption to the diagram. 2. Label it so that I can refer to it in a text? Do I just use the figure environment??

Thanks in advance

P. S. I looked through the archives here and elsewhere and could not find reference to this issue.

  • Yes, use figure with \caption{}\label{}. – Sigur Jun 27 '18 at 2:24
  • The \caption macro depends on \@captype to determine what sort of caption to generate. It also fills the the entire \textwidth. It might be easier to create your own macro and use \refstepcounter to set up \label. – John Kormylo Jun 27 '18 at 12:18

Your Answer

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

Browse other questions tagged or ask your own question.