LaTeX forum ⇒ Generalmusixtex | Formatting for Notes Topic is solved

LaTeX specific issues not fitting into one of the other forums of this category.
Liben
Posts: 5
Joined: Tue Jan 01, 2013 6:10 pm

musixtex | Formatting for Notes

Postby Liben » Tue Jan 01, 2013 9:42 pm

Hello,

I am doing some work in LaTeX and I am using package musixtex but I don't know how to write some commands. This is model of notes that I need to transfer into LaTeX.
wanted.jpg
wanted.jpg (85.91 KiB) Viewed 9255 times

but there is five problems that I need to solve.

  1. For the "align" of notes I need same length.
  2. The number at the beginning of notes in red circle.
  3. The underscore behind the text in green circle.
  4. The symbol at the end of notes.
  5. In the yellow rectangle I don't know how can I put "bar" symbol between two notes.

for now I have this:
have.jpg
have.jpg (110.7 KiB) Viewed 9255 times

I found some solution but it doesn´t work so I hope that somebody could help me with this.
  1. begin{music}
  2. \generalsignature{2}
  3. \def\nbinstruments{1}
  4.  
  5. \debutextrait
  6. \def\writebarno{\llap{\tenbf\the\barno\barnoadd}}%
  7. \def\raisebarno{2\internote}%
  8. \def\shiftbarno{1.3\Interligne}%
  9. \NOtes\zsong{Ra - }\qu f\enotes
  10. \NOtes\zsong{dosť}\qu f\enotes
  11. \NOtes\zsong{krás - }\qu g\enotes
  12. \NOtes\zsong{na }\qu h\enotes
  13. \barre
  14. \NOTes\zsong{is - }\qu h\enotes
  15. \NOTes\zsong{kra }\qu g\enotes
  16. \NOTes\zsong{bo - }\qu f\enotes
  17. \NOTes\zsong{hov }\qu e\enotes
  18. \barre
  19. \NOtes\zsong{E - }\qu d\enotes
  20. \NOtes\zsong{ly - }\qu d\enotes
  21. \NOtes\zsong{zej - }\qu e\enotes
  22. \NOtes\zsong{ská }\qu f\enotes
  23. \barre
  24. \NOTes\zsong{dcé - }\qu f\enotes
  25. \NOTes\zsong{ra }\cu e\enotes
  26. \NOTes\zsong{ty, }\hu e\enotes
  27. \barre
  28. \NOtes\zsong{o - }\qu f\enotes
  29. \NOtes\zsong{má - }\qu f\enotes
  30. \NOtes\zsong{me - }\qu g\enotes
  31. \NOtes\zsong{ní }\qu h\enotes
  32. \finextrait
  33. .
  34. \debutextrait
  35. .
  36. .
  37. .

Thank you.
Last edited by cgnieder on Wed Jan 02, 2013 9:53 pm, edited 1 time in total.

Tags:

User avatar
cgnieder
Site Moderator
Posts: 1988
Joined: Sat Apr 16, 2011 7:27 pm

Postby cgnieder » Wed Jan 02, 2013 10:44 pm

Hi Liben,

welcome to the LaTeX-community!

I'll try to answer your questions:

  • bar numbers only at the beginning of a line can be achieved by calling \systemnumbers
  • lyrics are best set up loading and using the musixlyr extension; my example below should give you an idea how to use it. You'll see that in the lyrics there are - and _ used to indicate where a word must be broken or be extended to the next note.
  • one should delete the aux files ending mx1 and mx2 before finally typesetting the whole piece and then run pdflatex, musixflx and pdflatex on the file again to get proper alignment.

  1. \documentclass{article}
  2. \usepackage[utf8]{inputenc}
  3. \usepackage[T1]{fontenc}
  4. \usepackage{musixtex}
  5. \input{musixlyr}
  6.  
  7. \begin{document}
  8.  
  9.  
  10. \begin{music}
  11. \setlength\parindent{0pt}%
  12. \generalsignature{2}%
  13. \renewcommand*\writebarno{\textit{\the\barno}}%
  14. \systemnumbers
  15. \setlyrics{text}{%
  16. Ra-dosť krás-na isk-ra bo-hov E-ly-zej-ská dcé-ra ty, o-má-me-ní
  17. a_ sim-ple test to sho-ow
  18. }%
  19. \assignlyrics1{text}%
  20. \startpiece
  21. \NOtes\qu{ffgh}\enotes
  22. \barre
  23. \NOTes\qu{hgfe}\enotes
  24. \barre
  25. \NOtes\qu{ddef}\enotes
  26. \barre
  27. \NOTes\qup f\cu e\hu e\enotes
  28. \barre
  29. \NOtes\qu{ffgh}\enotes
  30. \barre
  31. \NOtes\qu{cdef}\enotes
  32. \barre
  33. \NOtes\qu{ghij}\enotes
  34. \endpiece
  35. \end{music}
  36.  
  37. \end{document}


