I'm trying to get my counter (which has a value between 1--4) to display as a character (namely, the corresponding char from the string SWOT). The following looks right to me but does not do the trick:
\usepackage{xstring}
and then
\renewcommand{\theswot}{\StrMid{SWOT}{\value{swot}}{\value{swot}}}
That is, it's fine until I want to use
\refstepcounter{swot}
at which point this starts throwing all sorts of unintelligible errors.
I've tried many variations on the use of \StrMid, including sequences of \ifthenelse{\value{swot}=1}{S}{} and so on, but this does not seem to make any difference.
Any help is appreciated: why the errors, and how do I get what I want?
Added in response to @siracusa's comment:
Here's an MWE:
\documentclass{article}
\usepackage{ifthen}
\usepackage{xstring}
\begin{document}
\newcounter{swot}
\renewcommand{\theswot}{%
\StrMid{SWOT}{\arabic{swot}}{\arabic{swot}}%
% \ifthenelse{\arabic{swot}=1}{S}{}% This also doesn't work
% \ifthenelse{\arabic{swot}=2}{W}{}%
% \ifthenelse{\arabic{swot}=3}{O}{}%
% \ifthenelse{\arabic{swot}=4}{T}{}%
}
\stepcounter{swot}\theswot % Prints S
\stepcounter{swot}\theswot % Prints W
\stepcounter{swot}\theswot % Prints O
\refstepcounter{swot} % Throws errors
\end{document}


\renewcommand{\theswot}{\protect\StrMid{SWOT}{\value{swot}}{\value{swot}}}(It also prints nothing at all for counter values > 4). – Alan Munn Aug 31 '19 at 12:05