I'm trying to compile the code from this answer: https://tex.stackexchange.com/a/1376/35161
I keep getting the following error:
! Undefined control sequence.
\ALG@cmd@2@alglinenumber ...size \addfontfeatures
{Colour=888888,Numbers=Mon...
l.22 \Function
{Distance}{$x, y$}
?
When I remove the line numbers (changing \begin{algorithmic}[1]
to \begin{algorithmic}
), it compiles. Any clues on how to solve this?
Here is the MWE:
\documentclass[11pt]{article}
\usepackage{algorithm}
\usepackage{algorithmicx}
\usepackage[noend]{algpseudocode}
\newcommand*\DNA{\textsc{dna}~}
\newcommand*\Let[2]{\State #1 $\gets$ #2}
\algrenewcommand\alglinenumber[1]{
{\sf\footnotesize\addfontfeatures{Colour=888888,Numbers=Monospaced}#1}}
\algrenewcommand\algorithmicrequire{\textbf{Precondition:}}
\algrenewcommand\algorithmicensure{\textbf{Postcondition:}}
\begin{document}
\begin{algorithm}
\caption{Counting mismatches between two packed \DNA strings
\label{alg:packed-dna-hamming}}
\begin{algorithmic}[1]
\Require{$x$ and $y$ are packed DNA strings of equal length $n$}
\Statex
\Function{Distance}{$x, y$}
\Let{$z$}{$x \oplus y$} \Comment{$\oplus$: bitwise exclusive-or}
\Let{$\delta$}{$0$}
\For{$i \gets 1 \textrm{ to } n$}
\If{$z_i \neq 0$}
\Let{$\delta$}{$\delta + 1$}
\EndIf
\EndFor
\State \Return{$\delta$}
\EndFunction
\end{algorithmic}
\end{algorithm}
\end{document}
In case someone finds relevant, I'm using MikTeX on Windows 7.