Browse Source

WIP : transformation de crepbok.cls en packages

\maketitle ne fonctionne pas, et tabs.sty n'est pas utilisé
pull/31/head
Luthaf 11 years ago
parent
commit
ba15ad1093
  1. 364
      songbook_core/data/latex/SongbookUtils.sty
  2. 596
      songbook_core/data/latex/crepbook.cls
  3. 170
      songbook_core/data/latex/crepbook.sty
  4. 117
      songbook_core/data/latex/tabs.sty
  5. 13
      songbook_core/data/templates/layout.tex

364
songbook_core/data/latex/SongbookUtils.sty

@ -0,0 +1,364 @@
% Songbook Package -- version 0.1 for LaTeX2e
%
% This package provide macro for automatic songbook
% generation. See http://github.com/patacrep/songbook-core/
\NeedsTeXFormat{LaTeX2e}[1994/06/01]
\ProvidesPackage{SongbookUtils}[2014/04/13 Songbook Package, version 0.1]
\RequirePackage{graphicx,xcolor} %
\RequirePackage{epstopdf} %
\RequirePackage{songs} %
\RequirePackage{fancybox}
\definecolor{tango-green-3}{HTML}{4e9a06}
\definecolor{tango-blue-3}{HTML}{204a87}
\RequirePackage[bookmarks,
bookmarksopen,
hyperfigures=true,
colorlinks=true,
linkcolor=tango-green-3,
urlcolor=tango-blue-3]{hyperref}
\RequirePackage{xstring}
\RequirePackage{framed}
\RequirePackage{currfile}
\newif{\iftabs}
\DeclareOption{tabs}{\tabstrue}
%\DeclareOption{notabs}{\tabsfalse} % This is the default.
\newif{\iflilypond}
\DeclareOption{lilypond}{\lilypondtrue}
%\DeclareOption{nolilypond}{\lilypondfalse}
\newif{\iflilypondauto}
\DeclareOption{lilypond}{\lilypondautotrue\lilypondtrue}
\newif{\ifdiagram}
\DeclareOption{diagram}{\diagramtrue}
%\DeclareOption{nodiagram}{\diagramfalse}
\newif{\ifimportantdiagramonly}
\DeclareOption{importantdiagramonly}{\importantdiagramonlytrue\diagramtrue}
\newif{\ifpictures}
\DeclareOption{pictures}{\picturestrue}
%\DeclareOption{nopictures}{\picturesfalse}
\newif{\ifrepeatchords}
\DeclareOption{repeatchords}{\repeatchordstrue}
%\DeclareOption{norepeatchords}{\repeatchordsfalse}
\newif{\ifukulele}
\DeclareOption{ukulele}{\ukuleletrue}
%\DeclareOption{noukulele}{\ukulelefalse}
\newif{\ifguitar}
\DeclareOption{guitar}{\guitartrue}
%\DeclareOption{noguitar}{\guitarfalse}
\newif{\ifonesongperpage}
\DeclareOption{onesongperpage}{\onesongperpagetrue}
\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{songs}}
\ProcessOptions\relax
\iflyric
\tabsfalse %
\lilypondfalse%
\nodiagramtrue%
\picturesfalse%
\renewcommand{\colbotglue}{0pt plus .5\textheight minus 0pt}%
\fi
% Patch for Debian TeXLive 2012
% A bug may produce corrupted PDF
\pdfobjcompresslevel=0
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Multilanguage management
\AtBeginDocument{
% Default names (english)
\def\songlistname{Songs list}
\def\originalsongname{Original song:}
\def\introname{intro}
\def\outroname{outro}
\def\bridgename{bridge}
\def\chorusname{chorus}
\def\versename{verse}
\def\soloname{solo}
\def\patternname{pattern}
\def\rythmname{rythm}
\def\transpositionname{transposition:}
\def\songindexname{Songs Index}
\def\authorindexname{Authors Index}
\def\chordlistname{Chords list}
\IfStrEq{\mainlanguage}{french}{
% French names
\def\songlistname{Liste des chansons}
\def\originalsongname{Chanson originale :}
\def\introname{intro}
\def\outroname{outro}
\def\bridgename{pont}
\def\chorusname{refrain}
\def\versename{couplet}
\def\soloname{solo}
\def\patternname{motif}
\def\rythmname{rythme}
\def\transpositionname{transposition :}
\def\songindexname{Index des chansons}
\def\authorindexname{Index des auteurs}
\def\chordlistname{Liste des accords}
}{}
}
\def\andname{and}
\def\lastandname{\unskip, and}
% End of multilanguage management
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Add some informations to the songs
\newlength{\coverheight}
\setlength{\coverheight}{2cm}
\newlength{\coverspace}
\setlength{\coverspace}{0.1cm}
\newcommand{\songcover}{}
\newcommand{\songalbum}{}
\newsongkey{cov}{\let\songcover\@empty}{\def\songcover{\currfiledir#1}}
\newsongkey{vcov}{\let\songcover\@empty}{\def\songcover{#1}}
\newsongkey{album}{\let\songalbum\@empty}{\def\songalbum{#1}}
\newsongkey{url}{\let\songurl\@empty}{\def\songurl{#1}}
\newsongkey{original}{\let\songoriginal\@empty}{\def\songoriginal{#1}}
% Insert cover pictures
\newcommand\cover{%
\ifpictures%
\ifx\songcover\@empty\else%
\mbox{%
\includegraphics[width=\coverheight]{\songcover}%
\hspace{\coverspace}%
}%
\fi%
\fi%
}
% display album in song header
\renewcommand{\extendprelude}{
{\bfseries\showauthors}
{\footnotesize\it\songalbum}
\IfStrEq{\songurl}{}{}{
\href{\songurl}{\includegraphics[width=.3cm]{internet}}
}
}
% display original song name in the postlude
\renewcommand{\extendpostlude}{
{\footnotesize%
\IfStrEq{\songoriginal}{}{}{
\originalsongname
\songoriginal
}
}
}
\let\utab\gtab
\let\utab@Original\utab
\newcommand{\utab@Hidden}[2]{}%
\let\gtab@Original\gtab
\newcommand{\gtab@Hidden}[2]{}%
\ifnodiagram%
\renewcommand{\gtab}{\@ifstar
\gtab@Hidden%
\gtab@Hidden%
}
\renewcommand{\utab}{\@ifstar
\utab@Hidden%
\utab@Hidden%
}
\else%
\ifimportantdiagramonly%
\renewcommand{\gtab}{\@ifstar
\gtab@Original%
\gtab@Hidden%
}
\renewcommand{\utab}{\@ifstar
\utab@Original%
\utab@Hidden%
}
\else%
\renewcommand{\gtab}{\@ifstar
\gtab@Original%
\gtab@Original%
}
\renewcommand{\utab}{\@ifstar
\utab@Original%
\utab@Original%
}
\fi%
\fi%
\ifguitar%
\else
\renewcommand{\gtab}{\@ifstar
\gtab@Hidden%
\gtab@Hidden%
}
\fi%
\ifukulele%
\else
\renewcommand{\utab}{\@ifstar
\utab@Hidden%
\utab@Hidden%
}
\fi%
% End of the new informations
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% On-the-fly compilation of lilypond files
\iflilypondauto
\epstopdfDeclareGraphicsRule{.ly}{pdf}{.pdf}{lilypond --format=pdf --output=\Gin@base\ETE@suffix\space #1}
\AppendGraphicsExtensions{.ly}
\fi
\newcommand{\lilypond}[1]{%
\iflilypond%
\includegraphics{\currfiledir#1}%
\fi%
}
\newcommand{\vlilypond}[1]{%
\iflilypond%
\includegraphics{#1}%
\fi%
}
\newcommand{\image}[2][]{%
\ifpictures%
\begin{flushright}%
\includegraphics[#1]{#2}%
\end{flushright}%
\fi%
}
\newcommand*{\Intro}{%
\introname%
}%
\newcommand*{\Outro}{%
\outroname%
}%
\newcommand*{\Bridge}{%
\bridgename%
}%
\newcommand*{\Chorus}{%
\chorusname%
}%
\newcommand*{\Verse}{%
\versename%
}%
\newcommand*{\Solo}{%
\soloname%
}%
\newcommand*{\Pattern}{%
\patternname%
}%
\newcommand*{\Rythm}{%
\rythmname%
}%
\newcommand*{\Adlib}{%
\emph{ad~lib.}%
}%
% Configuration of the songs package
% Horizontal space reserved to verse number
\setlength{\versenumwidth}{1em}
% Modifier to the space between consecutive lines of lyrics
\baselineadj=-6pt plus 0pt minus 2pt
% Space between verses and chorus
\versesep=6pt plus 2pt minus 2pt
% Paragraph indentation space
\setlength{\parindent}{0.3cm}
\ifonesongperpage%
\renewcommand\songcolumns[1]{%
\SB@cnt#1\relax%
\ifSB@preamble\else{\SB@clearpage}\fi%
\SB@numcols\SB@cnt%
\ifnum\SB@numcols>\z@%
\SB@colwidth-\columnsep%
\multiply\SB@colwidth\SB@numcols%
\advance\SB@colwidth\columnsep%
\advance\SB@colwidth\textwidth%
\divide\SB@colwidth\SB@numcols%
\else%
\ifrepchorus\SB@warnrc\fi%
\fi%
}
\fi
%% \SB@chordsoff with a greater for the line spacing
\newcommand{\CB@chordshidden}{%
\def\SB@bracket##1]{\ignorespaces}%
\let\SB@rechord\relax%
\let\SB@ch\SB@ch@off%
\ifSB@measurespec%
\ifmeasures\SB@measureson\else\SB@measuresoff\fi%
\else%
\SB@measuresoff%
\fi%
\ifSB@preamble\let\colbotglue{\z@\@plus.5\textheight}\fi%
\SB@setbaselineskip%
}
\newenvironment{repeatedchords}{%
\ifnorepeatchords%
\CB@chordshidden%
\fi
}{}%
\newenvironment{bridge}{%
\begin{framed}
\vspace{-.4cm}
\begin{verse*}
}{
\end{verse*}
\vspace{-.2cm}
\end{framed}
}
\def\removefirstch@r#1{}
\newcommand{\transposition}[1]{%
\ifnorepeatchords%
\musicnote{%
\transpositionname~
\ifthenelse{#1>0}{#1$\Uparrow$}{\removefirstch@r#1$\Downarrow$}%
}%
\else%
\transpose{#1}
\fi%
}%
\iftab
\RequirePackage{tabs}
\fi
\endinput

596
songbook_core/data/latex/crepbook.cls

@ -1,596 +0,0 @@
% CREPBOOK DOCUMENT CLASS -- version 0.2.2
% for LaTeX2e
%
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesClass{crepbook}[2012/02/19 v0.5.0 LaTeX document class for Crep
Books]
\makeatletter\def\input@path{{tex/}}
\newif{\iftabs}
\newif{\iflilypond}
\newif{\ifnodiagram}
\newif{\ifimportantdiagramonly}
\newif{\ifpictures}
\newif{\ifnorepeatchords}
\newif{\ifukulele}
\newif{\ifguitar}
\newif{\ifonesongperpage}
\tabsfalse
\lilypondfalse
\nodiagramtrue
\picturesfalse
\importantdiagramonlyfalse
\norepeatchordstrue
\ukulelefalse
\guitarfalse
\onesongperpagefalse
% Options
\DeclareOption{tabs}{\tabstrue}
\DeclareOption{notabs}{\tabsfalse}
\DeclareOption{lilypond}{\lilypondtrue}
\DeclareOption{nolilypond}{\lilypondfalse}
\DeclareOption{nodiagram}{\nodiagramtrue}
\DeclareOption{diagram}{\nodiagramfalse}
\DeclareOption{importantdiagramonly}{\importantdiagramonlytrue\nodiagramfalse}
\DeclareOption{pictures}{\picturestrue}
\DeclareOption{nopictures}{\picturesfalse}
\DeclareOption{norepeatchords}{\norepeatchordstrue}
\DeclareOption{repeatchords}{\norepeatchordsfalse}
\DeclareOption{ukulele}{\ukuleletrue}
\DeclareOption{noukulele}{\ukulelefalse}
\DeclareOption{guitar}{\guitartrue}
\DeclareOption{noguitar}{\guitarfalse}
\DeclareOption{onesongperpage}{\onesongperpagetrue}
\DeclareOption{10pt}{\PassOptionsToClass{\CurrentOption}{article}}
\DeclareOption{11pt}{\PassOptionsToClass{\CurrentOption}{article}}
\DeclareOption{12pt}{\PassOptionsToClass{\CurrentOption}{article}}
% Default options : pass to the songs package
\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{songs}}
\ProcessOptions
% Base class
\LoadClass{article}
% Main packages
\RequirePackage{graphicx,xcolor}
\RequirePackage{epstopdf}
\RequirePackage{songs}
\RequirePackage{fancybox}
\definecolor{tango-green-3}{HTML}{4e9a06}
\definecolor{tango-blue-3}{HTML}{204a87}
\RequirePackage[bookmarks,
bookmarksopen,
hyperfigures=true,
colorlinks=true,
linkcolor=tango-green-3,
urlcolor=tango-blue-3]{hyperref}
\RequirePackage{tikz}
\RequirePackage{xstring}
\RequirePackage{ifthen}
\RequirePackage{framed}
\RequirePackage{currfile}
\iflyric%
\tabsfalse%
\lilypondfalse%
\nodiagramtrue%
\picturesfalse%
\renewcommand{\colbotglue}{0pt plus .5\textheight minus 0pt}%
\fi
% Start
% Patch for Debian TeXLive 2012
% A bug may produce corrupted PDF
\pdfobjcompresslevel=0
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Multilanguage management
\AtBeginDocument{
% Default names (english)
\newcommand{\songlistname}{Songs list}
\newcommand{\labelversionname}{version:}
\newcommand{\labeldatename}{date:}
\newcommand{\labelauthorname}{authors:}
\newcommand{\labelwebname}{web:}
\newcommand{\labelmailname}{mail:}
\newcommand{\originalsongname}{Original song:}
\newcommand{\introname}{intro}
\newcommand{\outroname}{outro}
\newcommand{\bridgename}{bridge}
\newcommand{\chorusname}{chorus}
\newcommand{\versename}{verse}
\newcommand{\soloname}{solo}
\newcommand{\patternname}{pattern}
\newcommand{\rythmname}{rythm}
\newcommand{\transpositionname}{transposition:}
\newcommand{\songindexname}{Songs Index}
\newcommand{\authorindexname}{Authors Index}
\newcommand{\chordlistname}{Chords list}
\IfStrEq{\mainlanguage}{french}{
% French names
\renewcommand{\songlistname}{Liste des chansons}{}
\renewcommand{\labelversionname}{version :}
\renewcommand{\labeldatename}{date :}
\renewcommand{\labelauthorname}{auteurs :}
\renewcommand{\labelwebname}{web :}
\renewcommand{\labelmailname}{mail :}
\renewcommand{\originalsongname}{Chanson originale :}
\renewcommand{\introname}{intro}
\renewcommand{\outroname}{outro}
\renewcommand{\bridgename}{pont}
\renewcommand{\chorusname}{refrain}
\renewcommand{\versename}{couplet}
\renewcommand{\soloname}{solo}
\renewcommand{\patternname}{motif}
\renewcommand{\rythmname}{rythme}
\renewcommand{\transpositionname}{transposition :}
\renewcommand{\songindexname}{Index des chansons}
\renewcommand{\authorindexname}{Index des auteurs}
\renewcommand{\chordlistname}{Liste des accords}
}{}
}
% End of multilanguage management
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\andname{and}
\def\lastandname{\unskip, and}
\newcounter{@inst}
\newcounter{@auth}
\newcounter{auco}
\def\clearheadinfo{
\gdef\@author{No Author Given}%
\gdef\@title{No Title Given}%
\gdef\@subtitle{}
\gdef\@version{}
\gdef\@web{}
\gdef\@mail{}
\gdef\@email{}
\gdef\@picture{}
\gdef\@picturecopyright{}
}
\def\subtitle#1{\gdef\@subtitle{#1}}
\def\version#1{\gdef\@version{#1}}
\def\web#1{\gdef\@web{#1}}
\def\mail#1{\gdef\@mail{#1}}
\def\email#1{\gdef\@email{#1}}
\def\picture#1{\gdef\@picture{#1}}
\def\picturecopyright#1{\gdef\@picturecopyright{#1}}
\def\footer#1{\gdef\@footer{#1}}
\def\lang#1{\gdef\mainlanguage{#1}}
\clearheadinfo
\renewcommand\maketitle{
\@maketitle
\thispagestyle{empty}
\clearheadinfo}
%
\def\@maketitle{\newpage
\markboth{}{}%
\def\lastand{\ifnum\value{@inst}=2\relax
\unskip{} \andname\
\else
\unskip \lastandname\
\fi}%
\def\and{\stepcounter{@auth}\relax
\ifnum\value{@auth}=\value{@inst}%
\lastand
\else
\unskip,
\fi}%
\begin{center}%
{\rule{\textwidth}{1mm}}
{\Huge \bfseries\boldmath\@title \par}
\if!\@subtitle!\else {\begin{flushright}\large \bfseries\boldmath
\@subtitle \par \end{flushright}}
\fi
{\rule{\textwidth}{1mm}}
\end{center}%
\vspace{1.5cm}
\begin{flushleft}
\begin{tabular}{l l}
\if!\@version!\else{\textbf{\labelversionname}} & \@version \\ \fi
\if!\@date!\else{\textbf{\labeldatename}} & \@date \\ \fi
\if!\@author!\else{\textbf{\labelauthorname}} & \@author \\ \fi
\if!\@web!\else{\textbf{\labelwebname}} & \url{\@web} \\ \fi
\if!\@mail!\else{\textbf{\labelmailname}} & \url{\@mail} \\ \fi
\end{tabular}
\end{flushleft}
\vspace{1.5cm}
\begin{center}
\includegraphics[keepaspectratio=true, width=14cm, height=14cm]{\@picture}
\begin{flushright}
{\flushright \small \@picturecopyright}
\end{flushright}
\end{center}
\@footer
\thispagestyle{empty}
}
\newlength{\coverheight}
\setlength{\coverheight}{2cm}
\newlength{\coverspace}
\setlength{\coverspace}{0.1cm}
\newcommand{\songcover}{}
\newcommand{\songalbum}{}
\newsongkey{cov}{\let\songcover\@empty}{\def\songcover{\currfiledir#1}}
\newsongkey{vcov}{\let\songcover\@empty}{\def\songcover{#1}}
\newsongkey{album}{\let\songalbum\@empty}{\def\songalbum{#1}}
\newsongkey{url}{\let\songurl\@empty}{\def\songurl{#1}}
\newsongkey{original}{\let\songoriginal\@empty}{\def\songoriginal{#1}}
\newcommand\cover{%
\ifpictures%
\ifx\songcover\@empty\else%
\mbox{%
\includegraphics[width=\coverheight]{\songcover}%
\hspace{\coverspace}%
}%
\fi%
\fi%
}
% display album in song header
\renewcommand{\extendprelude}{
{\bfseries\showauthors}
{\footnotesize\it\songalbum}
\IfStrEq{\songurl}{}{}{
\href{\songurl}{\includegraphics[width=.3cm]{internet}}
}
}
\renewcommand{\extendpostlude}{
{\footnotesize%
\IfStrEq{\songoriginal}{}{}{
\originalsongname
\songoriginal
}
}
}
\newlength{\capoheight}
\setlength{\capoheight}{1.5cm}
\renewcommand\capo[1]{%
\ifchorded%
\iftranscapos%
\transpose{#1}%
\else%
\ifpictures
\mbox{%
\includegraphics[height=\capoheight]{capodastre}%
\put(-22,8){\Large #1}
}%
\else
\musicnote{capo: #1}%
\fi
\hspace{\coverspace}%
\fi%
\fi%
}%
\let\utab\gtab
\let\utab@Original\utab
\newcommand{\utab@Hidden}[2]{}%
\let\gtab@Original\gtab
\newcommand{\gtab@Hidden}[2]{}%
\ifnodiagram%
\renewcommand{\gtab}{\@ifstar
\gtab@Hidden%
\gtab@Hidden%
}
\renewcommand{\utab}{\@ifstar
\utab@Hidden%
\utab@Hidden%
}
\else%
\ifimportantdiagramonly%
\renewcommand{\gtab}{\@ifstar
\gtab@Original%
\gtab@Hidden%
}
\renewcommand{\utab}{\@ifstar
\utab@Original%
\utab@Hidden%
}
\else%
\renewcommand{\gtab}{\@ifstar
\gtab@Original%
\gtab@Original%
}
\renewcommand{\utab}{\@ifstar
\utab@Original%
\utab@Original%
}
\fi%
\fi%
\ifguitar%
\else
\renewcommand{\gtab}{\@ifstar
\gtab@Hidden%
\gtab@Hidden%
}
\fi%
\ifukulele%
\else
\renewcommand{\utab}{\@ifstar
\utab@Hidden%
\utab@Hidden%
}
\fi%
% On-the-fly compilation of lilypond files
\epstopdfDeclareGraphicsRule{.ly}{pdf}{.pdf}{lilypond --format=pdf --output=\Gin@base\ETE@suffix\space #1}
\AppendGraphicsExtensions{.ly}
\newcommand{\lilypond}[1]{%
\iflilypond%
\includegraphics{\currfiledir#1}%
\fi%
}
\newcommand{\vlilypond}[1]{%
\iflilypond%
\includegraphics{#1}%
\fi%
}
\newcommand{\image}[2][]{%
\ifpictures%
\begin{flushright}%
\includegraphics[#1]{#2}%
\end{flushright}%
\fi%
}
% Configuration of the songs package
\titleprefixword{}
\renewcommand{\stitlefont}{\LARGE\bf}
\renewcommand{\printchord}[1]{\small{\it#1}}
\renewcommand{\chorusfont}{\it}
\renewcommand{\showauthors}{%
\hbox{\normalsize\songauthors}%
}
\renewcommand{\idxtitlefont}{\sffamily\bfseries}
\renewcommand{\idxauthfont}{\sffamily\bfseries}
\renewcommand{\idxheadfont}{\sffamily\it\LARGE}
\renewcommand{\idxrefsfont}{\bfseries}
% Paragraph indentation space
\setlength{\parindent}{0.3cm}
%
% songs class options
%
% Horizontal space reserved to verse number
\setlength{\versenumwidth}{1em}
% Modifier to the space between consecutive lines of lyrics
\baselineadj=-6pt plus 0pt minus 2pt
% Space between verses and chorus
\versesep=6pt plus 2pt minus 2pt
% lyrics font
\renewcommand{\lyricfont}{\normalfont\normalsize}
% color used to shade song numbers.
\definecolor{SongbookShade}{HTML}{d1e4ae}
%
\iftabs%
%% 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.35}
\def\yunit{0.2}
% The tab environmant
% \begin{tab}
\newenvironment{tab}
{
\normalsize
\setcounter{tab-line}{0}
\setcounter{tab-tempo}{0}
\setlength{\tablen}{\xunit cm}
% A single note
% \single <string> <fret>
\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\hsize<\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);
}
\hspace{-\parindent}
\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}
}
\else%
\newenvironment{tab}{%
\newcommand{\single}[2]{}%
\renewcommand{\bar}{}%
}{}%
\fi%
%% End of tabs.sty file
\newcommand*{\Intro}{%
\introname%
}%
\newcommand*{\Outro}{%
\outroname%
}%
\newcommand*{\Bridge}{%
\bridgename%
}%
\newcommand*{\Chorus}{%
\chorusname%
}%
\newcommand*{\Verse}{%
\versename%
}%
\newcommand*{\Solo}{%
\soloname%
}%
\newcommand*{\Pattern}{%
\patternname%
}%
\newcommand*{\Rythm}{%
\rythmname%
}%
\newcommand*{\Adlib}{%
\emph{ad~lib.}%
}%
\let\musicnoteORIG\musicnote
\renewcommand{\musicnote}[2][]{%
\vspace{.1cm}
\IfStrEq{}{#1}{\musicnoteORIG{#2}}{
\iflanguage{#1}{\musicnoteORIG{#2}}{}
}
}
\let\textnoteORIG\textnote
\renewcommand{\textnote}[2][]{%
\vspace{.1cm}
\IfStrEq{}{#1}{\textnoteORIG{#2}}{
\iflanguage{#1}{\textnoteORIG{#2}}{}
}
}
\renewcommand{\FrameCommand}[1]{
\begin{tikzpicture}
\node[rectangle] (rect) {
\begin{minipage}{.8\textwidth}
#1
\end{minipage}
};
\draw[very thick, dashed] (rect.north west) -- (rect.south west);
\end{tikzpicture}
}
\newenvironment{bridge}{%
\begin{framed}
\vspace{-.4cm}
\begin{verse*}
}{
\end{verse*}
\vspace{-.2cm}
\end{framed}
}
%% \SB@chordsoff with a greater for the line spacing
\newcommand{\CB@chordshidden}{%
\def\SB@bracket##1]{\ignorespaces}%
\let\SB@rechord\relax%
\let\SB@ch\SB@ch@off%
\ifSB@measurespec%
\ifmeasures\SB@measureson\else\SB@measuresoff\fi%
\else%
\SB@measuresoff%
\fi%
\ifSB@preamble\let\colbotglue{\z@\@plus.5\textheight}\fi%
\SB@setbaselineskip%
}
\newenvironment{repeatedchords}{%
\ifnorepeatchords%
\CB@chordshidden%
\fi
}{}%
\ifonesongperpage%
\renewcommand\songcolumns[1]{%
\SB@cnt#1\relax%
\ifSB@preamble\else{\SB@clearpage}\fi%
\SB@numcols\SB@cnt%
\ifnum\SB@numcols>\z@%
\SB@colwidth-\columnsep%
\multiply\SB@colwidth\SB@numcols%
\advance\SB@colwidth\columnsep%
\advance\SB@colwidth\textwidth%
\divide\SB@colwidth\SB@numcols%
\else%
\ifrepchorus\SB@warnrc\fi%
\fi%
}
\fi
\def\removefirstch@r#1{}
\newcommand{\transposition}[1]{%
\ifnorepeatchords%
\musicnote{%
\transpositionname~
\ifthenelse{#1>0}{#1$\Uparrow$}{\removefirstch@r#1$\Downarrow$}%
}%
\else%
\transpose{#1}
\fi%
}%
\makeatother

170
songbook_core/data/latex/crepbook.sty

@ -0,0 +1,170 @@
% Crepbook Package -- version 0.1 for LaTeX2e
%
% This package is intend to use with the songbook package.
% It defines some layout for automatic songbook generation.
% See http://github.com/patacrep/songbook-core/
\NeedsTeXFormat{LaTeX2e}[1994/06/01]
\ProvidesPackage{crepbook}[2014/04/13 Crepbook Package, version 0.1]
\RequirePackage{SongbookUtils}
\newif{\iffancycapo}
\DeclareOption{fancy-capo}{\iffancycapotrue}
\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{SongbookUtils}}
\ProcessOptions\relax
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Multilanguage management
\AtBeginDocument{
% Default names (english)
\def\labelversionname{Version:}
\def\labeldatename{dDate:}
\def\labelauthorname{aAuthors:}
\def\labelwebname{Web:}
\def\labelmailname{Email:}
\IfStrEq{\mainlanguage}{french}{
% French names
\def\labelversionname{Version :}
\def\labeldatename{Date :}
\def\labelauthorname{Auteurs :}
\def\labelwebname{Web :}
\def\labelmailname{Mail :}
}{}
}
\def\andname{and}
\def\lastandname{\unskip, and}
% End of multilanguage management
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Title page
\def\clearheadinfo{
\gdef\@author{No Author Given}%
\gdef\@title{No Title Given}%
\gdef\@subtitle{}
\gdef\@version{}
\gdef\@web{}
\gdef\@mail{}
\gdef\@email{}
\gdef\@picture{}
\gdef\@picturecopyright{}
}
\def\subtitle#1{\gdef\@subtitle{#1}}
\def\version#1{\gdef\@version{#1}}
\def\web#1{\gdef\@web{#1}}
\def\mail#1{\gdef\@mail{#1}}
\def\email#1{\gdef\@email{#1}}
\def\picture#1{\gdef\@picture{#1}}
\def\picturecopyright#1{\gdef\@picturecopyright{#1}}
\def\footer#1{\gdef\@footer{#1}}
\def\lang#1{\gdef\mainlanguage{#1}}
\clearheadinfo
\def\maketitle{
\@maketitle
\clearheadinfo
}
\newcounter{@inst}
\newcounter{@auth}
\newcounter{auco}
\def\@titlefont{\Huge\bfseries\boldmath}
\def\@subtitlefont{\large\bfseries\boldmath}
\def\@maketitle{
\begin{titlepage}
\thispagestyle{empty}
% \markboth{}{}%
% \def\lastand{\ifnum\value{@inst}=2\relax
% \unskip{} \andname\
% \else
% \unskip \lastandname\
% \fi}%
% \def\and{\stepcounter{@auth}\relax
% \ifnum\value{@auth}=\value{@inst}%
% \lastand
% \else
% \unskip,
% \fi}%
\begin{center}%
{\rule{\textwidth}{1mm}}
{\@titlefont\@title\par}
\if!\@subtitle!\else
{\hfil\@subtitlefont\@subtitle\par}
\fi
{\rule{\textwidth}{1mm}}
\end{center}%
\vfil
\begin{flushleft}
\begin{tabular}{l l}
\if!\@version!\else{\textbf{\labelversionname}} & \@version \\ \fi
\if!\@date!\else{\textbf{\labeldatename}} & \@date \\ \fi
\if!\@author!\else{\textbf{\labelauthorname}} & \@author \\ \fi
\if!\@web!\else{\textbf{\labelwebname}} & \url{\@web} \\ \fi
\if!\@mail!\else{\textbf{\labelmailname}} & \url{\@mail} \\ \fi
\end{tabular}
\end{flushleft}
\vfil
\begin{center}
\includegraphics[keepaspectratio=true, width=12cm, height=12cm]{\@picture}
{\hfil \small \@picturecopyright}
\end{center}
\@footer
\end{titlepage}
}
% Fancy capo
\iffancycapo %
\newlength{\capoheight}
\setlength{\capoheight}{1.5cm}
\renewcommand\capo[1]{%
\iftranscapos%
\transpose{#1}%
\fi%
\mbox{%
\includegraphics[height=\capoheight]{capodastre}%
\put(-22,8){\Large #1}
}%
\fi
% Fonts definitions
\def\chordfont#1{\gdef\@chordfont{#1}}
\def\@chordfont{\small\it}
\renewcommand{\idxtitlefont}{\sffamily\bfseries}
\renewcommand{\idxauthfont}{\sffamily\bfseries}
\renewcommand{\idxheadfont}{\sffamily\it\LARGE}
\renewcommand{\idxrefsfont}{\bfseries}
% Configuration of the songs package
\titleprefixword{}
\renewcommand{\stitlefont}{\LARGE\bf}
\renewcommand{\printchord}[1]{\@chordfont #1}
\renewcommand{\chorusfont}{\it}
\renewcommand{\lyricfont}{\normalfont\normalsize}
\renewcommand{\showauthors}{%
\hbox{\normalsize\songauthors}%
}
% color used to shade song numbers.
%\definecolor{SongbookShade}{HTML}{d1e4ae}
\endinput

117
songbook_core/data/latex/tabs.sty

@ -0,0 +1,117 @@
% Tabs Package -- version 0.1 for LaTeX2e
%
% This package provide macros for tablatures creations
\NeedsTeXFormat{LaTeX2e}[1994/06/01]
\ProvidesPackage{tabs}[2014/04/13 Tabs Package, version 0.1]
\RequirePackage{tikz}
% 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.35}
\def\yunit{0.2}
% The tab environmant
% \begin{tab}
\newenvironment{tab}
{
\normalsize
\setcounter{tab-line}{0}
\setcounter{tab-tempo}{0}
\setlength{\tablen}{\xunit cm}
% A single note
% \single <string> <fret>
\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\hsize<\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);
}
\hspace{-\parindent}
\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}
}
\else%
\newenvironment{tab}{%
\newcommand{\single}[2]{}%
\renewcommand{\bar}{}%
}{}%
\fi%
%% End of tabs.sty file
\let\musicnoteORIG\musicnote
\renewcommand{\musicnote}[2][]{%
\vspace{.1cm}
\IfStrEq{}{#1}{\musicnoteORIG{#2}}{
\iflanguage{#1}{\musicnoteORIG{#2}}{}
}
}
\let\textnoteORIG\textnote
\renewcommand{\textnote}[2][]{%
\vspace{.1cm}
\IfStrEq{}{#1}{\textnoteORIG{#2}}{
\iflanguage{#1}{\textnoteORIG{#2}}{}
}
}
\renewcommand{\FrameCommand}[1]{
\begin{tikzpicture}
\node[rectangle] (rect) {
\begin{minipage}{.8\textwidth}
#1
\end{minipage}
};
\draw[very thick, dashed] (rect.north west) -- (rect.south west);
\end{tikzpicture}
}
\endinput

13
songbook_core/data/templates/layout.tex

@ -70,12 +70,13 @@
(* endvariables *)
(* block documentclass *)
\documentclass[((booktype)),
(* for option in bookoptions *)((option)),
(* endfor *)
(* for instrument in instruments *)((instrument)),
(* endfor *)
((mainfontsize))pt]{crepbook}
\documentclass[((mainfontsize))pt]{article}
\usepackage[((booktype)),
(* for option in bookoptions *)((option)),
(* endfor *)
(* for instrument in instruments *)((instrument)),
(* endfor *)]{crepbook}
(* endblock *)
(* block songbookpreambule *)

Loading…
Cancel
Save