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 11853 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 11853 times

I found some solution but it doesn´t work so I hope that somebody could help me with this.
begin{music}
\generalsignature{2}
\def\nbinstruments{1}

\debutextrait
\def\writebarno{\llap{\tenbf\the\barno\barnoadd}}%
\def\raisebarno{2\internote}%
\def\shiftbarno{1.3\Interligne}%
\NOtes\zsong{Ra - }\qu f\enotes
\NOtes\zsong{dosť}\qu f\enotes
\NOtes\zsong{krás - }\qu g\enotes
\NOtes\zsong{na }\qu h\enotes
\barre
\NOTes\zsong{is - }\qu h\enotes
\NOTes\zsong{kra }\qu g\enotes
\NOTes\zsong{bo - }\qu f\enotes
\NOTes\zsong{hov }\qu e\enotes
\barre
\NOtes\zsong{E - }\qu d\enotes
\NOtes\zsong{ly - }\qu d\enotes
\NOtes\zsong{zej - }\qu e\enotes
\NOtes\zsong{ská }\qu f\enotes
\barre
\NOTes\zsong{dcé - }\qu f\enotes
\NOTes\zsong{ra  }\cu e\enotes
\NOTes\zsong{ty, }\hu e\enotes
\barre
\NOtes\zsong{o -  }\qu f\enotes
\NOtes\zsong{má -  }\qu f\enotes
\NOtes\zsong{me -  }\qu g\enotes
\NOtes\zsong{ní }\qu h\enotes
\finextrait
.
\debutextrait
.
.
.

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

User avatar
cgnieder
Site Moderator
Posts: 1993
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.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{musixtex}
\input{musixlyr}

\begin{document}


\begin{music}
\setlength\parindent{0pt}%
\generalsignature{2}%
\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í
  a_ sim-ple test to sho-ow
}%
\assignlyrics1{text}%
\startpiece
\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
\barre
\NOtes\qu{cdef}\enotes
\barre
\NOtes\qu{ghij}\enotes
\endpiece
\end{music}

\end{document}


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


Regards
site moderator & package author

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 11807 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.

User avatar
cgnieder
Site Moderator
Posts: 1993
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
site moderator & package author

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

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

sorry, I forgot

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{musixtex}
\input{musixlyr}

\begin{document}


\begin{music}
\setlength\parindent{0pt}
\generalsignature{2}
\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}
\startpiece
\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
\endpiece

\end{music}

\end{document}

User avatar
cgnieder
Site Moderator
Posts: 1993
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 11800 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
\setlyrics{text}{
  Ra-dosť krás-na isk-ra bo-hov E-ly-zej-ská dcé-ra ty, o-má-me-ní
 }

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


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:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

% show page dimensions:
\usepackage{showframe}

% reduce margins:
\usepackage[left=1in,right=1in]{geometry}

\usepackage{musixtex}
\input{musixlyr}

\begin{document}


\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{document}


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


Regards
site moderator & package author

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 11783 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
    \raisebox{0mm}{\qu p}
    but result is:
    15610101-notes-detail.jpg
    15610101-notes-detail.jpg (8.75 KiB) Viewed 11783 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.
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{musixtex}
\usepackage[left=1in,right=1in]{geometry}
\input{musixlyr}

\begin{document}

\begin{music}
\setlength\parindent{0pt}
\generalsignature{2}
\smallmusicsize
\def\writebarno{\llap{\the\barno\barnoadd}}
\def\raisebarno{2\internote}
\def\shiftbarno{1.3\Interligne}
\systemnumbers
\setlyrics{text}{%
  Ra-dosť krás-na isk-ra bo-hov E-ly-zej-ská dcé-ra ty, o-má-me-ní 
  žia-rou oh-ňov poď-me ktvo-jej svä-to-sti. Tvo-je ča-ro zno-vu_ zvia-že
  to čo_ mó-da de-lí dnes všet – kým ľu-ďom brat-mi ká-že stať sa tvo-jich
  krí-del let tvo-je ča-ro zno-vu_ zvia-že to čo_ mó-da
  de-lí dnes všet – kým ľu-ďom brat-mi ká-že stať sa tvo-jich krí-del let.
 }
\assignlyrics1{text}
\startbarno
\startextract
\NOTes\raisebox{0mm}{\qu p}\enotes
\NOtes\lcharnote{p}{100}\qu{f}\enotes
\NOTes\qu{gh}\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
\vspace{5px}

\assignlyrics2{text}
\startbarno=6
\startextract
\NOtes\qu{hgfe}\enotes
\barre
\NOtes\qu{ddef}\enotes
\barre
\NOTes\qup e\cu d\hu d\enotes
\barre
\NOtes\uptext{REF.:}\qu{e}\enotes
\NOtes\qu{efd}\enotes
\barre
\NOtes\qu{e}\enotes
\Notes\Dqbu fg\en
\NOtes\qu{fd}\enotes
\endextract
\vspace{5px}

\assignlyrics3{text}
\startbarno=11
\startextract
\NOtes\qu{e}\enotes
\Notes\Dqbu fg\en
\NOtes\qu{fe}\enotes
\barre
\NOTes\qu{dea}\enotes
\NOTes\isslurd0e\qu f\enotes
\barre
\NOTes\tsslur0e\qu f\enotes
\NOTes\qu {fgh}\enotes
\barre
\NOtes\qu{hgfe}\enotes
\barre
\NOtes\qu{ddef}\enotes
\endextract
\vspace{5px}

