From 7a2b0759f1a8dd5031597976bbe4b2d507f7749e Mon Sep 17 00:00:00 2001 From: fred Date: Tue, 26 Mar 2002 23:55:58 +0000 Subject: [PATCH] lilypond-1.3.89 --- Documentation/user/GNUmakefile | 12 +- Documentation/user/latex-mudela-example.latex | 161 +++++++ Documentation/user/mudela-book.tely | 447 +++++++++++++----- lily/hyphen-spanner.cc | 25 +- lily/include/hyphen-spanner.hh | 14 +- 5 files changed, 532 insertions(+), 127 deletions(-) create mode 100644 Documentation/user/latex-mudela-example.latex diff --git a/Documentation/user/GNUmakefile b/Documentation/user/GNUmakefile index 14857cc768..a045e99d94 100644 --- a/Documentation/user/GNUmakefile +++ b/Documentation/user/GNUmakefile @@ -2,18 +2,18 @@ depth=../.. -DATA_FILES = $(wildcard *.data) -datafiles = $(addprefix $(outdir)/,$(DATA_FILES:.data=.html)) -DOC_FILES = $(wildcard *.doc) -DVI_FILES = $(addprefix $(outdir)/,$(DOC_FILES:.doc=.dvi) $(TELY_FILES:.tely=.dvi)) +LATEX_FILES =$(wildcard *.latex) + +DVI_FILES = $(addprefix $(outdir)/,$(LATEX_FILES:.latex=.dvi) $(TELY_FILES:.tely=.dvi)) + +EXTRA_DIST_FILES= $(LATEX_FILES) $(wildcard *.itexi *.itely) -EXTRA_DIST_FILES= $(DOC_FILES) $(DATA_FILES) $(wildcard *.itexi *.itely) - HTML_FILES = $(addprefix $(outdir)/, $(TELY_FILES:.tely=.html)) PS_FILES = $(DVI_FILES:.dvi=.ps) $(OUTDOC_FILES:.doc=.ps) $(OUTTEX_FILES:.tex=.ps) + PS_GZ_FILES= $(addsuffix .gz, $(PS_FILES)) STEPMAKE_TEMPLATES=tex texinfo documentation diff --git a/Documentation/user/latex-mudela-example.latex b/Documentation/user/latex-mudela-example.latex new file mode 100644 index 0000000000..5b6c08e80e --- /dev/null +++ b/Documentation/user/latex-mudela-example.latex @@ -0,0 +1,161 @@ +\documentclass[a4paper, 12pt]{article} +%\def\pre MudelaExample{This if before} +%\def\pre MudelaExample{This is after} +%\usepackage{landscape} +\begin{document} +%uncomment this to try twocolumn mode +%\twocolumn + + +\section{Mudelabook + LaTeX} + +This is an examplefile for mixing Lilypond and Latex. It is also +used to test mudela-book. View the source to see how it is done. + +A simple scale: + +\begin{mudela} +\score{ + \notes\relative c'{c d e f g a b c} +} +\end{mudela} + +Mudela-book search for the \verb|\score| command when it decides +if the code is only a fragment. Thus, in the following code, you have +to use \verb|fragment| option, because the comment confuses mudela-book. + +\begin[fragment]{mudela} +c d e % \score +\end{mudela} + +There is also a shorthand version \verb|\mudela{c' e' g'}|: + +\mudela{c' e' g'} + +that is the same as writing +\begin{verbatim} +\begin[eps]{mudela} +c' e' g' +\end{mudela} +\end{verbatim} + +This C major +\begin[eps, 11pt]{mudela} +c' e' g' +\end{mudela} +and C minor \mudela[11pt]{c' es' g'} chords are floating inside the text. + +\subsection{verb and verbatim} + +As you see, the begin/end verbatim command inside +does not confuse mudela-book: + +\verb|\begin{mudela}c d e\end{mudela}| + +Neither does a verbatim inside verb: + +\verb|\begin{verbatim}\begin{mudela}c d e\end{mudela}\end{verbatim}| + +or verb inside verbatim: + +\begin{verbatim} +\verb|\begin{mudela}c d e\end{mudela}| +\end{verbatim} + +But this is just to stress \verb|mudela-book|. What you need is: + +\verb|\mudela{c' d' e'}| + +and + +\begin{verbatim} +\begin{mudela} +c d e +\end{mudela} +\end{verbatim} + +\subsection{The 'verbatim' and 'intertext' option} +This shows the verbatim option: +\begin[verbatim, intertext="gives this music:"]{mudela} +c' d' e' +\end{mudela} + +\subsection{LaTeX comments} +This is a line with mudela code after the comment char % \mudela{} +% \mudela{} + +If you do not see any music from the heading 'LaTeX comments' and until +this line, then mudela-book is handling latex comments pretty well :-) + +\subsection{To float or not to float} +This music +\begin[eps]{mudela} +c' e' +\end{mudela} +should be floating inside the text by using the \verb|eps| options. + +This music + +\begin[eps]{mudela} +c' e' +\end{mudela} + +has also the \verb|eps| options, but is not floating because there +are an emptry line before and after the mudela block. That is +correct behaviour because it follows La\TeX{} convention that an +empty line signals a new paragraph. Note that the \verb|eps| option +is not necessary when you want the music in a paragraph on its own. + +\subsection{More examples} + +Itemize environment: +\begin{itemize} +\item \mudela[11pt]{ c'} do +\item \mudela[11pt]{d'} re +\item \mudela[11pt]{e'} mi +\item \mudela[11pt]{f'} fa +\item \mudela[11pt]{g'} sol +\end{itemize} + +Tables\footnote{ and footnote: \mudela[eps,11pt]{c' e' g'} }: +\marginpar{ Yes, even as marginpar +\mudela[eps,11pt]{c' d' e'} } + +\begin{tabular}{|l|l|r|} +\hline +\em Notes & \em Name \\ +\hline +\mudela[11pt, filename="cdur"]{} & major \\ +\mudela[11pt]{} & minor \\ +\mudela[11pt]{} & diminished \\ +\mudela[11pt]{} & augmented \\ +\hline +\end{tabular} + +\pagebreak + +Testing of spacing. The next music is surrounded by an empty line. +text text text text text text text text text text text text +text text text text text text text text text text text text + +\begin{mudela} +\score{ \notes\relative c'{ c d e f g a b c} } +\end{mudela} + +text text text text text text text text text text text text +text text text text text text text text text text text text +text text text text text text text text text text text text + +Next has no empty lines. +text text text text text text text text text text text text +text text text text text text text text text text text text +text text text text text text text text text text text text +\begin{mudela} +\score{ \notes\relative c'{ c d e f g a b c} } +\end{mudela} +text text text text text text text text text text text text +text text text text text text text text text text text text + + + +\end{document} diff --git a/Documentation/user/mudela-book.tely b/Documentation/user/mudela-book.tely index 7df11604a1..cc16d77403 100644 --- a/Documentation/user/mudela-book.tely +++ b/Documentation/user/mudela-book.tely @@ -79,22 +79,335 @@ translation approved by the Free Software Foundation. @section Introduction +[ The tutorial part is at the moment commented out and moved to +the end of this document ] + + [TODO: THIS MANUAL IS NOT FINISHED YET. FIXME.] -@ignore -Mudela-book is a script that process your La@TeX{} file and with great -help from GNU LilyPond it translates blocks of mudela code it finds -inside @code{mudela} environments to tex or eps graphics. It then -creates a new file that can be sent through La@TeX{} to create a -@file{.dvi} file with lines of music integrated with text. +@command{mudela-book} is a script that helps integrating mudela with +La@TeX{} or TeXinfo. @command{mudela-book} runs Lilypond on fragments +of mudela in your source file, and includes the results into a +document that can be processed with La@TeX{}, @command{makeinfo} +or @command{texi2dvi}. +The result is a text document with formatted music integrated. -Mudela-book will do its best to try to align the music to the left and -right margins. Currently the most used papersizes and one- and -twocolumn mode is supported, but if you use the geometry-package from -La@TeX{} or change the margins things will break. +@command{mudela-book} will do its best to try to align the music to +the left and right margins. Currently the most used papersizes and +one- and twocolumn mode is supported. But if you use some more +advances features, like the geometry-package or change the margins in +La@TeX{} or use @code{@@pagesize} in texinfo, will break. This document assumes you have basic knowledge of GNU LilyPond and -La@TeX{}. +La@TeX{} or texinfo. + +@section TeXinfo reference + +Your markup the mudela code like this: +@example +@@mudela[options, go, here] + YOUR MUDELA CODE +@@end mudela +@end example + +or + +@example +@@mudela[option, go, here]@{ YOUR MUDELA CODE @} +@end example + +@command{mudela-book} knows the default margins, and a few papersizes. +These commands should be in the beginning of the document: +@itemize @bullet +@item @code{@@afourpaper} +@item @code{@@afourwide} +@item @code{@@smallbook} +@end itemize +@code{@@pagesizes} are not supported. + +@subsection{Examples} + +Two simple examples. First a complete block: + +@example +@@mudela[26pt] +c' d' e' f' g'2 g' +@@end mudela +@end example + +produces this music: +@mudela +c' d' e' f' g'2 g' +@end mudela + +Then the short version: +@example +@@mudela[11pt]@{@} +@end example + +and its music: + +@mudela[11pt]{} + + +@subsection{@@example and @@code} + +I'm not sure if this will go into the final documentation, this is +here mostly to remember me on why things are the way they are. + +@command{mudela-book} will do nothing with special with @code{@@code} and +@code{@@example} environments. The 'code' and 'example' commands +should work just as normal. People looking at document that should be +processed by @command{mudela-book}, should notice nothing special, except from +some block like this: +@example +@@mudela +BLABLA +@@end mudela +@end example + +or this: + +@code{@@mudela@{ BLABLA @}} + +Anything other is a bug in @command{mudela-book}. + +So to get this in the printed manual: + +@example +@@mudela[26pt] +\relative c'@{c d e f g2 g@} +@@end mudela +@end example + +you have to write this: + +@example +@@example +@@@@mudela[26pt] +\relative c'@@@{c d e f g2 g@@@} +@@@@end mudela +@@end example +@end example + +Simply explained, every '@{', '@}' and '@@' has to be written as '@@@{', +'@@@}' and '@@@@'. This is how it works in plain texinfo too. + +@section La@TeX{} reference + +Your markup the mudela code like this: +@example +\begin[option, go, here]@{mudela@} + YOUR MUDELA CODE +\end@{mudela@} +@end example + +or + +@example +\mudela@{ YOUR MUDELA CODE @} +@end example + +The 'geometry' package is is not supported. The most popular +papersizes should work. + +Mudela-book know about the @code{\onecolumn} and +@code{\twocolumn} commands. + +The music will be surrounded by @code{\preMudelaExample} and +@code{\postMudelaExample}. The variables are +defined to nothing by default, and the user can redefine them +to whatever he wants. +@strong{[UGH: THIS DOES NOT HAPPEN WHEN +YOU USE THE SHORT FORM, \MUDELA@{ ... @}, CHECK OUT WHY]} + +@subsection{@code{landscape} package} +There is some simple support for landscape paper format, and this +can be combined with the @code{\twocolumn} command. Only a4 and +letter paper is supported, more to come... + +A more complete +support, maybe also supporting the geometry package is planned, but +there are more work that has to be done on @command{mudela-book} +first. + +This should work: +@example +\documentclass@{article@} +\usepackage@{landscape@} +\begin@{document@} +\twocolumn +BLA BLA BLA +\end@{document@} +@end example + +@subsection{Examples} + +@example +\begin[26pt]@{mudela@} +c' d' e' f' g'2 g'2 +\end@{mudela@} +@end example + +produces this music: + +@mudela[26pt] +c' d' e' f' g'2 g'2 +@end mudela + +Then the short version: +@example +\mudela[11pt]@{@} +@end example + +and its music: + +@mudela[11pt]{} + + +@subsection{\begin@{verbatim@} and \verb|\verb|} + +There work just as expected. Look at @file{mb-latex.tex} for details. + +@section Options + +@table @samp +@item eps + the music is created as eps graphics that can be inserted in + the middle of a text line, not only as a separate paragraph. + (La@TeX{} only) +@item verbatim + CONTENTS is copied into the source enclosed in a verbatim block, + followed by any text given with the @code{intertext} option, then + the actual music is displayed. This option does not work with + the short version of the mudela blocks: + + @code{ @@mudela@{ CONTENTS @} } and @code{ \mudela@{ CONTENTS @} } + +@item intertext="text inside apostrophs" + Used in conjunction with @code{verbatim} option. +@item filename=FILENAME + Save the mudela code to FILENAME instead of using a hash value + of CONTENTS. +@item 11pt, 13pt, 16pt, 20pt, 26pt + set the fontsize to use for the music +@item singleline + linewidth = -1. +@item multiline + linewidth = textwidth +@item fragment +@item nonfragment + Override @command{mudela-book} autodetection of what type of code is in the + mudela block, voice contents or complete code. +@end table + +@section Invocation + +When you run @command{mudela-book} it will generate lots of small +files that Lilypond will process. So to avoid all the garbage in +your source directory, you should either change to a temporary +directory, or use the @code{--outdir} commandline options: + +@code{cd out && mudela-book ../yourfile.tex} + +@code{mudela-book --outdir=out yourfile.tex} + + +For latex input, the file to give to latex has ext @file{.latex}. +TeXinfo input will be written to a file with ext @file{.texi}. So be +careful, don't give the source file that ext, or the file will be +overwritten. + +@strong{[UGH: IS THIS THE BEST WAY TO DO IT. MAYBE ADD A COMMENT LINE TO THE +GENERATED FILE, SO MUDELA-BOOK CAN TEST IF THE FILE IT IS TO OVERWRITE +IS GENERATED.]} + +@strong{About the input} + +If the file contains the ``block'' + +@example + + \begin@{mudela@} + CONTENTS + \end@{mudela@} + +@end example + +then LilyPond is run on CONTENTS. @command{mudela-book} puts the result back, +surrounded by @code{\preMudelaExample} and @code{\postMudelaExample} +commands. @code{\preMudelaExample} and @code{posMudelaExample} is +defined to nothing by default, and the user can redefine them +to whatever he wants. + + +@subsection Command line options + +@table @samp + +@item @option{-f}, @option{--format=} + Specify the document type to process, @code{latex} or @code{texi}. + @command{mudela-book} usually figure out this automatically. +@item --default-music-fontsize=??pt + Set the fontsize to use for mudela if no fontsize is given + as option. +@item --force-music-fontsize=??pt + Force all mudela to use this fontsize, overriding options + given to \begin@{mudela@} +@item -I DIR, --include=DIR + include path +@item -M, --dependencies + Write dependencies to out-www/filename.dep +@item --dep-prefix=PREF + prepend PREF before each -M dependency +@item -n, --no-lily + don't run lilypond +@item --no-pictures + don't generate pictures +@item --read-lys + don't write ly files. This way you can do + @example + mudela-book file.tely + convert-mudela + mudela-book --read-lys + @end example +@item --outname=FILE + The name of La@TeX{} file to output. If this option is not given, + the output name derived from the input name. +@item --outdir= + where to place generated files +@item --version + print version information +@item --help + Print a short help message +@end table + + + +@command{mudela-book} is written in python 1.5, so you have to install +@uref{http://www.python.org,python}. + + + +@section Bugs + +The La@TeX{} \includeonly@{...@} command is ignored. + +Ignores almost all La@TeX{} commands that changes margins and linewidths. + +La@TeX{} comments can confuse command{mudela-book}: +@example +% this music will be displayed: \mudela@{c d e@} +@end example + +@section Authors + +@email{hanwen@@cs.uu.nl, Han-Wen Nienhuys}, @uref{http://www.cs.uu.nl/people/hanwen} + +@email{tca@@gnu.org, Tom Cato Amundsen} + +@bye +@ignore So what does this look like? Well, here is an example: @mudela[veryverbatim, intertext="produces this music:"] @@ -149,7 +462,7 @@ Very often, if you mix music and text, the music is often only a few notes or at most a few bars. This music should be as short as possible and not stretched to be aligned to the right margin. -If you only write voice-contents in the mudela block, mudela-book +If you only write voice-contents in the mudela block, @command{mudela-book} will set the @code{linewidth} variable to -1, so Lilypond will make the music as short as possible but without breaking the line. Here is a well know harmonic progression: @@ -198,7 +511,7 @@ You can also use @code{mudelafile} (on a separate line, FIXME), to include another file. @section Fontsize options You can use all lilypond fontsizes in -mudela-book. The default 16pt fontsize is probably to big to be +@command{mudela-book}. The default 16pt fontsize is probably to big to be included in the middle of the text, 11pt or 13pt is probably better. The code can look like this: @@ -258,8 +571,8 @@ lines. @section Just in case... The options @code{fragment} and @code{nonfragment} will override -mudela-book when it scans the mudela code to see if it is voice -contents or complete code. This might be useful if mudela-book choose +@command{mudela-book} when it scans the mudela code to see if it is voice +contents or complete code. This might be useful if @command{mudela-book} choose wrong. Since there is no finder's fee which doubles every year, there is no @@ -322,108 +635,4 @@ Verbatim environments will also ignore the page margins. That is a feature of La@TeX{}. (But you usually put things inside a verbatim environment when you don't want La@TeX{} to do any linebreaking) - -@section Texinfo behavior - -[TODO] - -@section Invocation - -@file{mudela-book} is a script that helps integrating mudela and -La@TeX{}. mudela-book runs LilyPond on fragments of mudela in your -source file, and includes the results into document that can be -processed with La@TeX{}. The result is a text document with formatted -music integrated. - -Lilypond will by default create all output files in directory @file{out}. -The file to give to latex has ext @file{.latex}. - -@strong{About the input} - -If the file contains the ``block'' - -@example - - \begin@{mudela@} - CONTENTS - \end@{mudela@} - -@end example - -then LilyPond is run on CONTENTS. mudela-book puts the result back, -surrounded by @code{\preMudelaExample} and @code{\postMudelaExample} -commands. @code{\preMudelaExample} and @code{posMudelaExample} is -defined to nothing by default, and the user can redefine them -to whatever he wants. - -@code{\begin} takes the following options: @end ignore - - -@subsection Command line options - -@table @samp - -@item -f, --format= - Specify the document type to process, @code{latex} or @code{texi}. - @file{mudela-book} usually figure out this automatically. -@item --default-music-fontsize=??pt - Set the fontsize to use for mudela if no fontsize is given - as option. -@item --force-music-fontsize=??pt - Force all mudela to use this fontsize, overriding options - given to \begin@{mudela@} -@item -I DIR, --include=DIR - include path -@item -M, --dependencies - Write dependencies to out-www/filename.dep -@item --dep-prefix=PREF - prepend PREF before each -M dependency -@item -n, --no-lily - don't run lilypond -@item --no-pictures - don't generate pictures -@item --read-lys - don't write ly files. This way you can do - @example - mudela-book file.tely - convert-mudela - mudela-book --read-lys - @end example -@item --outname=FILE - The name of La@TeX{} file to output. If this option is not given, - the output name derived from the input name. -@item --outdir= - where to place generated files -@item --version - print version information -@item --help - Print a short help message -@end table - - - -@file{mudela-book} is written in python 1.5, so you have to install -@uref{http://www.python.org,python}. - - - -@section Bugs - -The La@TeX{} \includeonly@{...@} command is ignored. - -Ignores almost all La@TeX{} commands that changes margins and linewidths. - -La@TeX{} comments can confuse mudela-book: -@example -% this music will be displayed: \mudela@{c d e@} -@end example - -@section Authors - -@email{hanwen@@cs.uu.nl, Han-Wen Nienhuys}, @uref{http://www.cs.uu.nl/people/hanwen} - -@email{tca@@gnu.org, Tom Cato Amundsen} - -@bye - diff --git a/lily/hyphen-spanner.cc b/lily/hyphen-spanner.cc index 50259cc314..a798afe422 100644 --- a/lily/hyphen-spanner.cc +++ b/lily/hyphen-spanner.cc @@ -15,6 +15,7 @@ #include "molecule.hh" #include "paper-def.hh" #include "hyphen-spanner.hh" +#include "paper-column.hh" #include "spanner.hh" #include "item.hh" @@ -60,7 +61,28 @@ Hyphen_spanner::brew_molecule (SCM smob) */ if(l < w) l = sqrt(l*w); - + else + { + /* OK, we have a problem. Usually this means that we're on the + first column, and we have a long lyric which extends to near + the offset for stuff */ + /* This test for being on the first column has been shamelessly + ripped from spanner.cc */ + Paper_column *sc = dynamic_cast (sp->get_bound(LEFT)->column_l()); + if (sc != NULL && + sc->break_status_dir () == RIGHT) + { + /* We are on the first column, so it's probably harmless to + get the minimum length back by extending leftwards into + the space under the clef/key sig/time sig */ + bounds[LEFT] = bounds[RIGHT] - l; + } + else + { + /* We can't get the length desired. Maybe we should warn. */ + l = w; + } + } Box b (Interval (-l/2,l/2), Interval (h,h+th)); Molecule mol (sp->lookup_l ()->filledbox (b)); mol.translate_axis (bounds.center () @@ -80,3 +102,4 @@ Hyphen_spanner::Hyphen_spanner (Spanner*s) { elt_l_ = s; } + diff --git a/lily/include/hyphen-spanner.hh b/lily/include/hyphen-spanner.hh index e8947a4209..fb114a914a 100644 --- a/lily/include/hyphen-spanner.hh +++ b/lily/include/hyphen-spanner.hh @@ -17,8 +17,20 @@ The length of the hyphen line should stretch based on the size of the gap between syllables. + +properties: + + thickness -- thickness of line (in stafflinethickness) + + height -- vertical offset (in staffspace) + + minimum-length -- try to make the hyphens at least this long. Also works + as a scaling parameter for the length + + word-space -- elongate left by this much (FIXME: cumbersome semantics) + */ -struct Hyphen_spanner // interface +struct Hyphen_spanner { public: Spanner* elt_l_; -- 2.39.5