# musixtex bars not visible

So, I am trying to typeset an article using \LaTeX that needs to have musixtex. To make things easier I made a few macros. Things are working OK, except I can't seem to get any (musical) vertical bar lines (other than microscopic dots). Accomplishing nothing, I rewrote my macros in vanilla \TeX, which... accomplished nothing. My document is sorta like:

\documentclass{article}

\usepackage{amsmath}
\usepackage{musixtex}
\usepackage{graphicx}

% Emits a pitchless duration (stems up). Hides the ugliness of musixtex.
% Usage: \beat{duration}
% Where: duration in [1, 2, 4, 8, 16, 32, 64].
\def\beat#1{
\ifnum#1=1
{\wh{i}} % whole
\else{
\ifnum#1=2
{\hu{i}} % half
\else{
\ifnum#1=4
{\qu{i}} % quarter
\else{
\ifnum#1=8
{\cu{i}} % eighth
\else{
\ifnum#1=16
{\ccu{i}} % sixteenth
\else{
\ifnum#1=32
{\cccu{i}} % thirty-second
\else{{\ccccu{i}}}\fi % sixty-fourth
}\fi
}\fi
}\fi
}\fi
}\fi
}

% Emits a single measure.
% Usage: \measure{notes}
% Where: notes is a sequence of \beat{?} or \rest{?}
\def\measure#1{\Notes #1\en\bar}

% Null clef.
\def\nullclef{\raise2\internote\hbox{\keychar77}}

% Emits a single-line staff rhythmic example with one or
% more measures.
% Usage: \rhythm{num}{den}{measures}
% Where: num, den are the meter.
%        measures is one or more \measure{notes}
\def\rhythm#1#2#3{\begin{music}
\nobarnumbers
\instrumentnumber{1}
\generalmeter{\meterfrac{#1}{#2}}
\setstaffs1{1}
\setclefsymbol1{\nullclef}
\setlines1{1}
\sepbarrules
\startextract
#3
\endextract
\end{music}}

\begin{document}

\title{Rhythmic Whatnot}
\maketitle

\begin{abstract}
Stuff about rhythmic structure with machine learning.
\end{abstract}

\section{Introduction}

Waffle on forever. For example, with $n = 4$ and $\left\{2, 1, 1\right\}$, then:

\rhythm{2}{4}{
\measure{\beat{4}\beat{8}\beat{8}}
\measure{\beat{8}\beat{4}\beat{8}}
\measure{\beat{8}\beat{8}\beat{4}}
}

Therefore, it is obvious.

\end{document}


I imagine that there is just one simple thing that I am doing wrong, but I can't see it, even after days of fooling with it.

• Welcome to very beautiful word of TEX.SE. The microscopic dots are similar to the eye? Please, could you also add a confirmation image? – Sebastiano Jul 27 '18 at 20:17
• For whatever reason, \bar which I presume was redefined by musictex is not working as you are expecting it to. – Steven B. Segletes Jul 27 '18 at 20:25
• I get this output (click here), which seems quite fine. – egreg Jul 27 '18 at 20:27
• @egreg I do not get that output. and my LaTeX installation (MikTeX) occurred earlier today, so I am fresh out of the box. – Steven B. Segletes Jul 27 '18 at 20:35
• @StevenB.Segletes There may be conflicts (for \breve, perhaps), but certainly not with \bar which is redefined in a music environment. I'm using MusiXTeX(c) 1.28 <2018-05-07>. On the other hand, the problem is reproducible with MusiXTeX(c) 1.27 <2017-12-26> – egreg Jul 27 '18 at 20:44

# Update

This is a bug related to MusiXTeX(c) 1.27 <2017-12-26>, fixed in MusiXTeX(c) 1.28 <2018-05-07>. You should update that package.

In case you can't update, you can fix this bug manually in your document. Add the following to your preamble and ignore my original answer:

\usepackage{regexpatch}

\makeatletter
\regexpatchcmd{\C@Inter}{=}{<}{}{}
\xpatchcmd{\C@Inter}{\thr@@}{\f@ur}{}{}
\makeatother


Full MWE (version 1.27):

\documentclass{article}

\usepackage{amsmath}
\usepackage{musixtex}
\usepackage{graphicx}

% to fix a bug in musixtex version <1.28
\usepackage{regexpatch}

\makeatletter
\regexpatchcmd{\C@Inter}{=}{<}{}{}
\xpatchcmd{\C@Inter}{\thr@@}{\f@ur}{}{}
\makeatother
% end fix

% Emits a pitchless duration (stems up). Hides the ugliness of musixtex.
% Usage: \beat{duration}
% Where: duration in [1, 2, 4, 8, 16, 32, 64].
\def\beat#1{
\ifnum#1=1
{\wh{i}} % whole
\else{
\ifnum#1=2
{\hu{i}} % half
\else{
\ifnum#1=4
{\qu{i}} % quarter
\else{
\ifnum#1=8
{\cu{i}} % eighth
\else{
\ifnum#1=16
{\ccu{i}} % sixteenth
\else{
\ifnum#1=32
{\cccu{i}} % thirty-second
\else{{\ccccu{i}}}\fi % sixty-fourth
}\fi
}\fi
}\fi
}\fi
}\fi
}

