Typesetting guitar chord diagrams in a songbook

The chords only have to be defined via \guitarchord once, and can be reutilized as needed. Rather that using \raiseguitar to set the vertical position, I use \setstackgap{L}{<baselinekip of stack>} to do so.

EDITED to address deficiencies noted by OP. Macros to use include

\guitarchord\<chordname>{<chord-definition>}

and

\showchord [<short entry text>]{\<chordname>}

where the optional argument is used if the chord text is shorter than the chord width. Note two lengths specified in the MWE that allow adjustments in alignment and minimum chord spacing.

RE-EDITED to provide optional syntax that some may find preferable:

\chordline{\<chordname>}{<text>}

Here is the MWE:

\documentclass{article}
\usepackage{musixguit,stackengine}
\def\chordalign{\dimexpr2.2ex}% 2.2ex sets alignment of chord
\def\chordminwidth{\dimexpr6.5ex}% 6.5ex provides min. hskip for optional argument
\newcommand\guitarchord[2]{%
  \savestack#1{\kern\chordalign\NOtes\guitar #2\en}
}
\newcommand\showchord[2][\relax]{%
  \ifx\relax#1\relax\def\tmpuaw{T}\else\def\tmpuaw{F}\fi%
  \stackengine{\Lstackgap}{#1}{%
    \makebox[0ex][l]{#2}\kern\chordminwidth}{O}{l}{F}{\tmpuaw}{L}%
}
\newcommand\chordline[2]{\setbox0=\hbox{#2}%
  \ifdim\wd0>\chordminwidth\showchord{#1}#2\else\showchord[#2]{#1}\fi%
}
\raiseguitar {0}
\setstackgap{L}{2.7\baselineskip}
\begin{document}
\guitarchord\Cm{{Cm $^7$}{2}x-----\gbarre1\gdot33\gdot52}
\guitarchord\GM{G{}o-----\gbarre3\gdot25\gdot35\gdot44}
\showchord[Ly-]{\Cm} \showchord{\GM}rics of the first 
  \showchord[of 2]{\Cm} \showchord{\GM}verses ...

Alternative syntax:

\chordline{\Cm}{Ly-}
\chordline{\GM}{rics of the first}
\chordline{\Cm}{of 2}
\chordline{\GM}{verses ...}
\end{document}

enter image description here

While I don't recommend it because of potential danger, the OP followed up asking if the # character (and things like parentheses) could be incorporated into chord names. To do so, I make # catcode 11, and employ a lot of \csname nomenclature.

Here is such a version:

\documentclass{article}
\usepackage{musixguit,stackengine}
\def\chordalign{\dimexpr2.2ex}% 2.2ex sets alignment of chord
\def\chordminwidth{\dimexpr9ex}% 6.5ex provides min. hskip for optional argument
\newcommand\guitarchord[2]{%
  \expandafter\savestack\expandafter{\csname #1\endcsname}{%
    \kern\chordalign\NOtes\guitar #2\en}
}
\newcommand\showchord[2][\relax]{%
  \ifx\relax#1\relax\def\tmpuaw{T}\else\def\tmpuaw{F}\fi%
  \stackengine{\Lstackgap}{#1}{%
    \makebox[0ex][l]{\csname #2\endcsname}\kern\chordminwidth}%
    {O}{l}{F}{\tmpuaw}{L}%
}
\newcommand\chordline[2]{\setbox0=\hbox{#2}%
  \ifdim\wd0>\chordminwidth\relax\showchord{#1}#2\else
    \showchord[#2]{#1}\fi%
}
\raiseguitar {0}
\setstackgap{L}{2.7\baselineskip}
\begin{document}
\catcode`#=11
\guitarchord{F#m7(add4)}{{F$\sharp$m7(add4)$^7$}{2}x-----\gbarre1\gdot33\gdot52}
\guitarchord{GM}{G{}o-----\gbarre3\gdot25\gdot35\gdot44}
\showchord[Ly-]{F#m7(add4)} \showchord{GM}rics of the first 
  \showchord[of 2]{F#m7(add4)} \showchord{GM}verses ...

Alternative syntax:

\chordline{F#m7(add4)}{Ly-}
\chordline{GM}{rics of the first}
\chordline{F#m7(add4)}{of 2}
\chordline{GM}{verses ...}
\end{document}

enter image description here


A combination of the guitarchordschemes package (needs v0.7) for creating the chord diagrams and the leadsheets package for placing the chords:

enter image description here

\documentclass{article}
\usepackage[T1]{fontenc}

% the `chords' library of the leadsheets package provides the convenient
% \chord macro; we don't any other functionality  of said package so we
% use the `chords' option:
\usepackage{leadsheets}
% no parsing of the chord input:
\setleadsheets{chord-cs=}

\usepackage{guitarchordschemes}
% guitarchordschemes setup:
\setchordscheme{
  tuning = {,,,,,} ,
  chord-frets = 4 ,
  rotate = -90 ,
  x-unit = 1.5mm , y-unit = 2mm ,
  finger-radius = .25 ,
  line-width = .6pt ,
  restrict-bounding-box ,
  position-format+ = \footnotesize ,
  chord-name-cs = \chordname ,
  name-distance = 0pt
}

\newcommand\minorsevenAtype[2]{%
  \chordscheme[
    name = #1 ,
    position = #2 ,
    finger = {2/2,3/4} ,
    barre = {1/1-5} ,
    mute = {6}
  ]%
}

\newcommand\minorsevenEtype[2]{%
  \chordscheme[
    name = #1 ,
    position = #2 ,
    finger = {1/6} ,
    barre = {1/2-4} ,
    mute = {1,5}
  ]%
}

\newcommand\majorEtype[2]{%
  \chordscheme[
    name = #1 ,
    position = #2 ,
    finger = {2/3,3/4,3/5} ,
    barre = {1/1-6}
  ]%
}

\newcommand\majorAtype[2]{%
  \chordscheme[
    name = #1 ,
    position = #2 ,
    finger = {3/2,3/3,3/4} ,
    barre = {1/1-5} ,
    mute = 6
  ]%
}

\newcommand\cminorseven{\minorsevenAtype{Cmi7}{III}}
\newcommand\fminorseven{\minorsevenEtype{Fmi7}{I}}
\newcommand\gmajor{\majorEtype{Gma}{III}}
\newcommand\ebmajor{\majorAtype{Ebma}{VI}}

\begin{document}

\chord{\cminorseven}Text and text and \chord{\ebmajor}more text and
\chord{\gmajor}more text and even \chord{\fminorseven}more text

\end{document}