I have created a font from otf using autoinst to typeset some chord symbols in TeX. This font is designed (by its creator) to map character positions to certain musical symbols, like the small latin letter b is mapped to a superscripted flat sign, and so on. The conversion worked well, but i need to remap some characters to a different default output. My font switch is:
\def\chordfont{\fontencoding{LY1}\fontfamily{OpusChordsStd-\OpusChordsStd@figurealign\OpusChordsStd@figurestyle}\selectfont% % working stuff omitted}\DeclareTextFontCommand{\textchord}{\chordfont}
When i type
1: \textchord{Ab-}\\2: \textchord{Ab\symbol{28}}
i get
What i want is to re-map the -
character in a way that it outputs \symbol{28}
by default.
So far i tried
%% first Try\def\chordfont{% ... \def\@tempa{\symbol{28}}% \let-\@tempa%}
and
%% second Try\def\chordfont{% ... \catcode`-=\active\relax \def-\symbol{28}%}
but bots tries give me an \inaccessible
error when i run latex. I'm using pdflatex in TeXLive2017.
An abstraction could be:
\documentclass{article}\def\myfirstcommand{% \catcode`-=\active \def-{\textsuperscript{-}}%}\makeatletter\def\mysecondcommand{% \def\@tempa \let-\@tempa%}\makeatother\begin{document}A-A\textsuperscript{-}\myfirstcommand{A-}\mysecondcommand{A-}\end{document}
In this minimal non-working example, \myfirstcommand
throws two exceptions: first the \inaccessible
error, second the - is an undefined control sequence
error. \mysecondcommand
throws no exception, but doesn't give the desired output, either.
How do I do this right?