% Emits a single measure.
% Usage: \measure{notes}
% Where: notes is a sequence of \beat{?} or \rest{?}
\def\measure#1{\Notes #1\en\bar}
\def\measuree#1{\Notes #1\en}

% Null clef.
\def\nullclef{\raise2\internote\hbox{\keychar77}}

% Emits a single-line staff rhythmic example with one or
% more measures.
% Usage: \rhythm{num}{den}{measures}
% Where: num, den are the meter.
%        measures is one or more \measure{notes}
\def\rhythm#1#2#3{\begin{music}
\nobarnumbers
\instrumentnumber{1}
\generalmeter{\meterfrac{#1}{#2}}
\setstaffs1{1}
\setclefsymbol1{\nullclef}
\setlines1{1}
\sepbarrules
\startextract
#3%
\endextract
\end{music}}

\begin{document}

\title{Rhythmic Whatnot}
\maketitle

\begin{abstract}
Stuff about rhythmic structure with machine learning.
\end{abstract}

\section{Introduction}

Waffle on forever. For example, with $n = 4$ and $\left\{2, 1, 1\right\}$, then:

\rhythm{2}{4}{%
\measure{\beat{4}\beat{8}\beat{8}}
\measure{\beat{8}\beat{4}\beat{8}}
\measuree{\beat{8}\beat{8}\beat{4}}%
}

Therefore, it is obvious.

\end{document}


The technical details: Reading helps, as in the 1.28 changelog is written

% version 1.28

% defined
%  \z[left|right|leftright]repeat, for use *within* a bar
%  \zz...repeat, to force to the end of a system
% corrected definition of \C@Inter for \nblines < 4


If one looks up the definition

\def\C@Inter{%  RDT: corrected to work if \nblines > 6   (version 1.23)


in line 1831 (v1.27) or in line 1838 (v1.28), one finds the following diff

<   \ifnum\nblines=\thr@@
---
>   \ifnum\nblines<\f@ur


Hence I consider this a bug and one should update, but as a workaround, my presented solution seems to work.

Not sure why @egreg seems to get the desired (?) result already, but I found a fix for MusiXTeX(c) 1.27 <2017-12-26>:

\documentclass{article}

\usepackage{amsmath}
\usepackage{musixtex}
\usepackage{graphicx}

% Emits a pitchless duration (stems up). Hides the ugliness of musixtex.
% Usage: \beat{duration}
% Where: duration in [1, 2, 4, 8, 16, 32, 64].
\def\beat#1{
\ifnum#1=1
{\wh{i}} % whole
\else{
\ifnum#1=2
{\hu{i}} % half
\else{
\ifnum#1=4
{\qu{i}} % quarter
\else{
\ifnum#1=8
{\cu{i}} % eighth
\else{
\ifnum#1=16
{\ccu{i}} % sixteenth
\else{
\ifnum#1=32
{\cccu{i}} % thirty-second
\else{{\ccccu{i}}}\fi % sixty-fourth
}\fi
}\fi
}\fi
}\fi
}\fi
}

% Emits a single measure.
% Usage: \measure{notes}
% Where: notes is a sequence of \beat{?} or \rest{?}
\def\measure#1{\Notes #1\en\bar}

% Null clef.
\def\nullclef{\raise2\internote\hbox{\keychar77}}

% Emits a single-line staff rhythmic example with one or
% more measures.
% Usage: \rhythm{num}{den}{measures}
% Where: num, den are the meter.
%        measures is one or more \measure{notes}
\def\rhythm#1#2#3{\begin{music}
\nobarnumbers
\instrumentnumber{1}
\generalmeter{\meterfrac{#1}{#2}}
\setstaffs1{1}
\setclefsymbol1{\nullclef}
\setlines1{1}
\sepbarrules
#3%
\endextract
\end{music}}

\begin{document}

\title{Rhythmic Whatnot}
\maketitle

\begin{abstract}
Stuff about rhythmic structure with machine learning.
\end{abstract}

\section{Introduction}

Waffle on forever. For example, with $n = 4$ and $\left\{2, 1, 1\right\}$, then:

\rhythm{2}{4}{%
\measure{\beat{4}\beat{8}\beat{8}}
\measure{\beat{8}\beat{4}\beat{8}}
\measuree{\beat{8}\beat{8}\beat{4}}% <-- changed
}

Therefore, it is obvious.

\end{document}


It seems that \bar creates the bar depending on the height of the lines. If you change that after \startextract, you're able to modify the bars without affecting the printed lines. Not sure if this is a feature though.

I also created a new macro \measuree for "measure end" without a bar to remove the double bar at the end.

• SpexTeXular @nox! Yes, I was using the v1.27 MusiXTex, and although I did examine the log file, sometimes it takes a TeXnician, and I am no way there yet. – Kristen777 Jul 28 '18 at 1:06