Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to print only the first flat on each line #1607

Open
wants to merge 18 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
3ae07bb
Adds a new option (alteration-scope: line in header, \setalterationsc…
davidweichiang Jan 22, 2025
f16aa96
Adds a new option (alteration-scope: line in header, \setalterationsc…
davidweichiang Jan 22, 2025
a2a2e0c
correctly compute space before suppressed flats
davidweichiang Jan 24, 2025
5ab1c49
resolve conflicts
davidweichiang Jan 24, 2025
7043fdb
fix bug in previous commit
davidweichiang Jan 24, 2025
949b794
with alteration-scope:line, if a natural follows a flat on the same l…
davidweichiang Jan 24, 2025
3eac5d4
fix bug in last commit and clean up
davidweichiang Jan 25, 2025
e2f293b
suppressed flats shouldn't have ledger lines
davidweichiang Jan 25, 2025
1a0b474
rename some local macros with \gre@ prefix
davidweichiang Jan 25, 2025
a0054fd
Add "soft" flat (X), sharp (#*), and natural (Y), which appear only i…
davidweichiang Jan 26, 2025
d28a7e6
a soft natural shouldn't be printed if it's the first on the line
davidweichiang Jan 26, 2025
348de3c
new cases needed for soft flats with ledger lines
davidweichiang Jan 27, 2025
24b60df
Add \gresetalterationeffect option and some documentation
davidweichiang Jan 27, 2025
a35eb55
fix spacing between bar and suppressed flat
davidweichiang Jan 28, 2025
fc38e7a
change soft sharp to ##
davidweichiang Jan 28, 2025
4005bb8
update docs for soft alterations
davidweichiang Jan 29, 2025
88c8928
change many double quotes
davidweichiang Jan 29, 2025
48dce0b
improve "rerun to fix" warning and some comments
davidweichiang Jan 30, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions doc/Command_Index_User.tex
Original file line number Diff line number Diff line change
Expand Up @@ -1408,6 +1408,23 @@ \subsubsection{Ancient Notation}
\#2 & integer & point size at which the font should be loaded\\
\end{argtable}

\subsubsection{Alterations (Flats, Naturals, and Sharps)}\label{setalterationeffect}

\macroname{\textbackslash gresetalterationeffect}{\{\#1\}}{gregoriotex-signs.tex}
Macro to set the effect of alterations (flats and sharps), for the purpose of deciding whether to print soft alterations (see \S\ref{softalterations}).

\begin{argtable}
\#1 & \texttt{note} (default) & effect ends immediately \\
& \texttt{line} & effect ends at the end of the line \\
\end{argtable}

Soft flats are printed if no previous flat (on the same pitch) is in effect. Similarly for soft sharps. Soft naturals are printed if a previous flat or sharp (on the same pitch) is in effect.

Thus, under \verb|\gresetalterationeffect{note}|, all sharps and flats lose their effect immediately, so all soft sharps and flats are printed, but no soft naturals are printed.
Under \verb|\gresetalterationeffect{line}|, all sharps and flats are in effect until the end of the line (unless cancelled by a natural), which is the convention used in Dominican chant scores.

(Argument \#1 is actually a comma-separated list of keywords, but currently, it must not be empty, and \texttt{note,line} has the same effect as \texttt{note}. In the future, other options like \texttt{word} and \texttt{bar} may be added.)

\subsection{Counts}\label{counts}

Each of the following counts controls some aspect of the configuration of the Gregorio\TeX\ score. They are changed using \verb=\grechangecount=, documented above.
Expand Down
36 changes: 36 additions & 0 deletions doc/Command_Index_gregorio.tex
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,18 @@ \section{Gregorio Controls}
\#5 & string & the line, byte offset, and column address for textedit links when point-and-click is enabled\\
\end{argtable}

\macroname{\textbackslash GreFlatSoft}{\#1\#2\#3\#4\#5}{gregoriotex-signs.tex}
Macro to typeset a soft flat.

\begin{argtable}
\#1 & integer & Height number of the flat.\\
\#2 & \texttt{0} & The flat is not part of the clef.\\
& \texttt{1} & The flat is part of the clef.\\
\#3 & \TeX\ code & signs to typeset before the glyph (typically additional bars, as they must be "behind" the glyph)\\
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use typographical quotes around behind.

\#4 & \TeX\ code & signs to typeset after the glyph (almost all signs)\\
\#5 & string & the line, byte offset, and column address for textedit links when point-and-click is enabled\\
\end{argtable}

\macroname{\textbackslash GreForceHyphen}{}{gregoriotex-syllable.tex}
Macro that indicates that a hyphen should be forced (if enabled) after the given syllable.

Expand Down Expand Up @@ -810,6 +822,18 @@ \section{Gregorio Controls}
\#5 & string & the line, byte offset, and column address for textedit links when point-and-click is enabled\\
\end{argtable}

\macroname{\textbackslash GreNaturalSoft}{\#1\#2\#3\#4\#5}{gregoriotex-signs.tex}
Macro to typeset a soft natural.

\begin{argtable}
\#1 & integer & Height number of the natural.\\
\#2 & \texttt{0} & The natural is not part of the clef.\\
& \texttt{1} & The natural is part of the clef (doesn't happen).\\
\#3 & \TeX\ code & signs to typeset before the glyph (typically additional bars, as they must be "behind" the glyph)\\
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment about quotes.

\#4 & \TeX\ code & signs to typeset after the glyph (almost all signs)\\
\#5 & string & the line, byte offset, and column address for textedit links when point-and-click is enabled\\
\end{argtable}

\macroname{\textbackslash GreNewLine}{}{gregoriotex-main.tex}
Macro to call if you want to go to the next line.

Expand Down Expand Up @@ -1080,6 +1104,18 @@ \section{Gregorio Controls}
\#5 & string & the line, byte offset, and column address for textedit links when point-and-click is enabled\\
\end{argtable}

\macroname{\textbackslash GreSharpSoft}{\#1\#2\#3\#4\#5}{gregoriotex-signs.tex}
Macro to typeset a soft sharp.

\begin{argtable}
\#1 & integer & Height number of the sharp.\\
\#2 & \texttt{0} & The sharp is not part of the clef.\\
& \texttt{1} & The sharp is part of the clef (doesn't happen).\\
\#3 & \TeX\ code & signs to typeset before the glyph (typically additional bars, as they must be "behind" the glyph)\\
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And a third time.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a copy-paste from the existing documentation for \GreFlat and friends. I've changed them throughout the whole manual.

\#4 & \TeX\ code & signs to typeset after the glyph (almost all signs)\\
\#5 & string & the line, byte offset, and column address for textedit links when point-and-click is enabled\\
\end{argtable}

\macroname{\textbackslash GreSmallCaps}{\#1}{gregoriotex.sty and gregoriotex.tex}
Makes argument small capitals. Accesses \LaTeX\ \verb=\textsc= or
Plain \TeX\ \verb=\sc= as appropriate Corresponds to ``<sc></sc>'' tags
Expand Down
5 changes: 4 additions & 1 deletion doc/Command_Index_internal.tex
Original file line number Diff line number Diff line change
Expand Up @@ -2386,7 +2386,10 @@ \subsection{Alteration Type}\label{alterationtype}
\texttt{3} & sharp\\
\texttt{4} & parenthesized flat\\
\texttt{5} & parenthesized natural\\
\texttt{6} & parenthesized sharp
\texttt{6} & parenthesized sharp \\
\texttt{7} & soft flat\\
\texttt{8} & soft natural\\
\texttt{9} & soft sharp\\
\end{tabulary}

\subsection{Note Offset Specifier}\label{NoteOffset}
Expand Down
46 changes: 41 additions & 5 deletions doc/Gabc.tex
Original file line number Diff line number Diff line change
Expand Up @@ -452,10 +452,6 @@ \subsubsection{One-Note Neumes}
to the pitch letter. These characters may be used together, and
Gregorio\TeX{} will try to typeset them together.

Things like flats, sharps, and naturals, while not technically notes, are
treated as one-note neumes by Gregorio\TeX. Thus, they are also added by
appending characters to pitch letters.

\begin{tabularx}{\textwidth}{l|X}
Gabc & Description \\
\hline
Expand All @@ -480,6 +476,12 @@ \subsubsection{One-Note Neumes}
\pitchchar\texttt{x} & flat \\
\pitchchar\texttt{\#} & sharp \\
\pitchchar\texttt{y} & natural \\
\pitchchar\texttt{x?} & parenthesized flat \\
\pitchchar\texttt{\#?} & parenthesized sharp \\
\pitchchar\texttt{y?} & parenthesized natural \\
\pitchchar\texttt{X} & soft flat \\
\pitchchar\texttt{\#\#} & soft sharp \\
\pitchchar\texttt{Y} & soft natural \\
\end{tabularx}

In the above table, \pitchchar{} represents a pitch character and
Expand All @@ -490,17 +492,51 @@ \subsubsection{One-Note Neumes}
{
\gresetinitiallines{0}\gresetlyriccentering{firstletter}%
\gresetclef{invisible}\gresetlastline{justified}\greseteolcustos{manual}%
\ttfamily
\gabcsnippet{
( )
g(g) g<sp>~~</sp>(g~) g<(g<) g>(g>) go(go) go<sp>~~</sp>(go~) gw(gw)
gv(gv) gV(gV) gs(gs) gs<(gs<) g=(g=)
( ) (z) ( )
gr(gr) gR(gR) gr0(gr0) G(G) G0(G0) G1(G1) G<sp>~~</sp>(G~) G>(G>) Gr(Gr) gx(gx)
g#(g#) gy(gy)
g#(g#) gy(gy) gx?(gx?) g#?(g#?) gy?(gy?)
( )
}
}

\subsubsection{Alterations (Flats, Naturals, and Sharps)} \label{softalterations}

Things like flats, sharps, and naturals (called ``alterations''), while not technically notes, are
treated as one-note neumes by Gregorio\TeX. Thus, they are also added by
appending characters to pitch letters.

Flats, sharps, and naturals each have a ``soft'' version (\verb|X|, \verb|##|, and \verb|Y|, respectively). Soft flats are printed if no previous flat (on the same pitch) is in effect. Similarly for soft sharps. Soft naturals are printed if a previous flat or sharp (on the same pitch) is in effect.
What ``in effect'' means is controlled by the \verb|\gresetalterationeffect| macro (see \S\ref{setalterationeffect}). Soft alterations currently have two use cases.

For Dominican chant (in which flats take effect until the end of a line or until cancelled by a natural), use \verb|\gresetalterationeffect{line}|, and type a soft flat (\verb|X|) in front of \emph{every} note that is to be sung a half-step flat. Naturals should also be soft (\verb|Y|), but only naturals that cancel flats need to be typed. For example:

\begin{center}\parbox{5in}{%
\gresetinitiallines{0}\gresetlyriccentering{firstletter}%
\grechangestyle{translation}{\ttfamily}%
\grechangedim{spacelinestext}{0.4cm}{scalable}%
\grechangedim{translationheight}{0.4cm}{scalable}%
\grechangedim{spaceabovelines}{0.5cm}{scalable}%
\gresetalterationeffect{line}%
\ttfamily
\gabcsnippet{(e) (e) (e) gX(gXge) (f)gX(gXghED) (eddc) (;) (efef//hhv) gX(gXfe//fgED//efDC//ef) (;) (hhvFEf)(fv_//hhf)gY(gYghghf) (::)}
}\end{center}

Even under the convention that flats only take effect until the end of a word, if a long word has a flat that applies to two notes, one may want a flat to appear on the second note if a line break occurs between them. To do this, again use \verb|\gresetalterationeffect{line}| and type a soft flat (\verb|X|) before the second note. For example:
\begin{center}\parbox{4in}{%
\gresetinitiallines{0}\gresetlyriccentering{firstletter}%
\grechangestyle{translation}{\ttfamily}%
\grechangedim{spacelinestext}{0.4cm}{scalable}%
\grechangedim{translationheight}{0.4cm}{scalable}%
\grechangedim{spaceabovelines}{0.5cm}{scalable}%
\gresetalterationeffect{line}%
\gabcsnippet{(c3) (d)(fh) (fe/hh)(ih..) (,) (hij) (kvJIH'i)(h.) (,) (k)(ij)(k) (jvIH'i) (h.) (;) mi[gx](gxfghz)se[gX](gXhvGF)re(e[ll:1]d)re(ef) (d_[oh:h]e_[oh:h]d_[oh:h])(d.) (::)}
}\end{center}

\subsubsection{Oriscus Orientation}

Under the default rules for oriscus orientation, the direction of an oriscus
Expand Down
3 changes: 3 additions & 0 deletions src/gabc/gabc-glyphs-determination.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,13 @@ static char add_note_to_a_glyph(gregorio_glyph_type current_glyph_type,
break;
case S_FLAT:
case S_FLAT_PAREN:
case S_FLAT_SOFT:
case S_SHARP:
case S_SHARP_PAREN:
case S_SHARP_SOFT:
case S_NATURAL:
case S_NATURAL_PAREN:
case S_NATURAL_SOFT:
next_glyph_type = G_ALTERATION;
*end_of_glyph = DET_END_OF_BOTH;
break;
Expand Down
12 changes: 12 additions & 0 deletions src/gabc/gabc-notes-determination.l
Original file line number Diff line number Diff line change
Expand Up @@ -1302,6 +1302,10 @@ x\? {
gregorio_change_shape(current_note, S_FLAT_PAREN,
legacy_oriscus_orientation);
}
X {
gregorio_change_shape(current_note, S_FLAT_SOFT,
legacy_oriscus_orientation);
}
# {
gregorio_change_shape(current_note, S_SHARP,
legacy_oriscus_orientation);
Expand All @@ -1310,6 +1314,10 @@ x\? {
gregorio_change_shape(current_note, S_SHARP_PAREN,
legacy_oriscus_orientation);
}
## {
gregorio_change_shape(current_note, S_SHARP_SOFT,
legacy_oriscus_orientation);
}
y {
gregorio_change_shape(current_note, S_NATURAL,
legacy_oriscus_orientation);
Expand All @@ -1318,6 +1326,10 @@ y\? {
gregorio_change_shape(current_note, S_NATURAL_PAREN,
legacy_oriscus_orientation);
}
Y {
gregorio_change_shape(current_note, S_NATURAL_SOFT,
legacy_oriscus_orientation);
}
!?\/0 {
gregorio_add_space_as_note(&current_note, SP_HALF_SPACE, NULL,
&notes_lloc);
Expand Down
9 changes: 9 additions & 0 deletions src/gabc/gabc-write.c
Original file line number Diff line number Diff line change
Expand Up @@ -631,18 +631,27 @@ static void gabc_write_gregorio_note(FILE *f, gregorio_note *note,
case S_FLAT_PAREN:
fprintf(f, "%cx?", pitch_letter(note->u.note.pitch));
break;
case S_FLAT_SOFT:
fprintf(f, "%cX", pitch_letter(note->u.note.pitch));
break;
case S_NATURAL:
fprintf(f, "%cy", pitch_letter(note->u.note.pitch));
break;
case S_NATURAL_PAREN:
fprintf(f, "%cy?", pitch_letter(note->u.note.pitch));
break;
case S_NATURAL_SOFT:
fprintf(f, "%cY", pitch_letter(note->u.note.pitch));
break;
case S_SHARP:
fprintf(f, "%c#", pitch_letter(note->u.note.pitch));
break;
case S_SHARP_PAREN:
fprintf(f, "%c#?", pitch_letter(note->u.note.pitch));
break;
case S_SHARP_SOFT:
fprintf(f, "%c#*", pitch_letter(note->u.note.pitch));
break;
case S_VIRGA:
fprintf(f, "%cv", pitch_letter(note->u.note.pitch));
break;
Expand Down
12 changes: 12 additions & 0 deletions src/gregoriotex/gregoriotex-position.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,13 @@ OFFSET_CASE(LeadingQuilisma);
OFFSET_CASE(LeadingOriscus);
OFFSET_CASE(Flat);
OFFSET_CASE(FlatParen);
OFFSET_CASE(FlatSoft);
OFFSET_CASE(Sharp);
OFFSET_CASE(SharpParen);
OFFSET_CASE(SharpSoft);
OFFSET_CASE(Natural);
OFFSET_CASE(NaturalParen);
OFFSET_CASE(NaturalSoft);

static __inline const char *note_before_last_note_case_ignoring_deminutus(
const gregorio_note *const current_note)
Expand Down Expand Up @@ -951,18 +954,27 @@ static gregorio_vposition advise_positioning(const gregorio_glyph *const glyph,
case S_FLAT_PAREN:
note->gtex_offset_case = FlatParen;
break;
case S_FLAT_SOFT:
note->gtex_offset_case = FlatSoft;
break;
case S_SHARP:
note->gtex_offset_case = Sharp;
break;
case S_SHARP_PAREN:
note->gtex_offset_case = SharpParen;
break;
case S_SHARP_SOFT:
note->gtex_offset_case = SharpSoft;
break;
case S_NATURAL:
note->gtex_offset_case = Natural;
break;
case S_NATURAL_PAREN:
note->gtex_offset_case = NaturalParen;
break;
case S_NATURAL_SOFT:
note->gtex_offset_case = NaturalSoft;
break;
default:
note->gtex_offset_case = last_note_case(glyph,
fused_single_note_case(glyph, FinalPunctum, LeadingPunctum),
Expand Down
Loading