From 95bcbed80fc123c902728ffed8d48e82b8ba9bb1 Mon Sep 17 00:00:00 2001
From: Reinhold Kainhofer <reinhold@kainhofer.com>
Date: Mon, 7 Jun 2010 17:09:53 +0200
Subject: [PATCH] Lilypond-book: Some more test cases for latex

---
 .../lilypond-book/html-lilypond-block.html    | 10 +++++
 .../lilypond-book/suffix-itely.itely          | 14 ++++++
 .../lilypond-book/suffix-lyxml.lyxml          | 14 ++++++
 .../regression/lilypond-book/suffix-tely.tely | 14 ++++++
 .../regression/lilypond-book/suffix-texi.texi | 14 ++++++
 .../lilypond-book/suffix-texinfo.texinfo      | 14 ++++++
 .../lilypond-book/tex-auto-linebreak.lytex    | 22 +++++++++
 .../lilypond-book/tex-comment-firstline.lytex | 17 +++++++
 .../lilypond-book/tex-comments.lytex          | 28 ++++++++++++
 .../tex-compatibility-mode.lytex              | 10 +++++
 .../lilypond-book/tex-footnote.lytex          | 11 +++++
 .../lilypond-book/tex-fragment.lytex          | 19 ++++++++
 .../tex-graphics-package-added.lytex          | 10 +++++
 ...ile-latex.lytex => tex-include-file.lytex} |  0
 .../lilypond-book/tex-include-options.lytex   |  5 +++
 .../lilypond-book/tex-lilypond-block.lytex    | 15 +++++++
 .../tex-lilypond-inside-itemize.lytex         | 21 +++++++++
 .../tex-lilypond-inside-table.lytex           | 20 +++++++++
 .../lilypond-book/tex-lilypondversion.lytex   | 10 +++++
 .../lilypond-book/tex-paragraphs.lytex        | 30 +++++++++++++
 .../lilypond-book/tex-snippet-options.lytex   | 38 ++++++++++++++++
 .../lilypond-book/tex-twocolumn.lytex         | 17 +++++++
 .../lilypond-book/tex-verbatim.lytex          | 45 +++++++++++++++++++
 23 files changed, 398 insertions(+)
 create mode 100644 input/regression/lilypond-book/html-lilypond-block.html
 create mode 100644 input/regression/lilypond-book/suffix-itely.itely
 create mode 100644 input/regression/lilypond-book/suffix-lyxml.lyxml
 create mode 100644 input/regression/lilypond-book/suffix-tely.tely
 create mode 100644 input/regression/lilypond-book/suffix-texi.texi
 create mode 100644 input/regression/lilypond-book/suffix-texinfo.texinfo
 create mode 100644 input/regression/lilypond-book/tex-auto-linebreak.lytex
 create mode 100644 input/regression/lilypond-book/tex-comment-firstline.lytex
 create mode 100644 input/regression/lilypond-book/tex-comments.lytex
 create mode 100644 input/regression/lilypond-book/tex-compatibility-mode.lytex
 create mode 100644 input/regression/lilypond-book/tex-footnote.lytex
 create mode 100644 input/regression/lilypond-book/tex-fragment.lytex
 create mode 100644 input/regression/lilypond-book/tex-graphics-package-added.lytex
 rename input/regression/lilypond-book/{tex-include-file-latex.lytex => tex-include-file.lytex} (100%)
 create mode 100644 input/regression/lilypond-book/tex-include-options.lytex
 create mode 100644 input/regression/lilypond-book/tex-lilypond-block.lytex
 create mode 100644 input/regression/lilypond-book/tex-lilypond-inside-itemize.lytex
 create mode 100644 input/regression/lilypond-book/tex-lilypond-inside-table.lytex
 create mode 100644 input/regression/lilypond-book/tex-lilypondversion.lytex
 create mode 100644 input/regression/lilypond-book/tex-paragraphs.lytex
 create mode 100644 input/regression/lilypond-book/tex-snippet-options.lytex
 create mode 100644 input/regression/lilypond-book/tex-twocolumn.lytex
 create mode 100644 input/regression/lilypond-book/tex-verbatim.lytex

