# [texhax] using a macro which changes catcodes inside another macro

Susan Dittmar Susan.Dittmar at gmx.de
Thu Nov 16 08:48:15 CET 2017

Hi folks,

the macro \chordname of the package leadsheets makes use of changed
catcodes (^,# and ! in this case). I would like to use \chordnames
within another macro. I know from several internet search results that
it is possible, but the answers I found were so much over my head I
could not adapt them to my problem.

Here's a simplified version of what I would like to use:

\documentclass{article}
\begin{document}

% macro \chordname does some catcode juggling, namely (ExplSyntaxOn):
%\char_set_catcode_other:N \#
%\char_set_catcode_active:N \^
%\char_set_catcode_parameter:N \!
% it can be found in
%

\newcommand{\Akkord}[3]{#1 and #2 and \chordname{#3}}

This should roughly look like this and that and $\mathrm{C}^7$'':
\Akkord{this}{that}{C^7}

\end{document}

Thanks for any help,

Susan