I'm trying to use a macro to generate arguments that should be passed to \charge. I'm trying this:
\documentclass{minimal}
\usepackage{chemfig}
\begin{document}
\charge{-135:1pt=5}{C}
\NewDocumentCommand{\myxyz}{}{-135:1pt=5}
\charge{\myxyz}{C}
\end{document}
The first \charge
command works, but the second does not.
I get these error messages:
line 10: Paragraph ended before \charge_g was complete.
line 11: Improper \prevdepth. \end{document}
line 11: Missing \endgroup inserted. \end{document}
line 11: Missing \endgroup inserted. \end{document}
line 11: Missing \endgroup inserted. \end{document}
line 11: Missing \endgroup inserted. \end{document}
line 11: Missing \endgroup inserted. \end{document}
line 11: Missing \endgroup inserted. \end{document}
line 11: Missing } inserted. \end{document}
line 11: Missing \endgroup inserted. \end{document}
line 11: Missing \endgroup inserted. \end{document}
line 11: Missing \endgroup inserted. \end{document}
line 11: Missing } inserted. \end{document}
I have also tried
\NewDocumentCommand{\myxyz}{}{-135:1pt=5}
\expandafter\charge{\myxyz}{C}
and
\NewDocumentCommand{\myxyz}{}{{-135:1pt=5}{C}}
\expandafter\charge\myxyz
What is the problem here and how can I make it work?