musixtex.png
musixtex.png (17.74 KiB) Viewed 9255 times


Regards
Clemens
------------------------------
chemmacros · chemformula · leadsheets · xsim

Liben
Posts: 5
Joined: Tue Jan 01, 2013 6:10 pm

Postby Liben » Mon Jan 14, 2013 9:29 pm

Thank you for your help but I have another problem. I rewrote my old code into LaTeX by using MusiXTeX package but I don´t know how can I write some notes or text of song to separated note line. It means that these two lines
15582906-note.jpg
15582906-note.jpg (25.24 KiB) Viewed 9209 times

I need merge into one line.

Thanks for your help.
Last edited by localghost on Mon Jan 14, 2013 9:51 pm, edited 1 time in total.
Reason: Preferably no external links (see Board Rules). Attachments go onto the forum server where possible.

User avatar
cgnieder
Site Moderator
Posts: 1988
Joined: Sat Apr 16, 2011 7:27 pm

Postby cgnieder » Mon Jan 14, 2013 9:32 pm

Can you please post a Infominimal working example, i.e., some code starting with \documentclass and ending with \end{document} that is compilable? Maybe you could simply post the code that you used to produce the image you posted?

Regards
Clemens
------------------------------
chemmacros · chemformula · leadsheets · xsim

Liben
Posts: 5
Joined: Tue Jan 01, 2013 6:10 pm

Postby Liben » Mon Jan 14, 2013 10:26 pm

sorry, I forgot

  1. \documentclass{article}
  2. \usepackage[utf8]{inputenc}
  3. \usepackage[T1]{fontenc}
  4. \usepackage{musixtex}
  5. \input{musixlyr}
  6.  
  7. \begin{document}
  8.  
  9.  
  10. \begin{music}
  11. \setlength\parindent{0pt}
  12. \generalsignature{2}
  13. \renewcommand*\writebarno{\textit{\the\barno}}
  14. \systemnumbers
  15. \setlyrics{text}{
  16. Ra-dosť krás-na isk-ra bo-hov E-ly-zej-ská dcé-ra ty, o-má-me-ní
  17. }
  18. \assignlyrics1{text}
  19. \startpiece
  20. \NOtes\qu{ffgh}\enotes
  21. \barre
  22. \NOTes\qu{hgfe}\enotes
  23. \barre
  24. \NOtes\qu{ddef}\enotes
  25. \barre
  26. \NOTes\qup f\cu e\hu e\enotes
  27. \barre
  28. \NOtes\qu{ffgh}\enotes
  29. \endpiece
  30.  
  31. \end{music}
  32.  
  33. \end{document}

User avatar
cgnieder
Site Moderator
Posts: 1988
Joined: Sat Apr 16, 2011 7:27 pm

Postby cgnieder » Tue Jan 15, 2013 12:54 am

Your image looks as if you haven't run »musixflx« on your document or have forgotten to delete the .mx1 and .mx2 files before doing so. Otherwise it would look like this:

musix1.png
musix1.png (13.65 KiB) Viewed 9202 times


You may have observed that the texts starts with the second instead of with the first note. The reason for this is the endofline in
  1. \setlyrics{text}{
  2. Ra-dosť krás-na isk-ra bo-hov E-ly-zej-ská dcé-ra ty, o-má-me-ní
  3. }

