texlive[41880] Master/texmf-dist: guitarchordschemes (17aug16)

commits+karl at tug.org commits+karl at tug.org
Wed Aug 17 23:35:24 CEST 2016


Revision: 41880
          http://tug.org/svn/texlive?view=revision&revision=41880
Author:   karl
Date:     2016-08-17 23:35:23 +0200 (Wed, 17 Aug 2016)
Log Message:
-----------
guitarchordschemes (17aug16)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/guitarchordschemes/README
    trunk/Master/texmf-dist/doc/latex/guitarchordschemes/guitarchordschemes_en.pdf
    trunk/Master/texmf-dist/doc/latex/guitarchordschemes/guitarchordschemes_en.tex
    trunk/Master/texmf-dist/tex/latex/guitarchordschemes/guitarchordschemes.sty

Modified: trunk/Master/texmf-dist/doc/latex/guitarchordschemes/README
===================================================================
--- trunk/Master/texmf-dist/doc/latex/guitarchordschemes/README	2016-08-17 21:35:06 UTC (rev 41879)
+++ trunk/Master/texmf-dist/doc/latex/guitarchordschemes/README	2016-08-17 21:35:23 UTC (rev 41880)
@@ -1,15 +1,15 @@
 --------------------------------------------------------------------------
-the GUITARCHORDSCHEMES package v 0.6
+the GUITARCHORDSCHEMES package v0.7
 
   Guitar Chord and Scale Tablatures with TikZ
 
-2014/09/15
+2016/08/16
 --------------------------------------------------------------------------
 Clemens Niederberger
 Web:    https://bitbucket.org/cgnieder/guitarchordschemes/
 E-Mail: contact at mychemistry.eu
 --------------------------------------------------------------------------
-Copyright 2013-2014 Clemens Niederberger
+Copyright 2013-2016 Clemens Niederberger
 
 This work may be distributed and/or modified under the
 conditions of the LaTeX Project Public License, either version 1.3

Modified: trunk/Master/texmf-dist/doc/latex/guitarchordschemes/guitarchordschemes_en.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/guitarchordschemes/guitarchordschemes_en.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/guitarchordschemes/guitarchordschemes_en.tex	2016-08-17 21:35:06 UTC (rev 41879)
+++ trunk/Master/texmf-dist/doc/latex/guitarchordschemes/guitarchordschemes_en.tex	2016-08-17 21:35:23 UTC (rev 41880)
@@ -12,7 +12,7 @@
 % Web:    https://bitbucket.org/cgnieder/guitarchordschemes/
 % E-Mail: contact at mychemistry.eu
 % --------------------------------------------------------------------------
-% Copyright 2012--2013 Clemens Niederberger
+% Copyright 2013--2016 Clemens Niederberger
 % 
 % This work may be distributed and/or modified under the
 % conditions of the LaTeX Project Public License, either version 1.3
@@ -37,7 +37,7 @@
 % --------------------------------------------------------------------------
 \documentclass[load-preamble+]{cnltx-doc}
 \usepackage{guitarchordschemes}
-\usepackage[chordnames]{leadsheets}
+\usepackage[chords]{leadsheets}
 
 \setcnltx{
   package = guitarchordschemes ,
@@ -48,6 +48,7 @@
   add-cmds = {
     chordscheme,
     setchordscheme,
+    setfingering ,
     scales
   } ,
   add-silent-cmds = textsuperscript ,
@@ -118,7 +119,7 @@
 % section~\ref{sec:realbookchords} for details on this option.
 
 \section{The Commands}
-This package more or less provides a single command:
+This package mainly provides two commands:
 \begin{commands}
   \command{chordscheme}[\oarg{options}]
     Typeset a guitar chord scheme.
@@ -237,9 +238,9 @@
     Set a whole predefined fingering.  The types correspond to ones taught
     in \citeauthor{leavitt:mmfg:1}'s
     \citetitle{leavitt:mmfg:1}~\cite{leavitt:mmfg:1}.  This option assumes an
-    ionic scale a places the roots correspondingly.
+    ionic scale and places the roots correspondingly.
   \keychoice{fingering*}{type 1,type 1A,type 2,type 3,type 4}
-    The same as \option{fingering} but not scale is assumed and no roots are
+    The same as \option{fingering} but no scale is assumed and no roots are
     indicated.
   \keychoice{fingering?}{type 1,type 1A,type 2,type 3,type 4}
     The same as \option{fingering*} but also no labels for the fingers are given.
@@ -284,11 +285,34 @@
   ]
 \end{example}
 
