On Mon, 16 Sep 2002, Alexandros Droseltis wrote: > Hello all! > > Five months before, Rainer Dunker and Eva had sent some marvellous > macros for inserting small extracts of music in a TeX-text. Is it > possible with a small arrangement to make them fit in LaTeX too? > It would be great.
> > For example, the macros of Rainer: > %%%%%%%%%%%%%%%%%%%%%%%%%%% > % macro to insert lineless, clefless sequence of notes > \makeatletter > \def\notesintext#1{% > {\let\extractline\relax > \setlines10\smallmusicsize \nobarnumbers \nostartrule > \staffbotmarg0pt \setclefsymbol1\empty \global\clef@skip0pt > \startextract\addspace{-\afterruleskip}#1\zendextract}} > \makeatother > > % macro adapted to insert music with clef & lines: > \def\musicintext#1{% > {\let\extractline\relax > \smallmusicsize \nobarnumbers > \staffbotmarg0pt \setclefsymbol1\treblelowoct > \startextract\addspace{-\afterruleskip}#1\endextract}} > > %\notesintext{% > \Notes\qu0\en\notes\Dqbu 00\en\bar\notes\Dqbu 00\Dqbu 00\en} > without clef and lines. > > Here's an insert > %\musicintext{\Notes\qu{cdef}\en} > with clef and lines. > > This insert > %\musicintext{\Notes\qu{cdefgfedc}\en} > contains more notes and expands to the appropriate width > automatically. > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% > > Thanks in advance > Alexandros > This is no problem at all --- cf. the attached LaTeX source file. Happy MusixLaTeXing! ccn. ------------------------------------------------------------------- On Mon, 16 Sep 2002, Alexandros Droseltis wrote: > One more question on the subject: these music extracts cause a > vertical spacing between the text line that is above them (TeX or > LaTeX). Could this be controlled in the macros? > > Alexandros Its easy to do that in LaTeX (outside the music environments): just use \vspace*{any length} "any length" can be just that, e.g. -1.5mm, +20pt, or whatever. The \vspace always goes on a line by itself, and dont forget to leave an empty line before it. ccn. ------------------------------------------------------------------- > On Tue, 17 Sep 2002, Alexandros Droseltis wrote: > > Thank you very much Mr. Noack, now the line and the spacing is > > all right, but the previous text line (two lines before \vspace) > > is aligned left, not justified, because latex thinks that a > > paragraph ends there. > Well, what kind of jusification do you want? You do have tell > LaTeX some of your wishes, otherwise it does what a good book type > setter would do ... > E.g. if you want a single line (like your last) centered instead > of left-justified, you might say (at the right place) > \centering{abcd abcd ... abcd}, or \begin{center} abcd abcd ... > abcd \end{center} ; > > Thank you Mr. Noack for the answer, but I think that I did not > > express myself very good. If you have a look at the DVI file, > > that is generated from the file MusicInText.tex that I have sent > > you, you would notice that line 3 is not expanded along the line > > (Blocksatz), as it should be: the whole file MusicInText.tex > > should be only *one* paragraph. This is a result of the > > > > [blank line] > > \vspace... > > and we added it because of the additional space that causes the > > musical extract between line 3 and line 4, if the command > > \vspace is not used. I'll try to make it clear: causes musical > > extract => additional space between line 3 and 4. Correction: > > causes with vspace && noindent=>two paragraphs instead of one. > > > > Best Reagrds > > Alexandros ------------------------------------------------------------------- On Wed, 18 Sep 2002, Alexandros Droseltis wrote: > > I have found the solution: \\[-Xmm] instead of \vspace solved the > problem. > > Alexandros > OK, I admit my various proposals meant too much handwork before everything was perfect. But yours isn't perfect yet either: you have to decide by hand where to put your line break. So I finally wrote a mini LaTeX macro to set the inline music in a box of adjustable height. Look at the attached LaTeX source and the resulting .ps file! Regards to all ccn. -- ..................................................................... _|_ / | \ \_|_/ Prof.Dr. Cornelius C. Noack Phones: _|_ __ Inst. f. Theor. Physik FB 1 office : +49 (421) 218-2427 | | | \ Universit"at Bremen secretary: -2422 |__| |__/ Otto-Hahn-Allee Fax : -4869 | | | \ D - 28334 Bremen home : +49 (421) 34 22 36 | | |__/ Fax: 346 7872 PhyHB E-mail: [EMAIL PROTECTED] WWW-page: www-theorie.physik.uni-bremen.de/~noack .......................................................................
\documentclass[12pt]{book} \usepackage{musixtex} % the 2 macros below are the unaltered originals by Rainer Dunker: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % macro to insert lineless, clefless sequence of notes \makeatletter \def\notesintext#1{% {\let\extractline\relax \setlines10\smallmusicsize \nobarnumbers \nostartrule % \stafftopmarg-2.5\Interligne% \staffbotmarg0pt \setclefsymbol1\empty \global\clef@skip0pt \startextract\addspace{-\afterruleskip}#1\zendextract}} \makeatother % macro adapted to insert music with clef & lines: \def\musicintext#1{% {\let\extractline\relax \smallmusicsize \nobarnumbers \staffbotmarg0pt \setclefsymbol1\treblelowoct \startextract\addspace{-\afterruleskip}#1\endextract}} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \newcommand{\Embednotes}[2][0pt]{\raisebox{0pt}[#1]{% \begin{music} \notesintext{#2} \end{music} } } \newcommand{\Embedmusic}[2][0pt]{\raisebox{0pt}[#1]{% \begin{music} \musicintext{#2} \end{music} } } % Usage of \Embednotes / \Embedmusic : % with just 1 parameter, you will get the default vertical spacing, % usually too small to be aesthetically pleasing. But, as optional % parameter (in SQUARE BRACKETS, before the actual music parameter!), % you can give the height of the line containing the inline music. % Adjust this as you please (cf. the 4 examples below). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{document} \begin{enumerate} \item \verb@\Embednotes@, with \emph{default} vertical spacing: \medskip\noindent abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd cd abcd abcd abcd cd abcd abcdb abcd sd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd xxxx xxxx xxxx xxxx xxxx \Embednotes{\notes\Qqbu eeee\en\Notes\qu0\qu0\en} abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd \item \verb@\Embednotes@, with \verb@4ex@ as the height of the line box containing the inline music: \medskip\noindent abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd cd abcd abcd abcd cd abcd abcdb abcd sd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd xxxx xxxx xxxx xxxx xxxx \Embednotes[4ex]{\notes\Qqbu eeee\en\Notes\qu0\qu0\en} abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd \newpage \item \verb@\Embedmusic@, with \emph{default} vertical spacing: \medskip\noindent abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd cd abcd abcd abcd cd abcd abcdb abcd sd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd xxxx xxxx xxxx xxxx xxxx \Embedmusic{\Notes\qu{cdef}\en} abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd \item \verb@\Embedmusic@, with \verb@5ex@ as the height of the line box containing the inline music: \medskip\noindent abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd cd abcd abcd abcd cd abcd abcdb abcd sd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd xxxx xxxx xxxx xxxx xxxx \Embedmusic[5ex]{\Notes\qu{cdef}\en} abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd \end{enumerate} \end{document}
musinln.ps
Description: PostScript document