0x00 @ˆl–Ým_Jµ4Ò‚_P.Üeû‚˜´o�þC,n¬ÛÏ ×\Œ/þÆ ƒx!Å_ˆI|¥�+$¾ÅÄ·% % Copyright 2018 Steven Franzen % % This file is part of chordbox. % % Chordbox may be distributed and/or modified under the conditions of the % LaTeX Project Public License, either version 1.3 of this license or (at your % option) any later version. The latest version of this license is in % http://www.latex-project.org/lppl.txt and version 1.3 or later is part of all % distributions of LaTeX version 2005/12/01 or later. % % Chordbox has the LPPL maintenance status `maintained'. % % The Current Maintainer of chordbox is Steven Franzen. % \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{chordbox}[2019/04/14 v1.0 Minor improvement to documentation] \RequirePackage{tikz, xifthen, xstring} \usetikzlibrary{shapes.misc, scopes, backgrounds} \newif\ifcb@startbarre % Set up keys for the drawing code \pgfqkeys{/chordbox}{ % This fills a bar of width 0.4 that scales properly, without requiring % extra libraries draw barre/.code 2 args={% \fill (#1) -- +(0, -0.2) -| (#2) -- +(0, 0.2) -| cycle; }, draw barre/.value required, % Number of frets displayed numfrets/.initial=4, % Base fret number parser base fret/.code={fr\raisebox{.5ex}{\scriptsize#1}}, % Chord name parser name/.code=\ensuremath{\mathrm{#1}}, name/.value required, % Configuration of text below the chord box and on the nodes text below/.is choice, text below/none/.code={\def\cb@textbelow{0}}, text below/fingering/.code={\def\cb@textbelow{1}}, text below/pitch/.code={\def\cb@textbelow{2}}, text below/fingering, text on node/.is choice, text on node/none/.code={\def\cb@textonnode{0}}, text on node/fingering/.code={\def\cb@textonnode{1}}, text on node/pitch/.code={\def\cb@textonnode{2}}, text on node/none, % Symbols for pitch notation flat symbol/.initial=\flat, sharp symbol/.initial=\sharp, % Pitch name settings; arrays only seem to work with TeX macros pitch names/.store in=\cb@pitchnames, pitch names={"A","A\#","B","C","C\#","D","D\#","E","F","F\#","G","G\#"}, tuning/.store in=\cb@tuning, tuning={"E","A","D","G","B","E"}, % The base fret of a given chord box @basefret/.initial=1, % Calculate the given fret position #1, corrected for the base fret @fretnum/.code=\pgfmathtruncatemacro{\fretnum}{% 1 + #1 - \pgfkeysvalueof{/chordbox/@basefret} }, % Whether the barre has yet to be started @start barre/.is if=cb@startbarre, % Find and typeset pitch of string number #1 at fret number #2 @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]}% \if\stringpitch\pgfmathresult \pgfmathparse{{\cb@pitchnames}[mod(\p + #2, 12)]} \pgfkeys{@replace symbols=\pgfmathresult}% \breakforeach \fi } \fi }, % Replace pitch text with math symbols @replace symbols/.code={% \def\#{\ensuremath{\pgfkeysvalueof{/chordbox/sharp symbol}}}% \StrSubstitute{#1}{b}{% \ensuremath{\pgfkeysvalueof{/chordbox/flat symbol}}% } } } % Define tikz drawing styles. The muted string symbol size is slightly smaller % to make it visually similar to the open symbol. Both are also placed above % their given coordinate for better separation from the box. \tikzset{ chordbox/.style={baseline, scale=0.25}, chordbox/.value forbidden, fret node text/.style={font=\Large\bfseries,text=white}, fret node text/.value forbidden, pitch text below/.style={font=\tiny}, string/.is choice, string/base/.style={% circle, draw, inner sep=0, minimum size=20, transform shape% }, string/fretted/.style={string/base, fill}, string/open/.style={string/base, above}, stri