texlive[49569] Master/texmf-dist: chordbars (1jan19)

commits+karl at tug.org commits+karl at tug.org
Tue Jan 1 23:50:09 CET 2019


Revision: 49569
          http://tug.org/svn/texlive?view=revision&revision=49569
Author:   karl
Date:     2019-01-01 23:50:09 +0100 (Tue, 01 Jan 2019)
Log Message:
-----------
chordbars (1jan19)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/chordbars/README.md
    trunk/Master/texmf-dist/doc/latex/chordbars/chordbars_manual.pdf
    trunk/Master/texmf-dist/doc/latex/chordbars/chordbars_manual.tex
    trunk/Master/texmf-dist/tex/latex/chordbars/chordbars.sty

Added Paths:
-----------
    trunk/Master/texmf-dist/doc/latex/chordbars/listing_halfbar.lst

Modified: trunk/Master/texmf-dist/doc/latex/chordbars/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/chordbars/README.md	2019-01-01 22:32:42 UTC (rev 49568)
+++ trunk/Master/texmf-dist/doc/latex/chordbars/README.md	2019-01-01 22:50:09 UTC (rev 49569)
@@ -1,13 +1,12 @@
 # chordbars
-A music-related LaTeX package usful to write chord grids.
+A music-related LaTeX package useful to write chord grids.
 
-From a given chord progression (a harmonic pattern), it draws nice rectangles (1 square per bar) with the chord name inside, and shows the number of repetitions and the bar count.
+From a given chord progression (a harmonic pattern), it draws nice rectangles (one square per bar) with the chord name inside, and shows the number of repetitions and the bar count.
 For details, see included manual.
 
-
 Author: S. Kramm - 2018 
 
 Licence: The LaTeX project public license (LPPL), version 1.3c
 
+Available via CTAN: https://ctan.org/pkg/chordbars
 
-

Modified: trunk/Master/texmf-dist/doc/latex/chordbars/chordbars_manual.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/chordbars/chordbars_manual.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/chordbars/chordbars_manual.tex	2019-01-01 22:32:42 UTC (rev 49568)
+++ trunk/Master/texmf-dist/doc/latex/chordbars/chordbars_manual.tex	2019-01-01 22:50:09 UTC (rev 49569)
@@ -1,8 +1,8 @@
-%% chordbars_manual.tex
+%% file: chordbars_manual.tex
 %% 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.3
+% 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
@@ -32,6 +32,12 @@
 }
 \usepackage{chordbars}
 
+% Add an extra line between paragraphs.
+\setlength{\parskip}{0.5\baselineskip}
+
+% Remove the indent at the start of paragraphs.
+\setlength{\parindent}{0pt}
+
 % Bold + tt
 \newcommand{\btt}{\bfseries \ttfamily } 
 
@@ -38,10 +44,11 @@
 % shorthand
 \newcommand{\tbs}{\textbackslash{}} 
 
+%\usepackage{parskip}
 
 \title{The chordbars Package}
 \author{S. Kramm}
-\date{\today - release 1.0}
+\date{\today {} - release 1.1}
 \begin{document}
 \maketitle
 
@@ -64,12 +71,13 @@
 
 
 \section{Usage}
+\subsection{Basic usage}
 This package provides a single environnment, named {\ttfamily chordbar}, that has 2 mandatory arguments.
 The first argument is the number of bars, and the second is the pattern name.
 The latter one can be empty.
 Inside this environment, you can use several commands, the most basic one is 
 \verb|\chordf| (for "Chord Full bar") that has as unique argument the chord name.
-This argument will just be printed out "as is", usually something like "Cm7", Db9, FMaj7", etc.
+This argument will just be printed out "as is", usually something like Cm7, Db9, FMaj7, etc.
 
 For example, the classical 12-bar blues progression will be written as:
 
@@ -80,20 +88,25 @@
 
 \input{listing_blues.lst}
 