+You can add other predefined fingerings or change the existing ones with the
+following command:
+\begin{commands}
+  \command{setfingering}[\marg{name}\marg{fingers}\marg{roots}]
+    \sinceversion{0.7}\marg{name} sets the name as chosen by
+    \option{fingering}, \option{fingering*} or \option{fingering?},
+    \meta{fingers} is passed to the \option{finger} option and \meta{roots}
+    either to the \option{finger} option or the \option{root} option depending
+    if the fingering is called by \option{fingering}, \option{fingering*} or
+    \option{fingering?}.
+\end{commands}
+As an example here is how fingering type 1A has been defined:
+\begin{sourcecode}
+  \setfingering{type 1A}{
+                   3/1:2,        5/1:4,
+                   3/2:2,        5/2:4,
+            2/3:1, 3/3:2,        5/3:4,
+            2/4:1,               5/4:4,
+    1/5:1s,        3/5:2,        5/5:4,
+                   3/6:2,        5/6:4
+  }{1/1:1s, 3/4:2, 1/6:1s}
+\end{sourcecode}
+
 \section{Options}
 There are quite a number of options determining the layout of the tablatures.
 They can either be set as package options or via the setup command:
 \begin{commands}
-  \command{setchordscheme}{options}
+  \command{setchordscheme}[\marg{options}]
     The setup command for \guitarchordschemes.
 \end{commands}
 
@@ -298,6 +322,8 @@
     The basic $x$ unit for the \TikZ{} picture the chord scheme is set in.
   \keyval{y-unit}{dim}\Default{.8cm}
     The basic $y$ unit for the \TikZ{} picture the chord scheme is set in.
+  \keyval{rotate}{angle}\Default{0}
+    \sinceversion{0.7}Rotates the diagram counter-clockwise by \meta{angle}.
   \keyval{finger-format}{\TeX{} code}\Default{\cs*{sffamily}\cs*{small}}
     The format the numbers for the fingers are typeset with.
   \keyval{finger-format+}{\TeX{} code}\Default
@@ -310,10 +336,15 @@
     The format the chord name/symbol is typeset with.
   \keyval{name-format+}{\TeX{} code}\Default
     Code to be appended to \option{name-format}.
-  \keyval{chord-name-format}{cs}\Default{\cs*{@firstofone}}
+  \keybool{name-below}\Default{false}
+    \sinceversion{0.7}If set to \code{true} the name will be written below
+    instead of above the diagram.
+  \keyval{name-distance}{dim}\Default{.5em}
+    \sinceversion{0.7}The distance between name and chord diagram.
+  \keyval{chord-name-cs}{cs}\Default{\cs*{@firstofone}}
     \sinceversion{0.5}The command that is used to parse the chord name.
     \meta{cs} needs to be a command that takes a mandatory argument.
-  \keyval{scales-name-format}{cs}\Default{\cs*{@firstofone}}
+  \keyval{scales-name-cs}{cs}\Default{\cs*{@firstofone}}
     \sinceversion{0.5}The command that is used to parse the scales name.
     \meta{cs} needs to be a command that takes a mandatory argument.
   \keyval{string-name-format}{\TeX{} code}\Default{\cs*{sffamily}\cs*{small}}
@@ -320,6 +351,8 @@
     The format the names of the strings are typeset with.
   \keyval{string-name-format+}{\TeX{} code}\Default
     Code to be appended to \option{string-name-format}.
+  \keyval{strings}{num}\Default{6}
+    \sinceversion{0.7}Sets the number of strings.
   \keyval{chord-frets}{number}\Default{4}
     \sinceversion{0.6}The default number of frets of a chord scheme.
     \meta{number} must be at least 4. 
@@ -359,7 +392,12 @@
     This is equivalent to \cs*{tikzset}\Marg{muted style/.style=\{\meta{\TikZ{}
         style}\}}.
   \keyval{tuning}{comma separated list of string names}\Default{E,B,G,D,A,E}
-    The tuning.
+    The tuning.  The strings are named from first to sixth string.  If you
+    want to remove all names use \keyis{tuning}{,,,,,}.
+  \keybool{restrict-bounding-box}\Default{false}
+    \sinceversion{0.7}If set to \code{true} the bounding box of the \TikZ{}
+    picture is not extended by string names, position labels etc.\@ but
+    restricted (more or less) only to the chord scheme diagram itself.
 \end{options}
 
 \end{document}

Modified: trunk/Master/texmf-dist/tex/latex/guitarchordschemes/guitarchordschemes.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/guitarchordschemes/guitarchordschemes.sty	2016-08-17 21:35:06 UTC (rev 41879)
+++ trunk/Master/texmf-dist/tex/latex/guitarchordschemes/guitarchordschemes.sty	2016-08-17 21:35:23 UTC (rev 41880)
@@ -8,7 +8,7 @@
 % Web:    https://bitbucket.org/cgnieder/guitarchordschemes/
 % E-Mail: contact at mychemistry.eu
 % --------------------------------------------------------------------------
