Graphics, Figures & Tablesboardfontencoding is incompatible with negative labelleftwidth: cannot put coordinates into a colored chessboard

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
princzp
Posts: 1
Joined: Mon Jun 12, 2023 5:07 pm

boardfontencoding is incompatible with negative labelleftwidth: cannot put coordinates into a colored chessboard

Post by princzp »

Dear LaTeX experts,

just registered because of an annoyance that is killing me, and I cannot fix it. Otherwise I am a long time LaTeX user and haven't had any issues with it till now. For my problem I have an MWE, hope it will go thru, it is just I am not familiar with this forum motor, please bear with me.

I am printing and laminating chessboards with great success (with the chessboard package and pdflatex, on both Linux and Windows), but now wanted one with (i) coordinates, so that beginners can have an a..h, 1..8 guidance, (ii) colored, not the default white / streaked and finally (iii) the coordinates to be inside the board so that the space is maximised, i.e. no outer margin, and the whole A3 sheet can be used for a 30x30 cm board to play with Staunton 3, maybe Staunton 4, almost tournament size chess pieces.

And it seems colours and inner coordinates are somehow incompatible, i.e. I can pick one but not both. I spent almost a day on it and could not figure out from debugging the compile logs either.

In the MWE below, all 4 sides of the board have the proper coordinates, just without colours. The colours are defined, and the boardfontencoding line prepared on line 17 just commented out. If you put it back, the board will become coloured, but the left vertical coordinates 1..8 will disappear. If you shrink the board size down from 293 mm and play with left margin and labelleftwidth on line #29, the coordinates will appear outside the board, on the margin, even if it is coloured. So either coordinates inside, or colours, but then coordinates outside, on the margin, but not both, i.e. coordinates inside a coloured board. Any help is appreciated.

Peter Princz

Code: Select all

\documentclass[oneside,10pt,a3paper]{book}
\usepackage[left=0mm,right=0mm,top=10mm,bottom=10mm]{geometry}
\usepackage[LSB,LSBC4,T1]{fontenc}
\usepackage{chessboard}

\definecolor{field_w}{HTML}{eeeed2}
\definecolor{field_b}{HTML}{769656}

\begin{document} % {{{
\pagenumbering{gobble}

\setchessboard
	{
		clearboard=true,
		showmover=false,
		margin=false,
		%boardfontencoding=LSBC4,
		whitefieldmaskcolor=field_w,
		blackfieldmaskcolor=field_b,
		setfontcolors,
		labeltop=true,
		labelright=true,
		labelleft=true,
		labelbottom=true,
		labeltoplift=2mm,
		labelbottomlift=2mm,
		labelleftlift=5.5mm,
		labelrightlift=0.5mm,
		labelleftwidth=0mm,
		labelrightwidth=-0mm,
		vlabelformat={\tiny\textrm{{~ \alph{filelabel} } } },								% bottom a..h
		labelleftformat={\tiny{\textrm{\arabic{ranklabel} } } },								% left 1..8
		labeltopformat={\rotatebox{180}{\tiny{\textrm{~ \alph{filelabel} } } } },				% top a..h upside down
		labelrightformat={\rotatebox[origin=c]{180}{\tiny{\textrm{\arabic{ranklabel} } } } },		% right 1..8 upside down
	}

\newpage 
\begin{figure}[p]
	\begin{center}
		\resizebox{293mm}!{\chessboard}
	\end{center}
\end{figure}

\newpage 
\begin{figure}[p]
	\begin{center}
		\resizebox{293mm}!{\chessboard}
	\end{center}
\end{figure}

\end{document}

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Post Reply