MAJOR=4 MINOR=41 DEVNAME=tty41 8ˆl–ßi~”TÊ:”ú‚ÆÁp©‹Fÿ�þDè^Y·Jä�¿(6�üÿÊ „¿ÏÇÄÌ'%% file: chordbars.sty %% Copyright 2018 M. Sebastien Kramm % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3c % of this license or (at your option) any later version. % The latest version of this license is in % http://www.latex-project.org/lppl.txt % and version 1.3 or later is part of all distributions of LaTeX % version 2005/12/01 or later. % % This work has the LPPL maintenance status `maintained'. % % The Current Maintainer of this work is M. Sebastien Kramm % % This work consists of the files chordbars.sty and chordbars_manual.tex % Home page: https://github.com/skramm/chordbars % TODO define command to have 1 chord per beat \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{chordbars}[2017-12-29 version 1.1] \RequirePackage{tikz} \RequirePackage{pgfmath} \RequirePackage{tkz-euclide} \usetikzlibrary{math,shapes} \RequirePackage{calc} \RequirePackage{ifthen} %\RequirePackage{fixltx2e} \def\vspacebefore{1ex} \def\vspaceafter{1ex} \newcommand{\songtitle} { \begin{center}% \begin{tikzpicture}[line width=1.5pt] \tikzstyle{block} = [rectangle, draw, text width=20em, text centered, minimum height=4em] \node [block,font=\fontsize{20}{28}\selectfont\bfseries] (init) { \@title\\ \@author }; \end{tikzpicture} \end{center}% \par \vskip 1.5em } \newcounter{NumMesure} \newcounter{NumPart} \newcounter{CurrentBarInLine} \newcounter{CurrentBar} \newcounter{CurrentLine} \newcommand{\bpm}[1] { \xdef\tempoBPM{#1} \rightline{Tempo=#1 BPM} } % "Beats Per Bar" % default value \xdef\bpb{4} \newcommand{\bpbfour} { \xdef\bpb{4} } \newcommand{\bpbthree} { \xdef\bpb{3} } \newcommand{\resetchordbars} { \setcounter{NumMesure}{0} \setcounter{NumPart}{0} \setcounter{CurrentBarInLine}{0} } \newcommand{\printNbBars} { \ifthenelse{\boolean{printBarNumber}} { Total number of bars: \arabic{NumMesure}, duration=\pgfmathparse{\theNumMesure/\tempoBPM*60*\bpb}\pgfmathresult {} s. }{} } \newboolean{printBarNumber} \newcommand{\countbarsYes} { \setboolean{printBarNumber}{true} } \newcommand{\countbarsNo} { \setboolean{printBarNumber}{false} } \def\barsize{1.6}% \def\delta{0.36} \def\chordFontSize{\normalsize \bfseries} \def\titleFontSize{\large \bfseries} \xdef\NumberOfBarsPerLine{4} % arg1: chord % arg2: number of bars % arg3: title \newcommand{\chordline}[3] { {\fontfamily{phv}\selectfont \noindent\ignorespaces % \vspace{\vspacebefore} \refstepcounter{NumMesure}% \refstepcounter{NumPart}% \begin{tikzpicture}[line width=1pt,x=1cm,y=-1cm] % draw part title \ifthenelse {\boolean{printBarNumber}} { \draw (0,-\barsize*.2) node [anchor=west, align=left,font=\titleFontSize] {Part \theNumPart: #3}; \draw (-.3,.5*\barsize) node{\bf \theNumMesure}; } { \draw (0,-\barsize*.2) node [anchor=west, align=left,font=\titleFontSize] {#3}; } \draw (0,0) -- (#2*\barsize,0); % horizontal lines \draw (0,\barsize) -- (#2*\barsize,\barsize); \draw (0,0) -- (0,\barsize); % first vertical line \draw (\barsize,0) -- (\barsize,\barsize); % second vertical line \draw (\barsize/2,\barsize/2) node [font=\chordFontSize]{#1}; % chord name \foreach \k in {2,...,{#2}} { \draw (\k*\barsize,0) -- (\k*\barsize,\barsize); \pgfmathsetmacro{\Axa}{(\k-1)*\barsize+\delta*\barsize} \pgfmathsetmacro{\Axb}{\k*\barsize-\delta*\barsize} \pgfmathsetmacro{\Aya}{(1-\delta)*\barsize} \pgfmathsetmacro{\Ayb}{\delta*\barsize} \coordinate (A) at (\Axa,\Ayb); \coordinate (B) at (\Axb,\Aya); \fill (A) circle[radius=2pt]; \fill (B) circle[radius=2pt]; \draw [thick] (\Axa,\Aya) -- (\Axb,\Ayb); % Draw "repeat" symbol } \end{tikzpicture} } \addtocounter{NumMesure}{#2} } %========================================================================== % main environment, has 2 mandatory arguments % arg 1 (#2 inside): total number of 4 beat bars (4, 8, ...) % arg 2 {#3 i