Tuesday, October 14, 2025

Scid 5.1.0: Bug Report and Fix: LaTeX Opening Report Fails to Compile with Modern Babel Due to Deprecated chess.sty

Bug Report: LaTeX Opening Report Fails to Compile with Modern Babel Due to Deprecated chess.sty Loading in Scid 5.1.0

Category: Bug Priority: Medium (affects LaTeX output generation for users with updated TeX distributions) Component: Opening Reports / LaTeX Export Version: 5.1.0 (generated report dated 2025.10.14) OS/Platform: Linux (TeX Live 2021) Submitted by: Marco Saba – Email: marco.saba.research@protonmail.com Date: October 14, 2025

Description

When generating an Opening Report in Scid 5.1.0 and attempting to compile the resulting .tex file with a modern LaTeX distribution (e.g., TeX Live 2021 or later), the compilation fails with errors related to the babel package. Specifically:

  • Primary Error: ! Package babel Error: You are loading directly a language style. (babel) This syntax is deprecated and you must use (babel) \usepackage[language]{babel}.
  • Secondary Errors: Multiple "Undefined control sequence" errors, such as \bbl@trace, \bbl@info, \bbl@ifshorthand, and \resetat. Additionally, "Missing \begin{document}" errors occur during package loading.
  • Affected Section: The issue triggers during the loading of \usepackage{chess} in the preamble, which is included in the generated .tex file. This cascades into failures in Babel's internal macros (e.g., from english.ldf and babel.def).

The root cause is that the outdated chess.sty package (dated 1992, loaded via \usepackage{chess}) attempts to directly load english.sty (a Babel language style file) if it detects that Babel's core is not fully initialized. This direct loading is deprecated in Babel versions since around 2013. The \resetat command is also used internally in chess.sty but is undefined in modern contexts.

This prevents users from generating printable PDF reports, which is a core feature for analyzing openings. The problem does not occur in older TeX distributions but affects anyone with an updated system (e.g., TeX Live 2021+).

Steps to Reproduce

  1. Open Scid 5.1.0.
  2. Load a database (e.g., one with millions of games, like the example database1613-2025.si4 with 11,590,035 games).
  3. Navigate to an opening position (e.g., 1.e4 e5 2.Nf3 Nc6 3.Bb5 Nd4 4.Bc4 Nxf3+ 5.Qxf3 Qf6).
  4. Generate an "Opening Report" and export it as a LaTeX file (e.g., provascid5fig.tex).
  5. Compile the .tex file using pdflatex (or equivalent in your LaTeX editor like TeXShop or Overleaf).
  6. Observe the compilation errors in the log output.

Environment Details:

  • Scid version: 5.1.0 (report generation timestamp: 2025.10.14).
  • LaTeX distribution: TeX Live 2021 on Linux (path: /home/equacoin/.texlive2021/).
  • Babel version: 3.70 (from babel.def 2022/01/26 in the log).
  • Sample generated file: Attached as provascid5fig.tex (original, unedited).
  • Full error log excerpt: Attached as compilation_log.txt (includes paths like /usr/share/texlive/texmf-dist/tex/generic/babel/english.sty).

Proposed Solution

The issue can be resolved by adding a short workaround snippet to the preamble of the generated .tex file, immediately after \usepackage[english]{babel} and before \usepackage{chess}. This snippet:

  • Tricks chess.sty into believing Babel's core is already loaded, preventing the direct load of english.sty.
  • Defines the missing \resetat command as a no-op to avoid the undefined sequence error.

Workaround Code:

latex
\makeatletter
\let\babel@core@loaded\relax
\let\resetat\relax
\makeatother

Updated Preamble Example (from generated file):

latex
\documentclass[10pt,a4paper]{article}
% This is a LaTeX file generated by Scid.
% You must have the "chess12" package installed to typeset this file.

\usepackage[T1]{fontenc}        % Codifica dei font, da caricare prima di babel
\usepackage[english]{babel}     % Lingua inglese 

% Workaround for chess.sty compatibility with modern Babel
\makeatletter
\let\babel@core@loaded\relax
\let\resetat\relax
\makeatother

\usepackage{mathptmx}           % Sostituisci times con mathptmx per un font Times moderno
\usepackage{a4wide}             % Margini formato A4
\usepackage{chess}              % Per notazione scacchistica

% Rest of preamble...

With this addition, the file compiles successfully to a PDF (e.g., 9 pages, 119498 bytes in my test). No other changes are needed, and it preserves the original layout and functionality.

Why This Works:

  • \let\babel@core@loaded\relax: Overrides the check in chess.sty (\ifx\undefined\babel@core@loaded), skipping the deprecated direct load.
  • \let\resetat\relax: Provides a harmless definition for the undefined command used in chess.sty for board resets.
  • The @ in \makeatletter/@other allows access to internal LaTeX commands.

Tested On:

  • TeX Live 2021 (pdflatex).
  • Result: Clean compilation with only minor warnings (e.g., "Underfull \hbox" for table formatting, which are cosmetic and unrelated to this bug).

Recommended Permanent Fix for Scid

To avoid users needing manual edits:

  1. Update the LaTeX template in Scid's source code (likely in src/export.tcl or similar) to automatically insert the workaround snippet after the Babel package line.
  2. Consider migrating from the obsolete chess.sty to a modern alternative like skak or xskak (available on CTAN), which are fully compatible with current LaTeX and offer better diagram rendering. This would require regenerating the notational commands (e.g., \N, \B) but would future-proof reports.
  3. Add a note in the Scid documentation (e.g., in the "Exporting Reports" section) warning about LaTeX compatibility and providing the workaround.

Attachments

  • provascid5fig.tex (original generated file, ~27KB).
  • provascid5fig_fixed.tex (file with workaround applied, compiles successfully).
  • provascid5fig.pdf (output PDF after fix).
  • compilation_log_original.txt (full error log without fix).
  • compilation_log_fixed.txt (log after fix, showing success).

Additional Notes

  • This bug has likely persisted since Scid's early LaTeX export features, as chess.sty hasn't been updated in decades.
  • It affects cross-platform users (Linux, Windows, macOS) who compile reports externally.
  • If needed, I can provide a minimal reproducible .tex snippet without the full database export.

Thank you for maintaining Scid vs. PC—it's an invaluable tool for chess analysis! Let me know if you need more details or testing on other environments.