Skip to content

Feature request: add center/right alignment options for above-lines text #1768

Description

@lbssousa

Motivation

Above-lines text (<alt>...</alt> and the note-level [alt:text] field) is
always left-aligned to its anchor note/glyph: the text's left edge lines up
with the anchor's left edge, and the text extends rightward from there.
There's no way to center it over the anchor or right-align it against it.

This makes it awkward to annotate anything that should read as ending at a
note rather than starting there (editorial marks placed at the close of a
melisma or phrase, footnote-style callouts anchored to a cadence,
rubrics anchored to a note near the ending of the line, or simply
centering a short label over a single note instead of having it drift to the
right).

Proposed syntax

Add optional per-occurrence horizontal alignment to the existing syntax,
plus a document-wide default:

  • Extend syllable-level tag <alt> with alignment modifiers for that occurrence:
    <alt:l> (left), <alt:c> (center), and <alt:r> (right)
  • Extend note-level field: [alt:text;l] (left), [alt:text;c] (center),
    and [alt:text;r] (right)
  • New macro \gresetabovelinestextalignment{left|center|right} to set the
    document-wide default for <alt>...</alt> and [alt:text]
    (defaults to left); per-occurrence markers override the default.

Example:

A<alt:c>Alleluia</alt>(fg) B[alt:cadence;r](g!hwi) (::)

Backward compatibility

<alt> keeps working exactly as it does today: <alt:l>, <alt:c>, and
<alt:r> are new tag names that were not valid gabc before, so no existing
score using <alt> changes its rendered output.

The note-level [alt:text] field is almost purely additive: the
document-wide default (\gresetabovelinestextalignment) defaults to left,
matching the old behavior, and the new ;l/;c/;r suffix only takes
effect when it appears literally, unescaped, at the very end of text. The
one edge case is a score where text already ended in a literal, unescaped
;l, ;c, or ;r: that suffix is now stripped and treated as an
alignment marker instead of literal text, changing the rendered output. See
UPGRADE.md for the workaround (escaping the semicolon with $).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions