From b06a53d1bc52d4f4f093b0c00efe229a4aeceb23 Mon Sep 17 00:00:00 2001 From: Alexandre Dupas Date: Sun, 19 Jul 2009 21:06:55 +0200 Subject: [PATCH 1/2] Add tab environment to produce guitar tabs. --- chordbook.tex | 1 - crepbook.cls | 85 +++++++++++++++++++++++++++++++++++++++++++++++++-- songs.sty | 3 ++ volume-1.tex | 1 - 4 files changed, 86 insertions(+), 4 deletions(-) diff --git a/chordbook.tex b/chordbook.tex index 7e491e1c..40fc0f2d 100644 --- a/chordbook.tex +++ b/chordbook.tex @@ -24,7 +24,6 @@ \documentclass[chorded]{crepbook} \usepackage[utf8]{inputenc} -\usepackage[pdftex]{graphicx, color} \usepackage[english,french]{babel} \newindex{titleidx}{cbtitle} diff --git a/crepbook.cls b/crepbook.cls index e1f87fb1..c16e0cfe 100644 --- a/crepbook.cls +++ b/crepbook.cls @@ -1,4 +1,4 @@ -% CREPBOOK DOCUMENT CLASS -- version 0.1 +% CREPBOOK DOCUMENT CLASS -- version 0.2 % for LaTeX2e % \NeedsTeXFormat{LaTeX2e}[1995/12/01] @@ -10,6 +10,10 @@ \RequirePackageWithOptions{songs} \RequirePackage{fancybox} \RequirePackage[bookmarks,bookmarksopen]{hyperref} +\RequirePackage[pdftex]{graphicx,xcolor} +\RequirePackage{tikz} + +\setlength{\parindent}{0cm} \def\andname{and} \def\lastandname{\unskip, and} @@ -23,12 +27,14 @@ \gdef\@subtitle{} \gdef\@version{} \gdef\@mail{} + \gdef\@email{} \gdef\@picture{} \gdef\@picturecopyright{}} \def\subtitle#1{\gdef\@subtitle{#1}} \def\version#1{\gdef\@version{#1}} \def\mail#1{\gdef\@mail{#1}} +\def\email#1{\gdef\@email{#1}} \def\licence#1{\gdef\@licence{#1}} \def\picture#1{\gdef\@picture{#1}} \def\picturecopyright#1{\gdef\@picturecopyright{#1}} @@ -127,7 +133,6 @@ \fi% } -\makeatother % Configuration of the songs package \titleprefixword{} @@ -160,3 +165,79 @@ \baselineadj=-2.5pt plus 1pt minus 0pt \versesep=8pt plus 2pt minus 2pt + +%% Code from tabs.sty +% Counters +\newcounter{tab-string} +\newcounter{tab-tempo} +\newcounter{tab-line} +% Length +\newlength{\tablen} +% Variables +\def\chordtuning{E,A,D,G,B,e} +\def\xunit{0.45} +\def\yunit{0.3} + +% The tab environmant +% \begin{tab} +% \begin{chord}[D,G,D,G,F,E] +\newenvironment{tab} +{ + \small + \setcounter{tab-line}{0} + \setcounter{tab-tempo}{0} + + \setlength{\tablen}{\xunit cm} + + % A single note + % \single + \newcommand{\single}[2]{ + % draw tuning if we are at the beginining of a new tab line + \ifnum\value{tab-tempo}=0 + \setcounter{tab-string}{6} + \foreach \tuning in \chordtuning + { + \node at (-1,\value{tab-line}+\value{tab-string}) {\tuning}; + \addtocounter{tab-string}{-1} + } + \fi + + % draw the 6 strings + \foreach \string in {1,...,6} + { + \draw[xshift=-0.5cm] (\value{tab-tempo},\value{tab-line}+\string) -- +(1,0); + } + \draw node[single] at (\value{tab-tempo},\value{tab-line}+##1) {##2}; + \addtocounter{tab-tempo}{1} + \addtolength{\tablen}{\xunit cm} + \ifnum\colwidth<\tablen + \addtocounter{tab-line}{8} + \setlength{\tablen}{\xunit cm} + \setcounter{tab-tempo}{0} + \end{tikzpicture} + \begin{tikzpicture}[ + single/.style={}, + cm={\xunit,0,0,-\yunit,(0,0)} + ] + \fi + } + % A mesure bar + % \bar + \renewcommand{\bar}{ + \draw[xshift=-0.5cm] (\value{tab-tempo},\value{tab-line}+1) --+(0,5); + } + + \begin{tikzpicture}[ + single/.style={}, + cm={\xunit,0,0,-\yunit,(0,0)} + ] + + % draw the first bar + \draw[xshift=-0.5cm] (0,1) --+(0,5); +} +{ + \end{tikzpicture} +} + +%% End of tabs.sty file +\makeatother diff --git a/songs.sty b/songs.sty index 90d99391..7e7ac682 100644 --- a/songs.sty +++ b/songs.sty @@ -134,6 +134,7 @@ \newcommand\idxcont[1]{\small\textbf{#1} (continued)} \newlength\colminheight \setlength\colminheight{123456789sp} +\newlength\colwidth \newdimen\SB@colwidth \DeclareOption{slides}{\slides} \newcommand\slides{% @@ -269,6 +270,8 @@ \advance\SB@colwidth\columnsep% \advance\SB@colwidth\textwidth% \divide\SB@colwidth\SB@numcols% + \setlength\colwidth\SB@colwidth + \addtolength\colwidth{-\columnsep} \fi% } \newcommand\SB@alloccol[1]{% diff --git a/volume-1.tex b/volume-1.tex index d5750385..b4e411aa 100644 --- a/volume-1.tex +++ b/volume-1.tex @@ -24,7 +24,6 @@ \documentclass[chorded]{crepbook} \usepackage[utf8]{inputenc} -\usepackage[pdftex]{graphicx, color} \usepackage[english,french]{babel} \newindex{titleidx}{volume1cbtitle} From f69788bff002d4cd0e1109dec761dfb9b52b2a00 Mon Sep 17 00:00:00 2001 From: Alexandre Dupas Date: Sun, 19 Jul 2009 21:07:40 +0200 Subject: [PATCH 2/2] Add guitar tab for Fuck You by Garfunkel and Oates. --- songs/Garfunkel_and_Oates/Fuck_You.sg | 28 +++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/songs/Garfunkel_and_Oates/Fuck_You.sg b/songs/Garfunkel_and_Oates/Fuck_You.sg index d17a5b8d..a92ce52f 100644 --- a/songs/Garfunkel_and_Oates/Fuck_You.sg +++ b/songs/Garfunkel_and_Oates/Fuck_You.sg @@ -1,4 +1,5 @@ \songcolumns{2} + \beginsong{F*** You}[by=Garfunkel and Oates,cov=garfunkel-and-oates] \cover @@ -8,6 +9,33 @@ \gtab{Sol}{320003} \gtab{Mi7}{020100} +\begin{tab} + \single 1 8 + \single 2 8 + \single 3 9 + \single 1 8 + \single 2 8 + \bar + \single 1 7 + \single 2 8 + \single 2 8 + \single 1 7 + \single 2 8 + \bar + \single 3 {10} + \single 3 {10} + \single 4 {10} + \single 3 {10} + \single 2 {10} + \bar + \single 1 7 + \single 2 8 + \single 2 8 + \single 1 7 + \single 2 8 + \bar +\end{tab} + \beginverse \[Do]I've \[Mim]got too many q\[Fa]uestions in my m\[Sol]ind \[Do]I've \[Mim]got too many a\[Fa]nswers to f\[Sol]ind