From fb4095fa7750d0e31cb426d30594a5fba6171763 Mon Sep 17 00:00:00 2001 From: Louis Date: Tue, 20 May 2014 23:30:37 +0200 Subject: [PATCH] [WIP] Application des discussions sur les packages Discussions : - http://github.com/patacrep/songbook-core/pull/32#issuecomment-43410215 - http://github.com/patacrep/songbook-core/commit/ba15ad1093fd28103521feed923b764102be8923#commitcomment-6359206 --- songbook_core/data/latex/SongbookUtils.sty | 30 ++---------------- songbook_core/data/latex/crepbook.sty | 36 +++++++++++++++++++--- songbook_core/data/latex/tabs.sty | 34 -------------------- songbook_core/data/templates/default.tex | 9 ------ songbook_core/data/templates/layout.tex | 7 ----- songbook_core/data/templates/patacrep.tex | 21 +++++++++++++ songbook_core/data/templates/songs.tex | 17 +++++++++- 7 files changed, 72 insertions(+), 82 deletions(-) diff --git a/songbook_core/data/latex/SongbookUtils.sty b/songbook_core/data/latex/SongbookUtils.sty index e1669b93..e6de97c8 100644 --- a/songbook_core/data/latex/SongbookUtils.sty +++ b/songbook_core/data/latex/SongbookUtils.sty @@ -9,14 +9,6 @@ \RequirePackage{graphicx,xcolor} % \RequirePackage{epstopdf} % \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} @@ -75,6 +67,8 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Multilanguage management +\def\lang#1{\def\mainlanguage{#1}} + \AtBeginDocument{ % Default names (english) \def\songlistname{Songs list} @@ -91,7 +85,7 @@ \def\songindexname{Songs Index} \def\authorindexname{Authors Index} \def\chordlistname{Chords list} - + \IfStrEq{\mainlanguage}{french}{ % French names \def\songlistname{Liste des chansons} @@ -350,24 +344,6 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Layout tweaks - -% 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} -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % One song per page? diff --git a/songbook_core/data/latex/crepbook.sty b/songbook_core/data/latex/crepbook.sty index 1954dd59..3ad6dc05 100644 --- a/songbook_core/data/latex/crepbook.sty +++ b/songbook_core/data/latex/crepbook.sty @@ -1,6 +1,7 @@ % Crepbook Package -- version 0.1 for LaTeX2e % -% This package is intended to be used with the songbook package. +% This package is intended to be used with the songbook Python program (and its +% interfaces). % It defines some layout for automatic songbook generation. % See http://github.com/patacrep/songbook-core/ @@ -19,6 +20,36 @@ \fancycapotrue \fi +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Custom hyperref options +\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} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Layout tweaks + +% 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} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Multilanguage management @@ -40,9 +71,6 @@ }{} } - -\def\lang#1{\def\mainlanguage{#1}} - % End of multilanguage management %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/songbook_core/data/latex/tabs.sty b/songbook_core/data/latex/tabs.sty index 8d1a4211..28a7cd66 100644 --- a/songbook_core/data/latex/tabs.sty +++ b/songbook_core/data/latex/tabs.sty @@ -77,40 +77,6 @@ { \end{tikzpicture} } -\else% -\newenvironment{tab}{% - \newcommand{\single}[2]{}% - \renewcommand{\bar}{}% -}{}% \fi% - - -\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 diff --git a/songbook_core/data/templates/default.tex b/songbook_core/data/templates/default.tex index fb64d884..1ba62c4a 100644 --- a/songbook_core/data/templates/default.tex +++ b/songbook_core/data/templates/default.tex @@ -80,15 +80,6 @@ \title{((title))} \author{((author))} - \subtitle{((subtitle))} - (* if version!="unknown" *) - \version{((version))} - (* endif *) - \mail{((mail))} - \web{((web))} - \picture{((picture))} - \picturecopyright{((picturecopyright))} - \footer{((footer))} \newindex{titleidx}{((filename))_title} \newauthorindex{authidx}{((filename))_auth} diff --git a/songbook_core/data/templates/layout.tex b/songbook_core/data/templates/layout.tex index 284cab7f..b7897ceb 100644 --- a/songbook_core/data/templates/layout.tex +++ b/songbook_core/data/templates/layout.tex @@ -74,19 +74,12 @@ (* endblock *) (* block songbookpackages *) -\usepackage[((booktype)), - (* for option in bookoptions *)((option)), - (* endfor *) - (* for instrument in instruments *)((instrument)), - (* endfor *)]{crepbook} (* endblock *) (* block songbookpreambule *) \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{lmodern} - - \lang{((lang))} (* endblock songbookpreambule *) (* block preambule *) diff --git a/songbook_core/data/templates/patacrep.tex b/songbook_core/data/templates/patacrep.tex index 94ba4db4..afe2dbe7 100644 --- a/songbook_core/data/templates/patacrep.tex +++ b/songbook_core/data/templates/patacrep.tex @@ -43,6 +43,17 @@ (* extends "default.tex" *) +(* block songbookpackages *) + (( super() )) + +\usepackage[((booktype)), + (* for option in bookoptions *)((option)), + (* endfor *) + (* for instrument in instruments *)((instrument)), + (* endfor *)]{crepbook} + \usepackage{chords} +(* endblock *) + (* block songbookpreambule *) \usepackage[ a4paper % paper size @@ -64,4 +75,14 @@ \renewcommand{\snumbgcolor}{SongNumberBgColor} \renewcommand{\notebgcolor}{NoteBgColor} \renewcommand{\idxbgcolor}{IndexBgColor} + + \subtitle{((subtitle))} + (* if version!="unknown" *) + \version{((version))} + (* endif *) + \mail{((mail))} + \web{((web))} + \picture{((picture))} + \picturecopyright{((picturecopyright))} + \footer{((footer))} (* endblock *) diff --git a/songbook_core/data/templates/songs.tex b/songbook_core/data/templates/songs.tex index 8ae2bf26..2ead6152 100644 --- a/songbook_core/data/templates/songs.tex +++ b/songbook_core/data/templates/songs.tex @@ -21,16 +21,31 @@ (* extends "layout.tex" *) -(* block songbookpreambule *) +(* block songbookpackages *) (( super() )) +\usepackage[((booktype)), + (* for option in bookoptions *)((option)), + (* endfor *) + (* for instrument in instruments *)((instrument)), + (* endfor *)]{SongbookUtils} +(* endblock *) + +(* block songbookpreambule *) + (( super() )) (* for lang in content.languages() *) \PassOptionsToPackage{((lang))}{babel} (* endfor *) \usepackage[((lang))]{babel} + \lang{((lang))} + \usepackage{graphicx} \graphicspath{{((datadir))/img/}} + + \makeatletter + \@ifpackageloaded{hyperref}{}{\newcommand{\phantomsection}{}} + \makeatother (* endblock *) (* block songs *)