3

This is my document:

\documentclass{scrreprt}
\newcommand\foo[1]{#1}

\begin{document}
\foo{%
\begin{itemize}
\item[x] hello
\item[y] world
\end{itemize}
}

\end{document}

I'd like to extract the item label and the item text for each \item line. The document will be processed with LuaTeX, so I could insert nodes in the item label and perhaps at the end of the line to analyze later on. My thought is that I can insert special markers such as

\item[(m1)x(m2)](m3) hello(m4)
\item[(m1)x(m2)](m3) world(m4)

where m1,...m4 are calls to \directlua{} to insert a special marker.

(How) Is it possible to augment the \item command to insert those m_n markers? The text within \foo is fixed and cannot be changed.

3

Replace \mi and \mii with the \directlua calls

\documentclass{scrreprt}
\usepackage{fontspec}
\newcommand\foo[1]{#1}
\let\Item\item
\renewcommand\item[1][]{\Item[\mi#1\mii]}
\def\mi{<m1>}
\def\mii{<m2>}

\begin{document}
    \foo{%
        \begin{itemize}
            \item[x] hello
            \item[y] world
        \end{itemize}
    }

\end{document}
  • I have tried exactly this, but it didn't work.... Thank you! – topskip May 26 '16 at 13:03

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.