Adding % helpd here:
  1. \setlyrics{text}{%
  2. Ra-dosť krás-na isk-ra bo-hov E-ly-zej-ská dcé-ra ty, o-má-me-ní
  3. }


If you want the whole piece in one line you can use \startextract and \endextract instead of \startpiece and \stoppiece. Beware that then the music line exceeds into the margin without warning. You might want to use the smallest music size and smaller margins then:

  1. \documentclass{article}
  2. \usepackage[utf8]{inputenc}
  3. \usepackage[T1]{fontenc}
  4.  
  5. % show page dimensions:
  6. \usepackage{showframe}
  7.  
  8. % reduce margins:
  9. \usepackage[left=1in,right=1in]{geometry}
  10.  
  11. \usepackage{musixtex}
  12. \input{musixlyr}
  13.  
  14. \begin{document}
  15.  
  16.  
  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.  
  41. \end{document}


musix2.png
musix2.png (7.16 KiB) Viewed 9202 times


Regards
Clemens
------------------------------
chemmacros · chemformula · leadsheets · xsim

Liben
Posts: 5
Joined: Tue Jan 01, 2013 6:10 pm

Postby Liben » Tue Jan 15, 2013 6:51 pm

OK, I almost got it but there are some details I need to repair.
15610005-notes.jpg
15610005-notes.jpg (87.56 KiB) Viewed 9185 times

  1. Align doesn´t work.
  2. I don´t want number in first line (green circle).
  3. I need to put note symbol on the place where showing red circle. I found commands
    1. \raisebox{0mm}{\qu p}
    but result is:
    15610101-notes-detail.jpg
    15610101-notes-detail.jpg (8.75 KiB) Viewed 9185 times

    one note is missing and note over note line have small line.
  4. Next problem is with "\Endpiece" symbol. I don´t know why there are two black rectangle. In the picture yellow circle.
  1. \documentclass{article}
  2. \usepackage[utf8]{inputenc}
  3. \usepackage[T1]{fontenc}
  4. \usepackage{musixtex}
  5. \usepackage[left=1in,right=1in]{geometry}
  6. \input{musixlyr}
  7.  
  8. \begin{document}
  9.  
  10. \begin{music}
  11. \setlength\parindent{0pt}
  12. \generalsignature{2}
  13. \smallmusicsize
  14. \def\writebarno{\llap{\the\barno\barnoadd}}
  15. \def\raisebarno{2\internote}
  16. \def\shiftbarno{1.3\Interligne}
  17. \systemnumbers
  18. \setlyrics{text}{%
  19. Ra-dosť krás-na isk-ra bo-hov E-ly-zej-ská dcé-ra ty, o-má-me-ní
  20. žia-rou oh-ňov poď-me ktvo-jej svä-to-sti. Tvo-je ča-ro zno-vu_ zvia-že
  21. to čo_ mó-da de-lí dnes všet – kým ľu-ďom brat-mi ká-že stať sa tvo-jich
  22. krí-del let tvo-je ča-ro zno-vu_ zvia-že to čo_ mó-da
  23. de-lí dnes všet – kým ľu-ďom brat-mi ká-že stať sa tvo-jich krí-del let.
  24. }
  25. \assignlyrics1{text}
  26. \startbarno
  27. \startextract
  28. \NOTes\raisebox{0mm}{\qu p}\enotes
  29. \NOtes\lcharnote{p}{100}\qu{f}\enotes
  30. \NOTes\qu{gh}\enotes
  31. \barre
  32. \NOTes\qu{hgfe}\enotes
  33. \barre
  34. \NOtes\qu{ddef}\enotes
  35. \barre
  36. \NOTes\qup f\cu e\hu e\enotes
  37. \barre
  38. \NOtes\qu{ffgh}\enotes
  39. \endextract
  40. \vspace{5px}
  41.  
  42. \assignlyrics2{text}
  43. \startbarno=6
  44. \startextract
  45. \NOtes\qu{hgfe}\enotes
  46. \barre
  47. \NOtes\qu{ddef}\enotes
  48. \barre
  49. \NOTes\qup e\cu d\hu d\enotes
  50. \barre
  51. \NOtes\uptext{REF.:}\qu{e}\enotes
  52. \NOtes\qu{efd}\enotes
  53. \barre
  54. \NOtes\qu{e}\enotes
  55. \Notes\Dqbu fg\en
  56. \NOtes\qu{fd}\enotes
  57. \endextract
  58. \vspace{5px}
  59.  
  60. \assignlyrics3{text}
  61. \startbarno=11
  62. \startextract
  63. \NOtes\qu{e}\enotes
  64. \Notes\Dqbu fg\en
  65. \NOtes\qu{fe}\enotes
  66. \barre
  67. \NOTes\qu{dea}\enotes
  68. \NOTes\isslurd0e\qu f\enotes
  69. \barre
  70. \NOTes\tsslur0e\qu f\enotes
  71. \NOTes\qu {fgh}\enotes
  72. \barre
  73. \NOtes\qu{hgfe}\enotes
  74. \barre
  75. \NOtes\qu{ddef}\enotes
  76. \endextract
  77. \vspace{5px}
  78.  
  79. \assignlyrics4{text}
  80. \startbarno=16
  81. \startextract
  82. \NOTes\qup e\cu d\hu d\enotes
  83. \barre
  84. \NOtes\uptext{REF.:}\qu{e}\enotes
  85. \NOtes\qu{efd}\enotes
  86. \barre
  87. \NOtes\qu{e}\enotes
  88. \Notes\Dqbu fg\en
  89. \NOtes\qu{fd}\enotes
  90. \barre
  91. \NOtes\qu{e}\enotes
  92. \Notes\Dqbu fg\en
  93. \NOtes\qu{fe}\enotes
  94. \endextract
  95. \vspace{5px}
  96.  
  97. \assignlyrics5{text}
  98. \startbarno=20
  99. \startextract
  100. \NOTes\qu{dea}\enotes
  101. \NOTes\isslurd0e\qu f\enotes
  102. \barre
  103. \NOTes\tsslur0e\qu f\enotes
  104. \NOTes\qu {fgh}\enotes
  105. \barre
  106. \NOtes\qu{hgfe}\enotes
  107. \barre
  108. \NOtes\qu{ddef}\enotes
  109. \barre
  110. \NOTes\qup e\cu d\hu d\en
  111. \Endpiece
  112. \endextract
  113.  
  114. \end{music}
  115.  
  116. \end{document}
