I've been trying to give some formatted input to \StrCut
from the xstring
package in a very complex code, and I've been getting an error.
Here is a MWE :
\documentclass[a4paper]{article}
\usepackage{xstring}
\begin{document}
\newcommand{\test}{\emph{First} part:Second part}
\StrCut{\test}{:}\firstpart\secondpart%
\firstpart --- \secondpart%
\end{document}
I get this error :
! Use of \@xs@StrCut@@ doesn't match its definition.
\text@command #1->\def \reserved@a {
#1}\ifx \reserved@a \@empty \let \check@...
l.7 \StrCut{\test}{:}
\firstpart\secondpart%
Any tip ?
EDIT :
With this MWE :
\documentclass[a4paper]{article}
\usepackage{xstring}
\begin{document}
\newcommand{\test}{\emph{First} part:Second part}
\newcommand{\testbis}{\test}
\expandarg\StrCut{\testbis}{:}\firstpart\secondpart%
\firstpart --- \secondpart%
\end{document}
I don't get any error, but the output is not what I expect, since \test isn't cut.
\expandarg\StrCut
etc.