-As usual, spaces and line-feeds are ignored.
+Each square stands for a 4-beat bar, and this is read left to right.
+The special symbol you can see in bars 4, 6 and 8 means "play the same content on this bar as the previous bar".
 
-The default behavior is to have 4-bars long lines, but you can change this anytime with the command 
+As usual with \LaTeX{} source files, spaces and line-feeds are ignored.
 
+The default behavior is to have 4-bars long lines, but you can change this anytime by giving a different value to {\btt \tbs NumberOfBarsPerLine}. For example, issuing the command
+
 \begin{lstlisting}
 \def\NumberOfBarsPerLine{3}
 \end{lstlisting}
 
-This will print out the same 12-bars blues as above, but printed out in a rather awkward view with 6 bars per line\footnote{Don't do this, of course!}.
+just before the above source code will print out the same 12-bars blues as above, but in a rather awkward view with 6 bars per line\footnote{Don't do this, of course!}.
 
 \def\NumberOfBarsPerLine{6}
 \input{listing_blues.lst}
 
-This package can also be used to print out the song structure, by showing the number of repetitions of each part and by counting the bars.
+\subsection{Handling song structure and bar count}
+
+This package can also be used to print the song structure by showing the number of repetitions of each part and by counting the bars.
 The number of repetitions of the part can be given as an optional argument to the environment.
 To enable this, you need to activate this option, with this inserted after the \verb!\begin{document}! :
 
@@ -113,7 +126,7 @@
 \input{listingA.lst}
 %}
 
-\paragraph{Two chords per bar.} 
+\subsection{Two chords per bar.} 
 The command \verb|\chordh| enables printing two chords per bar, as this happens quite often.
 Its two arguments are the two chords of the bar.
 For example, the well-know tune "House of the Rising Sun"\footnote{The Animals} chord structure can be printed as this:
@@ -125,7 +138,7 @@
 \countbarsNo
 \input{listing_HOTRS.lst}
 
-\paragraph{Sharps and flats.} If you know \LaTeX, you may know that the {\btt \#} character is a "reserved character" and as such you should'nt be able to use it inside your source file.
+\subsection{Sharps and flats.} If you know \LaTeX, you may know that the {\btt \#} character is a "reserved character" and as such you should'nt be able to use it inside your source file.
 However a special trick has been used here so you can directly type {\btt \tbs chordf\{C\#\}}.
 
 Warning: this {\bf may} lead to some problems in "some" situations, that are not yet clearly identified\footnote{See \url{https://tex.stackexchange.com/a/467566/11083} for details.}.
@@ -146,7 +159,46 @@
 \input{listing_sharp_flat.lst}
 \end{minipage}
 
+\subsection{Long parts on same chord}
+In some songs, you often have several bars on the same chord, say as an introduction or a bridge between two parts.
+Instead of filling a whole chordbars environment, a command is provided that will simply render the desired number of bars with the initial chord noted in first bar.
+
+For example, if you need a 8 bar intro on Gm7 chord, you can do this:
+\begin{lstlisting}
+\chordline{C#m7}{8}{Intro}
+\end{lstlisting}
+
+that will be rendered as this:
+
+\chordline{C#m7}{8}{Intro}
+
+Of course, the part and bar count will take this into account.
+Please note that this will always be a single line, so it is limited to standard situations (4 or 8 bars), it should not be used for longer parts.
+
+\subsection{Half bars}
+
+In some tunes, there can be a "special" bar inserted at one point that only has 2 beats instead of the regular 4-beat bars .
+This is handled with the special command {\btt \tbs addHalfBar} thats needs to be inserted in last position in a {\btt chordbar} environment.
+
+See for example this chord progression and its rendering:
+
+\lstinputlisting{listing_halfbar.lst}
+
+\resetchordbars
+\countbarsYes
+\input{listing_halfbar.lst}
+
+"Part 1" has an extra 2-beats bar added at the end, and the bar count is adjusted to take this into account.
+So "Part 2" starts at bar 6.
+
+\subsection{Song title}
+
+The package provides a {\btt \tbs songtitle} command that will format nicely the data given in the preamble with the classical 
+{\btt \tbs title} and {\btt \tbs author} commands.
+
+
 \section{Configuration}
+\label{sec:config}
 
 Several commands allow to customize the way the grids are printed out.
 
@@ -157,8 +209,13 @@
 The default value is 1.6, but you can adjust it anytime inside your document, for example with:\\
 {\btt \tbs def\tbs barsize\{1.8\}}
 
-The font size is at present fixed.
+The font used for the chords can be adjusted by redefining the variable {\btt \tbs chordFontSize} with classical \LaTeX{} font specifications.
+The default value is {\btt \tbs normalsize \tbs bfseries}.
+If you need better readability when extending grid size, you can add for example this, in the preamble of the document:
 
+{\btt \tbs def\tbs chordFontSize\{\tbs large\tbs bfserie\}}
+
+
 \item The command {\btt \tbs countbarsYes} enables counting the bars of the song:
 each grid will have printed on the left side the number of the first bar of the grid.
 It also enables printing the number of repetitions of this part on the right side of the grid.
@@ -172,7 +229,7 @@
 
 To stop this behaviour (anytime), the command is {\btt \tbs countbarsNo}.
 
-\item Additionaly, if the above command is issued, then the package can compute the total number of bars and the duration of the song.
+\item Additionaly, if the bar counting is enabled, then the package can compute the total number of bars and the duration of the song.
 This is done by issuing the command {\btt \tbs printNbBars} at the end of the file.
 The duration of the song depends on both the {\em tempo} of the song, expressed in BPM, and the number of beats per bar.
 The latter can be given with the command {\btt \tbs bpm}, for example:
@@ -182,10 +239,12 @@
 {\btt \tbs bpbfour} or {\btt \tbs bpbthree}.
 The default value is 4 beats per bar.
 
-\item As you have seen above, the command {\btt \tbs repeatBar} will be rendered as \textdiscount{} and means "repeat last chord".
-In some situations, it can be useful to show a repetitions spanning two bars.
-Fo this you can use {\btt \tbs repeatBarPair}.
-For example, see the source below showing a classical II/V-I pattern played twice and its rendering:
+\item As you have seen above, the command {\btt \tbs repeatBar} will be rendered as "./."
+%$\textdiscount${}
+and means "repeat last bar".
+In some situations, it can be useful to show a repetition spanning two bars.
+For this you can use {\btt \tbs repeatBarPair}.
+For example, see the source below showing a classical II-V-I pattern played twice and its rendering:
 
 \noindent
 \begin{minipage}{0.45\textwidth}
@@ -193,26 +252,43 @@
 \end{minipage}
 %
 \begin{minipage}{0.42\textwidth}
+\countbarsNo
 \input{listing_RBP.lst}
 \end{minipage}
 
+\item {\ttfamily \textbackslash resetchordbars}: this will reset the bar and part counters, useful if you want to print two songs in the same document.
+\end{itemize}
 
 
-%\end{itemize}
+\section{Reference}
 
-%\section{Additional commands}
+This section is useful for those who want to contribute or expand this package.
 
-%Besides the commands that can be used inside the chordbar environment, this package provides the following commands:
+Internal counters:
 
-%\begin{itemize}
-\item {\ttfamily \textbackslash resetchordbars}: this will reset the bar and part counters, useful if you want to print two songs in the same document.
+\begin{itemize}
+\item {\btt NumMesure}
+\item {\btt NumPart}
+\item {\btt CurrentBarInLine}
+\item {\btt CurrentBar}
+\item {\btt CurrentLine}
 \end{itemize}
 
+\section{Troubleshooting}
 
-\section{Reference}
+The relative sizes of the grid and the chord printing are not automatically adjusted.
+Thus, in some case, the chord name will be too large for the grid.
+In that case, you just need to enlarge the grid size and/or adjust the font size (see section \ref {sec:config}).
 
-This section is useful for those who want to contribute or expand this package.
+\section{Release history}
 
-(TO BE EXPANDED)
+\begin{itemize}
+\item 2018-12-28: First release (v1.0) and upload to CTAN
 
+\item 2018-12-29: Release 1.1, added commands {\btt \tbs chordline} and {\btt \tbs addHalfBar}, added font commands, fixed manual, bugfixes
+\end{itemize}
+
+
+
+
 \end{document}

Added: trunk/Master/texmf-dist/doc/latex/chordbars/listing_halfbar.lst
===================================================================
--- trunk/Master/texmf-dist/doc/latex/chordbars/listing_halfbar.lst	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/chordbars/listing_halfbar.lst	2019-01-01 22:50:09 UTC (rev 49569)
@@ -0,0 +1,10 @@
+\begin{chordbar}{4}{}
+\chordh{G}{C7} \chordf{FMaj7}
+\chordf{C} \chordf{D}
+\addHalfBar{Dm}
+\end{chordbar}
+
+\begin{chordbar}{4}{}
+\chordh{G}{C7} \chordf{FMaj7}
+\chordf{C} \chordf{D}
+\end{chordbar}


Property changes on: trunk/Master/texmf-dist/doc/latex/chordbars/listing_halfbar.lst
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/texmf-dist/tex/latex/chordbars/chordbars.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/chordbars/chordbars.sty	2019-01-01 22:32:42 UTC (rev 49568)
+++ trunk/Master/texmf-dist/tex/latex/chordbars/chordbars.sty	2019-01-01 22:50:09 UTC (rev 49569)
@@ -1,8 +1,8 @@
-%% chordbars.sty
+%% 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.3
+% 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
@@ -17,8 +17,12 @@
 
 % Home page: https://github.com/skramm/chordbars
 
+
+% TODO define command to have 1 chord per beat
+
+
 \NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{chordbars}[2017-12-28 version 1.0]
+\ProvidesPackage{chordbars}[2017-12-29 version 1.1]
 
 \RequirePackage{tikz}
 \RequirePackage{pgfmath}
@@ -38,7 +42,7 @@
   \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 };
+      	\node [block,font=\fontsize{20}{28}\selectfont\bfseries] (init) { \@title\\ \@author };
   	\end{tikzpicture}
   \end{center}%
   \par
@@ -98,14 +102,69 @@
 }
 
 \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: total number of 4 beat bars (4, 8, ...)
-% arg 2: part name (can be empty)
+% arg 1 (#2 inside): total number of 4 beat bars (4, 8, ...)
+% arg 2 {#3 inside}: part name (can be empty)
 % optional arg: nb of repetitions (default is 1)
 
 \newenvironment{chordbar}[3][1]
@@ -128,7 +187,7 @@
 		\refstepcounter{CurrentBarInLine}%
 		\pgfmathsetmacro{\x}{-\barsize/2+\theCurrentBarInLine*\barsize}
 		\pgfmathsetmacro{\y}{\value{CurrentLine})*\barsize+\barsize/2}		
-		\draw (\x,\y) node {##1};%
+		\draw (\x,\y) node [font=\chordFontSize]{##1};%
 	}%
 
 	\newcommand{\chordh}[2]%
@@ -154,11 +213,11 @@
 		\draw (
 			{-3*\barsize/4+\theCurrentBarInLine*\barsize},
 			{\theCurrentLine*\barsize+1*\barsize/4}
-		) node {##1};
+		) node [font=\chordFontSize]{##1};
 		\draw (
 			{-\barsize/4+\theCurrentBarInLine*\barsize},
 			{\theCurrentLine*\barsize+3*\barsize/4}
-		) node {##2};%	
+		) node [font=\chordFontSize]{##2};%	
 		
 	}
 	
@@ -173,7 +232,6 @@
 			{}
 		\refstepcounter{CurrentBarInLine}%
 	
-		\def\delta{0.36}
 		\pgfmathsetmacro{\Axa}{(\theCurrentBarInLine-1)*\barsize+\delta*\barsize}
 		\pgfmathsetmacro{\Axb}{\theCurrentBarInLine*\barsize-\delta*\barsize}
 		\pgfmathsetmacro{\Aya}{(1-\delta)*\barsize+\theCurrentLine*\barsize}
@@ -189,7 +247,6 @@
 
 	\newcommand{\repeatBarPair}%
 	{ %
-		\def\delta{0.36}
 		\pgfmathsetmacro{\Axa}{\theCurrentBarInLine*\barsize+\delta*\barsize}
 		\pgfmathsetmacro{\Axb}{(\theCurrentBarInLine+2)*\barsize-\delta*\barsize}
 		\pgfmathsetmacro{\Aya}{(1-\delta)*\barsize+\theCurrentLine*\barsize}
@@ -211,8 +268,39 @@
 		}
 		\fi		
 	}%
+
+	\newcommand{\addHalfBar}[1]%
+	{
+		\refstepcounter{NumMesure}%
+		\refstepcounter{CurrentBarInLine}%
+
+%		\pgfmathsetmacro{\xa}{(\theCurrentBarInLine-1)*\barsize}
+%		\pgfmathsetmacro{\xb}{\theCurrentBarInLine*\barsize}
+%
+%		\pgfmathsetmacro{\ya}{\theCurrentLine*\barsize}
+%		\pgfmathsetmacro{\ya}{(\theCurrentLine+1)*\barsize}
+		
+% diagonal line
+%	\draw (\xa,\ya) -- (\xb,\yb);  A BUG HERE: investigate
+		\draw
+		(\theCurrentBarInLine*\barsize,{\theCurrentLine*\barsize})
+			--
+		({(\theCurrentBarInLine-1)*\barsize},{(\theCurrentLine+1)*\barsize});
+
+% horizontal line
+		\draw
+		(\theCurrentBarInLine*\barsize,{\theCurrentLine*\barsize})
+			--
+		({(\theCurrentBarInLine-1)*\barsize},{(\theCurrentLine)*\barsize});
+
+
+		\pgfmathsetmacro{\x}{-3*\barsize/4+\theCurrentBarInLine*\barsize}
+		\pgfmathsetmacro{\y}{\value{CurrentLine})*\barsize+\barsize/4}		
+		\draw (\x,\y) node [font=\chordFontSize]{##1};%
 	
-	\typeout{chordbarl: START #2}
+	}
+		
+	\typeout{chordbar: START #3}
 
 	\fontfamily{phv}\selectfont
 	\setcounter{CurrentLine}{0}
@@ -236,7 +324,7 @@
 	\xdef\NbBarsInitialLine{\NumberOfBarsPerLine}
 	\ifthenelse
 		{#2<\NumberOfBarsPerLine}
-		{\xdef\NbBarsInitialLine{#1}}
+		{\xdef\NbBarsInitialLine{#2}}
 		{}
 			
 % initial horizontal line
@@ -245,8 +333,8 @@
 % draw part title	
 	\ifthenelse
 		{\boolean{printBarNumber}}	
-		{\draw (0,-\barsize*.2) node [anchor=west, align=left] {\bf Part \theNumPart: #3};} 
-		{\draw (0,-\barsize*.2) node [anchor=west, align=left] {\bf #3};} 
+		{\draw (0,-\barsize*.2) node [anchor=west, align=left,font=\titleFontSize] {Part \theNumPart: #3};} 
+		{\draw (0,-\barsize*.2) node [anchor=west, align=left,font=\titleFontSize] {#3};} 
 
 	\pgfmathtruncatemacro{\nblines}{(#2-1)/\NumberOfBarsPerLine+1}	
 	\typeout{chordbarl: nblines=\nblines}
@@ -301,6 +389,5 @@
 \let\OLDflat\flat
 \renewcommand{\flat}{\ensuremath{\OLDflat}}
 
-
 \endinput
   



More information about the tex-live-commits mailing list