Last edited by localghost on Tue Jan 15, 2013 6:59 pm, edited 1 time in total.
Reason: Preferably no external links (see Board Rules). Attachments go onto the forum server where possible.

User avatar
cgnieder
Site Moderator
Posts: 1988
Joined: Sat Apr 16, 2011 7:27 pm

Postby cgnieder » Tue Jan 15, 2013 9:53 pm

Ok, let's make this a little bit like a tutorial, just because I'm in the mood to. :)

First of all: as I understand it you're trying to typeset a whole piece and not a series of extracts. For this case \startextract and \endextract are the wrong choice. The whole piece should be placed inside \startpiece and \endpiece (or \stoppiece or the uppercase variants \Endpiece or \Stoppiece for the double bar that terminates a piece). (Using more that one of the ending commands will double the bar lines which is what causes your problem at the end of the piece.) The breaking into lines should be left to TeX or more precisely the program musixflx. Most of your problems will be solved following this rationale.

Creating a piece normally has the following routine. Suppose your main file is called mycoolmusic.tex. Now, after typing the piece you run pdflatex mycoolmusic as you would normally do. Additional to the usual mycoolmusic.aux and mycoolmusic.log files a file named mycoolmusic.mx1 is created. This file serves as input for musixflx. So you now have to run musixflx mycoolmusic. This will create an additional file named mycoolmusic.mx2. This serves as help file for the next latex run to get the right alignment and spacing. So you need to run pdflatex mycoolmusic another time.