\assignlyrics4{text}
\startbarno=16
\startextract
\NOTes\qup e\cu d\hu d\enotes
\barre
\NOtes\uptext{REF.:}\qu{e}\enotes
\NOtes\qu{efd}\enotes
\barre
\NOtes\qu{e}\enotes
\Notes\Dqbu fg\en
\NOtes\qu{fd}\enotes
\barre
\NOtes\qu{e}\enotes
\Notes\Dqbu fg\en
\NOtes\qu{fe}\enotes
\endextract
\vspace{5px}

\assignlyrics5{text}
\startbarno=20
\startextract
\NOTes\qu{dea}\enotes
\NOTes\isslurd0e\qu f\enotes
\barre
\NOTes\tsslur0e\qu f\enotes
\NOTes\qu {fgh}\enotes
\barre
\NOtes\qu{hgfe}\enotes
\barre
\NOtes\qu{ddef}\enotes
\barre
\NOTes\qup e\cu d\hu d\en
\Endpiece
\endextract

\end{music}

\end{document}
Last edited by localghost on Tue Jan 15, 2013 6:59 pm, edited 1 time in total.

User avatar
cgnieder
Site Moderator
Posts: 1993
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
\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:
\def\thebarno{\ifnum\barno=1\relax\else\the\barno\fi}
\def\writebarno{\llap{\thebarno\barnoadd}}


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

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{musixtex}
\usepackage[left=1in,right=1in]{geometry}
\input{musixlyr}

\begin{document}

\begin{music}
% general settings:
\setlength\parindent{0pt}
\generalsignature{2}
% more vertical space above of staffs, default is 3\Interligne:
\stafftopmarg=5\Interligne
\smallmusicsize
% hide bar number if bar number is 1, use systemnumbers:
\def\thebarno{\ifnum\barno=1\relax\else\the\barno\fi}
\def\writebarno{\llap{\thebarno\barnoadd}}
\def\raisebarno{2\internote}
\def\shiftbarno{1.3\Interligne}
\systemnumbers
% lyrics:
\setlyrics{text}{
  Ra-dosť krás-na isk-ra bo-hov E-ly-zej-ská dcé-ra ty, o-má-me-ní
  žia-rou oh-ňov poď-me ktvo-jej svä-to-sti. Tvo-je ča-ro zno-vu_ zvia-že
  to čo_ mó-da de-lí dnes všet – kým ľu-ďom brat-mi ká-že stať sa tvo-jich
  krí-del let tvo-je ča-ro zno-vu_ zvia-že to čo_ mó-da
  de-lí dnes všet – kým ľu-ďom brat-mi ká-že stať sa tvo-jich krí-del let.
 }
\assignlyrics1{text}
% the actual piece:
\startpiece
\notes\Uptext{\metron{\qu}{100}}\en
\NOTes\qu{ffgh}\enotes
\bar
\NOTes\qu{hgfe}\enotes
\bar
\NOtes\qu{ddef}\enotes
\bar
\NOTes\qup f\cu e\hu e\enotes
\bar
\NOtes\qu{ffgh}\enotes
\bar
\NOtes\qu{hgfe}\enotes
\bar
\NOtes\qu{ddef}\enotes
\bar
\NOTes\qup e\cu d\hu d\enotes
% get a double bar line to indicate that a new part starts
% and force line break:
\setdoublebar\alaligne
\NOtes\uptext{REF.:}\qu{e}\enotes
\NOtes\qu{efd}\enotes
\bar
\NOtes\qu{e}\enotes
\Notes\Dqbu fg\en
\NOtes\qu{fd}\enotes
\bar
\NOtes\qu{e}\enotes
\Notes\Dqbu fg\en
\NOtes\qu{fe}\enotes
\bar
\NOTes\qu{dea}\enotes
\NOTes\isslurd0e\qu f\enotes
\bar
\NOTes\tsslur0e\qu f\enotes
\NOTes\qu {fgh}\enotes
\bar
\NOtes\qu{hgfe}\enotes
\bar
\NOtes\qu{ddef}\enotes
\bar
\NOTes\qup e\cu d\hu d\enotes
\setdoublebar\alaligne
\NOtes\uptext{REF.:}\qu{e}\enotes
\NOtes\qu{efd}\enotes
\bar
\NOtes\qu{e}\enotes
\Notes\Dqbu fg\en
\NOtes\qu{fd}\enotes
\bar
\NOtes\qu{e}\enotes
\Notes\Dqbu fg\en
\NOtes\qu{fe}\enotes
\bar
\NOTes\qu{dea}\enotes
\NOTes\isslurd0e\qu f\enotes
\bar
\NOTes\tsslur0e\qu f\enotes
\NOTes\qu {fgh}\enotes
\bar
\NOtes\qu{hgfe}\enotes
\bar
\NOtes\qu{ddef}\enotes
\bar
\NOTes\qup e\cu d\hu d\en
\Endpiece
\end{music}

\end{document}


musixtexpiece.png
musixtexpiece.png (32.87 KiB) Viewed 11764 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
site moderator & package author

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: 1993
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
site moderator & package author


Return to “General”

Who is online

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