General ⇒ MusixTeX: How to add number and label to music extract?
MusixTeX: How to add number and label to music extract?
Hi,
I'm wondering how to add labels, numbering andreferences to music extracts. I'd like to have something like I have for pictures. Is sometthing similar available in MusixTeX?
Thx.
I'm wondering how to add labels, numbering andreferences to music extracts. I'd like to have something like I have for pictures. Is sometthing similar available in MusixTeX?
Thx.
NEW: TikZ book now 40% off at Amazon.com for a short time.

- Stefan Kottwitz
- Site Admin
- Posts: 10345
- Joined: Mon Mar 10, 2008 9:44 pm
MusixTeX: How to add number and label to music extract?
First option, you can simply use a
Second option, you could use a
Stefan
figure
environment also for pieces of music. It doesn't have to be a picture. So you can have a caption and numbering.Second option, you could use a
theorem
environment for music. That's a tool for any numbered environment, not only for theorems or definitions. Quick example:Code: Select all
\documentclass[a4paper,12pt]{article}
\usepackage[T1]{polski}
\usepackage[cp1250]{inputenc}
\usepackage{pslatex}
\usepackage{graphicx}
\usepackage{framed}
\usepackage{musixtex}
\usepackage[top=1cm,left=2cm,right=2cm,bottom=1cm]{geometry}
\newtheorem{mus}{Music}
\newcommand{\musicref}[1]{(Music \ref{#1})}
\include{musixlyr}
\begin{document}
\begin{mus}
\label{music:1}
\begin{music}
\setlength\parindent{0pt}
\generalsignature{2}
% use smallest available size:
\smallmusicsize
\renewcommand*\writebarno{\textit{\the\barno}}
\systemnumbers
\setlyrics{text}{%
Ra-dosť krás-na isk-ra bo-hov E-ly-zej-ská dcé-ra ty, o-má-me-ní
}
\assignlyrics1{text}
\startextract
\NOtes\qu{ffgh}\enotes
\barre
\NOTes\qu{hgfe}\enotes
\barre
\NOtes\qu{ddef}\enotes
\barre
\NOTes\qup f\cu e\hu e\enotes
\barre
\NOtes\qu{ffgh}\enotes
\endextract
\end{music}
\end{mus}
\begin{mus}
\label{music:2}
\begin{music}
\setlength\parindent{0pt}
\generalsignature{2}
% use smallest available size:
\smallmusicsize
\renewcommand*\writebarno{\textit{\the\barno}}
\systemnumbers
%\setlyrics{text}{
% Ra-dosť krás-na isk-ra bo-hov E-ly-zej-ská dcé-ra ty, o-má-me-ní
% }
%\assignlyrics1{text}
%\setlyrics{text}{
% Ra-dosť krás-na isk-ra bo-hov E-ly-zej-ská dcé-ra ty, o-má-me-ní
% }
\assignlyrics1{}
\startextract
\NOtes\qu{ffgh}\enotes
\barre
\NOTes\qu{hgfe}\enotes
\barre
\NOtes\qu{ddef}\enotes
\barre
\NOTes\qup f\cu e\hu e\enotes
\barre
\NOtes\qu{ffgh}\enotes
\endextract
\end{music}
\end{mus}
See \musicref{music:1} and \musicref{music:2}.
\end{document}
LaTeX.org admin
MusixTeX: How to add number and label to music extract?
Almost...
But when I compile the piece you presented I got ?? instead of numbers when I refer to my music pieces.
Instead having Music 1 and Music 2 I've got Music ?? and Music ??
But when I compile the piece you presented I got ?? instead of numbers when I refer to my music pieces.
Instead having Music 1 and Music 2 I've got Music ?? and Music ??
- Stefan Kottwitz
- Site Admin
- Posts: 10345
- Joined: Mon Mar 10, 2008 9:44 pm
MusixTeX: How to add number and label to music extract?
And..
1. Using theorem environment how I can move Music 1 under my piece of music to the middle?
2. Using theorem environment how I can modify that Music 1 to be not bold and smaller font?
3. Using figure environment how I can change the name 'Figure' to 'Piece music'?
Thanks
1. Using theorem environment how I can move Music 1 under my piece of music to the middle?
2. Using theorem environment how I can modify that Music 1 to be not bold and smaller font?
3. Using figure environment how I can change the name 'Figure' to 'Piece music'?
Thanks
MusixTeX: How to add number and label to music extract?
Stefan Kottwitz wrote:Compile two times,
Stefan
Great
- Stefan Kottwitz
- Site Admin
- Posts: 10345
- Joined: Mon Mar 10, 2008 9:44 pm
MusixTeX: How to add number and label to music extract?
Here is a figure example. Use the
caption package if you would like to customize the captions.
Stefan

Code: Select all
\documentclass[a4paper,12pt]{article}
\usepackage[T1]{polski}
\usepackage[utf8]{inputenc}
\usepackage{pslatex}
\usepackage{graphicx}
\usepackage{framed}
\usepackage{musixtex}
\usepackage[top=1cm,left=2cm,right=2cm,bottom=1cm]{geometry}
\include{musixlyr}
\usepackage{float}
\renewcommand{\figurename}{Music}
\begin{document}
\begin{figure}[H]
\begin{music}
\setlength\parindent{0pt}
\generalsignature{2}
% use smallest available size:
\smallmusicsize
\renewcommand*\writebarno{\textit{\the\barno}}
\systemnumbers
\setlyrics{text}{%
Ra-dosť krás-na isk-ra bo-hov E-ly-zej-ská dcé-ra ty, o-má-me-ní
}
\assignlyrics1{text}
\startextract
\NOtes\qu{ffgh}\enotes
\barre
\NOTes\qu{hgfe}\enotes
\barre
\NOtes\qu{ddef}\enotes
\barre
\NOTes\qup f\cu e\hu e\enotes
\barre
\NOtes\qu{ffgh}\enotes
\endextract
\end{music}
\caption{First one.}
\label{music:1}
\end{figure}
\begin{figure}[H]
\begin{music}
\setlength\parindent{0pt}
\generalsignature{2}
% use smallest available size:
\smallmusicsize
\renewcommand*\writebarno{\textit{\the\barno}}
\systemnumbers
%\setlyrics{text}{
% Ra-dosť krás-na isk-ra bo-hov E-ly-zej-ská dcé-ra ty, o-má-me-ní
% }
%\assignlyrics1{text}
%\setlyrics{text}{
% Ra-dosť krás-na isk-ra bo-hov E-ly-zej-ská dcé-ra ty, o-má-me-ní
% }
\assignlyrics1{}
\startextract
\NOtes\qu{ffgh}\enotes
\barre
\NOTes\qu{hgfe}\enotes
\barre
\NOtes\qu{ddef}\enotes
\barre
\NOTes\qup f\cu e\hu e\enotes
\barre
\NOtes\qu{ffgh}\enotes
\endextract
\end{music}
\caption{Second one.}
\label{music:2}
\end{figure}
See \ref{music:1} and \ref{music:2}.
\end{document}
LaTeX.org admin