jperon / lyluatex

Alternative à lilypond-book pour lualatex
MIT License
58 stars 11 forks source link

option "system-separator" (or "system-separator-markup") #235

Open uliska opened 5 years ago

uliska commented 5 years ago
\paper {
  system-separator-markup = \slashSeparator
  system-count = 2
}

{
  c'1 \break c'
}

will produce a double slash mark like this between the staves:

grafik

However, LilyPond does not include that in the generated PDFs for each system so it does not have any effect for a score included by lyluatex.

It is possible to achieve that effect by defining \betweenLilyPondSystem, but I think it would be nice to have an option for that (especially since this may only be desired for certain elements).

[system-separator] would do the same as system-separator-markup = \slashSeparator in LilyPond, while[system-separator={some-arbitrary-latex-code}] would insert custom code.

uliska commented 5 years ago

I've now investigated how the slash separator can be implemented in LaTeX (for insert=systems mode).

% refers to https://tex.stackexchange.com/questions/494138
\usepackage{tikz}
\setbox0\leftline{\hskip-2ex
\begin{tikzpicture}
\draw[fill] (0,0) -- (0.5,0.2) -- (0.5,0.3) -- (0,0.1) -- cycle;
\draw[fill] (0,-0.2) -- (0.5,0) -- (0.5,0.1) -- (0,0.-0.1) -- cycle;
\end{tikzpicture}
}

\def\slashsep{%
    \par
    \medskip
    \cleaders\copy0\vskip\dimexpr\ht0+\dp0\relax
    \bigskip}

\newcommand{\betweenLilyPondSystem}[1]{\slashsep}

produces nice output:

grafik

and it's pretty clear to me how to finetune it and make the appearance configurable.

However, @jperon I'd need your opinion on where to implement this. Probably the most straightforward way would be to simply create a separate package lyslashsep that provides \slashsep which a user can then use in \betweenLilyPondSystem. The advantage is that this doesn't clutter lyluatex's option namespace and leaves it at the user's discretion to load tikz.

OTOH it would be nice to simply activate the slash separator with a lyluatex option so it's easier to override it on a per-score basis. Plus, depending on the insert mode we could either insert that \slashsep manually (rather than defining \betweenLilyPondSystem) or write the appropriate layout override into the LilyPond file for insert=fullpage.

uliska commented 5 years ago

Forgot to mention: The above coding is necessary to prevent the separator from being printed at a page break.

uliska commented 5 years ago

One more argument for implementing it within lyluatex would be that this makes it possible to scale the separator in relation to the -- given or implicit -- staffsize.

uliska commented 5 years ago

I think I'll go for a solution within lyluatex that checks whether tikz is loaded and produces a warning if not (only if it would be necessary).