X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=Documentation%2Fuser%2Flatex-lilypond-example.latex;h=a8b799badba8691393a5148c438b244ae4eca53c;hb=c10e42d15b978acf35c75671b16c618215be8215;hp=d155917b569e6aaf97f320ab42bf51b8dd8e0205;hpb=dd555e6bd412ca7b7dc422aca6f0d35c40300b86;p=lilypond.git diff --git a/Documentation/user/latex-lilypond-example.latex b/Documentation/user/latex-lilypond-example.latex index d155917b56..a8b799badb 100644 --- a/Documentation/user/latex-lilypond-example.latex +++ b/Documentation/user/latex-lilypond-example.latex @@ -1,28 +1,38 @@ -% kommentar \documentclass[a4paper, 12pt]{article} -%\def\preMudelaExample{} -%\def\postMudelaExample{} +% keep \documentclass on 1st line for lilypond-book auto-detection + +% +% This is way too long and hairy -- +% +% + + + + +%\def\preLilyPondExample{} +%\def\postLilyPondExample{} %\usepackage{graphics} %\usepackage{landscape} + \begin{document} %uncomment this to try twocolumn mode %\twocolumn -\section{Mudelabook + LaTeX} +\section{LilyPond-book + LaTeX} -This is an examplefile for mixing Lilypond and Latex. It is also +This is an examplefile for mixing LilyPond and Latex. It is also used to test lilypond-book. View the source to see how it is done. A simple scale: \begin{lilypond} \score{ - \notes\relative c'{c d e f g a b c} + \relative c'{c d e f g a b c} } \end{lilypond} -Lilypond-book search for the \verb|\score| command when it decides +LilyPond-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 lilypond-book. @@ -30,43 +40,45 @@ to use \verb|fragment| option, because the comment confuses lilypond-book. c d e % \score \end{lilypond} -There is also a shorthand version \verb|\lilypond{c' e' g'}|: +There is also a shorthand version \verb|\lilypond[fragment]{c' e' g'}|: -\lilypond{c' e' g'} +\lilypond[fragment]{c' e' g'} that is the same as writing \begin{verbatim} -\begin[eps]{lilypond} +\begin[fragment]{lilypond} c' e' g' \end{lilypond} \end{verbatim} This C major -\begin[eps, 11pt]{lilypond} -c' e' g' +%%\begin[staffsize=11\pt,fragment]{lilypond} +\begin[11pt,fragment]{lilypond} +\context Voice <> \end{lilypond} -and C minor \lilypond[11pt]{c' es' g'} chords are floating inside the text. +and C minor +\lilypond[fragment,11pt]{\context Voice <>} chords are floating inside the text. \subsection{verb and verbatim} -As you see, the begin/end verbatim command inside +As you see, the begin/end verbatim command inside does not confuse lilypond-book: -\verb|\begin{lilypond}c d e\end{lilypond}| +\verb|\begin[fragment]{lilypond}c d e\end{lilypond}| Neither does a verbatim inside verb: -\verb|\begin{verbatim}\begin{lilypond}c d e\end{lilypond}\end{verbatim}| +\verb|\begin{verbatim}\begin[fragment]{lilypond}c d e\end{lilypond}\end{verbatim}| or verb inside verbatim: \begin{verbatim} -\verb|\begin{lilypond}c d e\end{lilypond}| +\verb|\begin[fragment]{lilypond}c d e\end{lilypond}| \end{verbatim} But this is just to stress \verb|lilypond-book|. What you need is: -\verb|\lilypond{c' d' e'}| +\verb|\lilypond[fragment]{c' d' e'}| and @@ -78,85 +90,92 @@ c d e \subsection{The 'verbatim' and 'intertext' option} This shows the verbatim option: -\begin[verbatim, intertext="gives this music:"]{lilypond} +\begin[fragment,verbatim, intertext="gives this music:"]{lilypond} c' d' e' \end{lilypond} \subsection{LaTeX comments} -This is a line with lilypond code after the comment char % \lilypond{} -% \lilypond{} +This is a line with lilypond code +after the comment char % \lilypond{\context Voice <>} +% \lilypond{\context Voice <>} If you do not see any music from the heading 'LaTeX comments' and until this line, then lilypond-book is handling latex comments pretty well :-) \subsection{To float or not to float} This music -\begin[eps]{lilypond} -c' e' +\begin[fragment]{lilypond} +c' e' \end{lilypond} should be floating inside the text by using the \verb|eps| options. This music -\begin[eps]{lilypond} +\begin[fragment]{lilypond} c' e' \end{lilypond} has also the \verb|eps| options, but is not floating because there are an emptry line before and after the lilypond 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 +empty line signals a new paragraph. 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 \lilypond[11pt]{ c'} do -\item \lilypond[11pt]{d'} re -\item \lilypond[11pt]{e'} mi -\item \lilypond[11pt]{f'} fa -\item \lilypond[11pt]{g'} sol +\item +\lilypond[11pt,fragment]{ c'} do +\item +\lilypond[11pt,fragment]{d'} re +\item +\lilypond[11pt,fragment]{e'} mi +\item +\lilypond[11pt,fragment]{f'} fa +\item +\lilypond[11pt,fragment]{g'} sol \end{itemize} -Tables\footnote{ and footnote: \lilypond[eps,11pt]{c' e' g'} }: +Tables\footnote{ and footnote: +\lilypond[11pt,fragment]{c' e' g'} }: \marginpar{ Yes, even as marginpar -\lilypond[eps,11pt]{c' d' e'} } +\lilypond[11pt,fragment]{c' d' e'} } \begin{tabular}{|l|l|r|} \hline \em Notes & \em Name \\ \hline -\lilypond[11pt, filename="cdur"]{} & major \\ -\lilypond[11pt]{} & minor \\ -\lilypond[11pt]{} & diminished \\ -\lilypond[11pt]{} & augmented \\ +\lilypond[11pt,fragment,filename="cdur"]{\context Voice <>} & major \\ +\lilypond[11pt,fragment]{\context Voice <>} & minor \\ +\lilypond[11pt,fragment]{\context Voice <>} & diminished \\ +\lilypond[11pt,fragment]{\context Voice <>} & 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 +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{lilypond} -\score{ \notes\relative c'{ c d e f g a b c} } +\score{ \relative c'{ c d e f g a b c} } \end{lilypond} -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 +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 +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{lilypond} -\score{ \notes\relative c'{ c d e f g a b c} } +\score{ \relative c'{ c d e f g a b c} } \end{lilypond} -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 +text text text text text text text text text text text text %% need to use an -I ../../../input/test to find the file %% \lilypondfile{tie.ly}