Hello,
On Thu, Aug 16, 2012 at 5:59 AM, Hwaen Ch'uqi <[email protected]> wrote:
> Greetings All,
> There must surely be an easy answer to this, though I have yet to
> find it. How does one produce page numbers in Roman numerals? And how
> does one then revert to Arabic numerals?
If there's an easy answer to this, I must not have found it :) In the
example below, I've created a markup command which converts page
numbers into Roman numerals, and added it to the default definitions
of oddHeaderMarkup and evenHeaderMarkup. The command takes an
integer: above that value, page numbers will revert to Arabic
numerals. I've made the Roman numerals lowercase.
> In a related question, will
> the output from a generated Table of Contents display a mix of Roman
> and Arabic page numbers?
This won't affect the table of contents, and unfortunately, I don't
have time right now to work on a solution :(
HTH,
David
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\version "2.15.42"
%%% roman numeral page numbers
#(define-markup-command (roman-numeral-page-number layout props arg) (integer?)
(let ((page-number (chain-assoc-get 'page:page-number props -1)))
(interpret-markup layout props
(if (and (> page-number 0) ; only positive integers can be `romanized'
(<= page-number arg))
(format #f "~(~@r~)" page-number)
(chain-assoc-get 'page:page-number-string props -1)))))
\paper {
print-first-page-number = ##t
print-page-number = ##t
oddHeaderMarkup = \markup
\fill-line {
" "
\on-the-fly #not-first-page \fromproperty #'header:instrument
\on-the-fly #print-page-number-check-first \roman-numeral-page-number #4
}
evenHeaderMarkup = \markup
\fill-line {
\on-the-fly #print-page-number-check-first \roman-numeral-page-number #4
\on-the-fly #not-first-page \fromproperty #'header:instrument
" "
}
}
\score {
\new Staff {
\repeat unfold 10 {
s1
\pageBreak
}
}
}
_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user