Browse Source

Change chords diagram placements in small paper size

pull/58/head
Luthaf 11 years ago
parent
commit
02ed17d4cb
  1. 47
      patacrep/data/latex/chords.sty

47
patacrep/data/latex/chords.sty

@ -2,26 +2,49 @@
% Define command \chords to display list of chords, for guitar or ukulele % Define command \chords to display list of chords, for guitar or ukulele
\ProvidesPackage{chords} \ProvidesPackage{chords}
\RequirePackage{songs} \RequirePackage{songs}
\RequirePackage{tabularx}
\RequirePackage{multirow}
\newcommand*{\Sharp}{\nolinebreak\hspace{-.05em}\raisebox{.6ex}{\,\small\bf \#}} \newcommand*{\Sharp}{\nolinebreak\hspace{-.05em}\raisebox{.6ex}{\,\small\bf \#}}
\newcommand*{\Flat}{\nolinebreak\hspace{-.05em}\raisebox{.6ex}{\,\small$\mathbf{\flat}$}} \newcommand*{\Flat}{\nolinebreak\hspace{-.05em}\raisebox{.6ex}{\,\small$\mathbf{\flat}$}}
\newcommand*{\chordname}[1]{\large \textbf{#1}} \newcommand*{\chordname}[1]{\large \textbf{#1}}
% Centering columns of tabulars % Temporary boxes and length
\newcolumntype{C}{>{\centering}X} \newsavebox{\@chordgroupbox@i}
\renewcommand{\tabularxcolumn}[1]{m{#1}} \newsavebox{\@chordgroupbox@ii}
\newlength{\@chordgrouplength@i}
\newlength{\@chordgrouplength@ii}
\newcommand{\chordtabs}[3]{ \newcommand{\chordtabs}[3]{
% Saving chords groups in boxes
\sbox{\@chordgroupbox@i}{#2}%
\settowidth{\@chordgrouplength@i}{\usebox{\@chordgroupbox@i}}%
\sbox{\@chordgroupbox@ii}{#3}%
\settowidth{\@chordgrouplength@ii}{\usebox{\@chordgroupbox@ii}}%
% Local command
\def\pl@cechord##1{%
\vskip.2ex%
\raisebox{2em}{\chordname{##1}} %
} %
% Placing boxes
\ifimportantdiagramonly% \ifimportantdiagramonly%
\begin{tabularx}{\linewidth}{cX}% \pl@cechord{#1}%
\chordname{#1} & #3 \\\hline% \hspace{\stretch{1}}%
\end{tabularx}% \usebox{\@chordgroupbox@ii}%
\hspace{\stretch{1}}%
\vskip.2ex%
\hrule%
\else% \else%
\begin{tabularx}{\linewidth}{cX}% \pl@cechord{#1}%
\multirow{2}{*}{{\chordname{#1}}} & #2 \\% \hspace{\stretch{1}}%
& #3 \\\hline% \ifdim \dimexpr\@chordgrouplength@i+\@chordgrouplength@ii\relax > .8\textwidth
\end{tabularx}% \vbox{\hbox{\usebox{\@chordgroupbox@i}}%
\hbox{\usebox{\@chordgroupbox@ii}}
}%
\else
\hbox{\usebox{\@chordgroupbox@i}%
\usebox{\@chordgroupbox@ii}%
}%
\fi
\vskip.2ex%
\hrule%
\fi% \fi%
} }

Loading…
Cancel
Save