-% Copyright 2013-2014 Clemens Niederberger
+% Copyright 2013-2016 Clemens Niederberger
 % 
 % This work may be distributed and/or modified under the
 % conditions of the LaTeX Project Public License, either version 1.3
@@ -34,8 +34,8 @@
 %
 % package info and requirements:
 \NeedsTeXFormat{LaTeX2e}
-\def\gcs at date{2014/09/15}
-\def\gcs at version{v0.6}
+\def\gcs at date{2016/08/16}
+\def\gcs at version{v0.7}
 \def\gcs at description{Guitar Chord and Scale Tablatures with TikZ (CN)}
 
 \ProvidesPackage{guitarchordschemes}[\gcs at date\space \gcs at version\space \gcs at description]
@@ -53,7 +53,7 @@
 \cnltx at create@generic at message{gcs}{guitarchordschemes}{WarningNoLine}{}
 \cnltx at create@generic at message{gcs}{guitarchordschemes}{Info}{}
 
-\def\gcs at missing@date at error#1#2{%
+\newcommand*\gcs at missing@date at error[2]{%
   \gcs at error
     {#1: empty #2}
     {#1: It seems you didn't specify the #2}%
@@ -72,7 +72,7 @@
     {\protected\def#1}%
 }
 
-\gcs at def\gcs at deprecated@option#1#2{%
+\newrobustcmd*\gcs at deprecated@option[2]{%
   \gcs at warning{Since version #1 the option `#2' has been dropped}%
 }
 
@@ -82,6 +82,7 @@
 \newcommand*\gcs at position@font{\sffamily}
 \newcommand*\gcs at name@font{\large}
 \newcommand*\gcs at string@name at format{\sffamily\small}
+\newcommand*\gcs at name@distance{.5em}
 
 \newcommand*\gcs at x@unit{.8cm}
 \newcommand*\gcs at y@unit{.8cm}
@@ -89,14 +90,58 @@
 \newcommand*\gcs at finger@radius{.1875}
 \newcommand*\gcs at finger@x at offset{.375}
 \newcommand*\gcs at finger@y at offset{.275}
+\newcommand*\gcs at angle{0}
 
+\newcommand*\gcs at string@number{6}
+\newcommand*\gcs at setstringnumber[1]{%
+  \ifnumless{#1}{1}
+    {%
+      \gcs at warning{You can't use less than one string. Setting string number
+        to 1}%
+      \def\gcs at string@number{1}%
+    }
+    {%
+      \ifnumgreater{#1}{7}
+        {%
+          \gcs at warning{You can't use more than seven
+            strings. Setting string number to 6}%
+          \def\gcs at string@number{6}%
+        }
+        {\def\gcs at string@number{#1}}%
+    }%
+}
+
+\newbool{gcs at switch@name}
+
 \newcommand*\gcs at chordscheme@fret at number{4}
 \newcommand*\gcs at scales@fret at number{6}
 
+\newrobustcmd*\gcs at chord@tuning[1]{%
+  \foreach \string at name [count=\x] in {#1}
+    {\csxdef{guitar at string@\x}{\expandonce\string at name}}%
+}
+
+\newbool{gcs at restrict@boundingbox}
+\newcommand*\gcs at restrictboundingbox[1]{
+  \ifbool{gcs at restrict@boundingbox}
+    {
+      \ifnumequal{\gcs at string@number}{1}
+        {\useasboundingbox (0,-.4) --++ (1.5*\csname gcs@#1 at fret@number\endcsname,.8) ; }
+        {
+          \useasboundingbox
+            (bass)
+            rectangle
+            (1.5*\csname gcs@#1 at fret@number\endcsname,{.8*(\gcs at string@number-1)}) ;
+        }
+    }{}
+}
+
 \pgfkeys{
   guitarchordschemes/.cd ,
     x-unit/.code              = \def\gcs at x@unit{#1} ,
     y-unit/.code              = \def\gcs at y@unit{#1} ,
+    rotate/.code              = \def\gcs at angle{#1} ,
+    strings/.code             = \gcs at setstringnumber{#1} ,
     finger-format/.code       = \def\gcs at finger@font{#1} ,
     finger-format+/.code      =
       \expandafter\def\expandafter\gcs at finger@font
@@ -109,6 +154,8 @@
     name-format+/.code        =
       \expandafter\def\expandafter\gcs at name@font
       \expandafter{\gcs at name@font#1} ,
+    name-distance/.code       = \def\gcs at name@distance{#1} ,
+    name-below/.is if         = gcs at switch@name ,
     chord-name-cs/.code       = {\let\gcs at chord@name at command=#1} ,
     scales-name-cs/.code      = {\let\gcs at scales@name at command=#1} ,
     string-name-format/.code  = \def\gcs at string@name at format{#1} ,
@@ -139,23 +186,14 @@
     ringing-style/.code       = \tikzset{ringing style/.style={#1}} ,
     muted-style/.code         = \tikzset{muted style/.style={#1}} ,
     tuning/.code              = \gcs at chord@tuning{#1} ,
-    use-rbc/.code             = \gcs at deprecated@option{0.5}{use-rbc}
+    use-rbc/.code             = \gcs at deprecated@option{0.5}{use-rbc} ,
+    restrict-bounding-box/.is if = gcs at restrict@boundingbox
 }
 
 % the setup command:
 \newrobustcmd*\setchordscheme[1]{\pgfqkeys{/guitarchordschemes}{#1}}
 
-\newcounter{gcs at string@number}
-\newrobustcmd*\gcs at chord@tuning[1]{%
-  \setcounter{gcs at string@number}{0}%
-  \foreach \string at name in {#1}
-    {%
-      \stepcounter{gcs at string@number}%
-      \csxdef{guitar at string@\arabic{gcs at string@number}}{\expandonce\string at name}%
-    }%
-}
-
-% some defaults - need to be set before options are processed:
+% some defaults -- need to be set before options are processed:
 \setchordscheme{
   tuning          = {E,B,G,D,A,E} ,
   muted-style     = {cross out,draw} ,
@@ -181,7 +219,7 @@
 % setting a chord scheme:
 \pgfkeys{
   gcs/chord/.cd ,
-    name/.code      = \gcs at chord@name{#1} ,
+    name/.code      = \gdef\gcs at chord@name{#1} ,
     position/.code  = \def\gcs at chord@position{#1} ,
     finger/.code    = \gcs at chord@finger{#1} ,
     root/.code      = \gcs at chord@root{#1} ,
@@ -198,10 +236,34 @@
         {\def\gcs at chordscheme@fret at number{#1}}
 }
 
+\newrobustcmd*\setfingering[3]{%
+  \pgfkeys{
+    gcs/scales/.cd ,
+    fingering/#1/.code =
+      \gcs at scales@finger{#2}
+      \ifblank{#3}{}{\gcs at scales@root{#3}} ,
+    fingering*/#1/.code =
+      \def\gcs at tmp{}%
+      \foreach \gcs at str in {#2,#3}
+        { \xappto\gcs at tmp{\gcs at str,} }%
+      \edef\gcs at tmp{\expandafter\cs at remove@comma\gcs at tmp\q at stop}%
+      \expandafter\gcs at scales@finger\expandafter{\gcs at tmp} ,
+    fingering?/#1/.code =
+      \def\gcs at tmp{}%
+      \foreach \gcs at str in {#2,#3}
+        { \xappto\gcs at tmp{\expandafter\cs at remove@finger\gcs at str::\q at stop,} }%
+      \edef\gcs at tmp{\expandafter\cs at remove@comma\gcs at tmp\q at stop}%
+      \expandafter\gcs at scales@finger\expandafter{\gcs at tmp}%
+  }%
+}
+
+\def\cs at remove@finger#1:#2:#3\q at stop{#1}
+\def\cs at remove@comma#1,\q at stop{#1}
+
 % setting a scale:
 \pgfkeys{
   gcs/scales/.cd ,
-    name/.code         = \gcs at scales@name{#1} ,
+    name/.code         = \gdef\gcs at scales@name{#1} ,
     position/.code     = \def\gcs at scales@position{#1} ,
     finger/.code       = \gcs at scales@finger{#1} ,
     root/.code         = \gcs at scales@root{#1} ,
@@ -213,150 +275,55 @@
         }
         {\def\gcs at scales@fret at number{#1}} ,
     fingering/.is choice ,
-    fingering/type 1/.code =
-      \gcs at scales@finger{%
-        1/1:1s,        3/1:2,        5/1:4,
-                       3/2:2,        5/2:4,
-                2/3:1,        4/3:3,
-                2/4:1, 3/4:2,        5/4:4,
-                2/5:1,               5/5:4,
-        1/6:1s,        3/6:2,        5/6:4
-      }%
-      \gcs at scales@root{5/3:4, 3/5:2} ,
-    fingering/type 1A/.code =
-      \gcs at scales@finger{%
-                       3/1:2,        5/1:4,
-                       3/2:2,        5/2:4,
-                2/3:1, 3/3:2,        5/3:4,
-                2/4:1,               5/4:4,
-        1/5:1s,        3/5:2,        5/5:4,
-                       3/6:2,        5/6:4
-      }%
-      \gcs at scales@root{1/1:1s, 3/4:2, 1/6:1s} ,
-    fingering/type 2/.code =
-      \gcs at scales@finger{%
-                2/1:1,               5/1:4,
-                       3/2:2,        5/2:4,
-                2/3:1,        4/3:3, 5/3:4,
-                2/4:1,        4/4:3,
-                2/5:1, 3/5:2,        5/5:4,
-                2/6:1,               5/6:4
-      }%
-      \gcs at scales@root{3/1:2, 5/4:4, 3/6:2},
-    fingering/type 3/.code =
-      \gcs at scales@finger{%
-                2/1:1, 3/1:2,        5/1:4,
-                2/2:1,               5/2:4,
-                2/3:1,        4/3:3,
-                2/4:1,        4/4:3, 5/4:4,
-                2/5:1,        4/5:3,
-                2/6:1, 3/6:2,        5/6:4
-      }%
-      \gcs at scales@root{3/2:2, 5/5:4},
-    fingering/type 4/.code =
-      \gcs at scales@finger{%
-                2/1:1,        4/1:3,
-                2/2:1, 3/2:2,        5/2:4,
-                              4/3:3,
-                2/4:1,        4/4:3,        6/4:4s,
-                2/5:1,        4/5:3, 5/5:4,
-                2/6:1,        4/6:3
-      }%
-      \gcs at scales@root{5/1:4, 2/3:1, 5/6:4},
     fingering*/.is choice ,
-    fingering*/type 1/.code =
-      \gcs at scales@finger{%
-        1/1:1s,        3/1:2,        5/1:4,
-                       3/2:2,        5/2:4,
-                2/3:1,        4/3:3, 5/3:4,
-                2/4:1, 3/4:2,        5/4:4,
-                2/5:1, 3/5:2,        5/5:4,
-        1/6:1s,        3/6:2,        5/6:4
-      } ,
-    fingering*/type 1A/.code =
-      \gcs at scales@finger{%
-        1/1:1s,        3/1:2,        5/1:4,
-                       3/2:2,        5/2:4,
-                2/3:1, 3/3:2,        5/3:4,
-                2/4:1, 3/4:2,        5/4:4,
-        1/5:1s,        3/5:2,        5/5:4,
-        1/6:1s,        3/6:2,        5/6:4
-      } ,
-    fingering*/type 2/.code =
-      \gcs at scales@finger{%
-                2/1:1, 3/1:2,        5/1:4,
-                       3/2:2,        5/2:4,
-                2/3:1,        4/3:3, 5/3:4,
-                2/4:1,        4/4:3, 5/4:4,
-                2/5:1, 3/5:2,        5/5:4,
-                2/6:1, 3/6:2,        5/6:4
-      } ,
-    fingering*/type 3/.code =
-      \gcs at scales@finger{%
-                2/1:1, 3/1:2,        5/1:4,
-                2/2:1, 3/2:2,        5/2:4,
-                2/3:1,        4/3:3,
-                2/4:1,        4/4:3, 5/4:4,
-                2/5:1,        4/5:3, 5/5:4,
-                2/6:1, 3/6:2,        5/6:4
-      } ,
-    fingering*/type 4/.code =
-      \gcs at scales@finger{%
-                2/1:1,        4/1:3, 5/1:4,
-                2/2:1, 3/2:2,        5/2:4,
-                2/3:1,        4/3:3,
-                2/4:1,        4/4:3,        6/4:4s,
-                2/5:1,        4/5:3, 5/5:4,
-                2/6:1,        4/6:3, 5/6:4
-      },
-    fingering?/.is choice ,
-    fingering?/type 1/.code =
-      \gcs at scales@finger{%
-        1/1,      3/1,      5/1,
-                  3/2,      5/2,
-             2/3,      4/3, 5/3,
-             2/4, 3/4,      5/4,
-             2/5, 3/5,      5/5,
-        1/6,      3/6,      5/6
-      } ,
-    fingering?/type 1A/.code =
-      \gcs at scales@finger{%
-        1/1,      3/1,      5/1,
-                  3/2,      5/2,
-             2/3, 3/3,      5/3,
-             2/4, 3/4,      5/4,
-        1/5,      3/5,      5/5,
-        1/6,      3/6,      5/6
-      } ,
-    fingering?/type 2/.code =
-      \gcs at scales@finger{%
-             2/1, 3/1,      5/1,
-                  3/2,      5/2,
-             2/3,      4/3, 5/3,
-             2/4,      4/4, 5/4,
-             2/5, 3/5,      5/5,
-             2/6, 3/6,      5/6
-      } ,
-    fingering?/type 3/.code =
-      \gcs at scales@finger{%
-             2/1, 3/1,      5/1,
-             2/2, 3/2,      5/2,
-             2/3,      4/3,
-             2/4,      4/4, 5/4,
-             2/5,      4/5, 5/5,
-             2/6, 3/6,      5/6
-      } ,
-    fingering?/type 4/.code =
-      \gcs at scales@finger{%
-             2/1,      4/1, 5/1,
-             2/2, 3/2,      5/2,
-             2/3,      4/3,
-             2/4,      4/4,      6/4,
-             2/5,      4/5, 5/5,
-             2/6,      4/6, 5/6
-      }
+    fingering?/.is choice
 }
 
+\setfingering{type 1}{
+  1/1:1s,        3/1:2,        5/1:4,
+                 3/2:2,        5/2:4,
+          2/3:1,        4/3:3,
+          2/4:1, 3/4:2,        5/4:4,
+          2/5:1,               5/5:4,
+  1/6:1s,        3/6:2,        5/6:4
+}{5/3:4, 3/5:2}
+
+\setfingering{type 1A}{
+                 3/1:2,        5/1:4,
+                 3/2:2,        5/2:4,
+          2/3:1, 3/3:2,        5/3:4,
+          2/4:1,               5/4:4,
+  1/5:1s,        3/5:2,        5/5:4,
+                 3/6:2,        5/6:4
+}{1/1:1s, 3/4:2, 1/6:1s}
+
+\setfingering{type 2}{
+          2/1:1,               5/1:4,
+                 3/2:2,        5/2:4,
+          2/3:1,        4/3:3, 5/3:4,
+          2/4:1,        4/4:3,
+          2/5:1, 3/5:2,        5/5:4,
+          2/6:1,               5/6:4
+}{3/1:2, 5/4:4, 3/6:2}
+
+\setfingering{type 3}{
+          2/1:1, 3/1:2,        5/1:4,
+          2/2:1,               5/2:4,
+          2/3:1,        4/3:3,
+          2/4:1,        4/4:3, 5/4:4,
+          2/5:1,        4/5:3,
+          2/6:1, 3/6:2,        5/6:4
+}{3/2:2, 5/5:4}
+
+\setfingering{type 4}{
+          2/1:1,        4/1:3,
+          2/2:1, 3/2:2,        5/2:4,
+                        4/3:3,
+          2/4:1,        4/4:3,        6/4:4s,
+          2/5:1,        4/5:3, 5/5:4,
+          2/6:1,        4/6:3
+}{5/1:4, 2/3:1, 5/6:4}
+
 % --------------------------------------------------------------------------
 % the internal commands
 
@@ -373,7 +340,7 @@
           \ifdefvoid\gcs at finger@y
             {\gcs at missing@date at error{finger}{string}}
             {
-              \pgfmathsetmacro\gcs at finger@string{(6-\gcs at finger@y)*4/5}
+              \pgfmathsetmacro\gcs at finger@string{(\gcs at string@number-\gcs at finger@y)*4/5}
               \draw[finger style]
                 (\gcs at finger@fret,\gcs at finger@string)
                 circle
@@ -406,8 +373,8 @@
         {\gcs at missing@date at error{barre}{string range}}
         {
           \expandafter\gcs at barre@getstrings\gcs at barre@fromto--\q at stop
-          \pgfmathsetmacro\gcs at barre@lower at string{(6-\gcs at barre@lower at y)*4/5}
-          \pgfmathsetmacro\gcs at barre@upper at string{(6-\gcs at barre@upper at y)*4/5}
+          \pgfmathsetmacro\gcs at barre@lower at string{(\gcs at string@number-\gcs at barre@lower at y)*4/5}
+          \pgfmathsetmacro\gcs at barre@upper at string{(\gcs at string@number-\gcs at barre@upper at y)*4/5}
           \draw[finger style,round cap-round cap,line width=2*\gcs at finger@radius*\gcs at x@unit]
             (\gcs at barre@fret,\gcs at barre@lower at string) node[gcs/finger] {\gcs at barre@finger}
             ++ (0,\gcs at finger@radius*\gcs at x@unit)
@@ -448,7 +415,7 @@
           \ifdefvoid\gcs at finger@y
             {\gcs at missing@date at error{root}{string}}
             {
-              \pgfmathsetmacro\gcs at finger@string{(6-\gcs at finger@y)*4/5}
+              \pgfmathsetmacro\gcs at finger@string{(\gcs at string@number-\gcs at finger@y)*4/5}
               \node[minimum size=2*\gcs at finger@radius*\gcs at x@unit,inner sep=0pt,root style]
                 at (\gcs at finger@fret,\gcs at finger@string) {} ;
               \node[gcs/finger]
@@ -473,7 +440,7 @@
           \ifdefvoid\gcs at finger@x
             {\gcs at missing@date at error{show-root}{string}}
             {
-              \pgfmathsetmacro\gcs at finger@string{(6-\gcs at finger@y)*4/5}
+              \pgfmathsetmacro\gcs at finger@string{(\gcs at string@number-\gcs at finger@y)*4/5}
               \node[
                 minimum size=2*\gcs at finger@radius*\gcs at x@unit,
                 inner sep=0pt,
@@ -497,7 +464,7 @@
 \newrobustcmd*\gcs at chord@ring[1]{%
   \foreach \ringing at string in {#1}
     {
-      \pgfmathsetmacro\ringing at string@pos{(6-\ringing at string)*4/5}
+      \pgfmathsetmacro\ringing at string@pos{(\gcs at string@number-\ringing at string)*4/5}
       \draw[ringing style]
         (0,\ringing at string@pos) circle (\gcs at finger@radius*\gcs at x@unit) ;
     }
@@ -504,33 +471,37 @@
 }
 
 % the chord name:
-\newrobustcmd*\gcs at chord@name[1]{%
-  \node[above,yshift=4ex] at (.75*\gcs at chordscheme@fret at number,4) {%
-    \gcs at name@font
-    \foreach \gcs at chord@name at variant in {#1}
-      {%
-        \space
-        \expandafter\gcs at chord@name at command
-        \expandafter{\gcs at chord@name at variant}%
-        \space
-      }%
-  } ;
+\newrobustcmd*\gcs at place@chord at name[1]{%
+  \node[
+    label={[text height=1.5ex,text depth=.2ex,font=\gcs at name@font,
+      label distance=\gcs at name@distance]\ifbool{gcs at switch@name}{below}{above}:{%
+      \foreach \gcs at chord@name at variant in {#1}
+        {%
+          % \space
+          \expandafter\gcs at chord@name at command
+          \expandafter{\gcs at chord@name at variant}%
+          % \space
+        }%
+    }}] at
+  (diagram.\ifbool{gcs at switch@name}{south}{north}) {} ;
 }
 
 \newrobustcmd*\gcs at chord@name at command[1]{#1}
 
 % the scale name:
-\newrobustcmd*\gcs at scales@name[1]{%
-  \node[above,yshift=4ex] at (.75*\gcs at scales@fret at number,4) {%
-    \gcs at name@font
-    \foreach \gcs at scales@name at variant in {#1}
-      {%
-        \space
-        \expandafter\gcs at scales@name at command
-        \expandafter{\gcs at scales@name at variant}%
-        \space
-      }%
-  } ;
+\newrobustcmd*\gcs at place@scales at name[1]{%
+  \node[
+    label={[text height=1.5ex,text depth=.2ex,font=\gcs at name@font,
+      label distance=\gcs at name@distance]\ifbool{gcs at switch@name}{below}{above}:{%
+      \foreach \gcs at scales@name at variant in {#1}
+        {%
+          % \space
+          \expandafter\gcs at scales@name at command
+          \expandafter{\gcs at scales@name at variant}%
+          % \space
+        }%
+    }}] at
+  (diagram.\ifbool{gcs at switch@name}{south}{north}) {} ;
 }
 
 \newrobustcmd*\gcs at scales@name at command[1]{#1}
@@ -543,29 +514,43 @@
        x=\gcs at x@unit,
        y=\gcs at y@unit,
        line width=\gcs at line@width,
-       baseline=(6thstring)
+       baseline=(bass)
      ]
-     \coordinate (6thstring) at (0,0) ;
+     \begin{scope}[rotate=\gcs at angle,local bounding box=diagram]
+     \coordinate (bass) at (0,0) ;
+     \gcs at restrictboundingbox{chordscheme}
      \pgfqkeys{/gcs/chord}{#1}%
-     \foreach \fret in {0,1,...,\gcs at chordscheme@fret at number}
-       { \draw (1.5*\fret,0) -- (1.5*\fret,4) ; }
-     \foreach \gcs at string@pos/\gcs at string@number in
-       { 0/6, 0.8/5, 1.6/4, 2.4/3, 3.2/2, 4/1, 0 }
+     \foreach \fretnumber
+       in {0,...,\gcs at chordscheme@fret at number}
        {
+         \ifnumequal{\gcs at string@number}{1}
+           { \draw (1.5*\fretnumber,-.4) --++ (0,.8) ; }
+           { \draw (1.5*\fretnumber,0) -- ++(0,{.8*(\gcs at string@number-1)}) ; }
+       }
+     \foreach \gcs at string in {1,...,\gcs at string@number}
+       {
          \draw
-           (0,\gcs at string@pos)
-           node[left,minimum width=2em]
-             {\gcs at string@name at format\csuse{guitar at string@\gcs at string@number}}
-           --
-           (1.5*\gcs at chordscheme@fret at number,\gcs at string@pos) ;
+           (0,{.8*(\gcs at string@number-\gcs at string)})
+           node[transform shape,
+           label={[text height=1.5ex,text depth=.2ex]left:%
+             \gcs at string@name at format\csuse{guitar at string@\gcs at string}}] {}
+           --++(1.5*\gcs at chordscheme@fret at number,0) ;
        }
      \ifdefvoid\gcs at chord@position
        {}
        {
-         \node[above,yshift=1ex,font=\gcs at position@font]
-           at (.75,4) {\gcs at chord@position} ;
+         \draw
+           (.75,{.8*(\gcs at string@number-1)})
+           node[transform shape,
+           label={[text height=1.5ex,text depth=.2ex,font=\gcs at position@font]%
+             above:\gcs at chord@position}] {} ;
        }
-    \end{tikzpicture}
+     \end{scope}
+     \ifdefvoid\gcs at chord@name
+       {}
+       {\expandafter\gcs at place@chord at name\expandafter{\gcs at chord@name}}
+     \gdef\gcs at chord@name{}
+   \end{tikzpicture}
   \endgroup
 }
 
@@ -577,28 +562,37 @@
        x=\gcs at x@unit,
        y=\gcs at y@unit,
        line width=\gcs at line@width,
-       baseline=(6thstring)
+       baseline=(bass)
      ]
+     \begin{scope}[rotate=\gcs at angle,local bounding box=diagram]
+     \coordinate (bass) at (0,0) ;
+     \gcs at restrictboundingbox{scales}
      \pgfqkeys{/gcs/scales}{#1}%
-     \coordinate (6thstring) at (0,0) ;
      \foreach \fret in { 0,1,...,\gcs at scales@fret at number }
-       { \draw (1.5*\fret,0) -- (1.5*\fret,4) ; }
-     \foreach \gcs at string@pos/\gcs at string@number in
-       { 0/6, 0.8/5, 1.6/4, 2.4/3, 3.2/2, 4/1, 0 }
+       { \draw (1.5*\fret,0) -- (1.5*\fret,{.8*(\gcs at string@number-1)}) ; }
+     \foreach \gcs at string in {1,...,\gcs at string@number}
        {
          \draw
-           (0,\gcs at string@pos)
-           node[left,minimum width=2em]
-             {\gcs at string@name at format\csuse{guitar at string@\gcs at string@number}}
-           --
-           (1.5*\gcs at scales@fret at number,\gcs at string@pos) ;
+           (0,{.8*(\gcs at string@number-\gcs at string)})
+           node[transform shape,
+           label={[text height=1.5ex,text depth=.2ex]%
+             left:\gcs at string@name at format\csuse{guitar at string@\gcs at string}}] {}
+           --++(1.5*\gcs at scales@fret at number,0) ;
        }
      \ifdefvoid\gcs at scales@position
        {}
-       {%
-         \node[above,yshift=1ex,font=\gcs at position@font]
-           at (.75,4) {\gcs at scales@position} ;
+       {
+         \draw
+           (.75,{.8*(\gcs at string@number-1)})
+           node[transform shape,
+           label={[text height=1.5ex,text depth=.2ex,font=\gcs at position@font]%
+             above:\gcs at scales@position}] {} ;
        }
+     \end{scope}
+     \ifdefvoid\gcs at scales@name
+       {}
+       {\expandafter\gcs at place@scales at name\expandafter{\gcs at scales@name}}
+     \gdef\gcs at scales@name{}
     \end{tikzpicture}
   \endgroup
 }
@@ -645,5 +639,10 @@
 2013/08/25 v0.4  - added scale option that allows variable number of frets
 2014/07/16 v0.5  - add `inner sep=0pt' to `root' and `show root' styles
 2014/09/15 v0.6  - new options `chord-frets', `scales-frets' and `fret-number'
-
-TODO:
+2016/08/16 v0.7  - new option `strings=<num>' makes the string number
+                   adaptable which allows creation of ukulele and bass guitar
+                   diagrams
+                 - new option `name-below'
+                 - new option `rotate=<angle>'
+                 - new option `name-distance'
+                 - new command \newfingering{name}{fingers}{roots}



More information about the tex-live-commits mailing list