Open marijnschraagen opened 1 year ago
The code for @typeset pitch contains an \if conditional to find the position of the relevant element in the pitch list:
@typeset pitch
\if
\if\stringpitch\pgfmathresult
However, this does not work when the element in the tuning list contains a sharp.
Snippet (see https://tex.stackexchange.com/questions/661722/problem-with-chordbox-and-sharps/661745)
\pgfkeys{% /chordbox/text on node=pitch,% /chordbox/numfrets=6,% /chordbox/text below=pitch,% /chordbox/text on node=pitch,% /chordbox/tuning={"F\#","B","F\#","B","D\#","F\#"}% }% ... \chordbox{B6sus4}{x,0,2,0,1,0}
This can be solved by using \IfStrEq from xstring instead of a plain \if:
\IfStrEq
xstring
@typeset pitch/.code 2 args={% \pgfmathparse{{\cb@tuning}[#1-1]}% \ifnum#2=0% \pgfkeys{@replace symbols=\pgfmathresult}% \else% \foreach \p in {0,...,11} {% \pgfmathsetmacro{\stringpitch}{{\cb@pitchnames}[\p]}% \IfStrEq{\stringpitch}{\pgfmathresult}{% \pgfmathparse{{\cb@pitchnames}[mod(\p + #2, 12)]}% \pgfkeys{@replace symbols=\pgfmathresult}% \breakforeach% }{}% }% \fi% }
Maybe this can be changed in the package source?
The code for
@typeset pitch
contains an\if
conditional to find the position of the relevant element in the pitch list:However, this does not work when the element in the tuning list contains a sharp.
Snippet (see https://tex.stackexchange.com/questions/661722/problem-with-chordbox-and-sharps/661745)
This can be solved by using
\IfStrEq
fromxstring
instead of a plain\if
:Maybe this can be changed in the package source?