Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

For some reason or other the following code does not compile. Could anyone provide an insight into why?

\documentclass[letterpaper]{article}
\usepackage{enumitem}
\usepackage{fullpage}
\usepackage[dvipsnames,table]{xcolor}
\usepackage{amsmath,amsthm,amsfonts,amssymb,hhline,mathtools}
\usepackage{tikz,background,array,multicol,bbding}
\usepackage{enumitem}
\usepackage{cancel,array,booktabs}
\usepackage{framed}

\setlist[enumerate]{before=\setupmodenumerate}

\newif\ifmoditem
\newcommand{\setupmodenumerate}{%
  \global\moditemfalse
  \let\origmakelabel\makelabel
  \def\moditem##1{\global\moditemtrue\def\mesymbol{##1}\item}%
  \def\makelabel##1{%
    \origmakelabel{\ifmoditem\llap{\mesymbol\enspace}\fi##1}%
    \global\moditemfalse}%
}

\setlist[enumerate]{before=\setupcmodenumerate}

\newif\ifcitem
\newcommand{\setupcmodenumerate}{%
  \global\citemfalse
  \let\origmakelabel\makelabel
  \def\citem##1{\global\citemtrue\def\cecolor{##1}\item}%
  \def\makelabel##1{%
    \origmakelabel{\ifcitem\color{\cecolor}\fi##1}%
    \global\citemfalse}%
}
\begin{document}
\begin{enumerate}
\moditem{*} test
\citem{blue}
\end{enumerate}
\end{document}
share|improve this question
    
Unrelated to the issue, but you don't need to load tikz if you are loading background (background internally loads tikz). –  Gonzalo Medina Dec 18 '12 at 22:29
    
The second \setlist command overrides the before= given with the first one. If you want to use both \moditem and \citem you need to merge the two codes. –  egreg Dec 18 '12 at 22:33
    
@GonzaloMedina I know tikz is not needed but just included all of my preamble for in case it was needed. –  azetina Dec 18 '12 at 22:59

1 Answer 1

up vote 3 down vote accepted

The second \setlist command overrides the before=\setupmodenumerate given with the first, so \moditem doesn't get defined. You have to merge the two settings. Minimal example:

\documentclass{article}
\usepackage{enumitem,color}

\setlist[enumerate]{before=\setupmodenumerate}

\newif\ifmoditem
\newif\ifcitem
\newcommand{\setupmodenumerate}{%
  \global\moditemfalse
  \global\citemfalse
  \let\origmakelabel\makelabel
  \def\moditem##1{\global\moditemtrue\def\mesymbol{##1}\item}%
  \def\citem##1{\global\citemtrue\def\cecolor{##1}\item}%
  \def\makelabel##1{%
    \origmakelabel{\ifmoditem\llap{\mesymbol\enspace}\else\ifcitem\color{\cecolor}\fi\fi##1}%
    \global\moditemfalse\global\citemfalse}%
}

\begin{document}
\begin{enumerate}
\moditem{*} test
\citem{blue} test
\end{enumerate}
\end{document}

enter image description here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.