diff --git a/input/regression/lilypond-book/html-lilypond-block.html b/input/regression/lilypond-book/html-lilypond-block.html
new file mode 100644
index 0000000000..dfaf1c1e81
--- /dev/null
+++ b/input/regression/lilypond-book/html-lilypond-block.html
@@ -0,0 +1,10 @@
+<html>
+
+A simple lilypond snippet as a stand-alone paragraph:
+
+<lilypond>
+\relative c' {\repeat unfold 20 c4}
+</lilypond>
+
+
+</html>
diff --git a/input/regression/lilypond-book/suffix-itely.itely b/input/regression/lilypond-book/suffix-itely.itely
new file mode 100644
index 0000000000..8b89751f52
--- /dev/null
+++ b/input/regression/lilypond-book/suffix-itely.itely
@@ -0,0 +1,14 @@
+\input texinfo @c -*- coding: utf-8; mode: texinfo; -*-
+@setfilename suffix-itely.info
+@settitle lilypond-book Suffix test for itely
+
+@node Top
+@top Suffix test for itely
+
+Testing lilypond-book texinfo mode with .itely file suffix.
+@lilypond[fragment,relative=2]
+\key c \minor c4 e d2
+@end lilypond
+
+
+@bye
diff --git a/input/regression/lilypond-book/suffix-lyxml.lyxml b/input/regression/lilypond-book/suffix-lyxml.lyxml
new file mode 100644
index 0000000000..0e8c8ae9a4
--- /dev/null
+++ b/input/regression/lilypond-book/suffix-lyxml.lyxml
@@ -0,0 +1,14 @@
+<book id="lyxml_suffix_test">
+    <title></title>
+    <chapter id="lyxml_test">
+        <title>Suffix test for lyxml</title>
+        <para>Testing lilypond-book DocBook mode with .lyxml file suffix.</para>
+        <inlinemediaobject>
+          <textobject>
+            <programlisting language="lilypond" role="fragment verbatim staffsize=16 ragged-right relative=2">
+              \key c \minor c4 es g2
+            </programlisting>
+          </textobject>
+        </inlinemediaobject>
+    </chapter>
+</book>
\ No newline at end of file
diff --git a/input/regression/lilypond-book/suffix-tely.tely b/input/regression/lilypond-book/suffix-tely.tely
new file mode 100644
index 0000000000..60a2eb09ef
--- /dev/null
+++ b/input/regression/lilypond-book/suffix-tely.tely
@@ -0,0 +1,14 @@
+\input texinfo @c -*- coding: utf-8; mode: texinfo; -*-
+@setfilename suffix-tely.info
+@settitle lilypond-book Suffix test for tely
+
+@node Top
+@top Suffix test for tely
+
+Testing lilypond-book texinfo mode with .tely file suffix.
+@lilypond[fragment,relative=2]
+\key c \minor c4 e d2
+@end lilypond
+
+
+@bye
diff --git a/input/regression/lilypond-book/suffix-texi.texi b/input/regression/lilypond-book/suffix-texi.texi
new file mode 100644
index 0000000000..0670343e96
--- /dev/null
+++ b/input/regression/lilypond-book/suffix-texi.texi
@@ -0,0 +1,14 @@
+\input texinfo @c -*- coding: utf-8; mode: texinfo; -*-
+@setfilename suffix-texi.info
+@settitle lilypond-book Suffix test for texi
+
+@node Top
+@top Suffix test for texi
+
+Testing lilypond-book texinfo mode with .texi file suffix.
+@lilypond[fragment,relative=2]
+\key c \minor c4 e d2
+@end lilypond
+
+
+@bye
diff --git a/input/regression/lilypond-book/suffix-texinfo.texinfo b/input/regression/lilypond-book/suffix-texinfo.texinfo
new file mode 100644
index 0000000000..11cea1521d
--- /dev/null
+++ b/input/regression/lilypond-book/suffix-texinfo.texinfo
@@ -0,0 +1,14 @@
+\input texinfo @c -*- coding: utf-8; mode: texinfo; -*-
+@setfilename suffix-texinfo.info
+@settitle lilypond-book Suffix test for texinfo
+
+@node Top
+@top Suffix test for texinfo
+
+Testing lilypond-book texinfo mode with .texinfo file suffix.
+@lilypond[fragment,relative=2]
+\key c \minor c4 e d2
+@end lilypond
+
+
+@bye
diff --git a/input/regression/lilypond-book/tex-auto-linebreak.lytex b/input/regression/lilypond-book/tex-auto-linebreak.lytex
new file mode 100644
index 0000000000..a76e9e17c8
--- /dev/null
+++ b/input/regression/lilypond-book/tex-auto-linebreak.lytex
@@ -0,0 +1,22 @@
+\documentclass[a4paper]{article}
+
+\begin{document}
+
+Documents for \verb+lilypond-book+ may freely mix music and text. The music
+snippets will be properly line-broken. For example,
+
+\begin{lilypond}
+\relative c' {
+  c2 g'2 \times 2/3 { f8 e d } c'2 g4
+  c,2 g'2 \times 2/3 { f8 e d } c'2 g4
+  c,2 g'2 \times 2/3 { f8 e d } c'2 g4
+  c,2 g'2 \times 2/3 { f8 e d } c'2 g4
+  c,2 g'2 \times 2/3 { f8 e d } c'2 g4
+  c,2 g'2 \times 2/3 { f8 e d } c'2 g4
+  c,2 g'2 \times 2/3 { f8 e d } c'2 g4
+  c,2 g'2 \times 2/3 { f8 e d } c'2 g4
+}
+\end{lilypond}
+
+
+\end{document}
\ No newline at end of file
diff --git a/input/regression/lilypond-book/tex-comment-firstline.lytex b/input/regression/lilypond-book/tex-comment-firstline.lytex
new file mode 100644
index 0000000000..5d0ae0c0a3
--- /dev/null
+++ b/input/regression/lilypond-book/tex-comment-firstline.lytex
@@ -0,0 +1,17 @@
+% A comment on the first line should not confuse lilypond-book's format
+% detection
+\documentclass[a4paper, 12pt]{article}
+
+\begin{document}
+
+\section{A coment on the first line of the file}
+
+This should not confuse the auto-detection of lilypond-book...
+
+\begin{lilypond}
+\score{
+  \relative c'{c d e f g a b c}
+}
+\end{lilypond}
+
+\end{document}
diff --git a/input/regression/lilypond-book/tex-comments.lytex b/input/regression/lilypond-book/tex-comments.lytex
new file mode 100644
index 0000000000..72bf7f2a81
--- /dev/null
+++ b/input/regression/lilypond-book/tex-comments.lytex
@@ -0,0 +1,28 @@
+\documentclass[a4paper, 12pt]{article}
+
+\begin{document}
+
+
+\subsection{LaTeX comments}
+This is a line with lilypond code
+after the comment char % \lilypond{\context Voice <<c' e' g'>>}
+% \lilypond{\context Voice <<c' e' g'>>}
+
+If you do not see any music above
+this line, then lilypond-book is handling latex comments pretty well :-)
+
+The following snippet is preceded by a comment that would start a lilypond
+environment
+
+%%\begin{lilypond}
+\begin{lilypond}[11pt,fragment]
+\context Voice <<c' e' g'>>
+\end{lilypond}
+
+A single-line comment inside a fragment does not confuse lilypond-book:
+
+\begin{lilypond}[fragment]
+c d e %\score
+\end{lilypond}
+
+\end{document}
diff --git a/input/regression/lilypond-book/tex-compatibility-mode.lytex b/input/regression/lilypond-book/tex-compatibility-mode.lytex
new file mode 100644
index 0000000000..aab288e7b3
--- /dev/null
+++ b/input/regression/lilypond-book/tex-compatibility-mode.lytex
@@ -0,0 +1,10 @@
+\documentclass[a4paper, 12pt]{article}
+
+\begin{document}
+\section{LilyPond snippets with deprecated options}
+
+A snippet with a deprecated option, triggering compatibility mode:
+
+\lilypond[11pt,fragment]{c' e' g'}
+
+\end{document}
diff --git a/input/regression/lilypond-book/tex-footnote.lytex b/input/regression/lilypond-book/tex-footnote.lytex
new file mode 100644
index 0000000000..cd7c9307c4
--- /dev/null
+++ b/input/regression/lilypond-book/tex-footnote.lytex
@@ -0,0 +1,11 @@
+\documentclass[a4paper, 12pt]{article}
+
+\begin{document}
+\section{LilyPond snippets in a footnote}
+
+Test for snippets in a footnote\footnote{Here's the footnote:
+\lilypond[fragment]{c' e' g'} }:
+\marginpar{ Yes, even as marginpar
+\lilypond[fragment]{c' d' e'} }
+
+\end{document}
diff --git a/input/regression/lilypond-book/tex-fragment.lytex b/input/regression/lilypond-book/tex-fragment.lytex
new file mode 100644
index 0000000000..4adc809b8a
--- /dev/null
+++ b/input/regression/lilypond-book/tex-fragment.lytex
@@ -0,0 +1,19 @@
+\documentclass[a4paper, 12pt]{article}
+
+\begin{document}
+
+\section{Using lilypond-book's fragment option}
+
+If a snippet is not a fully valid LilyPond file, you have
+to use the \verb|fragment| option:
+
+\begin{lilypond}[fragment]
+c d e
+\end{lilypond}
+
+% TODO: \verb does not yet work!!!
+There is also a shorthand version %\verb|\lilypond[fragment]{c' e' g'}|:
+
+\lilypond[fragment]{c' e' g'}
+
+\end{document}
diff --git a/input/regression/lilypond-book/tex-graphics-package-added.lytex b/input/regression/lilypond-book/tex-graphics-package-added.lytex
new file mode 100644
index 0000000000..d94360ab54
--- /dev/null
+++ b/input/regression/lilypond-book/tex-graphics-package-added.lytex
@@ -0,0 +1,10 @@
+\documentclass[a4paper]{article}
+
+\begin{document}
+
+\section{Lilypond-book should add the graphicx package}
+
+If a latex file does not yet include the graphicx package, it is added by
+lilypond-book.
+
+\end{document}
diff --git a/input/regression/lilypond-book/tex-include-file-latex.lytex b/input/regression/lilypond-book/tex-include-file.lytex
similarity index 100%
rename from input/regression/lilypond-book/tex-include-file-latex.lytex
rename to input/regression/lilypond-book/tex-include-file.lytex
diff --git a/input/regression/lilypond-book/tex-include-options.lytex b/input/regression/lilypond-book/tex-include-options.lytex
new file mode 100644
index 0000000000..a53fb5dcd0
--- /dev/null
+++ b/input/regression/lilypond-book/tex-include-options.lytex
@@ -0,0 +1,5 @@
+\documentclass{article}
+\begin{document}
+Including Lilypond file with options (quote and noindent):
+\lilypondfile[quote,noindent]{include2.ly}
+\end{document}
diff --git a/input/regression/lilypond-book/tex-lilypond-block.lytex b/input/regression/lilypond-book/tex-lilypond-block.lytex
new file mode 100644
index 0000000000..ad76d3c2f5
--- /dev/null
+++ b/input/regression/lilypond-book/tex-lilypond-block.lytex
@@ -0,0 +1,15 @@
+\documentclass[a4paper, 12pt]{article}
+
+\begin{document}
+
+\section{Simple lilypond blocks}
+
+A simple scale:
+
+\begin{lilypond}
+\score{
+  \relative c' { c d e f g a b c }
+}
+\end{lilypond}
+
+\end{document}
diff --git a/input/regression/lilypond-book/tex-lilypond-inside-itemize.lytex b/input/regression/lilypond-book/tex-lilypond-inside-itemize.lytex
new file mode 100644
index 0000000000..91d78bb60f
--- /dev/null
+++ b/input/regression/lilypond-book/tex-lilypond-inside-itemize.lytex
@@ -0,0 +1,21 @@
+\documentclass[a4paper, 12pt]{article}
+
+\begin{document}
+
+\section{Lilypond snippets inside lists:}
+
+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}
+
+\end{document}
diff --git a/input/regression/lilypond-book/tex-lilypond-inside-table.lytex b/input/regression/lilypond-book/tex-lilypond-inside-table.lytex
new file mode 100644
index 0000000000..a75c4df735
--- /dev/null
+++ b/input/regression/lilypond-book/tex-lilypond-inside-table.lytex
@@ -0,0 +1,20 @@
+\documentclass[a4paper, 12pt]{article}
+
+\begin{document}
+
+\section{Lilypond snippets inside tables:}
+
+Tables:
+
+\begin{tabular}{|l|l|r|}
+\hline
+\em Notes & \em Name \\
+\hline
+\lilypond[11pt,fragment,filename="cdur"]{\context Voice <<c' e' g'>>} & major \\
+\lilypond[11pt,fragment]{\context Voice <<c' es' g'>>} & minor \\
+\lilypond[11pt,fragment]{\context Voice <<c' es' ges'>>} & diminished \\
+\lilypond[11pt,fragment]{\context Voice <<c' e' gis'>>} & augmented \\
+\hline
+\end{tabular}
+
+\end{document}
diff --git a/input/regression/lilypond-book/tex-lilypondversion.lytex b/input/regression/lilypond-book/tex-lilypondversion.lytex
new file mode 100644
index 0000000000..d8102c7672
--- /dev/null
+++ b/input/regression/lilypond-book/tex-lilypondversion.lytex
@@ -0,0 +1,10 @@
+\documentclass[a4paper, 12pt]{article}
+
+\begin{document}
+
+Version: \lilypondversion
+
+A digit immediately after the version: \lilypondversion9
+A formula immediately after the version: \lilypondversion$x_k$
+
+\end{document}
diff --git a/input/regression/lilypond-book/tex-paragraphs.lytex b/input/regression/lilypond-book/tex-paragraphs.lytex
new file mode 100644
index 0000000000..da2452981e
--- /dev/null
+++ b/input/regression/lilypond-book/tex-paragraphs.lytex
@@ -0,0 +1,30 @@
+\documentclass[a4paper, 12pt]{article}
+
+\begin{document}
+
+
+\section{Paragraphs and line spacing}
+
+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
+
+\end{document}
diff --git a/input/regression/lilypond-book/tex-snippet-options.lytex b/input/regression/lilypond-book/tex-snippet-options.lytex
new file mode 100644
index 0000000000..1f175af37e
--- /dev/null
+++ b/input/regression/lilypond-book/tex-snippet-options.lytex
@@ -0,0 +1,38 @@
+\documentclass[a4paper, 12pt]{article}
+
+\begin{document}
+
+\section{Snippet options}
+
+Fragment:
+\begin{lilypond}[fragment]
+c d e %\score
+\end{lilypond}
+
+This shows the verbatim option:
+\begin{lilypond}[fragment,verbatim]
+c' d' e'
+\end{lilypond}
+
+printfilename:
+\lilypondfile[printfilename]{include.ly}
+
+staffsize:
+\begin{lilypond}[staffsize=7,fragment]
+\context Voice <<c' e' g'>>
+\end{lilypond}
+\lilypond[fragment,staffsize=7]{\context Voice <<c' es' g'>>}
+
+relative:
+\lilypond[relative=1]{ c4 f b e }
+
+quote:
+\lilypond[quote,fragment]{\relative c' c1 }
+
+fragment, quote, staffsize=26, verbatim:
+\begin{lilypond}[fragment,quote,staffsize=26,verbatim]
+  c'4 f16
+\end{lilypond}
+
+
+\end{document}
diff --git a/input/regression/lilypond-book/tex-twocolumn.lytex b/input/regression/lilypond-book/tex-twocolumn.lytex
new file mode 100644
index 0000000000..69c10bb7be
--- /dev/null
+++ b/input/regression/lilypond-book/tex-twocolumn.lytex
@@ -0,0 +1,17 @@
+\documentclass[a4paper, 12pt]{article}
+
+\begin{document}
+\twocolumn
+
+\section{A latex file with two columns}
+
+In this example, the width auto-detection shall detect the two columns
+and produce snippets that have the smaller width for a column!
+
+\begin{lilypond}
+\score{
+  \relative c'{c d e f g a b c | c d e f g a b c | c d e f g a b c}
+}
+\end{lilypond}
+
+\end{document}
diff --git a/input/regression/lilypond-book/tex-verbatim.lytex b/input/regression/lilypond-book/tex-verbatim.lytex
new file mode 100644
index 0000000000..363138d454
--- /dev/null
+++ b/input/regression/lilypond-book/tex-verbatim.lytex
@@ -0,0 +1,45 @@
+\documentclass[a4paper, 12pt]{article}
+
+\begin{document}
+
+\section{verb and verbatim}
+
+This file should not contain (and produce) any lilypond images!
+
+Snippets inside a verbatim environment or a comment are not run through
+lilypond, but left as is.
+
+% TODO: These do not yet work, as \verb is explicitly disabled in lilypond-book for now!
+% \verb|\lilypond[fragment]{c' d' e'}|
+%
+% and
+
+\begin{verbatim}
+\begin{lilypond}
+c d e
+\end{lilypond}
+\end{verbatim}
+
+
+As you can see, the begin/end lilypond commands inside
+do not confuse lilypond-book.
+
+% TODO: These do not yet work, as \verb is explicitly disabled in lilypond-book for now!
+% \verb|\begin{lilypond}[fragment]c d e\end{lilypond}|
+
+% \verb+\lilypondfile[quote,noindent]{screech-boink.ly}+
+
+Neither does a verbatim inside verb:
+
+\verb|\begin{verbatim}\begin{lilypond}[fragment]c d e\end{lilypond}\end{verbatim}|
+
+or verb inside verbatim:
+
+\begin{verbatim}
+\verb|\begin{lilypond}[fragment]c d e\end{lilypond}|
+\end{verbatim}
+
+But these are just to stress \verb|lilypond-book|.
+
+
+\end{document}
-- 
2.39.5