[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}
\usepackage[full]{leadsheets}
\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
% 
texlive/2017/texmf-dist/tex/latex/leadsheets/leadsheets.library.chordnames.code.tex

\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


More information about the texhax mailing list