新しいコマンドが、複数段落または tikz 画像をパラメータとして使用しても機能するようにしたいと思います。
\documentclass{article}
\usepackage{paralist,xparse,calc}
\NewDocumentCommand{\HorsListe}{sO{1}m}{%
\IfBooleanTF{#1}{%
\par\nopagebreak[4]\addvspace{1\itemsep}%
\hspace{-#2\leftmargin}}{%
\par\nopagebreak[4]\addvspace{2\itemsep}%
\hspace{-#2\leftmargin}}%
\begin{minipage}[t]{\linewidth+#2\leftmargin}
#3
\addvspace{3\itemsep}
\end{minipage}%
\nopagebreak[2]}
\begin{document}
\begin{itemize}
\item This works
\HorsListe{Something wide}
\item This doesn't work.
\HorsListe{Something wide
with paragraph}
\item This doesn't work too
\HorsListe{\begin{tikzpicture}
\draw (0,0) rectangle (\linewidth,0) ;
\end{tikzpicture}}
\end{itemize}
\end{document}
答え1
の引数は\NewDocumentCommand
短いと想定されています。+
引数を長くする必要があります。
\NewDocumentCommand{\HorsListe}{sO{1}+m}{ CODE HERE }