I have a cheatsheet with a table that looks like
\begin{tabular}{l|l}
$k > 0$ & \verb+k > 0+ \\
$k \geq 0$ & \verb+k \geq 0+ \\
$\sum_l$ & \verb+\sum_l+ \\
%etc
\end{tabular}
There is a lot of redundancy here since the argument to verb is the same as the first entry of the table. I tried to make a macro to remove the duplication
\newcommand\code[1]{$#1$& \verb+#1+\\}
but that gives an error. I also tried using detokenize
\newcommand\code[1]{$#1$&\texttt{\detokenize{#1}}\\}
but that introduces superfluous spaces. How can I define a macro that produces both the formula and its verbatim code?

%tokens, etc.? – Joseph Wright Sep 11 '14 at 14:11