LaTeX forum ⇒ GeneralMusixTeX: How to add number and label to music extract?

LaTeX specific issues not fitting into one of the other forums of this category.
MimiKLM
Posts: 8
Joined: Wed Jun 27, 2018 6:35 pm

MusixTeX: How to add number and label to music extract?

Postby MimiKLM » Wed Jun 27, 2018 7:24 pm

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.

User avatar
Stefan Kottwitz
Site Admin
Posts: 8946
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Thu Jun 28, 2018 10:26 am

First option, you can simply use a 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:

  1. \documentclass[a4paper,12pt]{article}
  2. \usepackage[T1]{polski}
  3. \usepackage[cp1250]{inputenc}
  4. \usepackage{pslatex}
  5. \usepackage{graphicx}
  6. \usepackage{framed}
  7. \usepackage{musixtex}
  8. \usepackage[top=1cm,left=2cm,right=2cm,bottom=1cm]{geometry}
  9. \newtheorem{mus}{Music}
  10. \newcommand{\musicref}[1]{(Music \ref{#1})}
  11. \include{musixlyr}
  12.  
  13. \begin{document}
  14.  
  15. \begin{mus}
  16. \label{music:1}
  17. \begin{music}
  18. \setlength\parindent{0pt}
  19. \generalsignature{2}
  20. % use smallest available size:
  21. \smallmusicsize
  22. \renewcommand*\writebarno{\textit{\the\barno}}
  23. \systemnumbers
  24. \setlyrics{text}{%
  25. Ra-dosť krás-na isk-ra bo-hov E-ly-zej-ská dcé-ra ty, o-má-me-ní
  26. }
  27. \assignlyrics1{text}
  28. \startextract
  29. \NOtes\qu{ffgh}\enotes
  30. \barre
  31. \NOTes\qu{hgfe}\enotes
  32. \barre
  33. \NOtes\qu{ddef}\enotes
  34. \barre
  35. \NOTes\qup f\cu e\hu e\enotes
  36. \barre
  37. \NOtes\qu{ffgh}\enotes
  38. \endextract
  39. \end{music}
  40. \end{mus}
  41.  
  42. \begin{mus}
  43. \label{music:2}
  44. \begin{music}
  45. \setlength\parindent{0pt}
  46. \generalsignature{2}
  47. % use smallest available size:
  48. \smallmusicsize
  49. \renewcommand*\writebarno{\textit{\the\barno}}
  50. \systemnumbers
  51. %\setlyrics{text}{
  52. % Ra-dosť krás-na isk-ra bo-hov E-ly-zej-ská dcé-ra ty, o-má-me-ní
  53. % }
  54. %\assignlyrics1{text}
  55. %\setlyrics{text}{
  56. % Ra-dosť krás-na isk-ra bo-hov E-ly-zej-ská dcé-ra ty, o-má-me-ní
  57. % }
  58. \assignlyrics1{}
  59. \startextract
  60. \NOtes\qu{ffgh}\enotes
  61. \barre
  62. \NOTes\qu{hgfe}\enotes
  63. \barre
  64. \NOtes\qu{ddef}\enotes
  65. \barre
  66. \NOTes\qup f\cu e\hu e\enotes
  67. \barre
  68. \NOtes\qu{ffgh}\enotes
  69. \endextract
  70. \end{music}
  71. \end{mus}
  72.  
  73. See \musicref{music:1} and \musicref{music:2}.
  74. \end{document}


music.png
music.png (16.24 KiB) Viewed 114 times


Stefan
Site admin

MimiKLM
Posts: 8
Joined: Wed Jun 27, 2018 6:35 pm

Postby MimiKLM » Fri Jun 29, 2018 1:05 pm

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 ??

User avatar
Stefan Kottwitz
Site Admin
Posts: 8946
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Fri Jun 29, 2018 1:07 pm

Compile two times,

Stefan
Site admin

MimiKLM
Posts: 8
Joined: Wed Jun 27, 2018 6:35 pm

Postby MimiKLM » Fri Jun 29, 2018 1:27 pm

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

MimiKLM
Posts: 8
Joined: Wed Jun 27, 2018 6:35 pm

Postby MimiKLM » Fri Jun 29, 2018 1:39 pm

Stefan Kottwitz wrote:Compile two times,

Stefan



Great

User avatar
Stefan Kottwitz
Site Admin
Posts: 8946
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Fri Jun 29, 2018 1:45 pm

Here is a figure example. Use the caption package if you would like to customize the captions.

  1. \documentclass[a4paper,12pt]{article}
  2. \usepackage[T1]{polski}
  3. \usepackage[utf8]{inputenc}
  4. \usepackage{pslatex}
  5. \usepackage{graphicx}
  6. \usepackage{framed}
  7. \usepackage{musixtex}
  8. \usepackage[top=1cm,left=2cm,right=2cm,bottom=1cm]{geometry}
  9. \include{musixlyr}
  10. \usepackage{float}
  11. \renewcommand{\figurename}{Music}
  12. \begin{document}
  13.  
  14. \begin{figure}[H]
  15. \begin{music}
  16. \setlength\parindent{0pt}
  17. \generalsignature{2}
  18. % use smallest available size:
  19. \smallmusicsize
  20. \renewcommand*\writebarno{\textit{\the\barno}}
  21. \systemnumbers
  22. \setlyrics{text}{%
  23. Ra-dosť krás-na isk-ra bo-hov E-ly-zej-ská dcé-ra ty, o-má-me-ní
  24. }
  25. \assignlyrics1{text}
  26. \startextract
  27. \NOtes\qu{ffgh}\enotes
  28. \barre
  29. \NOTes\qu{hgfe}\enotes
  30. \barre
  31. \NOtes\qu{ddef}\enotes
  32. \barre
  33. \NOTes\qup f\cu e\hu e\enotes
  34. \barre
  35. \NOtes\qu{ffgh}\enotes
  36. \endextract
  37. \end{music}
  38. \caption{First one.}
  39. \label{music:1}
  40. \end{figure}
  41.  
  42. \begin{figure}[H]
  43. \begin{music}
  44. \setlength\parindent{0pt}
  45. \generalsignature{2}
  46. % use smallest available size:
  47. \smallmusicsize
  48. \renewcommand*\writebarno{\textit{\the\barno}}
  49. \systemnumbers
  50. %\setlyrics{text}{
  51. % Ra-dosť krás-na isk-ra bo-hov E-ly-zej-ská dcé-ra ty, o-má-me-ní
  52. % }
  53. %\assignlyrics1{text}
  54. %\setlyrics{text}{
  55. % Ra-dosť krás-na isk-ra bo-hov E-ly-zej-ská dcé-ra ty, o-má-me-ní
  56. % }
  57. \assignlyrics1{}
  58. \startextract
  59. \NOtes\qu{ffgh}\enotes
  60. \barre
  61. \NOTes\qu{hgfe}\enotes
  62. \barre
  63. \NOtes\qu{ddef}\enotes
  64. \barre
  65. \NOTes\qup f\cu e\hu e\enotes
  66. \barre
  67. \NOtes\qu{ffgh}\enotes
  68. \endextract
  69. \end{music}
  70. \caption{Second one.}
  71. \label{music:2}
  72. \end{figure}
  73.  
  74. See \ref{music:1} and \ref{music:2}.
  75. \end{document}


Stefan
Site admin


Return to “General”

Who is online

Users browsing this forum: No registered users and 3 guests