If you now see that you have to change details of the piece you have go through this whole routine again. In order to get it right you should delete both mycoolmusic.mx1 and mycoolmusic.mx2 before doing so or you might observe strange displacements and the like.

Now, just like with LaTeX and normal text one sometimes has to help musixflx to get the line breaking right. Every \bar (\barre is an alias) is considered as potential break point. If you want to prohibit this for a certain \bar you can use \xbar instead. You can also insert a potential break point without creating a bar line with \zbar. If you want to force a line break you can use \alaligne (as equivalent to \bar) or \zalaligne (as equivalent to \zbar).

The next problem: I guess you want to insert some tempo information above the first bar. As you have noticed \qu{<pitch>} won't help here. Raising it with a box will at best lead to strange effects. Specifically \qu{p} creates a quarter note with a stem pointing up at pitch p. Pitch p corresponds to b'' which is exactly what you're getting. I'll present a better solution later using a combination of \metron, \Uptext and \qu. A little more on \qu{<pitch>} first. There are to siblings, \ql{<pitch>} which creates a quarter note with a lower stem and \qa{<pitch>} which creates a quarter note with automatic stem placement.

The \qu in \metron below unfortunately is not hidden from musixlyr. In order to get it ignored we have to remove the % I suggested in my last posting. So at the beginning we'll place something like
  1. \notes\Uptext{\metron{\qu}{100}}\en


Hiding the system bar number at the beginning can be done via a conditional. In the following code I test if the number is 1. It will only be printed if otherwise:
  1. \def\thebarno{\ifnum\barno=1\relax\else\the\barno\fi}
  2. \def\writebarno{\llap{\thebarno\barnoadd}}


Now, - at last - let's put everything together (to be compiled twice with one run of musixflx in between):

  1. \documentclass{article}
  2. \usepackage[utf8]{inputenc}
  3. \usepackage[T1]{fontenc}
  4. \usepackage{musixtex}
  5. \usepackage[left=1in,right=1in]{geometry}
  6. \input{musixlyr}
  7.  
  8. \begin{document}
  9.  
  10. \begin{music}
  11. % general settings:
  12. \setlength\parindent{0pt}
  13. \generalsignature{2}
  14. % more vertical space above of staffs, default is 3\Interligne:
  15. \stafftopmarg=5\Interligne
  16. \smallmusicsize
  17. % hide bar number if bar number is 1, use systemnumbers:
  18. \def\thebarno{\ifnum\barno=1\relax\else\the\barno\fi}
  19. \def\writebarno{\llap{\thebarno\barnoadd}}
  20. \def\raisebarno{2\internote}
  21. \def\shiftbarno{1.3\Interligne}
  22. \systemnumbers
  23. % lyrics:
  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. žia-rou oh-ňov poď-me ktvo-jej svä-to-sti. Tvo-je ča-ro zno-vu_ zvia-že
  27. to čo_ mó-da de-lí dnes všet – kým ľu-ďom brat-mi ká-že stať sa tvo-jich
  28. krí-del let tvo-je ča-ro zno-vu_ zvia-že to čo_ mó-da
  29. de-lí dnes všet – kým ľu-ďom brat-mi ká-že stať sa tvo-jich krí-del let.
  30. }
  31. \assignlyrics1{text}
  32. % the actual piece:
  33. \startpiece
  34. \notes\Uptext{\metron{\qu}{100}}\en
  35. \NOTes\qu{ffgh}\enotes
  36. \bar
  37. \NOTes\qu{hgfe}\enotes
  38. \bar
  39. \NOtes\qu{ddef}\enotes
  40. \bar
  41. \NOTes\qup f\cu e\hu e\enotes
  42. \bar
  43. \NOtes\qu{ffgh}\enotes
  44. \bar
  45. \NOtes\qu{hgfe}\enotes
  46. \bar
  47. \NOtes\qu{ddef}\enotes
  48. \bar
  49. \NOTes\qup e\cu d\hu d\enotes
  50. % get a double bar line to indicate that a new part starts
  51. % and force line break:
  52. \setdoublebar\alaligne
  53. \NOtes\uptext{REF.:}\qu{e}\enotes
  54. \NOtes\qu{efd}\enotes
  55. \bar
  56. \NOtes\qu{e}\enotes
  57. \Notes\Dqbu fg\en
  58. \NOtes\qu{fd}\enotes
  59. \bar
  60. \NOtes\qu{e}\enotes
  61. \Notes\Dqbu fg\en
  62. \NOtes\qu{fe}\enotes
  63. \bar
  64. \NOTes\qu{dea}\enotes
  65. \NOTes\isslurd0e\qu f\enotes
  66. \bar
  67. \NOTes\tsslur0e\qu f\enotes
  68. \NOTes\qu {fgh}\enotes
  69. \bar
  70. \NOtes\qu{hgfe}\enotes
  71. \bar
  72. \NOtes\qu{ddef}\enotes
  73. \bar
  74. \NOTes\qup e\cu d\hu d\enotes
  75. \setdoublebar\alaligne
  76. \NOtes\uptext{REF.:}\qu{e}\enotes
  77. \NOtes\qu{efd}\enotes
  78. \bar
  79. \NOtes\qu{e}\enotes
  80. \Notes\Dqbu fg\en
  81. \NOtes\qu{fd}\enotes
  82. \bar
  83. \NOtes\qu{e}\enotes
  84. \Notes\Dqbu fg\en
  85. \NOtes\qu{fe}\enotes
  86. \bar
  87. \NOTes\qu{dea}\enotes
  88. \NOTes\isslurd0e\qu f\enotes
  89. \bar
  90. \NOTes\tsslur0e\qu f\enotes
  91. \NOTes\qu {fgh}\enotes
  92. \bar
  93. \NOtes\qu{hgfe}\enotes
  94. \bar
  95. \NOtes\qu{ddef}\enotes
  96. \bar
  97. \NOTes\qup e\cu d\hu d\en
  98. \Endpiece
  99. \end{music}
  100.  
  101. \end{document}


