Debian Codegraph @

texmf-dist/doc/latex/guitartabs/guitartabs-doc.tex

raw
1 %NAME: guitartabs-doc.tex
2 %
3 % Andrey Babushkin, 2018/05/01
4 % [email protected]
5 %
6 % The documentation source for the guitartabs class.
7 %
8 % Released under the The LaTeX Project Public License 1.3c.
9
10 \documentclass{guitartabs}
11
12 \title{\LaTeX\ Guitar Tabs}
13 \author{Andrey Babushkin}
14 \date{June, 2018}
15
16 \usepackage{geometry}
17 \geometry{left=2.0cm, top=1.5cm, right=2.0cm, bottom=1.5cm, footskip=0cm}
18
19 \usepackage{listings}
20 \lstset{
21 keepspaces=false,
22 numbers=left,
23 language=[LaTeX]TeX,
24 basicstyle=\tt\scriptsize,
25 keywordstyle=\color{blue},
26 identifierstyle=\color{magenta},
27 morekeywords={*,
28 artistname,
29 albumtitle,
30 songname,
31 maketabheader,
32 note,
33 notel,
34 restwhole,
35 resthalf,
36 restquarter,
37 resteighth,
38 restsixteenth
39 }
40 }
41
42 \usepackage{titling}
43 \renewcommand\maketitlehooka{\null\mbox{}\vfill}
44 \renewcommand\maketitlehookd{\vfill\null}
45
46 \begin{document}
47
48 \begin{titlingpage}
49 \maketitle
50 \end{titlingpage}
51
52 \pagebreak
53 \tableofcontents
54 \pagebreak
55
56 \section{Introduction}
57
58 Many guitarists in the world use instead of music sheets guitar tabs, which is a more convenient
59 way of learning songs. Music sheets show how a melody goes: the notes, tonality, mode, time signatures etc.
60 Unfortunately, a guitar has one same note on different strings several times and the position of the left
61 hand plays its role. So, the guitar tabs were created where a different notation is used. Every line of a
62 guitar tab shows a separate string. A number on a string shows which fret should be played on which moment.
63 Of course, the a time signature is still written on the beginning of the tab and vertical lines separate
64 a tab onto bars, just like on a music sheet. There are also tuning settings written for each string.
65
66 This project describes a set of \LaTeX\space macros that allow a user to write such guitar tabs.
67
68 \begin{tabline}{3}{6}{8}{E,A,D,G,B,E}
69 \notel{1}{6}{6}{0}{8}
70 \notel{2}{6}{3}{0}{8}
71 \notel{3}{6}{2}{0}{8}
72 \notel{4}{6}{1}{0}{8}
73 \notel{5}{6}{2}{0}{8}
74 \notel{6}{6}{3}{0}{8}
75
76 \nextbar
77 \notel{1}{12}{6}{0}{8}
78 \notel{3}{12}{3}{0}{8}
79 \notel{5}{12}{2}{0}{8}
80 \notel{7}{12}{1}{0}{8}
81 \notel{9}{12}{2}{0}{8}
82 \notel{11}{12}{6}{3}{16}
83 \notel{12}{12}{6}{2}{16}
84
85 \nextbar
86 \notel{1}{12}{6}{0}{8}
87 \notel{3}{12}{3}{0}{8}
88 \notel{5}{12}{2}{0}{8}
89 \notel{7}{12}{1}{3}{8}
90 \notel{9}{12}{3}{0}{16}
91 \notel{10}{12}{1}{0}{16}
92 \notel{11}{12}{2}{0}{16}
93 \notel{12}{12}{3}{0}{16}
94 \end{tabline}
95
96 \section{Quick start}
97 \subsection{Generating header}
98
99 A new class called \textbf{\textit{guitartabs.cls}} was created, so, for using this class a command
100 \begin{lstlisting}
101 \documentclass{guitartabs}
102 \end{lstlisting}
103 should be used on the beginning of a document.
104
105 Every guitar tab has a title of a song, an album and a composer (resp. band) name. Before starting a
106 document one can use a set of macros to define these.
107 \begin{lstlisting}[firstnumber=2]
108 \artistname{Metallica}
109 \albumtitle{Metallica}
110 \songname{Nothing Else Matters}
111 \end{lstlisting}
112
113 To start writing a document one should begin with:
114 \begin{lstlisting}[firstnumber=5]
115 \begin{document}
116 \maketabheader % print the header
117
118 The code goes here...
119 \end{document}
120 \end{lstlisting}
121 As you can see, the \lstinline{\maketabheader} is used to print a header of the document.
122
123 \pagebreak
124 \subsection{List of available commands}
125
126 So, now we are ready to make some \LaTeX\ music! First of all, let me introduce a set of all available commands:
127 \vspace{0.5cm}
128
129 \begin{tabular}{ | p{4cm} | p{5cm} | p{7cm} | }
130 \hline
131 \textbf{Command}
132 & \textbf{Description}
133 & \textbf{Arguments}
134 \\ \hline
135 \textbackslash artistname\{name\}
136 & Sets an artist name who wrote or performed a composition.
137 & \textit{name} - an artist name.
138 \\ \hline
139 \textbackslash albumtitle\{title\}
140 & Sets an album title on which the song was published.
141 & \textit{title} - an album title
142 \\ \hline
143 \textbackslash songname\{name\}
144 & Sets a song name.
145 & \textit{name} - a song name.
146 \\ \hline
147 \parbox[t]{4cm}{
148 \textbackslash begin\{tabline\}
149 \\ \hspace*{1cm}\{bars\}
150 \\ \hspace*{1cm}\{tsupper\}
151 \\ \hspace*{1cm}\{tslower\}
152 \\ \hspace*{1cm}\{tuning\}
153 }
154 & Opens the environment and make \LaTeX\ ready for drawing tabs.
155 & \parbox[t]{7cm}{
156 \textit{bars} - a number of bars on a tab line.
157 \\ \textit{tsupper} - upper time signature number.
158 \\ \textit{tslower} - lower time signature number.
159 \\ \textit{tuning} - a guitar tuning, starting from the 6th string.
160 \\ E.g. E,A,D,G,B,E
161 }
162 \\ \hline
163 \textbackslash maketabheader
164 & Prints a header.
165 &
166 \\ \hline
167 \parbox[t]{4cm}{
168 \textbackslash note\{numerator\}
169 \\ \hspace*{1cm}\{denominator\}
170 \\ \hspace*{1cm}\{string\}
171 \\ \hspace*{1cm}\{fret\}
172 }
173 & Draws one note.
174 & \parbox[t]{7cm}{
175 \textit{string} - a string.
176 \\ \textit{fret} - a fret.
177 \\ \textit{numerator}
178 \\ \textit{denominator} - sets the position of a note relatively to the beginning of a bar.
179 E.g. values \{1\}\{2\} or \{8\}\{16\} print a note at the center of the bar.
180 }
181 \\ \hline
182 \parbox[t]{4cm}{
183 \textbackslash notel\{numerator\}
184 \\ \hspace*{1cm}\{denominator\}
185 \\ \hspace*{1cm}\{string\}
186 \\ \hspace*{1cm}\{fret\}
187 \\ \hspace*{1cm}\{length\}
188 }
189 & Draws one note with a note length beneath a tab line.
190 & \parbox[t]{7cm}{
191 \textit{string} - a string.
192 \\ \textit{fret} - a fret.
193 \\ \textit{numerator}
194 \\ \textit{denominator} - sets the position of a note relatively to the beginning of a bar.
195 E.g. values \{1\}\{2\} or \{8\}\{16\} print a note at the center of the bar.
196 \\ \textit{length} - 1 for a whole note, 2 for a half note etc.
197 \\ Available values for length are:
198 \\ 1, 2, 2.5, 4, 4.5, 8, 8.5, 16, 16.5
199 }
200 \\ \hline
201 \parbox[t]{4cm}{
202 \textbackslash restwhole
203 \\ \textbackslash resthalf
204 \\ \textbackslash restquarter
205 \\ \textbackslash resteighth
206 \\ \textbackslash restsixteenth
207 \\ \hspace*{1cm}\{numerator\}
208 \\ \hspace*{1cm}\{denominator\}
209 }
210 & A set of functions that draw rest symbols (whole, half, quarter, eighth, sixteenth, eighth respectively) on a selected position.
211 & \parbox[t]{7cm}{
212 \textit{numerator}
213 \\ \textit{denominator} - sets the position of a rest relatively to the beginning of a bar.
214 E.g. values \{1\}\{2\} or \{8\}\{16\} print a rest at the center of the bar.
215 }
216 \\ \hline
217 \textbackslash end\{tabline\}
218 & Closes the environment and draws a tab line.
219 &
220 \\ \hline
221 \textbackslash nextbar
222 & Moves a position of the cursor to the next bar.
223 &
224 \\ \hline
225 \end{tabular}
226
227 \vspace{0.5cm}
228 The way how the position of a note is set was chosen with a reason. Sometimes some notes are played
229 out of the rhythm of a song. For example:
230
231 \begin{tabline}{1}{4}{4}{E,A,D,G,B,E}
232 \notel{1}{2}{3}{12}{2}
233 \notel{2}{2}{3}{12}{2}
234 \notel{3}{4}{4}{12}{8}
235 \end{tabline}
236
237 So, here we have 3 notes, two of them fill the bar rhythmically but we have the 3rd note, 1/8, that goes before the second 1/2. So, such approach of setting the exact position of each note offers great flexibility.
238
239 \pagebreak
240 \subsection{Example}
241
242 So, let's have a look on the example from the introduction section:
243
244 \begin{tabline}{3}{6}{8}{E,A,D,G,B,E}
245
246 \notel{1}{6}{6}{0}{8}
247 \notel{2}{6}{3}{0}{8}
248 \notel{3}{6}{2}{0}{8}
249 \notel{4}{6}{1}{0}{8}
250 \notel{5}{6}{2}{0}{8}
251 \notel{6}{6}{3}{0}{8}
252
253 \nextbar
254 \notel{1}{12}{6}{0}{8}
255 \notel{3}{12}{3}{0}{8}
256 \notel{5}{12}{2}{0}{8}
257 \notel{7}{12}{1}{0}{8}
258 \notel{9}{12}{2}{0}{8}
259 \notel{11}{12}{6}{3}{16}
260 \notel{12}{12}{6}{2}{16}
261
262 \nextbar
263 \notel{1}{12}{6}{0}{8}
264 \notel{3}{12}{3}{0}{8}
265 \notel{5}{12}{2}{0}{8}
266 \notel{7}{12}{1}{3}{8}
267 \notel{9}{12}{3}{0}{16}
268 \notel{10}{12}{1}{0}{16}
269 \notel{11}{12}{2}{0}{16}
270 \notel{12}{12}{3}{0}{16}
271 \end{tabline}
272
273 Of course, the best way to learn something is to look at the code. Here is comes:
274
275 \begin{lstlisting}[firstnumber=1]
276 % we create a tab with 3 bars, with the time signature 6/8 and a standart guitar tuning (E, A, D, G, B, E)
277 \begin{tabline}{3}{6}{8}{E,A,D,G,B,E}
278
279 \notel{1}{6}{6}{0}{8} % 1st bar, position 1/6, 6th string, 0th fret, length 1/8
280 \notel{2}{6}{3}{0}{8} % 1st bar, position 2/6, 3rd string, 0th fret, length 1/8
281 \notel{3}{6}{2}{0}{8}
282 \notel{4}{6}{1}{0}{8}
283 \notel{5}{6}{2}{0}{8}
284 \notel{6}{6}{3}{0}{8}
285
286 \nextbar % move the cursor to the next bar
287 \notel{1}{12}{6}{0}{8}
288 \notel{3}{12}{3}{0}{8}
289 \notel{5}{12}{2}{0}{8}
290 \notel{7}{12}{1}{0}{8}
291 \notel{9}{12}{2}{0}{8}
292 \notel{11}{12}{6}{3}{16} % 2nd bar, position 11/12, 6th string, 3rd fret, length 1/16
293 \notel{12}{12}{6}{2}{16}
294
295 \nextbar
296 \notel{1}{12}{6}{0}{8}
297 \notel{3}{12}{3}{0}{8}
298 \notel{5}{12}{2}{0}{8}
299 \notel{7}{12}{1}{3}{8}
300 \notel{9}{12}{3}{0}{16}
301 \notel{10}{12}{1}{0}{16}
302 \notel{11}{12}{2}{0}{16}
303 \notel{12}{12}{3}{0}{16}
304
305 \end{tabline}
306 \end{lstlisting}
307
308 It is that simple. Of course, the position on the bar determines the length of each note, so, if
309 one does not need the length to be drawn, one can omit the last argument and use \lstinline{\note}
310 instead of \lstinline{\notel}. Everything else stays the same.
311
312 \begin{lstlisting}[firstnumber=1]
313 \begin{tabline}{3}{6}{8}{E,A,D,G,B,E}
314 \note{1}{6}{6}{0} % we use \note instead of \notel and omit the last argument
315 \note{2}{6}{3}{0}
316 \note{3}{6}{2}{0}
317 \note{4}{6}{1}{0}
318 \note{5}{6}{2}{0}
319 \note{6}{6}{3}{0}
320
321 \nextbar
322 \note{1}{12}{6}{0}
323 \note{3}{12}{3}{0}
324 \note{5}{12}{2}{0}
325 \note{7}{12}{1}{0}
326 \note{9}{12}{2}{0}
327 \note{11}{12}{6}{3}
328 \note{12}{12}{6}{2}
329
330 \nextbar
331 \note{1}{12}{6}{0}
332 \note{3}{12}{3}{0}
333 \note{5}{12}{2}{0}
334 \note{7}{12}{1}{3}
335 \note{9}{12}{3}{0}
336 \note{10}{12}{1}{0}
337 \note{11}{12}{2}{0}
338 \note{12}{12}{3}{0}
339
340 \end{tabline}
341 \end{lstlisting}
342
343 This code results in this tab line:
344
345 \begin{tabline}{3}{6}{8}{E,A,D,G,B,E}
346
347 \note{1}{6}{6}{0}
348 \note{2}{6}{3}{0}
349 \note{3}{6}{2}{0}
350 \note{4}{6}{1}{0}
351 \note{5}{6}{2}{0}
352 \note{6}{6}{3}{0}
353
354 \nextbar
355 \note{1}{12}{6}{0}
356 \note{3}{12}{3}{0}
357 \note{5}{12}{2}{0}
358 \note{7}{12}{1}{0}
359 \note{9}{12}{2}{0}
360 \note{11}{12}{6}{3}
361 \note{12}{12}{6}{2}
362
363 \nextbar
364 \note{1}{12}{6}{0}
365 \note{3}{12}{3}{0}
366 \note{5}{12}{2}{0}
367 \note{7}{12}{1}{3}
368 \note{9}{12}{3}{0}
369 \note{10}{12}{1}{0}
370 \note{11}{12}{2}{0}
371 \note{12}{12}{3}{0}
372
373 \end{tabline}
374
375 One may notice that there are no small drawn anymore underneath every note.
376
377 \pagebreak
378
379 \section{Conclusion}
380
381 The goal of this work was to create flexible and simple enough system to draw guitar tabs. In my opinion, this goal was reached. The \textbf{guitartabs} class offers a simple interface for drawing such tabs, so, a user
382 is only responsible for writing music and the class will make everything else including drawing, calculating
383 positions on the bar, setting correct size etc.
384
385 \end{document}