# Problem on list in custom command using adjustbox

I have a problem, that seems to be quite common : code expansion.

I have declared a command, that use an other command that use adjustbox. So far so good, until I need to pass to the first command a itemsize as an argument.

Here is my code :

\documentclass{report}

\begin{document}
Test

\newcommand{\compVProMargin}[1]{
#1
}
}
\newcommand{\compVPro}[2]{
\compVProMargin{
First arg : #1
}\\
\compVProMargin{
\textbf{Second arg} : #2
}\\
}

\section{This works ok}
\compVPro{
first argument, no code, works ok
}{
second argument, no code works ok too
}

\section{This doen't works}
\compVPro{
\begin{itemize}
\item item 1
\item item 2
\item item 3
\end{itemize}
}{
foo
}
\end{document}


I think I have to use commands like \expandafter and such, but I really don't manage to understand where to put it to make it works.

Thanks.

• Maybe useful latex.org/forum/viewtopic.php?t=11357 – Bobyandbob Feb 9 '18 at 9:10
• Ok, but isn't a solution for list only ? couldn't it happen on other kind of usage ? – iXô Feb 9 '18 at 9:17
• Yes it is. But you could put itemes into list. Just an idea. – Bobyandbob Feb 9 '18 at 11:07
• The problem is not expansion but the box. Why do you use \adjustbox here? – Ulrike Fischer Mar 23 '18 at 8:40