8

I have the following code and it supposes to output the following music (C-major K545 by Mozart)

enter image description here

But I am unable to make it work, can someone see what is the problem for my package and document setup

\documentclass[11pt,urlcolor=blue, linkcolor=blue]{article} 


\usepackage{musixtex}
\usepackage{wasysym}





\begin{document}


\begin{music}
\parindent 1cm
\def\nbinstruments{1}\relax % a single instrument
\def\instrumenti{Piano}%    % whose name is Piano
\nbporteesi=2\relax         % with two staffs
\generalmeter{\meterfrac{4}{4}}\relax % 4/4 meter chosen
\debutextrait               % starting real score
\normal                     % normal 12 pt note spacing
\temps\Notes\ibu0f0\qh0{cge}\tbu0\qh0g|\hl j\enotes
\temps\Notes\ibu0f0\qh0{cge}\tbu0\qh0g|\ql l\sk\ql n\enotes
\barre                      % bar
\Notes\ibu0f0\qh0{dgf}|\qlp i\enotes
\notes\tbu0\qh0g|\ibbl1j3\qb1j\tbl1\qb1k\enotes
\temps\Notes\ibu0f0\qh0{cge}\tbu0\qh0g|\hl j\enotes
\finextrait                 % terminate excerpt
\end{music}



\end{document}

for other info, please see this.

I am using the document class [article].

Many thanks in advance!

  • 2
    If you want to typeset a complete score (and not just a part which is included in the text of a bigger document) then I strongly recommend using something like musescore. LaTeX is great but music scores are not on its strong side… – clemens Jun 17 '17 at 10:19
18

Don't confuse MusicTeX with MusiXTeX. The example loads musixtex, then code for the music becomes (documentation, "1.2 A simple example"):

\documentclass[11pt]{article} 

\usepackage{musixtex}
\usepackage{wasysym}

\begin{document}

\begin{music}
\setlength{\parindent}{1cm}
\instrumentnumber{1}        % a single instrument
\setname1{Piano}            % whose name is Piano 
\setstaffs1{2}              % with two staffs
\generalmeter{\meterfrac{4}{4}} % 4/4 meter chosen
\startextract               % starting real score
\Notes\ibu0f0\qb0{cge}\tbu0\qb0g|\hl j\en
\Notes\ibu0f0\qb0{cge}\tbu0\qb0g|\ql l\sk\ql n\en
\bar                        % bar
\Notes\ibu0f0\qb0{dgf}|\qlp i\en
\notes\tbu0\qb0g|\ibbl1j3\qb1j\tbl1\qb1k\en
\Notes\ibu0f0\qb0{cge}\tbu0\qb0g|\hl j\en
\zendextract                % terminate excerpt
\end{music}

\end{document}

Result

MusicTeX is older and seems no longer maintainted. TeX Live does not include it and needs to be installed first. Therefore, I would prefer MusiXTeX. Also, I recommend to take a look at LilyPond.

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.