diff --git a/gchords.sty b/gchords.sty index 0d811b5..73b363f 100644 --- a/gchords.sty +++ b/gchords.sty @@ -55,6 +55,7 @@ \newcommand\fatsiz{1.6} % size of a fat note % Changed by Margarita %\newcommand\lenbar{2.0} % lenght of sixth part of barré +\newcommand\barrecirclesiz{0.9} % size of barre's rounded extreme \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 @@ -107,6 +108,53 @@ \newdimen\needsize \newdimen\ascale +\newcount\barrefret +\newcount\barrefrom +\newcount\barreto +\newif\ifbarre +\barrefalse + +\newcount\@barreX +\newcount\@barreY +\newcount\@barreW + +\newcommand{\setbarre}[3]{% + \global\barrefret=#1\relax + \global\barrefrom=#2\relax + \global\barreto=#3\relax + \global\barretrue +} + +\newcommand{\@drawbarre}{% + % Switch to half-units, same as putdots does for dots + \needsize=\ascale\divide\needsize by 2 + \unitlength\needsize + % y: center of the barré-fret-slot + \@barreY=\numfrets + \advance\@barreY by \yoff + \advance\@barreY by -\barrefret + \multiply\@barreY by 2 + \advance\@barreY by 1 + % x: position of the first string + \@barreX=\barrefrom + \advance\@barreX by \xoff + \advance\@barreX by -1 + \multiply\@barreX by 2 + % width: number of strings + \@barreW=\barreto + \advance\@barreW by -\barrefrom + \multiply\@barreW by 2 + % Line with filled circles at the extremes for rounded edges + \linethickness{3.5pt} + \put(\@barreX,\@barreY){\line(1,0){\@barreW}} + \thinlines + \put(\@barreX,\@barreY){\circle*{\barrecirclesiz}} + \advance\@barreX by \@barreW + \put(\@barreX,\@barreY){\circle*{\barrecirclesiz}} + % Restore unitlength + \unitlength\ascale +} + \newcommand\chord[3]{\vbox{\hbox{\ascale=\chordsize \truewidth=\strings\advance\truewidth by -1 \advance\truewidth by \xoff @@ -156,6 +204,7 @@ \edef\notelabel{} \putdots{#2}{\chordsize} +\ifbarre\@drawbarre\global\barrefalse\fi \put(\xoff,0){\hbox to \truewidth\ascale{\hss\namefont #3\hss}} \end{picture} }}} diff --git a/gchords_doc.pdf b/gchords_doc.pdf index b8b3822..a239d4b 100644 Binary files a/gchords_doc.pdf and b/gchords_doc.pdf differ diff --git a/gchords_doc.tex b/gchords_doc.tex index b0cacf7..94097b9 100644 --- a/gchords_doc.tex +++ b/gchords_doc.tex @@ -100,6 +100,21 @@ \section{Quick guide} \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{Barre} + +You can add a barre by prefixing it to the {\tt $\backslash$chord} command. \\ +Example: +\begin{verbatim} + \setbarre{2}{1}{6}\chord{t}{n,p4,p4,p3,n,n}{FIS} +\end{verbatim} +Which produces \\ \setbarre{2}{1}{6}\chord{t}{n,p4,p4,p3,n,n}{FIS} \\ +The first argument to {\tt $\backslash$setbarre} denotes the bar where the barre +must be located; the second denotes the string from which to start the barre; +the third denotes the string at which to end the barre. + + %------------------------------------------------------------------------- \section{Gchords and lyrics}