Enumerate List with Different Base number
\documentclass{article}
\usepackage{tikz}
\renewcommand*{\labelenumi}{\pgfmathparse{int(2^(\theenumi-1))} \pgfmathresult}
\begin{document}
\begin{enumerate}
\item One
\item Two
\item Three
\item more
\item more
\item more
\item more
\item more
\item more
\item more
\item more
\item more
\item more
\end{enumerate}
\end{document}
Here's a LuaLaTeX-based solution, which works with the enumitem
package. It defines an enumerated environment called powertwoenum
, in which consecutive items are numbered as 1, 2, 4, 8, 32, etc. Items in a powertwoenum
list may be cross-referenced via the usual \label
-\ref
mechanism.
% !TEX TS-program = lualatex
\documentclass{article}
\newcommand\powertwo{\directlua{tex.sprint(2^(\arabic{powertwoenumi}-1))}}
\usepackage{enumitem}
\newlist{powertwoenum}{enumerate}{1}
\setlist[powertwoenum]{label=\protect\powertwo.,ref=\protect\powertwo}
\begin{document}
\begin{powertwoenum}
\item First
\item Second
\item Third
\item Fourth
\item Fifth \label{item:five}
\end{powertwoenum}
A cross-reference to item \ref{item:five}.
Resume the enumerated list.
\begin{powertwoenum}[resume]
\item First
\item Second
\item Third
\item Fourth
\item Fifth
\end{powertwoenum}
\end{document}
A variant of Christian Hupfer's solution, but fully expandable:
\documentclass{article}
\usepackage{enumitem}
\usepackage{xparse}
\ExplSyntaxOn
\DeclareExpandableDocumentCommand{\basetwoenum}{m}
{
\basetwoenum_main:n { #1 }
}
\cs_new:Nn \basetwoenum_main:n
{
\exp_args:Nc \basetwoenum_eval:n { c@#1 }
}
\cs_new:Nn \basetwoenum_eval:n
{
\fp_eval:n { 2 ** (#1-1) }
}
%% for keeping enumitem happy
\cs_set_eq:cN { @basetwoenum } \basetwoenum_main:n
\ExplSyntaxOff
\makeatletter
\AddEnumerateCounter{\basetwoenum}{\@basetwoenum}{000}
\makeatother
\begin{document}
\begin{enumerate}[label={\basetwoenum*}]
\item First
\item Second
\item Third
\item Fourth
\item Fifth
\end{enumerate}
Resume it
\begin{enumerate}[label={\basetwoenum*},resume]
\item First
\item Second
\item Third
\item Fourth
\item Fifth
\end{enumerate}
\end{document}
This gives correct results up to 253; of course, if you plan to use more than ten items you have to accordingly increase the number of zeros in the final argument to \AddEnumerateCounter
.