My LilyPond output often includes a long, meaty section of editorial notes
— several paragraphs of prose — at the end of the file, after the \score
block.

I would like to use TeX’s Knuth–Plass line-breaking algorithm
<https://en.wikipedia.org/wiki/Knuth%E2%80%93Plass_line-breaking_algorithm>
for paragraphs of justified text, but I believe that there is no way within
LilyPond itself to apply LaTeX’s algorithm to

\markup \justify { Insert my text here }

I know of lilypond-book and lyluatex, but those are not options for my
current project; I have to work entirely within LilyPond (because I am
going to hand my engraving file over to someone who doesn’t and won’t use
LaTeX).

As a workaround, I’ve drafted a simple LaTeX file to typeset a paragraph
for me using Knuth-Plass, with formatting identical to what I use in
LilyPond. I used LuaLaTeX as compiler. Please see the attached PDF. The
code is below.

I also attach my LilyPond file and a PDF of the output of this experiment.
The screenshot shows how valuable hyphenation is in justified paragraphs!

I am very, very new to the world of LaTeX, so I’d like to ask the
LaTeX-proficient people on this list for input on my .tex code (below). My goal
is to mimic in LaTeX the features of my LilyPond environment, such as paper
size, left and right margin, typeface, font size, and spacing (French), so
that I can see where LaTeX places hyphens and line breaks, then tweak my
LilyPond code accordingly. Does my TeX input accomplish that goal? Are
there any ways I can improve it?

I think my scope here is fairly narrow. I’m sure that there are all kinds
of things that LaTeX can do a page level (or overall document level), but
for now I’m just focused on hyphenation and line breaks within any given
paragraph that I ultimately will typeset using \markup \justify in
LilyPond. I just need a good .tex template into which I can write one
paragraph of text for my editorial notes.


%%% BEGIN LATEX INPUT %%%

\documentclass[11pt, letterpaper]{article}

% Use LilyPond’s default typeface
\usepackage{fontspec}
\setmainfont{C059}

% Margins should equal LilyPond defaults on US Letter
\usepackage[
  left=15mm,
  right=15mm
]{geometry}

% French spacing (single space after periods)
\frenchspacing

% No paragraph indentation
\setlength{\parindent}{0pt}

\begin{document}
% Write the text that will go into LilyPond here:
LilyPond came about when two musicians wanted to go
beyond the soulless look of computer-printed sheet music.
Musicians prefer reading beautiful music, so
why couldn’t programmers write software
to produce elegant printed parts?
The result is a program that creates beautiful sheet music
following the best traditions of classical music engraving.
The best thing about LilyPond is that it handles all layout
programmatically, allowing composers, transcribers
and publishers to focus on the music instead of
improving their software’s default output.
\end{document}

Attachment: LaTeX Output.pdf
Description: Adobe PDF document

Attachment: Justified Text.pdf
Description: Adobe PDF document

Attachment: Justified Text.ly
Description: application/frescobaldi-ly

Reply via email to