# MusiXTeX within LaTeX does not insert space before first note

to make my problem visible, I have created following simple file:

\documentclass[a4paper,12pt]{article}
\usepackage{musixtex}
\setlength{\parindent}{0em}
\begin{document}
\begin{music}
\startpiece
\notes\nq{hgf}\enotes\alaligne
\notes\nq{hgf}\enotes
\endpiece
\end{music}
\end{document}


Processing this with latex file musixflx file latex file gives a rather nasty output, because between the clef and the first note in the first line, there is nearly no space. The problem does not occur in subsequent lines, and it does not occur when using \startextract ... \endextract instead of \startpiece ... \endpiece, but this is no option for \startextract allows only one line of music. Has anybody any idea, why this happen, and how to fix it?

Best regards, Volker

Please try add something like this before \startpiece

\hsize150mm


Below is the updated version of my answer:

If you extend your scores to the length of acutal musical lines, it will shown correctly. However if you'd like to only exhibit what in your example file, you can use \sk or \noteskip to forward one note's distance.\hsk for half note skip.

\qsk for one note head width, \tqsk,\hqsk,\qqsk for two third, half thirds, or one quarter. \bqsk,\btsk,\bhsk to skip backwardly.

Importantly, you'd need package xspace too, or else the bars at the end of the line will scatter apart.

\documentclass[a4paper,12pt]{article}
\usepackage{musixtex}
\usepackage{xspace}

\setlength{\parindent}{0em}
\begin{document}
\begin{music}
%\hsize150mm % \hsize moves all the lines horizontally to the right
\startpiece
\notes\hsk\nq{hgf}\enotes\alaligne
\notes\bhsk\nq{hgf}\enotes
\endpiece
\end{music}

\end{document}


I tridd my best, I suggest you still wait for the better answers, I am also curious to see the professional anwser! Jesus bless!

• Hi Paul, thanks for the answer! Yes, there is now more space between clef and first note, but still the first line does not look like the following - what I do expect. – Volker Dec 29 '18 at 13:37
• @Volker I update the answer, you can keep the question and wait for better and professional answers, I am curious too. – Paul Chen Dec 29 '18 at 20:30

I think the difference comes from the \afterruleskip extra space added after each bar. The firstline does not have this space, so you can just add it manually:

\documentclass[a4paper,12pt]{article}
\usepackage{musixtex}
\setlength{\parindent}{0em}
\begin{document}
\begin{music}

• Yet, in musixtex official documentation, almost all \startpiece are followed with \addspace\afterruleskip, so I think it is necessary. – JPG Feb 11 '19 at 17:36