Consider the following example where the code is taken from https://tex.stackexchange.com/a/399817/15874 and modified a bit:
\documentclass{article}
\usepackage{etoolbox}
\usepackage{xfp}
\usepackage{xskak}
\def\svarstedB{3.7em}
\newcommand*\hestB[2][\svarstedB]{%
\underline{\makebox[\ifdim\width>#1\width\else#1\fi]{#2}}}
\newcommand*\matLoesninger[1]{\hestB{\textcolor{blue}{\smash{#1}}}}
\newcommand*\matTo[6]{%
\def\tempA{#1}%
\def\tempB{#2}%
\def\tempC{#3}%
\def\tempD{#4}%
\def\tempE{#5}%
\def\tempF{#6}%
\matToEkstra}
\newcommand*\matToEkstra[5]{%
\begin{figure}[!htbp]
\LARGE
\centering
\begin{minipage}{0.5\textwidth}
\centering
\ifblank{\tempA}{\vphantom{1}}{\textbf{\tempA}}%
\vspace*{-2ex}
\scalebox{1}{\newchessgame[setfen = \tempC\space \tempB - - 0 1, print]}%
\hspace*{1.2em} Hvid \hspace*{2em} Sort
\vspace*{-1ex}
\begin{flushleft}
\ifstrequal%
{\tempB}{w}%
{\hspace*{1.1em}%
1.%
\hspace*{0.6em}%
\matLoesninger{\tempD}%
\hspace*{0.8em}%
\matLoesninger{\tempE}%
\vspace*{0.6ex}
\hspace*{1.1em}%
2.%
\hspace*{0.6em}%
\matLoesninger{\tempF}}%
{\hspace*{1.1em}%
1.%
\hspace*{5.1em}%
\matLoesninger{\tempD}%
\vspace*{0.6ex}
\hspace*{1.1em}%
2.%
\hspace*{0.6em}%
\matLoesninger{\tempE}%
\hspace*{0.8em}%
\matLoesninger{\tempF}}%
\end{flushleft}
\end{minipage}%
\begin{minipage}{0.5\textwidth}
\centering
\ifblank{\tempA}{\vphantom{1}}{\textbf{\fpeval{\tempA+1}}}%
\vspace*{-2ex}
\scalebox{1}{\newchessgame[setfen = #2 #1 - - 0 1, print]}%
\hspace*{1.2em} Hvid \hspace*{2em} Sort
\vspace*{-1ex}
\begin{flushleft}
\ifstrequal%
{#1}{w}%
{\hspace*{1.1em}%
1.%
\hspace*{0.6em}%
\matLoesninger{#3}%
\hspace*{0.8em}%
\matLoesninger{#4}%
\vspace*{0.6ex}
\hspace*{1.1em}%
2.%
\hspace*{0.6em}%
\matLoesninger{#5}}%
{\hspace*{1.1em}%
1.%
\hspace*{5.1em}%
\matLoesninger{#3}%
\vspace*{0.6ex}
\hspace*{1.1em}%
2.%
\hspace*{0.6em}%
\matLoesninger{#4}%
\hspace*{0.8em}%
\matLoesninger{#5}}%
\end{flushleft}
\end{minipage}
\end{figure}}
\begin{document}
\matTo%
{15}%
{w}{5r1k/ppq4p/4p2p/2PnNp2/5P2/P6P/1B4P1/5R1K}{Sf7+}{Kg8}{Sxh6\#}%
{b}{5rk1/1pp4p/p3R1p1/3R1n2/6B1/2P5/2PQ2PP/5K2}{Sg3+}{Ke1}{Tf1\#}
\end{document}
It doesn't matter if I set the value of the second argument of \matTo to b or w, the macro registres it as not being w. (The code works just fine for the chessboard printed inside the minipage to the right but not the one printed to the right.)
What is wrong with my macro and how do I fix it?
(It's probably really easy but I simply can't find the error. :-()
I simply don't understand why the
\ifstrequal%
{\tempB}{w}
part of my macro inside the first minipage is wrong.
P.S. Don't look at the page layout when the chessboards are printed; it's really ugly at the moment.


:-)– Svend Tveskæg Nov 23 '17 at 21:43