From e0c6872cf40896c7be36b11dcc744620f10adf1d Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 2 Sep 2019 13:46:59 +0900 Subject: Initial commit --- macros/latex/contrib/guitartabs/README.md | 25 ++ macros/latex/contrib/guitartabs/guitartabs-doc.pdf | Bin 0 -> 152088 bytes macros/latex/contrib/guitartabs/guitartabs-doc.tex | 385 +++++++++++++++++++++ macros/latex/contrib/guitartabs/guitartabs.cls | 297 ++++++++++++++++ .../contrib/guitartabs/nothingelsematters.pdf | Bin 0 -> 57592 bytes .../contrib/guitartabs/nothingelsematters.tex | 222 ++++++++++++ 6 files changed, 929 insertions(+) create mode 100644 macros/latex/contrib/guitartabs/README.md create mode 100644 macros/latex/contrib/guitartabs/guitartabs-doc.pdf create mode 100644 macros/latex/contrib/guitartabs/guitartabs-doc.tex create mode 100644 macros/latex/contrib/guitartabs/guitartabs.cls create mode 100644 macros/latex/contrib/guitartabs/nothingelsematters.pdf create mode 100644 macros/latex/contrib/guitartabs/nothingelsematters.tex (limited to 'macros/latex/contrib/guitartabs') diff --git a/macros/latex/contrib/guitartabs/README.md b/macros/latex/contrib/guitartabs/README.md new file mode 100644 index 0000000000..1f4d5afa42 --- /dev/null +++ b/macros/latex/contrib/guitartabs/README.md @@ -0,0 +1,25 @@ +#OVERVIEW + +Guitartabs is a simple LaTeX class that allows guitarists to create basicĀ guitar tablatures using LaTeX. Create music and do not be bothered with macro programming. + +##REQUIREMENTS + +The environment is created using LaTeX2e and different packages. All of them are marked with \RequirePackage. + +##What's inside + +README.md - this README. +guitartabs.cls - a class with the environment. +nothingelsematters.tex - an example. +nothingelsematters.pdf - an example in PDF format. +guitartabs-doc.tex - documentation. +guitartabs-doc.pdf - documentation in PDF format. + +##License + +Released under the The LaTeX Project Public License 1.3c. + +##Contacts + +Andrey Babushkin +babusand@fit.cvut.cz \ No newline at end of file diff --git a/macros/latex/contrib/guitartabs/guitartabs-doc.pdf b/macros/latex/contrib/guitartabs/guitartabs-doc.pdf new file mode 100644 index 0000000000..1a969fde6d Binary files /dev/null and b/macros/latex/contrib/guitartabs/guitartabs-doc.pdf differ diff --git a/macros/latex/contrib/guitartabs/guitartabs-doc.tex b/macros/latex/contrib/guitartabs/guitartabs-doc.tex new file mode 100644 index 0000000000..df8b1dc12a --- /dev/null +++ b/macros/latex/contrib/guitartabs/guitartabs-doc.tex @@ -0,0 +1,385 @@ +%NAME: guitartabs-doc.tex +% +% Andrey Babushkin, 2018/05/01 +% babusand@fit.cvut.cz +% +% The documentation source for the guitartabs class. +% +% Released under the The LaTeX Project Public License 1.3c. + +\documentclass{guitartabs} + +\title{\LaTeX\ Guitar Tabs} +\author{Andrey Babushkin} +\date{June, 2018} + +\usepackage{geometry} +\geometry{left=2.0cm, top=1.5cm, right=2.0cm, bottom=1.5cm, footskip=0cm} + +\usepackage{listings} +\lstset{ + keepspaces=false, + numbers=left, + language=[LaTeX]TeX, + basicstyle=\tt\scriptsize, + keywordstyle=\color{blue}, + identifierstyle=\color{magenta}, + morekeywords={*, + artistname, + albumtitle, + songname, + maketabheader, + note, + notel, + restwhole, + resthalf, + restquarter, + resteighth, + restsixteenth + } +} + +\usepackage{titling} +\renewcommand\maketitlehooka{\null\mbox{}\vfill} +\renewcommand\maketitlehookd{\vfill\null} + +\begin{document} + + \begin{titlingpage} + \maketitle + \end{titlingpage} + + \pagebreak + \tableofcontents + \pagebreak + + \section{Introduction} + + Many guitarists in the world use instead of music sheets guitar tabs, which is a more convenient + way of learning songs. Music sheets show how a melody goes: the notes, tonality, mode, time signatures etc. + Unfortunately, a guitar has one same note on different strings several times and the position of the left + hand plays its role. So, the guitar tabs were created where a different notation is used. Every line of a + guitar tab shows a separate string. A number on a string shows which fret should be played on which moment. + Of course, the a time signature is still written on the beginning of the tab and vertical lines separate + a tab onto bars, just like on a music sheet. There are also tuning settings written for each string. + + This project describes a set of \LaTeX\space macros that allow a user to write such guitar tabs. + + \begin{tabline}{3}{6}{8}{E,A,D,G,B,E} + \notel{1}{6}{6}{0}{8} + \notel{2}{6}{3}{0}{8} + \notel{3}{6}{2}{0}{8} + \notel{4}{6}{1}{0}{8} + \notel{5}{6}{2}{0}{8} + \notel{6}{6}{3}{0}{8} + + \nextbar + \notel{1}{12}{6}{0}{8} + \notel{3}{12}{3}{0}{8} + \notel{5}{12}{2}{0}{8} + \notel{7}{12}{1}{0}{8} + \notel{9}{12}{2}{0}{8} + \notel{11}{12}{6}{3}{16} + \notel{12}{12}{6}{2}{16} + + \nextbar + \notel{1}{12}{6}{0}{8} + \notel{3}{12}{3}{0}{8} + \notel{5}{12}{2}{0}{8} + \notel{7}{12}{1}{3}{8} + \notel{9}{12}{3}{0}{16} + \notel{10}{12}{1}{0}{16} + \notel{11}{12}{2}{0}{16} + \notel{12}{12}{3}{0}{16} + \end{tabline} + + \section{Quick start} + \subsection{Generating header} + + A new class called \textbf{\textit{guitartabs.cls}} was created, so, for using this class a command + \begin{lstlisting} +\documentclass{guitartabs} + \end{lstlisting} + should be used on the beginning of a document. + + Every guitar tab has a title of a song, an album and a composer (resp. band) name. Before starting a + document one can use a set of macros to define these. + \begin{lstlisting}[firstnumber=2] +\artistname{Metallica} +\albumtitle{Metallica} +\songname{Nothing Else Matters} + \end{lstlisting} + + To start writing a document one should begin with: + \begin{lstlisting}[firstnumber=5] +\begin{document} + \maketabheader % print the header + + The code goes here... +\end{document} + \end{lstlisting} + As you can see, the \lstinline{\maketabheader} is used to print a header of the document. + + \pagebreak + \subsection{List of available commands} + + So, now we are ready to make some \LaTeX\ music! First of all, let me introduce a set of all available commands: + \vspace{0.5cm} + + \begin{tabular}{ | p{4cm} | p{5cm} | p{7cm} | } + \hline + \textbf{Command} + & \textbf{Description} + & \textbf{Arguments} + \\ \hline + \textbackslash artistname\{name\} + & Sets an artist name who wrote or performed a composition. + & \textit{name} - an artist name. + \\ \hline + \textbackslash albumtitle\{title\} + & Sets an album title on which the song was published. + & \textit{title} - an album title + \\ \hline + \textbackslash songname\{name\} + & Sets a song name. + & \textit{name} - a song name. + \\ \hline + \parbox[t]{4cm}{ + \textbackslash begin\{tabline\} + \\ \hspace*{1cm}\{bars\} + \\ \hspace*{1cm}\{tsupper\} + \\ \hspace*{1cm}\{tslower\} + \\ \hspace*{1cm}\{tuning\} + } + & Opens the environment and make \LaTeX\ ready for drawing tabs. + & \parbox[t]{7cm}{ + \textit{bars} - a number of bars on a tab line. + \\ \textit{tsupper} - upper time signature number. + \\ \textit{tslower} - lower time signature number. + \\ \textit{tuning} - a guitar tuning, starting from the 6th string. + \\ E.g. E,A,D,G,B,E + } + \\ \hline + \textbackslash maketabheader + & Prints a header. + & + \\ \hline + \parbox[t]{4cm}{ + \textbackslash note\{numerator\} + \\ \hspace*{1cm}\{denominator\} + \\ \hspace*{1cm}\{string\} + \\ \hspace*{1cm}\{fret\} + } + & Draws one note. + & \parbox[t]{7cm}{ + \textit{string} - a string. + \\ \textit{fret} - a fret. + \\ \textit{numerator} + \\ \textit{denominator} - sets the position of a note relatively to the beginning of a bar. + E.g. values \{1\}\{2\} or \{8\}\{16\} print a note at the center of the bar. + } + \\ \hline + \parbox[t]{4cm}{ + \textbackslash notel\{numerator\} + \\ \hspace*{1cm}\{denominator\} + \\ \hspace*{1cm}\{string\} + \\ \hspace*{1cm}\{fret\} + \\ \hspace*{1cm}\{length\} + } + & Draws one note with a note length beneath a tab line. + & \parbox[t]{7cm}{ + \textit{string} - a string. + \\ \textit{fret} - a fret. + \\ \textit{numerator} + \\ \textit{denominator} - sets the position of a note relatively to the beginning of a bar. + E.g. values \{1\}\{2\} or \{8\}\{16\} print a note at the center of the bar. + \\ \textit{length} - 1 for a whole note, 2 for a half note etc. + \\ Available values for length are: + \\ 1, 2, 2.5, 4, 4.5, 8, 8.5, 16, 16.5 + } + \\ \hline + \parbox[t]{4cm}{ + \textbackslash restwhole + \\ \textbackslash resthalf + \\ \textbackslash restquarter + \\ \textbackslash resteighth + \\ \textbackslash restsixteenth + \\ \hspace*{1cm}\{numerator\} + \\ \hspace*{1cm}\{denominator\} + } + & A set of functions that draw rest symbols (whole, half, quarter, eighth, sixteenth, eighth respectively) on a selected position. + & \parbox[t]{7cm}{ + \textit{numerator} + \\ \textit{denominator} - sets the position of a rest relatively to the beginning of a bar. + E.g. values \{1\}\{2\} or \{8\}\{16\} print a rest at the center of the bar. + } + \\ \hline + \textbackslash end\{tabline\} + & Closes the environment and draws a tab line. + & + \\ \hline + \textbackslash nextbar + & Moves a position of the cursor to the next bar. + & + \\ \hline + \end{tabular} + + \vspace{0.5cm} + The way how the position of a note is set was chosen with a reason. Sometimes some notes are played + out of the rhythm of a song. For example: + + \begin{tabline}{1}{4}{4}{E,A,D,G,B,E} + \notel{1}{2}{3}{12}{2} + \notel{2}{2}{3}{12}{2} + \notel{3}{4}{4}{12}{8} + \end{tabline} + + 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. + + \pagebreak + \subsection{Example} + + So, let's have a look on the example from the introduction section: + + \begin{tabline}{3}{6}{8}{E,A,D,G,B,E} + + \notel{1}{6}{6}{0}{8} + \notel{2}{6}{3}{0}{8} + \notel{3}{6}{2}{0}{8} + \notel{4}{6}{1}{0}{8} + \notel{5}{6}{2}{0}{8} + \notel{6}{6}{3}{0}{8} + + \nextbar + \notel{1}{12}{6}{0}{8} + \notel{3}{12}{3}{0}{8} + \notel{5}{12}{2}{0}{8} + \notel{7}{12}{1}{0}{8} + \notel{9}{12}{2}{0}{8} + \notel{11}{12}{6}{3}{16} + \notel{12}{12}{6}{2}{16} + + \nextbar + \notel{1}{12}{6}{0}{8} + \notel{3}{12}{3}{0}{8} + \notel{5}{12}{2}{0}{8} + \notel{7}{12}{1}{3}{8} + \notel{9}{12}{3}{0}{16} + \notel{10}{12}{1}{0}{16} + \notel{11}{12}{2}{0}{16} + \notel{12}{12}{3}{0}{16} + \end{tabline} + + Of course, the best way to learn something is to look at the code. Here is comes: + + \begin{lstlisting}[firstnumber=1] + % we create a tab with 3 bars, with the time signature 6/8 and a standart guitar tuning (E, A, D, G, B, E) + \begin{tabline}{3}{6}{8}{E,A,D,G,B,E} + + \notel{1}{6}{6}{0}{8} % 1st bar, position 1/6, 6th string, 0th fret, length 1/8 + \notel{2}{6}{3}{0}{8} % 1st bar, position 2/6, 3rd string, 0th fret, length 1/8 + \notel{3}{6}{2}{0}{8} + \notel{4}{6}{1}{0}{8} + \notel{5}{6}{2}{0}{8} + \notel{6}{6}{3}{0}{8} + + \nextbar % move the cursor to the next bar + \notel{1}{12}{6}{0}{8} + \notel{3}{12}{3}{0}{8} + \notel{5}{12}{2}{0}{8} + \notel{7}{12}{1}{0}{8} + \notel{9}{12}{2}{0}{8} + \notel{11}{12}{6}{3}{16} % 2nd bar, position 11/12, 6th string, 3rd fret, length 1/16 + \notel{12}{12}{6}{2}{16} + + \nextbar + \notel{1}{12}{6}{0}{8} + \notel{3}{12}{3}{0}{8} + \notel{5}{12}{2}{0}{8} + \notel{7}{12}{1}{3}{8} + \notel{9}{12}{3}{0}{16} + \notel{10}{12}{1}{0}{16} + \notel{11}{12}{2}{0}{16} + \notel{12}{12}{3}{0}{16} + +\end{tabline} + \end{lstlisting} + + It is that simple. Of course, the position on the bar determines the length of each note, so, if + one does not need the length to be drawn, one can omit the last argument and use \lstinline{\note} + instead of \lstinline{\notel}. Everything else stays the same. + + \begin{lstlisting}[firstnumber=1] +\begin{tabline}{3}{6}{8}{E,A,D,G,B,E} + \note{1}{6}{6}{0} % we use \note instead of \notel and omit the last argument + \note{2}{6}{3}{0} + \note{3}{6}{2}{0} + \note{4}{6}{1}{0} + \note{5}{6}{2}{0} + \note{6}{6}{3}{0} + + \nextbar + \note{1}{12}{6}{0} + \note{3}{12}{3}{0} + \note{5}{12}{2}{0} + \note{7}{12}{1}{0} + \note{9}{12}{2}{0} + \note{11}{12}{6}{3} + \note{12}{12}{6}{2} + + \nextbar + \note{1}{12}{6}{0} + \note{3}{12}{3}{0} + \note{5}{12}{2}{0} + \note{7}{12}{1}{3} + \note{9}{12}{3}{0} + \note{10}{12}{1}{0} + \note{11}{12}{2}{0} + \note{12}{12}{3}{0} + +\end{tabline} + \end{lstlisting} + + This code results in this tab line: + + \begin{tabline}{3}{6}{8}{E,A,D,G,B,E} + + \note{1}{6}{6}{0} + \note{2}{6}{3}{0} + \note{3}{6}{2}{0} + \note{4}{6}{1}{0} + \note{5}{6}{2}{0} + \note{6}{6}{3}{0} + + \nextbar + \note{1}{12}{6}{0} + \note{3}{12}{3}{0} + \note{5}{12}{2}{0} + \note{7}{12}{1}{0} + \note{9}{12}{2}{0} + \note{11}{12}{6}{3} + \note{12}{12}{6}{2} + + \nextbar + \note{1}{12}{6}{0} + \note{3}{12}{3}{0} + \note{5}{12}{2}{0} + \note{7}{12}{1}{3} + \note{9}{12}{3}{0} + \note{10}{12}{1}{0} + \note{11}{12}{2}{0} + \note{12}{12}{3}{0} + + \end{tabline} + + One may notice that there are no small drawn anymore underneath every note. + + \pagebreak + + \section{Conclusion} + + 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 + is only responsible for writing music and the class will make everything else including drawing, calculating + positions on the bar, setting correct size etc. + +\end{document} \ No newline at end of file diff --git a/macros/latex/contrib/guitartabs/guitartabs.cls b/macros/latex/contrib/guitartabs/guitartabs.cls new file mode 100644 index 0000000000..e86ba3a1da --- /dev/null +++ b/macros/latex/contrib/guitartabs/guitartabs.cls @@ -0,0 +1,297 @@ +%NAME: guitartabs.cls +% +% Andrey Babushkin, 2018/05/01 +% babusand@fit.cvut.cz +% +% A class allowing to draw guitar tablatures easily. +% +% Released under the The LaTeX Project Public License 1.3c. + +\NeedsTeXFormat{LaTeX2e} +\ProvidesClass{guitartabs}[2018/05/01 CTU FIT BI-TEX Guitar Tabs] + +% Inherit options of article +\DeclareOption*{ + \PassOptionsToClass{\CurrentOption}{article} +} +\ProcessOptions\relax +\LoadClass[10pt, a4paper]{article} + +% Proper encoding +\RequirePackage[utf8]{inputenc} + +% Needed to configure page layout +\RequirePackage{geometry} + +% Needed to use \if-\then-\else statement +\RequirePackage{xifthen} + +% Needed for creating graphics +\RequirePackage{tikz} + +% Music notation +\RequirePackage{musixtex} +\RequirePackage{harmony} + +% Some calculations +\RequirePackage{intcalc} + +%------------------------------------------------------------------------------- +% Commands for the song information +%------------------------------------------------------------------------------- + +% Define an artist +\newcommand*{\artistname}[1]{\def\@artistname{#1}} + +% Define an album title +\newcommand*{\albumtitle}[1]{\def\@albumtitle{#1}} + +% Define a song name +\newcommand*{\songname}[1]{\def\@songname{#1}} + +%------------------------------------------------------------------------------- +% Header creation commands +%------------------------------------------------------------------------------- + +\newcommand*{\maketabheader}{ + \begin{center} + \LARGE\rmfamily\bfseries\@songname% + \\% + \normalsize\rmfamily\bfseries\@artistname% + \\% + \normalsize\rmfamily\mdseries\@albumtitle% + \\% + \vspace{4mm} + \hrule + \vspace{10mm} + \end{center} +} + +%------------------------------------------------------------------------------- +% Counters +%------------------------------------------------------------------------------- + +\newcounter{tabstrings} +\newcounter{tabbars} + +\newcounter{tabcstring} +\newcounter{tabcbar} +\newcounter{tabcn} +\newcounter{tabcdn} + +\newcounter{flag} + +%------------------------------------------------------------------------------- +% A tab line environment +%------------------------------------------------------------------------------- + +\newenvironment{tabline}[4] +{ + + %------------------------------------------------------------------------------- + % Defining helpers + %------------------------------------------------------------------------------- + + \newcommand{\gtuning}{#4} + \newcommand{\timesigtop}{#2} + \newcommand{\timesigbot}{#3} + + \newcommand{\tabwidth}{ + \textwidth - 0.6cm + } + \newcommand{\ypostimetop}{ + {(\value{tabstrings} - 1) / 4} + } + \newcommand{\ypostimebot}{ + {(\value{tabstrings} - 1) / 4 * 3} + } + + %------------------------------------------------------------------------------- + % Defining symbols + %------------------------------------------------------------------------------- + + % Moves cursor to the next bar. + % + % \nextbar + % + \newcommand{\nextbar}{ + \stepcounter{tabcbar} + } + + % Draws one note on a current bar. + % + % \note{numerator}{denominator}{string}{fret} + % + \newcommand{\note}[4]{ + \pgfmathsetlengthmacro\xpos{ + % skipping time sig and tuning + 0.8cm + % skipping bars + + (\textwidth - 1.4cm) / \value{tabbars} * (\value{tabcbar} - 1) + % calculating position inside a bar + + (\textwidth - 1.4cm) / \value{tabbars} / (##2 + 1) * ##1 + } + \draw node[note] at (##3 - 1,\xpos) {##4}; + } + + % + % The same as \note but draws the length of a note under strings tab. + % + % \note{numerator}{denominator}{string}{fret}{length} + % + \newcommand{\notel}[5]{ + \note{##1}{##2}{##3}{##4} + \setcounter{flag}{0} + \ifthenelse{\lengthtest{##5 pt = 1pt }} + {\note{##1}{##2}{\value{tabstrings} + 1}{\rotatebox{180}{\Ganz}}\setcounter{flag}{1}}{} + \ifthenelse{\lengthtest{##5 pt = 2pt }} + {\note{##1}{##2}{\value{tabstrings} + 1}{\rotatebox{180}{\Halb}}\setcounter{flag}{1}}{} + \ifthenelse{\lengthtest{##5 pt = 4pt }} + {\note{##1}{##2}{\value{tabstrings} + 1}{\rotatebox{180}{\Vier}}\setcounter{flag}{1}}{} + \ifthenelse{\lengthtest{##5 pt = 8pt }} + {\note{##1}{##2}{\value{tabstrings} + 1.3}{\rotatebox{180}{\Acht}}\setcounter{flag}{1}}{} + \ifthenelse{\lengthtest{##5 pt = 16pt }} + {\note{##1}{##2}{\value{tabstrings} + 1.3}{\rotatebox{180}{\Sech}}\setcounter{flag}{1}}{} + \ifthenelse{\lengthtest{##5 pt = 2.5pt }} + {\note{##1}{##2}{\value{tabstrings} + 1}{\rotatebox{180}{\Halb}.}\setcounter{flag}{1}}{} + \ifthenelse{\lengthtest{##5 pt = 4.5pt }} + {\note{##1}{##2}{\value{tabstrings} + 1}{\rotatebox{180}{\Vier}.}\setcounter{flag}{1}}{} + \ifthenelse{\lengthtest{##5 pt = 8.5pt }} + {\note{##1}{##2}{\value{tabstrings} + 1.3}{\rotatebox{180}{\Acht}.}\setcounter{flag}{1}}{} + \ifthenelse{\lengthtest{##5 pt = 16.5pt}} + {\note{##1}{##2}{\value{tabstrings} + 1}{\rotatebox{180}{\Sech}.}\setcounter{flag}{1}}{} + \ifthenelse{\value{flag} = 0}{\note{##1}{##2}{\value{tabstrings} + 1}{?}}{} + } + + % + % Draws a whole rest symbol. + % + % \restwhole{numerator}{denominator} + % + \newcommand{\restwhole}[2]{ + \pgfmathsetlengthmacro\xpos{ + % skipping time sig and tuning + 0.8cm + % skipping bars + + (\textwidth - 1.4cm) / \value{tabbars} * (\value{tabcbar} - 1) + % calculating position inside a bar + + (\textwidth - 1.4cm) / \value{tabbars} / (##2 + 1) * ##1 + } + \draw node[.style={scale=0.7}] at (\intcalcDiv{\value{tabstrings}}{2} - 1.05,\xpos) {\GaPa}; + } + + % + % Draws a half rest symbol. + % + % \resthalf{numerator}{denominator} + % + \newcommand{\resthalf}[2]{ + \pgfmathsetlengthmacro\xpos{ + % skipping time sig and tuning + 0.8cm + % skipping bars + + (\textwidth - 1.4cm) / \value{tabbars} * (\value{tabcbar} - 1) + % calculating position inside a bar + + (\textwidth - 1.4cm) / \value{tabbars} / (##2 + 1) * ##1 + } + \draw node[.style={scale=0.7}] at (\intcalcDiv{\value{tabstrings}}{2} - 0.85,\xpos) {\HaPa}; + } + + % + % Draws a quarter rest symbol. + % + % \restquarter{numerator}{denominator} + % + \newcommand{\restquarter}[2]{ + \note{##1}{##2}{\intcalcDiv{\value{tabstrings}}{2}}{\ViPa} + } + + % + % Draws a eighth rest symbol. + % + % \resteigth{numerator}{denominator} + % + \newcommand{\resteighth}[2]{ + \note{##1}{##2}{\intcalcDiv{\value{tabstrings}}{2}}{\AcPa} + } + + % + % Draws a sixteenth rest symbol. + % + % \restsixteenth{numerator}{denominator} + % + \newcommand{\restsixteenth}[2]{ + \note{##1}{##2}{\intcalcDiv{\value{tabstrings}}{2}}{\SePa} + } + + %------------------------------------------------------------------------------- + % Setting counters + %------------------------------------------------------------------------------- + + % Set a number of strings + \setcounter{tabstrings}{0} + \foreach \tuning in \gtuning { + \addtocounter{tabstrings}{1} + } + + % Set a number of bars + \setcounter{tabbars}{#1} + + % Current bar + \setcounter{tabcbar}{1} + + %------------------------------------------------------------------------------- + % Drawing + %------------------------------------------------------------------------------- + + \begin{center} + \begin{tikzpicture}[ + note/.style={rectangle,fill=white, scale=0.7}, + cm={0,-0.3,1,0,(0,0)} + ] + + \setcounter{tabcstring}{\value{tabstrings}} + + % Drawing tuning labels + \foreach \tuning in \gtuning { + \node[ + xshift=-0.3cm, + font=\fontsize{0.2cm}{0.1cm}\selectfont + ] at (\value{tabcstring}-1,0) {\tuning}; + \addtocounter{tabcstring}{-1} + } + + % Drawing time signatures + \node[ + xshift=0.4cm, + font=\fontsize{1cm}{0.1cm}\selectfont\bfseries + ] at (\ypostimetop,0) {\timesigtop}; + + \node[ + xshift=0.4cm, + font=\fontsize{1cm}{0.1cm}\selectfont\bfseries + ] at (\ypostimebot,0) {\timesigbot}; + + % Drawing strings + \foreach \tline in {1,...,\value{tabstrings}} { + \draw (\tline - 1,0) -- (\tline - 1,\tabwidth); + } + + % Drawing bars + \draw (0,0) -- (\value{tabstrings}-1,0); + + \foreach \tbar in {1,...,\value{tabbars}} { + \pgfmathsetlengthmacro\barpos{ (\textwidth - 1.4cm) / \value{tabbars} * \tbar + 0.8cm } + \draw (0,\barpos) -- (\value{tabstrings}-1,\barpos); + } +} { + \end{tikzpicture} +\end{center} +} + +%------------------------------------------------------------------------------- +% Configure layout +%------------------------------------------------------------------------------- +\geometry{left=2.0cm, top=1.5cm, right=2.0cm, bottom=1.5cm, footskip=0cm} + + diff --git a/macros/latex/contrib/guitartabs/nothingelsematters.pdf b/macros/latex/contrib/guitartabs/nothingelsematters.pdf new file mode 100644 index 0000000000..ff6e03f322 Binary files /dev/null and b/macros/latex/contrib/guitartabs/nothingelsematters.pdf differ diff --git a/macros/latex/contrib/guitartabs/nothingelsematters.tex b/macros/latex/contrib/guitartabs/nothingelsematters.tex new file mode 100644 index 0000000000..41c5889c42 --- /dev/null +++ b/macros/latex/contrib/guitartabs/nothingelsematters.tex @@ -0,0 +1,222 @@ +%NAME: nothingelsematters.tex +% +% Andrey Babushkin, 2018/05/01 +% babusand@fit.cvut.cz +% +% An example of guitartabs class usage. +% +% Released under the The LaTeX Project Public License 1.3c. + +\documentclass{guitartabs} + +\artistname{Metallica} +\albumtitle{Metallica} +\songname{Nothing Else Matters} + +\begin{document} + \maketabheader + + Refrain: + + \begin{tabline}{3}{6}{8}{E,A,D,G,B,E} + % 1 bar + \notel{1}{2}{1}{0}{4.5} + \note{1}{2}{2}{1} + \note{1}{2}{3}{0} + \note{1}{2}{4}{2} + \note{1}{2}{5}{3} + + \notel{2}{2}{2}{2}{4.5} + \note{2}{2}{3}{2} + \note{2}{2}{4}{2} + \note{2}{2}{5}{0} + + \nextbar + + % 2 bar + \notel{1}{12}{1}{2}{8.5} + \note{1}{12}{2}{3} + \note{1}{12}{3}{2} + \note{1}{12}{4}{0} + + \notel{4}{12}{1}{2}{16} + \note{4}{12}{2}{3} + \note{4}{12}{3}{2} + \note{4}{12}{4}{0} + + \notel{5}{12}{1}{2}{16} + \note{5}{12}{2}{3} + \note{5}{12}{3}{2} + \note{5}{12}{4}{0} + + \notel{6}{12}{1}{2}{16} + \note{6}{12}{2}{3} + \note{6}{12}{3}{2} + \note{6}{12}{4}{0} + + \notel{7}{12}{1}{3}{16} + \note{7}{12}{2}{3} + \note{7}{12}{3}{2} + \note{7}{12}{4}{0} + + \notel{8}{12}{1}{2}{8} + \note{8}{12}{2}{3} + \note{8}{12}{3}{2} + \note{8}{12}{4}{0} + + \notel{10}{12}{1}{0}{8} + \note{10}{12}{2}{3} + \note{10}{12}{3}{2} + \note{10}{12}{4}{0} + + \notel{12}{12}{1}{2}{16} + \note{12}{12}{2}{3} + \note{12}{12}{3}{2} + \note{12}{12}{4}{0} + + \nextbar + + % 3 bar + \notel{1}{2}{1}{0}{4.5} + \note{1}{2}{2}{1} + \note{1}{2}{3}{0} + \note{1}{2}{4}{2} + \note{1}{2}{5}{3} + + \notel{2}{2}{2}{2}{4.5} + \note{2}{2}{3}{2} + \note{2}{2}{4}{2} + \note{2}{2}{5}{0} + \end{tabline} + + \begin{tabline}{3}{6}{8}{E,A,D,G,B,E} + % 1 bar + \notel{1}{12}{1}{2}{8.5} + \note{1}{12}{2}{3} + \note{1}{12}{3}{2} + \note{1}{12}{4}{0} + + \notel{4}{12}{1}{2}{16} + \note{4}{12}{2}{3} + \note{4}{12}{3}{2} + \note{4}{12}{4}{0} + + \notel{5}{12}{1}{2}{16} + \note{5}{12}{2}{3} + \note{5}{12}{3}{2} + \note{5}{12}{4}{0} + + \notel{6}{12}{1}{2}{16} + \note{6}{12}{2}{3} + \note{6}{12}{3}{2} + \note{6}{12}{4}{0} + + \notel{7}{12}{1}{3}{16} + \note{7}{12}{2}{3} + \note{7}{12}{3}{2} + \note{7}{12}{4}{0} + + \notel{8}{12}{1}{2}{8} + \note{8}{12}{2}{3} + \note{8}{12}{3}{2} + \note{8}{12}{4}{0} + + \notel{10}{12}{1}{0}{8} + \note{10}{12}{2}{3} + \note{10}{12}{3}{2} + \note{10}{12}{4}{0} + + \notel{12}{12}{1}{2}{16} + \note{12}{12}{2}{3} + \note{12}{12}{3}{2} + \note{12}{12}{4}{0} + + \nextbar + + % 2 bar + \notel{1}{2}{1}{0}{4.5} + \note{1}{2}{2}{1} + \note{1}{2}{3}{0} + \note{1}{2}{4}{2} + \note{1}{2}{5}{3} + + \notel{2}{2}{2}{2}{4.5} + \note{2}{2}{3}{2} + \note{2}{2}{4}{2} + \note{2}{2}{5}{0} + + \nextbar + + % 3 bar + \notel{1}{6}{1}{2}{8} + \note{1}{6}{2}{3} + \note{1}{6}{3}{2} + \note{1}{6}{4}{0} + + \notel{3}{6}{1}{2}{16} + \note{3}{6}{2}{3} + \note{3}{6}{3}{2} + \note{3}{6}{4}{0} + + \notel{4}{6}{1}{2}{16} + \note{4}{6}{2}{3} + \note{4}{6}{3}{2} + \note{4}{6}{4}{0} + + \notel{5}{6}{1}{2}{8} + \note{5}{6}{2}{3} + \note{5}{6}{3}{2} + \note{5}{6}{4}{0} + \end{tabline} + + \begin{tabline}{3}{6}{8}{E,A,D,G,B,E} + % 1 bar + \notel{1}{6}{6}{0}{8} + \notel{2}{6}{3}{0}{8} + \notel{3}{6}{2}{0}{8} + \notel{4}{6}{1}{0}{8} + \notel{5}{6}{2}{0}{8} + \notel{6}{6}{3}{0}{8} + + \nextbar + + % 2 bar + \notel{1}{12}{6}{0}{8} + \notel{3}{12}{3}{0}{8} + \notel{5}{12}{2}{0}{8} + \notel{7}{12}{1}{0}{8} + \notel{9}{12}{2}{0}{8} + \notel{11}{12}{6}{3}{16} + \notel{12}{12}{6}{2}{16} + + \nextbar + + % 3 bar + \notel{1}{12}{6}{0}{8} + \notel{3}{12}{3}{0}{8} + \notel{5}{12}{2}{0}{8} + \notel{7}{12}{1}{3}{8} + \notel{9}{12}{3}{0}{16} + \notel{10}{12}{1}{0}{16} + \notel{11}{12}{2}{0}{16} + \notel{12}{12}{3}{0}{16} + \end{tabline} + + \vspace{2cm} + + Here I demonstrate the functionality of drawing pauses: + + \begin{tabline}{1}{}{}{E,A,D,G,B,E} + % Pauses + \restwhole{1}{5} + \resthalf{2}{5} + \restquarter{3}{5} + \resteighth{4}{5} + \restsixteenth{5}{5} + + + \end{tabline} + + + +\end{document} \ No newline at end of file -- cgit v1.2.3