3

I am writing a musical exercise book with musixtex. I'm trying to typeset a single stave with some text positioned beneath it. There are no notes, only the key signatures change and I would like to annotate each bar with the key signature name.

These two examples demonstrate what I am trying to achieve:

\documentclass[11pt,a4paper,BCOR=12mm,DIV=24,headsepline=true,parskip=half]{scrbook}

\usepackage{musixtex}

\begin{document}

% First example, right layout but text missing
\begin{music}
\generalsignature{0}
\nostartrule
\nobarnumbers
\startpiece\addspace\afterruleskip
\generalsignature{+1}\ignorenats\Changecontext
\generalsignature{+2}\ignorenats\Changecontext
\generalsignature{+3}\ignorenats\Changecontext
\generalsignature{+4}\ignorenats\Changecontext
\generalsignature{+5}\ignorenats\Changecontext
\generalsignature{-1}\ignorenats\Changecontext
\generalsignature{-2}\ignorenats\Changecontext
\generalsignature{-3}\ignorenats\Changecontext
\generalsignature{-4}\ignorenats\Changecontext
\generalsignature{-5}\ignorenats\Changecontext
\setdoublebar
\endpiece
\end{music}

% Second example, adding text messes up layout
\begin{music}
\generalsignature{0}
\nostartrule
\nobarnumbers
\startpiece\addspace\afterruleskip
\lcharnote{P}{\smalltype{C-Dur}}
\generalsignature{+1}\ignorenats\Changecontext
\lcharnote{P}{\smalltype{G-Dur}}
\generalsignature{+2}\ignorenats\Changecontext
\lcharnote{P}{\smalltype{D-Dur}}
\generalsignature{+3}\ignorenats\Changecontext
\lcharnote{P}{\smalltype{A-Dur}}
\generalsignature{+4}\ignorenats\Changecontext
\lcharnote{P}{\smalltype{E-Dur}}
\generalsignature{+5}\ignorenats\Changecontext
\lcharnote{P}{\smalltype{H-Dur}}
\generalsignature{-1}\ignorenats\Changecontext
\lcharnote{P}{\smalltype{F-Dur}}
\generalsignature{-2}\ignorenats\Changecontext
\lcharnote{P}{\smalltype{B-Dur}}
\generalsignature{-3}\ignorenats\Changecontext
\lcharnote{P}{\smalltype{Es-Dur}}
\generalsignature{-4}\ignorenats\Changecontext
\lcharnote{P}{\smalltype{As-Dur}}
\generalsignature{-5}\ignorenats\Changecontext
\lcharnote{P}{\smalltype{Des-Dur}}
\setdoublebar
\endpiece
\end{music}
\end{document}

Please note that this example has to be compiled in a three step process:

$ pdflatex example.tex
$ musixflx example.tex
$ pdflatex example.tex

enter image description here

In the first example, the layout is correct, but the text is not included yet. In the second example, I tried to include the text, but this adds unwanted horizontal space and the layout is messed up, although the documentation promises in section 2.6.13 that no horizontal space will be added.

Also, it would be nice if the text would be centered within each bar.

Does anyone have an idea how to fix the example, or a different solution to achieve the same thing?

Thank you!

2
  • 1
    It seems the space is due to the end-of-lines after \lcharnote{P}{\smalltype{C-Dur}}. If you replace those lines by \lcharnote{P}{\smalltype{C-Dur}}% the spacing of both examples is the same
    – cgnieder
    Dec 29, 2013 at 16:34
  • Wow, great find! This already helps a lot. Now I'm trying to fiddle with hspaces to get the annotations to be centered... If you write your comment as an answer I will accept it.
    – PiQuer
    Dec 29, 2013 at 16:43

1 Answer 1

3

It seems the space is due to the end-of-lines after

\lcharnote{P}{\smalltype{C-Dur}}

If you replace those lines by

\lcharnote{P}{\smalltype{C-Dur}}%

the spacing of both examples is the same. The output IMHO even looks better when you put the texts in a box overlapping to the right:

\zcharnote{P}{\makebox[0pt][r]{\smalltype{C-Dur}}}%

enter image description here

2
  • 2
    I am the expert in adding % at end of lines. ;-)
    – egreg
    Dec 29, 2013 at 17:37
  • @egreg Sorry for fishing in your fishing grounds ;)
    – cgnieder
    Dec 29, 2013 at 17:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.