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.

I am trying to define a variable with an asterisk in its value but keep getting errors. I have tried \def, \let and \newcommand but neither worked. A minimal example:

\documentclass{article}
\usepackage{enumitem}
\def\cLists{leftmargin=*}
\setlist{\cLists}
\begin{document}
\begin{itemize}
\item a
\end{itemize}
\end{document}

Any help, please?

share|improve this question
    
Why the close vote? I don't think this is a duplicate of Defining starred versions of commands –  Alan Munn Feb 21 '12 at 0:18
3  
Use \expandafter\setlist\expandafter{\cLists} instead. I think this has to do with the definition of \setlist that can take optional arguments. –  Werner Feb 21 '12 at 0:23
    
@AlanMunn I was confused for a moment. I deleted the automatic coment, but I can't undo my vote. –  lockstep Feb 21 '12 at 0:23
1  
@lockstep: Two days and your confusion will be lost. See Cancel asking to close? –  Werner Feb 21 '12 at 0:26
    
@Werner Rather to the fact that \setlist expects a list of options and doesn't perform expansion. –  egreg Feb 21 '12 at 0:27

1 Answer 1

up vote 10 down vote accepted

To appropriately use a control sequence \cLists as arguments to \setlist, use

\expandafter\setlist\expandafter{\cLists}

This expands \cLists first, before passing it to \setlist.

share|improve this answer
    
It worked. Thanks a lot! –  Kamil S. Feb 21 '12 at 13:54

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.