lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: StaffGroup bracket cut off by lilypond-book (issue 720)


From: David Wright
Subject: Re: StaffGroup bracket cut off by lilypond-book (issue 720)
Date: Mon, 8 Aug 2016 20:10:25 -0500
User-agent: Mutt/1.5.21 (2010-09-15)

On Tue 02 Aug 2016 at 23:12:48 (+0200), Noeck wrote:
> Hi David and Kieren,
> 
> would you mind describing the workflow in a bit more details?
> 
> In particular, I would be interested in:
> 
> 1. Do you put something special in your .ly files like \include
> lilypond-book-preamble? Or do you just set the tagline to false? Or
> something else?

I include Cropping.ily which contains

\version "2.18.2"
\header { tagline = ##f }
\paper {
  page-count = 1
  print-page-number = ##f
  ragged-bottom = ##t
  ragged-last-bottom = ##t
}

though I can override any of them of course.

Most fragments are just set in the "natural" mode, ie not constrained
dimensionally, but there are exceptions. Anglican Chants are set to
particular widths for Double/Quadruple, Single, Short, Half. Triple
chants are set as a double followed by a single with an extra L margin
though the latter has an unconstrained R margin.

Large (multiline) fragments might have their linewidth/pageheight set;
fragments with large 'instrument names' (read 'intonation') have an
appropriate indent set. And so on.

> 2. What's the benefit of pdfcrop? When using the preamble, I see no
> difference between cropped and original – probably because it is already
> cropped as thight as possible.

If you can train lilypond-book-preamble to give you just what you
want, then that's fine. My attempt failed, as reported in
http://lists.gnu.org/archive/html/lilypond-user/2016-07/msg00339.html
(though I attached no evidence). Judging by the .eps files, slicing
and dicing was occurring, so the cropped PDF had different internal
vertical spacing from the 'real' version.

Personally I prefer to use LP in its "native" mode for production
of ordinary uncropped output in its normal manner. Then I crop it
(with a tiny margin to make clearer when viewed in a window on the
screen) and include these cropped PDFs in LaTeX (Lua flavour) with
all the control that it gives you.

> 3. Is it possible to write your workflow down in a way that is easy to
> reproduce? Something like a ly-template and a list of commands. In
> latex, I guess it is just a matter of \includegraphics{ ... } ?

For typesetting psalms with chants, I use a python program which you
just do not want to see. It's rather convoluted but it allows me to
write \newpagesnippet{../chants/address@hidden and have the chant
transposed from E to F automatically, and to generate a shell file
that plays the sequence of transposed chants (so that I can aurally
check the key changes).

Otherwise, I process my .ly files with ordinary bash shell functions:

lilycrop is a function
lilycrop () 
{ 
    [ -z "$1" ] && printf '%s\n' "Usage:        $FUNCNAME path-to/lilypond-file
        processes the lilypond file, changing to its directory first,
        to generate cropped pdf files for inclusion within LuaLaTeX files.
        It turns off point-and-click to reduce file sizes and prevent revealing
        the sources' paths. It hands its output to midirename so that the
        MIDI filenames sort in the correct order, and to pdfcropper to crop
        any PDFs generated." 1>&2 && return 1;
    local EXPANDEDNAME=$(addextensionandoldfile "$1" "ly");
    [ -z "$EXPANDEDNAME" ] && return;
    local DIRNAME=$(dirname "$EXPANDEDNAME");
    local BASENAME=$(basename "$EXPANDEDNAME");
    ( local UNIQUE=$(mktemp --suffix .pdf ${UNIQUETRASH:-/tmp}/$FUNCNAME-$(date 
+%s)-XXXX);
    cd "$DIRNAME";
    $HOME/bin/lilypond -dno-point-and-click -drelative-includes 
--include="$HOME/LilyLib" "$BASENAME" 2>&1 | tee "$UNIQUE";
    midirename "$UNIQUE";
    pdfcropper "$UNIQUE";
    [ -r "${BASENAME/%.ly/.error}" ] && rm "${BASENAME/%.ly/.error}";
    grep -q "error" < "$UNIQUE";
    [ "$?" = "0" ] && mv -i "$UNIQUE" "${BASENAME/%.ly/.error}" )
}

pdfcropper is a function
pdfcropper () 
{ 
    [ -z "$1" ] && printf '%s\n' "Usage:        $FUNCNAME file-of-pdf-filenames
        for internal use only, it crops the pdf files generated by lilypond
        whose names are in the file." 1>&2 && return 1;
    [ ! -r "$1" ] && printf '%s\n' "$1 not found!" 1>&2 && return 1;
    local UNIQUE=$(mktemp ${UNIQUETRASH:-/tmp}/$FUNCNAME-$(date +%s)-XXXX);
    grep '^Converting to `' "$1" | sed -e 's/^[^`]*.//;s/.\.\.\.$//' | while 
read NEXT; do
        pdfcrop --margins 1 "$NEXT" "$UNIQUE";
        mv "$UNIQUE" "$NEXT";
    done
}

to produce cropped PDFs, and then I have a LaTeX class file which
contains a lot of macros like

\newcommand{\newpagesnippet}[2]{%
{\vfill
\newpage
\centering
\phantom{0}% anchor for vspace
\vspace{0mm}%
\includegraphics{#1}\begin{turn}{90}{\scriptsize\hspace{11mm}\timestamp}\end{turn}
\vspace{2mm}\\%
{#2}
}}

where the first argument is the PDF file. The second is an adjustment
to the default vspace (typically negative) and timestamp is so that
I can annotate a snippet without adding any vertical space, often at
a premium.

BTW the reference to error above is from a period when the PS→PDF
conversion would occasionally blow up at random. It made it easy to
spot any failures when I ran a load of LP files all at once.

All criticisms welcome.

Cheers,
David.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]