diff options
author | Karl Berry <karl@freefriends.org> | 2009-02-12 00:03:25 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2009-02-12 00:03:25 +0000 |
commit | acb9a71c893816044a81194578f8f1754ce8dc17 (patch) | |
tree | 058e9c3840625694ce10903bd744760e5b068f6a /Master/texmf-dist | |
parent | 4d2a3e89c58e5ada3e1792f609aa53931e26289e (diff) |
new (old) latex package gchords
git-svn-id: svn://tug.org/texlive/trunk@12144 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r-- | Master/texmf-dist/doc/latex/gchords/README | 12 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/gchords/chordbox.tcl | 178 | ||||
-rwxr-xr-x | Master/texmf-dist/doc/latex/gchords/gchords_doc.pdf | bin | 0 -> 59500 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/gchords/gchords_doc.tex | 175 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/gchords/get2knowu.tex | 112 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/gchords/gchords.sty | 281 |
6 files changed, 758 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/gchords/README b/Master/texmf-dist/doc/latex/gchords/README new file mode 100644 index 00000000000..deffd5cf3e0 --- /dev/null +++ b/Master/texmf-dist/doc/latex/gchords/README @@ -0,0 +1,12 @@ + +This is the `gchords' LaTeX package, enabling you to typeset guitar +chord diagrams. The documentation is in gchords_doc.tex (and the +associated ps file). + +D. R. Lovell kindly provided me with a TCL script which can be used to +graphically construct the diagrams and then generate TeX input files. + +All available under the GNU General Public License. + +Kasper Peeters, <K.Peeters@damtp.cam.ac.uk> + diff --git a/Master/texmf-dist/doc/latex/gchords/chordbox.tcl b/Master/texmf-dist/doc/latex/gchords/chordbox.tcl new file mode 100644 index 00000000000..e4d5fdfbe8b --- /dev/null +++ b/Master/texmf-dist/doc/latex/gchords/chordbox.tcl @@ -0,0 +1,178 @@ +# +# $Id: chordbox.tcl,v 1.4 2002/08/28 15:39:51 t16 Exp $ +# +# Graphical helper tool for gchords.sty, written by David R. Lovell, +# with additions by Kasper Peeters. +# +upvar #0 ChordBoxInfo cb +upvar #0 BlotArray blot +upvar #0 DampArray damp +wm title . "Chord Box" + +frame .top +frame .middle +frame .bottom + +set strings 6 +set frets [lindex $argv 0] +if {$frets == ""} { + puts "Usage: wish chordbox.tcl \[number of frets\]" + exit +} +set dx 0.5 +set dy 1.0 +set left $dx +set right [expr $left + ($strings - 1) * $dx] +set width [expr $right + $left] +set bottom [expr 0.3 * $dy] +set top [expr $bottom + ($frets - 1) * $dy] +set height [expr $top + $bottom] +set xgrid [expr $dx] +set ygrid [expr $dy] +canvas .c -width ${width}c -height ${height}c +.c config -cursor dot + +set cb(rad) [winfo fpixels .c [expr 0.3 * $dx]c] +set cb(gridx) [winfo fpixels .c ${dx}c] +set cb(gridy) [winfo fpixels .c ${dy}c] +set cb(left) [winfo fpixels .c ${left}c] +set cb(right) [winfo fpixels .c ${right}c] +set cb(top) [winfo fpixels .c [expr ($frets - 1) * $dy]c] +set cb(bottom) [winfo fpixels .c ${dy}c] +set cb(nut) [winfo fpixels .c ${bottom}c] +set cb(damp) [winfo fpixels .c [expr $bottom / 2]c] + +#label .name -text "Name: " +#entry .nameentry -width 15 -relief sunken -bd 2 -textvariable name +label .spell -text "Name: " +entry .spellentry -width 15 -relief sunken -bd 2 -textvariable spelling +scale .zerofret -from -1 -to 24 -length ${height}c -width 0.3c -orient vertical -variable zerofret +#set zerofret -1 +button .print -text Print -command print +button .quit -text Quit -command exit + +pack .print .quit -in .top -side left -fill x -expand 1 +pack .zerofret .c -in .middle -side left -fill y -expand 1 +pack .spellentry .spell -in .bottom -side bottom -padx 1m -pady 1m +#pack .nameentry .name -in .bottom -side bottom -padx 1m -pady 1m +pack .top .middle .bottom -side top -fill x -expand 1 + +for {set i 0} {$i < $strings} {incr i} { + set x [expr $left + $i * $dx] + .c create line ${x}c ${bottom}c ${x}c ${top}c +} +for {set i 0} {$i < [expr $frets - 1]} {incr i} { + set y [expr $bottom + $i * $dy] + .c create line ${left}c ${y}c ${right}c ${y}c +} + +bind .c <1> "mkBlot .c %x %y" + + +proc mkBlot { c x y } { + upvar #0 ChordBoxInfo cb + upvar #0 BlotArray blot + upvar #0 DampArray damp + + set cx [$c canvasx $x $cb(gridx)] + set cy [$c canvasy $y $cb(gridy)] + if {($cx < $cb(left))} { + set cx $cb(left) + } + if {($cx > $cb(right))} { + set cx $cb(right) + } + if {($cy < $cb(nut))} { + set s [expr round($cx / $cb(gridx))] + if [info exists damp($s)] { + $c delete $damp($s) + unset damp($s) + } else { + set damp($s) [$c create line \ + [expr $cx - $cb(rad)] [expr $cb(damp) - $cb(rad)]\ + [expr $cx + $cb(rad)] [expr $cb(damp) + $cb(rad)]\ + $cx $cb(damp) \ + [expr $cx - $cb(rad)] [expr $cb(damp) + $cb(rad)]\ + [expr $cx + $cb(rad)] [expr $cb(damp) - $cb(rad)]\ + ] + } + return + } + + if {($cy < $cb(bottom))} { + set cy $cb(bottom) + } + if {($cy > $cb(top))} { + set cy $cb(top) + } + set f [expr round($cy / $cb(gridy))] + set s [expr round($cx / $cb(gridx))] + +# puts "$x, $y = ($cx,$cy), $s, $f" + + if [info exists blot($s,$f)] { + $c delete $blot($s,$f) + unset blot($s,$f) + } else { + set blot($s,$f) [$c create oval\ + [expr $cx - $cb(rad)] [expr $cy - $cb(rad)] \ + [expr $cx + $cb(rad)] [expr $cy + $cb(rad)] -fill black] + } +} + +proc print {} { + upvar #0 ChordBoxInfo cb + upvar #0 frets frets + upvar #0 strings strings + upvar #0 zerofret zerofret +# upvar #0 name name + upvar #0 spelling spelling + upvar #0 BlotArray blot + upvar #0 DampArray damp + + puts "\\def\\numfrets\{$frets\}" + puts -nonewline "\\chord\{" + if {$zerofret == 0} { + puts -nonewline "t" + } + if {$zerofret > 0} { + puts -nonewline $zerofret + } + puts -nonewline "\}\{" + + for {set s 1} {$s <= $strings} {incr s} { + set nmarks 0 + for {set f 0} {$f < $frets} {incr f} { + if [info exists blot($s,$f)] { + puts -nonewline "p\{$f\}" + incr nmarks + } + } + if {$nmarks == 0} { + if [info exists damp($s)] { + puts -nonewline "x" + } else { + puts -nonewline "n" + } + } + if {$s < $strings} { + puts -nonewline "," + } + } + + puts -nonewline "\}\{" + +# if { $name != "" } { +# puts -nonewline "$name" +# } +# +# puts -nonewline "\}\{" + + if { $spelling != "" } { + regsub -all , $spelling \},\{ texspelling + regsub -all b $texspelling \\ensuremath\{\\flat\} texspelling + regsub -all \# $texspelling \\ensuremath\{\\sharp\} texspelling + puts -nonewline "\{$texspelling\}" + } + puts "\}" +} diff --git a/Master/texmf-dist/doc/latex/gchords/gchords_doc.pdf b/Master/texmf-dist/doc/latex/gchords/gchords_doc.pdf Binary files differnew file mode 100755 index 00000000000..4f44c56904e --- /dev/null +++ b/Master/texmf-dist/doc/latex/gchords/gchords_doc.pdf diff --git a/Master/texmf-dist/doc/latex/gchords/gchords_doc.tex b/Master/texmf-dist/doc/latex/gchords/gchords_doc.tex new file mode 100644 index 00000000000..d8152f93aeb --- /dev/null +++ b/Master/texmf-dist/doc/latex/gchords/gchords_doc.tex @@ -0,0 +1,175 @@ +\documentclass{article} +\usepackage{gchords} +\usepackage{geometry} +\usepackage{rotating} + +\begin{document} +\begin{center} +{\Large GCHORDS, a \LaTeXe\ package to draw guitar chord diagrams}\\ +\vskip 0.2cm +{\large by Kasper Peeters, kasper.peeters@aei.mpg.de} +\end{center} +\vskip 4cm GCHORDS is a \LaTeXe\ package to draw those familiar guitar +chord diagrams. Options are available to draw them in any size, using +any number of strings, produce black dotes or numbered circles to +denote fingers, add chordnames, show the number of the top fret, +specify fonts for almost any symbol occuring in the diagram and many +more. There is also a macro to typeset chords above lyrics. A small +TCL script for graphical construction of chord symbols is also +included. This is a short guide to show how the commands work, with a +few examples included. Feel free to contact me if you want other +features included. +\medskip + +Note that, in order for this to work, you need the \LaTeX\ `lcircle' font +in various sizes. +\medskip + +The homepage for this macro package is +{\tt http://www.damtp.cam.ac.uk/user/kp229/gchords/}. + +\renewcommand\topfretsiz{3pt} + +%------------------------------------------------------------------------- +\section{Quick guide} + +The main macro is called {\tt$\backslash$chord}, and should be used as follows: + +\bigskip +{$\backslash${\tt chord}\{{\it modifiers}\/\}\{$x_1,x_2,\ldots$\}\{{\it +name}\/\}}, where +\begin{itemize} +\item {\it modifiers}\/: Currently, there are two uses of this part. +Putting a `t' in it draws a thick top fret. Putting in an arbitrary number +(large numbers must be put in curly braces) resuls in this number being +printed at the top left corner of the diagram (denoting a fret position). +\item $x_1,x_2,\ldots$: Each $x_i$ contains the information for a single +string. Recognized commands are +\begin{itemize} +\item {\tt b}: This note is a base note and will be printed a bit larger +than the others, +\item {\tt n}: This string does not contain any dots. +\item {\tt x}: This string should be muted (a $\times$ appears above the +string). +\item {\tt o}: This string should be explicitly labelled as open (a + $\circ$ symbol appears above the +string). +\item {\tt f{\it num}\/}: This note should be played with finger number +{\it num}\/. The number will be put inside the (open) dot. +\item {\tt p{\it num}\/}: Fret number on which the dot should be +placed. If you need numbers larger than $9$, they must be enclosed in +curly braces. +\item {\tt t{\it txt}\/}: Adds a label to this string, to be put at + the very top of the diagram (useful to add the name of the note, for + instance). If you need more than one character, put the text in + curly brackets (though this probably will not fit). +\item {\tt s{\it num}\/}: Use a different string to put this note on. +\end{itemize} +\item {\it name}\/: The name of the chord. Appears underneath the diagram. +\end{itemize} +If you want to put more notes on one string, just add the $f$ and $p$ +sequences. They {\em must}\/ appear in top-down order in order for the +strings to be drawn correctly. + +The chord macro can be used in tables if you need a lot of diagrams neatly +aligned. For a row of diagrams, the shortcut {$\backslash$\texttt{chords}$\{$ +\textit{chords}$\}$} may be used (where {\it chords}\/ is a sequence of chord +macros). + +\smallchords\def\xoff{0}\def\yoff{0} A few examples will illustrate +the possibilities. First, lets put a diagram in the text itself, like +\chord{t}{n,n,p2,p2,p1,n}{}, which is just A minor. The numbers of the +fingers can be put in, resulting in +\chord{t}{n,n,f2p2,f0p2,f1p1,n}{}. Now let's make the diagrams a bit +larger and put them in a separate line, like +\def\numfrets{6}\mediumchords\def\xoff{2}\def\yoff{2} +\chords{\chord{t}{t{E}n,t{A}n,t{E}f{m}p2,t{A}f3p2,t{C}f1p1,t{E}n}{Am}\chord{t}{x,f3p3,f2p2,o,f1p1,n}{C}} +In the first diagram you can see how to put note names at the top of +the diagram. It is also possible to display a larger part of the +neck, like in \def\numfrets{10} +\chords{\chord{t}{p5,p7,p7,p6,p5,p5}{A}} which can also be displayed +as \def\numfrets{5} \chords{\chord{{5~}}{p1,p3,p3,p2,p1,p1}{A}} Nice +patterns to play are the following: +\chords{\chord{}{p1p4,p1p3,p1p3,p1p3,p1p4,p1p4}{} \def\numfrets{20} +\chord{}{p{10}p{13},p{10}p{12},p{10}p{12},p{10}p{12},p{10}p{13},p{10}p{13}}{}} + +%------------------------------------------------------------------------- +\section{Gchords and lyrics} + +You can also typeset chords above lyrics by using the {\tt +$\backslash$upchord} command, provided by Yotam Medini. You use it as +follows +\begin{verbatim} +\begin{verse} +\smallchords +\newcommand{\AsevenMaj}{\chord{t}{x,n,p2,p1,p2,n}{A7+}} +Getting to \upchord{\AsevenMaj}know you +\end{verse} +\end{verbatim} +which produces the output +\begin{verse} +\smallchords +\newcommand{\AsevenMaj}{\chord{t}{x,n,p2,p1,p2,n}{A7+}} +Getting to \upchord{\AsevenMaj}know you +\end{verse} +See the file {\tt get2knowu.tex} for a more complicated example. + +There is currently no functionality for rotated diagrams, but you can +rotate the diagrams using the ``rotating'' package: +{\smallchords\hspace{10ex}\raisebox{-10ex}{\vbox{\begin{rotate}{90} +\chord{t}{x,n,p2,p1,p2,n}{A7+} +\end{rotate}}}} + +%------------------------------------------------------------------------- +\section{Chordbox graphical chord editor} + +Included in the distribution is a small TCL script which provides a +graphical editor for chords. This script was written by David R.~Lovell. +To start it, for instance with 8 frets, type +\begin{quote} +\verb|wish chordbox.tcl 8| +\end{quote} +After constructing the chord and entering the name, press the `print' button +to see the \LaTeX{} command printed on stdout. + +It is possible to use the `b' and `\#' symbols in the `name' field to +denote `flat' and `sharp' chords. + +%------------------------------------------------------------------------- +\section{Sizes and defaults} + +It's possible to change the dimensions, fonts, number of strings etc.\ by +using one of the following settings. +\begin{itemize} +\item {$\backslash${\tt strings}\{{\it num}\/\}}: number of strings on your guitar. +\item {$\backslash${\tt numfrets}\{{\it num}\/\}}: length (number of frets) of +a diagram. +\item {$\backslash${\tt chordsize}\{{\it dim}\/\}}: distance between two frets in some +dimension known to \TeX. +\item {$\backslash${\tt fingerfont}\{{\it font}\/\}}: font used for numbering of +fingers. This can be any font, but if it is too large, the number will not +fit into the circle, so beware. +\item {$\backslash${\tt namefont}\{{\it font}\/\}}: font used when typesetting the name +of the chord. +\item {$\backslash${\tt fretposfont}\{{\it font}\/\}}: font used when typesetting the +position of on the neck of the top fret in the diagram. +\item {$\backslash${\tt dampsymbol}\{{\it symbol}\/\}}: a single symbol in any font you +like, used to denote damped strings (usually a $\times$). +\item {$\backslash${\tt fatsiz}\{{\it dec}\/\}}: size of a fat note (the physical size +will be {$\backslash${\tt fatsiz*}$\backslash${\tt chordsize/2}}). +\item {$\backslash${\tt normalsiz}\{{\it dec}\/\}}: size of a normal note. +\item {$\backslash${\tt fingsiz}\{{\it dec}\/\}}: size of the circle used to produce +`numbered fingers'. +\item {$\backslash${\tt fatfingsiz}\{{\it dec}\/\}}: size of the circle used to produce +`numbered fingers', used for the fatter notes. +\item {$\backslash${\tt topfretsiz}\{{\it dim}\}}: thickness of the + top fret (when the `t' modifier is used). +\item {$\backslash${\tt xoff}\{{\it dec}\/\}},{$\backslash${\tt yoff}\{{\it dec}\/\}}: the left lower +corner of the diagram in units of {$\backslash${\tt chordsize}}. +\end{itemize} + +There are two sizes predefined, which can be activated by +{$\backslash${\tt smallchords}} and {$\backslash${\tt mediumchords}}. + + +\end{document} diff --git a/Master/texmf-dist/doc/latex/gchords/get2knowu.tex b/Master/texmf-dist/doc/latex/gchords/get2knowu.tex new file mode 100644 index 00000000000..f9399978e46 --- /dev/null +++ b/Master/texmf-dist/doc/latex/gchords/get2knowu.tex @@ -0,0 +1,112 @@ +\documentclass[12pt]{article} + +\usepackage{geometry} +\setlength{\parindent}{0pt} +% \setlength{\textwidth}{6.5in} +\setlength{\textwidth}{7.2in} + +% \usepackage{gchords2} +\usepackage{gchords} + +\iftrue +% From: Richard Cobbe (cobbe@directlink.net) +% Subject: Re: Raised Guitar Chords in LaTeX +% Newsgroups: comp.text.tex +% Date: 2000/04/20 +% \newcommand{\chord}... + +\newcommand\mychords{ +\def\chordsize{1.6mm} % distance between two frets (and two strings) +\font\fingerfont=cmr5 % font used for numbering fingers +% \font\fingerfont=cmmi5 % font used for numbering fingers +\font\namefont=cmr10 % font used for labeling of the chord +\font\fretposfont=cmr7 % font used for the fret position marker +% \def\dampsymbol{$\scriptstyle\times$} % `damp this string' marker +\def\dampsymbol{{\tiny$\scriptstyle\times$}} % `damp this string' marker +} + +\renewcommand\yoff{3} +\renewcommand\fingsiz{1.6} + +\newcommand{\AsevenMaj}{\chord{t}{x,n,p2,p1,p2,n}{A7+}} +\newcommand{\Aseven}{\chord{t}{x,n,p2,n,p2,n}{A7}} +\newcommand{\A}{\chord{t}{x,n,p2,p2,p2,n}{A}} +\newcommand{\BmseveN}{\chord{t}{x,p2,p4,p3,p3,p2}{Bm7+}} +\newcommand{\BmsevenA}{\chord{t}{x,n,p4,p4,p3,n}{Bm/A}} +\newcommand{\Bmseven}{\chord{t}{x,p2,p4,p2,p3,p2}{Bm7}} +\newcommand{\Bm}{\chord{t}{x,p2,p4,p4,p3,p2}{Bm}} +\newcommand{\Bseven}{\chord{t}{x,f1p2,p4,f1p2,p4,f1p2,}{B7}} +\newcommand{\BsevenBasDs}{\chord{t}{x,x,p1,p2,n,p2}{B7/D\#}} +\newcommand{\CssevenLight}{\chord{t}{x,p4,p3,p4,p2,x}{C\#7}} +\newcommand{\DmBasB}{\chord{t}{x,p2,p3,p2,p3,x}{Dm/B}} +\newcommand{\DseveN}{\chord{t}{x,x,n,p2,p2,p2}{D7+}} +\newcommand{\Dsix}{\chord{t}{x,x,n,p2,n,p2}{D6}} +\newcommand{\D}{\chord{t}{x,x,n,p2,p3,p2}{D}} +\newcommand{\EseveNNine}{\chord{t}{n,f1p2,f1p2,p4,p3,f1p2,}{E79}} +\newcommand{\EseveN}{\chord{t}{n,p2,p2,p4,p3,p4}{E7}} +\newcommand{\EsevenFour}{\chord{t}{n,p2,p2,p4,p3,p5}{E7,11}} +\newcommand{\Eseven}{\chord{t}{n,p2,p2,p1,p3,n}{E7}} +\newcommand{\Fsmin}{\chord{t}{f1p2,p4,p4,f1p2,f1p2,f1p2,}{F\#m}} +\newcommand{\FsminLight}{\chord{t}{x,x,f3p4,f1p2,f1p2,f1p2,}{F\#m}} +\newcommand{\FsminBasSeveN}{\chord{t}{x,x,f3p3,f1p2,f1p2,f1p2,}{F\#m/E\#}} +\newcommand{\FsminBasSeven}{\chord{t}{x,x,f2p2,f1p2,f1p2,f1p2,}{F\#m/E}} +\newcommand{\FsminSeven}{\chord{t}{f1p2,p4,p4,f1p2,p5,f1p2,}{F\#7m}} +\newcommand{\Gsminseven}{\chord{t}{f2p4,x,f4p4,f4p4,f4p4,f4p4,}{G\#7}} + +\fi + +\begin{document} + +\mychords + +% \mediumchords +% \chord{t}{x,f3p3,f2p2,n,f1p1,f4p3,}{C} +\pagestyle{empty} + +% textwidth is \textwidth. +\begin{center} +\Large +\textbf{Getting to Know You} / \textsl{Rogers \& Hammerstein} \\ +Arranged \& Performed: \textsl{James Taylor} \\ +{\normalsize Recover \& Typeset: \textsl{Yotam Medini}} +\end{center} + +\begin{verse} + \large + Getting to \upchord{\AsevenMaj}know you, + Getting to know all \upchord{\EsevenFour}{about} \upchord{\EseveN}{you} + \quad\upchord{\EseveNNine}{\qquad } \upchord{\EseveN}{\qquad } \\ + Getting to \upchord{\Bm}{like} \quad\upchord{\BmseveN}{you}, + \upchord{\Bmseven}{Gett}ing to hope \upchord{\Eseven}{you} like + \upchord{\AsevenMaj}{me} + \qquad\upchord{\BmsevenA}{\qquad} \upchord{\Eseven}{\qquad}\\ + + Getting to \upchord{\AsevenMaj}know you, + Putting it my way, but \upchord{\D}{nice} --- \upchord{\DseveN}ly + \qquad\upchord{\Dsix}{\qquad} \\ + You are pre\upchord{\FsminSeven}{cise}ly \upchord{\Bseven}{my} cup of + \upchord{\Bmseven}{tea} \quad\upchord{\Eseven}{\quad} \\ + + Getting to \upchord{\AsevenMaj}know you, + Getting to feel free and \upchord{\EsevenFour}{ea} --- \upchord{\EseveN}{sy} + \quad\upchord{\EseveNNine}{\qquad} \upchord{\EseveN}{\qquad } \\ + When I am \upchord{\Bm}{with} \upchord{\BmseveN}{you}, + \upchord{\Bmseven}{Gett}ing to know \upchord{\Eseven}{what} to + \upchord{\A}{say} \qquad\upchord{\Aseven}{\qquad} + +\pagebreak + + Haven't you \upchord{\D}{no}ticed, + \upchord{\Gsminseven}{Suddenly} I'm \upchord{\CssevenLight}{bright} + and \upchord{\Fsmin}{breezy} \upchord{\Bseven}{\qquad}\\ + Because of \upchord{\A}{all} \quad \upchord{\Fsmin}{the} + \quad\upchord{\Bmseven}{beautiful} and \upchord{\Eseven}{new}\\ + \upchord{\FsminLight}{Things} \quad\upchord{\FsminBasSeveN}{I'm} + \qquad\upchord{\FsminBasSeven}{learning} about \upchord{\BsevenBasDs}{you}\\ + \upchord{\DmBasB}{Day} \quad\upchord{\Eseven}{by} + \qquad[ \upchord{\A}{day} \(\mid\) Getting to \ldots ] +\end{verse} + + +\end{document} + diff --git a/Master/texmf-dist/tex/latex/gchords/gchords.sty b/Master/texmf-dist/tex/latex/gchords/gchords.sty new file mode 100644 index 00000000000..b19655610b1 --- /dev/null +++ b/Master/texmf-dist/tex/latex/gchords/gchords.sty @@ -0,0 +1,281 @@ +% +% GCHORDS, a LaTeX2e package to draw guitar chord diagrams. +% +% $Id: gchords.sty,v 1.20 2009/02/04 20:25:59 peekas Exp $ +% +% Copyright (C) 2001-2009 Kasper Peeters <kasper.peeters@aei.mpg.de> +% Available under the GNU General Public License. +% +% - minor additions by D. R. Lovell, 05-nov-1998 +% - bug fixes by Yotam Medini <yotam_medini@yahoo.com>, 11-aug-2001 +% - bug fix by Brent Lievers, 23-sep-2002 +% - minor additions by P. Margarita, 14-aug-2003 +% - bug fix with f0 (thumb), thanks to Andreas Griewank, 15-jan-2005 +% - added optional open string marker, 3-feb-2008 +% +% See ChangeLog for a list of changes. +% +% The homepage for this macro package is +% +% http://www.aei.mpg.de/~peekas/gchords/ +% +%------------------------------------------------------------------------- +% Variable, user definable stuff is below. + + +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{gchords} + +% Your guitar +\newcommand\strings{6} % number of strings on your guitar +\newcommand\numfrets{5} % length (no of frets) of a diagram + +% These should be modified if you want chords in a different size +\newcommand\mediumchords{ +\def\chordsize{3.0mm} % distance between two frets (and two strings) +\font\fingerfont=cmr5 % font used for numbering fingers +\font\namefont=cmr10 % font used for labeling of the chord +\font\fretposfont=cmr7 % font used for the fret position marker +\def\dampsymbol{$\scriptstyle\times$} % symbol of the `damp this % string' marker +\def\opensymbol{$\scriptstyle\circ$} % symbol of the `open string' marker +} +\newcommand\smallchords{ +\def\chordsize{2.0mm} % distance between two frets (and two strings) +\font\fingerfont=cmr5 % font used for numbering fingers +\font\namefont=cmr10 % font used for labeling of the chord +\font\fretposfont=cmr7 % font used for the fret position marker +\def\dampsymbol{$\scriptstyle\times$} % symbol of the `damp this string' marker +\def\opensymbol{$\scriptstyle\circ$} % symbol of the `open string' marker +} + +\smallchords + +% Dot and line sizes (which scale with the chordsize macro) + +\newcommand\fatsiz{1.6} % size of a fat note +% Changed by Margarita +%\newcommand\lenbar{2.0} % lenght of sixth part of barré +\newcommand\normalsiz{1.2} % size of a normal note +\newcommand\fingsiz{1.4} % size of the circle around a numbered finger +\newcommand\fatfingsiz{1.8} % size of the circle around a numbered finger +\newcommand\topfretsiz{2.0pt} % thickness of top fret + +% Position of the chord in its bounding box +\newcommand\xoff{2} % pos(\xoff,\yoff) is left lower corner of diagram +\newcommand\yoff{2} + +%------------------------------------------------------------------------- +\def\@forc#1#2#3{\expandafter\f@rc\expandafter#1{#2 K}{#3}} +\def\f@@rc#1#2#3\f@@rc#4{\def#1{#2}#4\f@rc#1{#3}{#4}} + +% Chords above lyrics, macro by Yotam Medini. +\newlength{\cwidth}% +\newcommand{\upchord}[1]{% + \settowidth{\cwidth}{#1}% + \raisebox{\baselineskip}{#1}\hspace{-\cwidth}} + +% The chord typesetting macros. +\makeatletter +\newcommand\basenote{\circle*{\fatsiz}} +% Changed by Margarita +% \newcommand\basenote{\line(1,0){\lenbar}} +\newcommand\stdnote{\circle*{\normalsiz}} +\newcommand\fingnote{\circle{\fingsiz}} +\newcommand\fatfingnote{\circle{\fatfingsiz}} +\newcommand\cvline{\line(0,1)} +\newcommand\chline{\line(1,0)} + +\newcommand\chords[1]{$$\hbox{#1}$$} +\newcommand\chtext[1]{\vbox{\settowidth{\hsize}{#1 xxxx} {#1 + \ascale=\chordsize\vskip8\ascale}}} + +% #1 modifiers (like num, or fretbar0) +% #2 positions +% #3 chordname + +\newcount\truewidth % the true width of the diagram, computed from strings +\newcount\topline +\newcount\myvpos +\newcount\mylength +\def\fnum{ } % current f{...} symbol (number of finger) +\newcount\fpos % current p{...} value +\newcount\ghor % string number currently being drawn +\newcount\prevpos % previous value of p{...}, zero if no previous dot on string +\newcount\dlen % length of the vertical line to draw between dots +\newcount\cpos % scratch variable to hold vertical position of dot +\newcount\stpos +\newdimen\needsize +\newdimen\ascale + +\newcommand\chord[3]{\vbox{\hbox{\ascale=\chordsize +\truewidth=\strings\advance\truewidth by -1 +\advance\truewidth by \xoff +\topline=\numfrets +\advance\topline by \yoff +\advance\topline by 2 + +%%% The Diagram itself %%%%%%%%% +\unitlength\ascale +\begin{picture}(\truewidth,\topline) +\advance\topline by -1 +\advance\truewidth by -\xoff +\myvpos=\yoff\advance\myvpos by \numfrets +%%% Parse the modifier string %% +\newcommand\topbar{n} +\@tfor\modstr:=#1\do + { \def\ttest{t}% + \ifx\modstr\ttest{\linethickness{\topfretsiz}\put(\xoff,\myvpos){\chline{\truewidth}}\thinlines}% + \else {\advance\topline by -1% + \put(\xoff,\topline){\hbox to 0pt{\hss\fretposfont\modstr~}}% + }% + \fi% + } +% \@tfor\modstr:=#1\do +% { \if\modstr t{\thicklines\put(\xoff,\myvpos){\chline{\truewidth}}\thinlines}% +% \else {\advance\topline by -2% +% \put(\xoff,\topline){\hbox to 0pt{\hss\fretposfont\modstr\ }}% +% }% +% \fi% +% } + +%%% Horizontal lines (frets)%%%% +\mylength=0 +\myvpos=\yoff +\advance\myvpos by 1 % first fret starts a bit higher +\@whilenum \mylength<\numfrets \do { + \put(\xoff,\myvpos){\chline{\truewidth}} + \advance\mylength by 1 + \advance\myvpos by 1} + +%%% The Dots %%%%%%%%%%%%%%%%%%% +\newcommand\fnow{n} +\newcommand\pnow{n} +\newcommand\snow{n} +\newcommand\Lnow{n} + +\edef\notelabel{} + +\putdots{#2}{\chordsize} +\put(\xoff,0){\hbox to \truewidth\ascale{\hss\namefont #3\hss}} +\end{picture} +}}} + + +\long\def\ReturnAfterFi#1\fi{\fi#1} + \def\f@rc#1#2#3{% + \def\temp@ty{#2}% + \ifx\@empty\temp@ty + \else + \ReturnAfterFi{% + \f@@rc#1#2\f@@rc{#3}% + }% + \fi + }% + +\newcommand{\putdots}[2]{ + \prevpos=0 + \fpos=0 + \ghor=\xoff + \let\curnote\stdnote + \let\curfing\fingnote + \def\Ktest{K}\def\cotest{,}\def\btest{b}\def\ftest{f} + \def\stest{s}\def\ptest{p}\def\xtest{x}\def\otest{o}\def\etest{e}\def\ntest{n}\def\Ltest{t} + \def\attest{ } + \@forc\thisel{#1}{ + \ifx\thisel\Ktest{} + \else\ifx\thisel\cotest\cpos=-\fpos\advance\cpos by \numfrets\advance\cpos by \yoff + \dlen=\cpos + \advance\dlen by -\yoff + \put(\ghor,\yoff){\cvline{\dlen}} + \prevpos=0 + \fpos=0 + \def\fnum{ } + \renewcommand\pnow{n} + \renewcommand\fnow{n} + \renewcommand\snow{n} + \renewcommand\Lnow{n} + \advance\ghor by 1 + \else\if\fnow y \edef\fnum{\thisel}\renewcommand\fnow{n} + \else\ifx\thisel\btest\let\curnote\basenote\let\curfing\fatfingnote + \else\ifx\thisel\ftest\renewcommand\snow{n}\renewcommand\pnow{n}\renewcommand\fnow{y}\renewcommand\Lnow{n} + \else\ifx\thisel\stest\renewcommand\snow{y}\renewcommand\pnow{n}\renewcommand\fnow{n}\renewcommand\Lnow{n} + \else\ifx\thisel\ptest\renewcommand\snow{n}\renewcommand\pnow{y}\renewcommand\fnow{n}\renewcommand\Lnow{n} + \else\ifx\thisel\Ltest\renewcommand\snow{n}\renewcommand\pnow{n}\renewcommand\fnow{n}\renewcommand\Lnow{y} + \else\ifx\thisel\xtest{\put(\ghor,\yoff){\cvline{\numfrets}} + \needsize=\ascale + \divide\needsize by 2 + \unitlength\needsize + \multiply\ghor by 2 + \multiply\topline by 2 + \advance\topline by -1 + \put(\ghor,\topline){\hbox to 0pt{\hss{\dampsymbol}\hss}}} + \else\ifx\thisel\otest{\put(\ghor,\yoff){\cvline{\numfrets}} + \needsize=\ascale + \divide\needsize by 2 + \unitlength\needsize + \multiply\ghor by 2 + \multiply\topline by 2 + \advance\topline by -1 + \put(\ghor,\topline){\hbox to 0pt{\hss{\opensymbol}\hss}}} + \else\ifx\thisel\ntest\put(\ghor,\yoff){\cvline{\numfrets}} + {\needsize=\ascale + \divide\needsize by 2 + \unitlength\needsize + \multiply\ghor by 2 + \multiply\topline by 2 + \advance\topline by -1 + \put(\ghor,\topline){\hbox to 0pt{\hss{\notelabel}\hss}}} + \edef\notelabel{} + \else\if\snow y \ghor=\thisel\advance\ghor by \xoff \advance\ghor by -1 + \else\if\Lnow y \edef\notelabel{\thisel}\renewcommand\Lnow{n} + \else\prevpos=\fpos\advance\prevpos by -1 + \fpos=\thisel + \ifx\fnum\attest + \put(\ghor,\yoff){\cvline{\numfrets}} + \else + \cpos=\fpos\advance\cpos by -1 + \ifnum\cpos > \prevpos + \dlen=\fpos\advance\dlen by -\prevpos + \advance\dlen by -2 + \stpos=\topline \advance\stpos by -\fpos + \put(\ghor,\stpos){\cvline{\dlen}} + \fi + \fi + \cpos=-\fpos\advance\cpos by \numfrets\advance\cpos by \yoff + {\needsize=\ascale + \divide\needsize by 2 + \unitlength\needsize + \multiply\ghor by 2 + \multiply\cpos by 2 + \advance\cpos by 1 + \ifx\fnum\attest + % Line added by Margarita +% \linethickness{2.0pt} + \put(\ghor,\cpos){\curnote} + \else + \put(\ghor,\cpos){\curfing} + \put(\ghor,\cpos){$\vcenter{\vskip 0.5em\vbox{\hbox to 0pt{\hss{\fingerfont\fnum}\hss}}}$} + \fi} + {\needsize=\ascale + \divide\needsize by 2 + \unitlength\needsize + \multiply\ghor by 2 + \multiply\topline by 2 + \advance\topline by -1 + \put(\ghor,\topline){\hbox to 0pt{\hss{\notelabel}\hss}}} + \let\curnote\stdnote + \let\curfing\fingnote + \edef\notelabel{} + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi % one for each in the 'select' loop + } % end forc loop + \ifnum\cpos > \yoff % draw the last bit of vertical line + \dlen=\cpos + \advance\dlen by -\yoff + \put(\ghor,\yoff){\cvline{\dlen}} + \fi +} + +\makeatother + +% That's all folks! +%------------------------------------------------------------------------- |