From: Graham Percival Date: Fri, 25 Sep 2009 22:20:16 +0000 (+0100) Subject: Doc: move latex examples into application. X-Git-Tag: release/2.13.5-0~44 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=6060fd44fd273e8c138454350103876467decee3;p=lilypond.git Doc: move latex examples into application. --- diff --git a/Documentation/GNUmakefile b/Documentation/GNUmakefile index c5045faa5f..da6fbc3c90 100644 --- a/Documentation/GNUmakefile +++ b/Documentation/GNUmakefile @@ -26,13 +26,11 @@ $(outdir)/snippets/index..html: TEXI2HTML_FLAGS += -D short_toc ### Extra source files README_TOP_FILES= DEDICATION THANKS -LATEX_FILES =$(call src-wildcard,*.latex) IN_ITELY_FILES = $(call src-wildcard,snippets/*-intro.itely) SNIPPET_LY_FILES = $(call src-wildcard,snippets/*.ly) -EXTRA_DIST_FILES = $(call src-wildcard,*.init) $(LATEX_FILES) \ - search-box.html +EXTRA_DIST_FILES = $(call src-wildcard,*.init) search-box.html ### Out files diff --git a/Documentation/application/GNUmakefile b/Documentation/application/GNUmakefile index c93c9e0624..26e33a6901 100644 --- a/Documentation/application/GNUmakefile +++ b/Documentation/application/GNUmakefile @@ -2,4 +2,9 @@ depth = ../.. LOCALSTEPMAKE_TEMPLATES = ly +LATEX_FILES =$(call src-wildcard,*.latex) +EXTRA_DIST_FILES = $(LATEX_FILES) + include $(depth)/make/stepmake.make + + diff --git a/Documentation/application/latex-example.latex b/Documentation/application/latex-example.latex new file mode 100644 index 0000000000..da9c12b871 --- /dev/null +++ b/Documentation/application/latex-example.latex @@ -0,0 +1,46 @@ +\documentclass[a4paper]{article} + +%\def\preLilyPondExample{}} +%\def\postLilyPondExample{} + + +\begin{document} + +\begin{lilypond} +\relative { c' d e f g a b c } +\end{lilypond} + + +\begin[fragment]{lilypond} +c d e +\end{lilypond} + + +% show interaction of margins lilypond+verses + +% outdated +% generate standard lilypond titles +\input titledefs.tex +\def\preLilyPondExample{\def\mustmakelilypondtitle{}} + +\begin{lilypond} +\header { + title = "Title" + subtitle = "Subtitle" + subsubtitle = "Subsubtitle" + opus = "Opus 1" + piece = "Piece" + composer = "Composer" + enteredby = "JCN" + instrument = "instrument" +} +\layout { linewidth = -1. } +\relative c'' { a b c d } +\end{lilypond} + +\begin{enumerate} +\item Vers one. aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa +\item Vers two. bbb bbb bbb bbb bbb bbb bbb bbb bbb bbb +\end{enumerate} + +\end{document} diff --git a/Documentation/application/latex-lilypond-example.latex b/Documentation/application/latex-lilypond-example.latex new file mode 100644 index 0000000000..a8b799badb --- /dev/null +++ b/Documentation/application/latex-lilypond-example.latex @@ -0,0 +1,183 @@ +\documentclass[a4paper, 12pt]{article} +% 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{LilyPond-book + LaTeX} + +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{ + \relative c'{c d e f g a b c} +} +\end{lilypond} + +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. + +\begin[fragment]{lilypond} +c d e % \score +\end{lilypond} + +There is also a shorthand version \verb|\lilypond[fragment]{c' e' g'}|: + +\lilypond[fragment]{c' e' g'} + +that is the same as writing +\begin{verbatim} +\begin[fragment]{lilypond} +c' e' g' +\end{lilypond} +\end{verbatim} + +This C major +%%\begin[staffsize=11\pt,fragment]{lilypond} +\begin[11pt,fragment]{lilypond} +\context Voice <> +\end{lilypond} +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 +does not confuse lilypond-book: + +\verb|\begin[fragment]{lilypond}c d e\end{lilypond}| + +Neither does a verbatim inside verb: + +\verb|\begin{verbatim}\begin[fragment]{lilypond}c d e\end{lilypond}\end{verbatim}| + +or verb inside verbatim: + +\begin{verbatim} +\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[fragment]{c' d' e'}| + +and + +\begin{verbatim} +\begin{lilypond} +c d e +\end{lilypond} +\end{verbatim} + +\subsection{The 'verbatim' and 'intertext' option} +This shows the verbatim option: +\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{\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[fragment]{lilypond} +c' e' +\end{lilypond} +should be floating inside the text by using the \verb|eps| options. + +This music + +\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. 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,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[11pt,fragment]{c' e' g'} }: +\marginpar{ Yes, even as marginpar +\lilypond[11pt,fragment]{c' d' e'} } + +\begin{tabular}{|l|l|r|} +\hline +\em Notes & \em Name \\ +\hline +\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 + +\begin{lilypond} +\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 + +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{lilypond} +\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 + +%% need to use an -I ../../../input/test to find the file +%% \lilypondfile{tie.ly} + +\end{document} diff --git a/Documentation/latex-example.latex b/Documentation/latex-example.latex deleted file mode 100644 index da9c12b871..0000000000 --- a/Documentation/latex-example.latex +++ /dev/null @@ -1,46 +0,0 @@ -\documentclass[a4paper]{article} - -%\def\preLilyPondExample{}} -%\def\postLilyPondExample{} - - -\begin{document} - -\begin{lilypond} -\relative { c' d e f g a b c } -\end{lilypond} - - -\begin[fragment]{lilypond} -c d e -\end{lilypond} - - -% show interaction of margins lilypond+verses - -% outdated -% generate standard lilypond titles -\input titledefs.tex -\def\preLilyPondExample{\def\mustmakelilypondtitle{}} - -\begin{lilypond} -\header { - title = "Title" - subtitle = "Subtitle" - subsubtitle = "Subsubtitle" - opus = "Opus 1" - piece = "Piece" - composer = "Composer" - enteredby = "JCN" - instrument = "instrument" -} -\layout { linewidth = -1. } -\relative c'' { a b c d } -\end{lilypond} - -\begin{enumerate} -\item Vers one. aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa -\item Vers two. bbb bbb bbb bbb bbb bbb bbb bbb bbb bbb -\end{enumerate} - -\end{document} diff --git a/Documentation/latex-lilypond-example.latex b/Documentation/latex-lilypond-example.latex deleted file mode 100644 index a8b799badb..0000000000 --- a/Documentation/latex-lilypond-example.latex +++ /dev/null @@ -1,183 +0,0 @@ -\documentclass[a4paper, 12pt]{article} -% 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{LilyPond-book + LaTeX} - -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{ - \relative c'{c d e f g a b c} -} -\end{lilypond} - -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. - -\begin[fragment]{lilypond} -c d e % \score -\end{lilypond} - -There is also a shorthand version \verb|\lilypond[fragment]{c' e' g'}|: - -\lilypond[fragment]{c' e' g'} - -that is the same as writing -\begin{verbatim} -\begin[fragment]{lilypond} -c' e' g' -\end{lilypond} -\end{verbatim} - -This C major -%%\begin[staffsize=11\pt,fragment]{lilypond} -\begin[11pt,fragment]{lilypond} -\context Voice <> -\end{lilypond} -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 -does not confuse lilypond-book: - -\verb|\begin[fragment]{lilypond}c d e\end{lilypond}| - -Neither does a verbatim inside verb: - -\verb|\begin{verbatim}\begin[fragment]{lilypond}c d e\end{lilypond}\end{verbatim}| - -or verb inside verbatim: - -\begin{verbatim} -\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[fragment]{c' d' e'}| - -and - -\begin{verbatim} -\begin{lilypond} -c d e -\end{lilypond} -\end{verbatim} - -\subsection{The 'verbatim' and 'intertext' option} -This shows the verbatim option: -\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{\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[fragment]{lilypond} -c' e' -\end{lilypond} -should be floating inside the text by using the \verb|eps| options. - -This music - -\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. 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,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[11pt,fragment]{c' e' g'} }: -\marginpar{ Yes, even as marginpar -\lilypond[11pt,fragment]{c' d' e'} } - -\begin{tabular}{|l|l|r|} -\hline -\em Notes & \em Name \\ -\hline -\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 - -\begin{lilypond} -\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 - -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{lilypond} -\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 - -%% need to use an -I ../../../input/test to find the file -%% \lilypondfile{tie.ly} - -\end{document}