musixtexpiece.png
musixtexpiece.png (32.87 KiB) Viewed 9166 times


Last but not least: it really is worth reading through the whole documentation of musixtex. Admittedly: it is rather long. Also, it is in English which is not perfect for us non-native speakers. And third, since musixtex is a generic package the syntax often is more plainTeX- than LaTeX-like. Nevertheless it pays off!

Regards
Clemens
------------------------------
chemmacros · chemformula · leadsheets · xsim

Liben
Posts: 5
Joined: Tue Jan 01, 2013 6:10 pm

Postby Liben » Tue Jan 15, 2013 11:29 pm

Finally, I have it. Big thanks cgnieder. I don´t understood how to create .mx2 file but I download "musixflx" and run .mx1 file with this musixflx and .mx2 file was created. Then when I start .tex file all was align like I need :) I have to make some details like title,autor but it wouldn´t be a problem. I read many pdf and another literature about musixtex and I found some useful commands which could helped me but I didn´t know how to used them so they didn´t worked and very often literature was very extensive for me as a beginner of Latex ;) Thank you for your time and help.

User avatar
cgnieder
Site Moderator
Posts: 1988
Joined: Sat Apr 16, 2011 7:27 pm

Postby cgnieder » Tue Jan 15, 2013 11:38 pm

Liben wrote:Finally, I have it. Big thanks cgnieder.

You're welcome!

Liben wrote:I don´t understood how to create .mx2 file but I download "musixflx" and run .mx1 file with this musixflx and .mx2 file was created.

I don't know which TeX distribution you're using but musixflx is part of TeX Live and of MiKTeX so I assumed you must have it installed already...

Liben wrote:I read many pdf and another literature about musixtex and I found some useful commands which could helped me but I didn´t know how to used them so they didn´t worked and very often literature was very extensive for me as a beginner of Latex ;) Thank you for your time and help.

Well, at the beginning TeX and LaTeX and all the details can be quite confusing and it takes quite some time to learn good practices and the like. Just ask again if you have another question.

Regards
Clemens
------------------------------
chemmacros · chemformula · leadsheets · xsim


Return to “General”

Who is online

Users browsing this forum: Bing [Bot] and 8 guests