Debian Codegraph @

lib/ChordPro/res/templates/guitar_songbook.tt

raw
1 [% # these variables are obligatory to set
2 newpage_tag = '\newpage' _ "\n" # _ is concatenate
3 emptyline_tag = '\newline'_"\n"
4 columnbreak_tag = "\\par\n"
5 beginchorus_tag = "\\begin{tcolorbox}[boxrule=0pt,frame hidden,sharp corners,enhanced,borderline west={1pt}{0pt}{black},colback=white]"
6 endchorus_tag = "\\end{tcolorbox}"
7 beginverse_tag = ""
8 endverse_tag = '\newline'
9 beginabc_tag = "\\begin{abc}"
10 endabc_tag = "\\end{abc}"
11 beginlilypond_tag = "\\begin{lilypond}"
12 endlilypond_tag = "\\end{lilypond}"
13 begingrid_tag = "\\begin{singlespace*}\n\\begin{verbatim}"
14 endgrid_tag = "\\end{verbatim}\n\\end{singlespace*}"
15 begintab_tag = "\\begin{singlespace*}\n\\begin{verbatim}"
16 endtab_tag = "\\end{verbatim}\n\\end{singlespace*}"
17 gchordstart_tag = "\\guitarChord{"
18 gchordend_tag = "}"
19 chorded_line = "" # \\guitarAccord when using \begin{guitar}
20 unchorded_line = "" # \\guitarNoChord
21 start_spaces_songline = "\\hspace{0,5cm}" #if a songline starts with spaces it will be replaced by start_spaces_songline
22 eol = '\\\\' _ "\n" #sometimes this need to be to \\ or \newline
23 %]
24 % https://ftp.rrze.uni-erlangen.de/ctan/macros/latex/contrib/guitar/guitar.pdf
25 \documentclass[a4paper]{article}
26
27 \usepackage{guitar}
28 \usepackage[most]{tcolorbox}
29 \usepackage[TS1,T1]{fontenc}
30 \usepackage[bookmarks]{hyperref}
31 \usepackage{gchords}
32 \begin{document}
33 \smallchords
34
35 \title{my Songbook}
36 \author{The Author}
37 \date{\today}
38 \maketitle
39
40 \section{Songbook-chapter}
41
42 [% FOREACH song IN songs %]
43 \newpage
44 \subsection{[% song.title %]}
45 [% IF song.chords.0 %]\begin{tcolorbox}[colback=white,colframe=black,width=0.75\textwidth,arc=3mm, auto outer arc]
46 \chords{
47 [% FOREACH chord IN song.chords %]\chord{t}{[% FOREACH fret IN chord.frets.split('');
48 IF fret != 'X';
49 IF fret != '0';
50 'p'; fret; END;
51 ELSE; 'x';
52 END;
53 IF not loop.last; ','; END;
54 END; -%]}{[% chord.chord %]} [% elements = loop.count % 5 %][% IF ((elements == 0) and (not loop.last)) %]\newline[% END %][% END %]
55 }\end{tcolorbox}[% END %]
56
57 [% FOREACH st IN song.subtitle %] [% st %] \\[% END %]
58 [% IF song.meta.composer.0 %] Composer [% song.meta.composer.0 %] \\[% END %][% IF song.meta.lyricist.0 %]lyricist [% song.meta.lyricist.0 %] \\[% END %][% IF song.meta.copyright.0 %](c) [% song.meta.copyright.0 %] \\[% END %]
59 [% song.songlines | eval #eval is obligatory to eval the variables set above %]
60 [% END %]
61
62 \end{document}