3

in my book I will have to itemize a lot of things in different lists. That's why I want to reduce my commands to a minimum. This script is just part of a bigger macro.

\documentclass{book}

\usepackage[at]{easylist}

\begin{document}

\newcommand{\el}[1]{\begin{easylist}[itemize] #1 \end{easylist}}

\el{
@ 1
@ 2
@ 3
    @@ 3a
    @@ 3b
    @@ 3c
}

\begin{easylist}[itemize]
@ 1
@ 2
@ 3
    @@ 3a
    @@ 3b
    @@ 3c
\end{easylist}

\end{document}

When I pass the @-char to my macro it gets converted into a string so that it won't get recognized by easylist as an active character. How can I reconvert the @-char from string to an active character?

5

I'm not really sure you gain something with this.

What you call a “catcode” is actually an active character. You have to activate the @ before looking at the argument:

\documentclass{book}

\usepackage[at]{easylist}
\newcommand{\el}{\begingroup\catcode`@=\active\doel}
\newcommand{\doel}[1]{\begin{easylist}[itemize] #1 \end{easylist}\endgroup}

\begin{document}

\el{
@ 1
@ 2
@ 3
    @@ 3a
    @@ 3b
    @@ 3c
}

\begin{easylist}[itemize]
@ 1
@ 2
@ 3
    @@ 3a
    @@ 3b
    @@ 3c
\end{easylist}

\end{document}

enter image description here

Alternative version (perhaps preferable, do some experiments):

\newcommand{\el}[1]{%
 \scantokens{\begin{easylist}[itemize] #1 \end{easylist}}%
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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