I would like to have an enumerate list, with the numbers expressed in unary. That is, "1" would be represented as •, "3" as •••, and "8" as •••••|•••.
I'm able to print the dots already, and that's working fine:
\newcommand{\xxdot}{\textbullet} % The dot character to use
\newcounter{loopcntr} % A one-off counter for \forloop
\newcommand{\xxdots}[1]{% Print #1 dots in a row
\ifthenelse{#1>5}{% If there are more than five, break them into groups
\xxdots{5}\textpipe\xxdots{\number\numexpr#1-5\relax}% By printing five, then a pipe, then the rest
}{% Otherwise, just print that many dots
\forloop{loopcntr}{0}{\value{loopcntr}<#1}{\xxdot}%
}%
}
\newcommand{\xdots}[1]{\textnormal{\xxdots{#1}}} % Wrap it in textnormal style
However, I have no idea how to make enumerate use this. Based on this answer, I tried redefining \theenumi:
\renewcommand\theenumi{\xdots{\arabic{enumi}}}
But this went badly wrong:
! Illegal parameter number in definition of \@currentlabel.
<to be read again>
1
l.376 ^^I\item My text here ...
You meant to type ## instead of #, right?
Or maybe a } was forgotten somewhere earlier, and things
are all screwed up? I'm going to assume that you meant ##.
How can I apply my unary-printing code to the enumerate label?
EDIT: Based on this answer, I tried this:
\newcommand*\unary[1]{\expandafter\@unary\csname c@#1\endcsname}
\newcommand*\@unary[1]{\xdots{\the\numexpr#1\relax}}
And it seems to work! As in, this produces the correct output:
\newcounter{test}
\setcounter{test}{8}
\unary{test}
However, the MWE still throws a bunch of errors.
MWE follows:
\documentclass{article}
\usepackage{forloop}
\usepackage{tipa}
\usepackage[T1]{fontenc}
\newcommand{\xxdot}{\textbullet} % The dot character to use
\newcounter{loopcntr} % A one-off counter for \forloop
\newcommand{\xxdots}[1]{% Print #1 dots in a row
\ifthenelse{#1>5}{% If there are more than five, break them into groups
\xxdots{5}\textpipe\xxdots{\number\numexpr#1-5\relax}% By printing five, then a pipe, then the rest
}{% Otherwise, just print that many dots
\forloop{loopcntr}{0}{\value{loopcntr}<#1}{\xxdot}%
}%
}
\newcommand{\xdots}[1]{\textnormal{\xxdots{#1}}} % Wrap it in textnormal style
\makeatletter
\newcommand*\unary[1]{\expandafter\@unary\csname c@#1\endcsname}
\newcommand*\@unary[1]{\xdots{\the\numexpr#1\relax}}
\makeatother
%\renewcommand\theenumi{\unary{enumi}} % This crashes and burns
\begin{document}
Unary works normally: \xdots{1}, \xdots{3}, \xdots{8}.
It even works with a counter.
\newcounter{test}
\setcounter{test}{8}
\unary{test}
But in a list:
\begin{enumerate}
\item My text here my text here
\item More text more text
\item Even more text
\end{enumerate}
\end{document}




