diff --git a/CHANGELOG.md b/CHANGELOG.md index 36fc8a83f..51a638aed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,12 +13,19 @@ As of v3.0.0 this project adheres to [Semantic Versioning](http://semver.org/). - Added additional message to verbose output of command-line tool to prevent confusion when a custom Latin vowel convention is found that the internal Latin rules will be used. See [#1470](https://github.com/gregorio-project/gregorio/issues/1470). ## [Unreleased][CTAN] +### Changed +- The space between a non-punctum inclinatum and the upright punctum inclinatum is renamed to uprightpunctuminclinatumshift. This helps to better distinguish it from punctuminclinatumunisonshift (the space between two consecutive ascending or descending puncta inclinata on the same line). See [#1507](https://github.com/gregorio-project/gregorio/issues/1507). + ### Fixed - Staff line thickness is now set in gsp-default.tex. This corrects a problem with the staff lines changing thickness when the default spacing configuration is loaded while the staff size is something other than the default (17). See [#1461](https://github.com/gregorio-project/gregorio/issues/1461). - Corrected interaction issues between text styles and ligatures. The LaTeX commands like `\textit` insert italics correction, preventing ligatures being formed between their arguments if two occur sequentially. On the other hand the switches like `\itshape` do not. Since gregorio breaks up syllables around the vowel and then applies the formating commands to each part, this behavior showed up. We switch to using the switches to avoid this (except for underlining, for which a switch does not exist). We also fix this for color tags by loading `luacolor` which changes how the `\color` tag is implemented to allow ligatures to span groups. See [#1444](https://github.com/gregorio-project/gregorio/issues/1444). +- A reuse of a save register led to the `\hyphenpenalty` not being restored correctly at the end of the score. All save registers are now clearly identified by when they are used so as to make it harder to accidentally use the wrong one. See [posts on mailing list](https://groups.google.com/g/gregorio-users/c/u3LmnGYnhwU). +- Fixed an overly specific find/replace in snippets that that led to `\par` being able to slip into the snippet file under certain circumstances (and there by causing compilation to fail). See [#1497](https://github.com/gregorio-project/gregorio/issues/1497). +- Updated to use iftex package (the sucessor to ifluatex). See [#1481](https://github.com/gregorio-project/gregorio/issues/1481). ### Added - GregorioTeX will now look in additional places for scores using. Users can specify paths to look in using `\gresetgregpath`. If scores are not found in the current working directory or the list of provided paths, we fall back on kpse to try and find them. See [#1395](https://github.com/gregorio-project/gregorio/issues/1395). +- Added the ability to toggle the visibility of the translation and above lines text. See [user request on mailing list](https://groups.google.com/g/gregorio-users/c/J-V0dkBMevY). ## [5.2.1] - 2019-04-06 diff --git a/README.md b/README.md index 215993bde..3b5d5543b 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Create a [LaTeX](http://en.wikipedia.org/wiki/LaTeX) file that will produce the Compile the LaTeX file with LuaLaTeX, you get your score in PDF! You can change the LaTeX file to include other scores, create booklets, books, etc. -You can also try it online [here](http://dev.illuminarepublications.com/gregorio/). +You can also try it online [here](http://dev.illuminarepublications.com/). ## Installation diff --git a/doc/Command_Index_User.tex b/doc/Command_Index_User.tex index 74373e0e9..562f31372 100644 --- a/doc/Command_Index_User.tex +++ b/doc/Command_Index_User.tex @@ -150,7 +150,7 @@ \subsubsection{Including scores} compile the gabc file into a gtex file. This is similar to \texttt{[a]} except the gabc is compiled every time. -\macroname{\textbackslash gregetgregpath}{\{\#1\}}{gregoriotex-main.tex} +\macroname{\textbackslash gresetgregpath}{\{\#1\}}{gregoriotex-main.tex} Set a list of additional directories which should be searched for scores. Directories may be absolute or relative, but must end with a slash (\verb=/=) and enclosed in braces (\verb={}=), even if there is only one additional directory. For example, to look in a directory called “Scores” which is alongside the main project directory, one could use the following: \begin{latexcode} @@ -920,6 +920,22 @@ \subsubsection{Text Elements} & \texttt{invisible} & Lyrics are not visible.\\ \end{argtable} +\macroname{\textbackslash gresettranslation}{\{\#1\}}{gregoriotex-main.tex} +Sets the visibility of the translations. + +\begin{argtable} + \#1 & \texttt{visible} & Translations are visible (default).\\ + & \texttt{invisible} & Translations are not visible.\\ +\end{argtable} + +\macroname{\textbackslash gresetabovelinestext}{\{\#1\}}{gregoriotex-main.tex} +Sets the visibility of the above lines text. + +\begin{argtable} + \#1 & \texttt{visible} & Above lines text are visible (default).\\ + & \texttt{invisible} & Above lines text are not visible.\\ +\end{argtable} + \subsubsection{Text Alignment} Gregorio\TeX\ allows you to manipulate the global alignment behavior of some text elements using the following commands. diff --git a/doc/Command_Index_gregorio.tex b/doc/Command_Index_gregorio.tex index 6bf00e000..af4c90c13 100644 --- a/doc/Command_Index_gregorio.tex +++ b/doc/Command_Index_gregorio.tex @@ -324,7 +324,7 @@ \section{Gregorio Controls} & \texttt{1} & The notes around the bar are far, \verb=@short= versions of spaces will be used.\\ \end{argtable} -\macroname{\textbackslash GreDivisioMinimaHigh}{\#1\#2\#3}{gregoriotex-signs.tex} +\macroname{\textbackslash GreDivisioMinimisHigh}{\#1\#2\#3}{gregoriotex-signs.tex} Macro to typeset a divisio ``minimis'' (eighth bar) on the ledger line above the staff. \begin{argtable} @@ -682,6 +682,12 @@ \section{Gregorio Controls} \macroname{\textbackslash GreInDivisioMinimaParenHigh}{\#1\#2\#3}{gregoriotex-signs.tex} Same as \verb=\GreDivisioMinimaParenHigh= except inside a syllable. +\macroname{\textbackslash GreInDivisioMinimis}{\#1\#2\#3}{gregoriotex-signs.tex} +Same as \verb=\GreDivisioMinimis= except inside a syllable. + +\macroname{\textbackslash GreInDivisioMinimisHigh}{\#1\#2\#3}{gregoriotex-signs.tex} +Same as \verb=\GreDivisioMinimisHigh= except inside a syllable. + \macroname{\textbackslash GreInDivisioMinor}{\#1\#2}{gregoriotex-signs.tex} Same as \verb=\GreDivisioMinor= except inside a syllable. diff --git a/doc/Command_Index_internal.tex b/doc/Command_Index_internal.tex index 0a89f643d..ee9c8c08d 100644 --- a/doc/Command_Index_internal.tex +++ b/doc/Command_Index_internal.tex @@ -25,6 +25,8 @@ \section{Gregorio\TeX{} Controls} document and are listed here for programmer documentation purposes only. +Sometimes it is necessary to temporarily change some register or macro for the purpose of some particular operation and then restore it to its previous value. In those case we define a \verb=\gre@saved@...= register or macro associated with it (\eg \verb=\gre@dimen@constantglyphraise= is saved just before a discretionary to \verb=\gre@saved@prediscretionary@dimen@constantglyphraise= and restored from it afterwards). These registers/macros are not listed in this documentation. + \macroname{\textbackslash gre@error}{\#1}{gregoriotex.sty \textup{and} gregoriotex.tex} Prints an error to the \TeX\ output log. @@ -564,9 +566,6 @@ \section{Gregorio\TeX{} Controls} \macroname{\textbackslash gre@lastoflinecount}{}{gregoriotex-main.tex} Count to track where on the line we are. Values are \texttt{0} (we are not near the end of a line), \texttt{1} (we’re at the last syllable of the line), and \texttt{2} (we just set the last syllable of the line and so are at the first syllable of a new line). -\macroname{\textbackslash gre@savedlastoflinecount}{}{gregoriotex-main.tex} -A spot to save the \verb=\gre@lastoflinecount= so we can change it temporarily and revert to the saved value later. - \macroname{\textbackslash gre@newlinecommon}{\#1\#2}{gregoriotex-main.tex} The macro which needs to be called each time a new lines is started. @@ -615,9 +614,6 @@ \section{Gregorio\TeX{} Controls} \macroname{\textbackslash gre@opening@syllabletext}{}{gregoriotex-syllable.tex} Macro that stores the computed \TeX\ code for rendering the text of the first syllable. -\macroname{\textbackslash gre@exhyphencharsave}{}{gregoriotex-main.tex} -Macro for saving the ex hyphen character so that it can be restored at the end of the score. - \macroname{\textbackslash gre@factor}{}{gregoriotex-main.tex} Count which stores the current staff size. @@ -1054,6 +1050,10 @@ \section{Gregorio\TeX{} Controls} & \texttt{20} & Space between a punctum inclinatum and a ``no-bar'' glyph two pitches above. \\ & \texttt{21} & Space between a punctum inclinatum and a ``no-bar'' glyph three or four pitches above \\ & \texttt{22} & Half-space. \\ + & \texttt{23} & Space between two puncta inclinata on a unison. \\ + & \texttt{24} & Space before a right-leaning puncta inclinatum when the pitch is ascending (up to 4 pitches away). \\ + & \texttt{25} & Space before a left-leaning puncta inclinatum when the pitch is descending (up to 4 pitches away). \\ + & \texttt{26} & Space after after a non-punctum inclinatum and before the upright punctum inclinatum. \\ \end{argtable} \macroname{\textbackslash gre@nabcfontname}{}{gregoriotex-main.tex} @@ -1105,19 +1105,6 @@ \section{Gregorio\TeX{} Controls} \#2 & \TeX\ code & Code to perform when \emph{not} rewriting the syllable\\ \end{argtable} -\macroname{\textbackslash gre@save@endsyllablepart}{}{gregoriotex-syllable.tex} -Control sequence aliased to the carry-over syllable part to be moved to the next syllable. - -\macroname{\textbackslash gre@save@fixedtextformat}{\#1}{gregoriotex-syllable.tex} -Control sequence aliased to the fixed text format for the carry-over syllable part to be moved to the next syllable. - -\begin{argtable} - \#1 & string & The carry-over syllable part, as with \verb=\gre@fixednexttextformat=\\ -\end{argtable} - -\macroname{\textbackslash gre@save@pointandclick}{}{gregoriotex-syllable.tex} -Control sequence aliased to the line:char:column of the point-and-click link for the carry-over syllable part to be moved to the next syllable\\ - \macroname{\textbackslash gre@push@endsyllable}{\#1}{gregoriotex-syllable.tex} Sets the save aliases to push the end-syllable part of the current syllable to the next syllable if necessary. @@ -1222,7 +1209,7 @@ \section{Gregorio\TeX{} Controls} \macroname{\textbackslash gre@pitch@clefbottom}{}{gregoriotex-spaces.tex} The pitch of the lowest point of the current clef. -\macroname{\textbackslash gre@saveclefextrema}{\#1\#2}{gregoriotex-signs.tex} +\macroname{\textbackslash gre@save@clefextrema}{\#1\#2}{gregoriotex-signs.tex} Computes the pitches of the lowest and highest points of a clef and saves them into \verb=\gre@pitch@cleftop= and \verb=\gre@pitch@clefbottom=. @@ -1398,9 +1385,6 @@ \section{Gregorio\TeX{} Controls} \macroname{\textbackslash gre@newlinecommondelayed}{}{gregoriotex-syllable.tex} Macro used in place of \verb=\gre@newlinecommon= when the line break must be delayed. -\macroname{\textbackslash gre@newlinecommonsaved}{}{gregoriotex-syllable.tex} -Macro for storing original behavior of \verb=\gre@newlinecommon= so that it can be restored after the delayed line break takes effect. - \macroname{\textbackslash gre@punctum@mora}{\#1\#2\#3\#4}{gregoriotex-signs.tex} Macro to typeset a punctum mora. @@ -1959,9 +1943,6 @@ \subsection{Flags} \macroname{\textbackslash ifgre@disablevepisema}{}{gregoriotex-signs.tex} Boolean to disable the printing of vertical episemata. -\macroname{\textbackslash ifgre@lastendswithmorasave}{}{gregoriotex-syllable.tex} -Boolean for saving \verb=\ifgre@lastendswithmora= for later restoration. - \macroname{\textbackslash gre@lasteuouaeindex}{}{gregoriotex-main.tex} Count which keeps track of the most recent euouae area. @@ -2004,6 +1985,12 @@ \subsection{Flags} \macroname{\textbackslash ifgre@showlyrics}{}{gregoriotex-syllable.tex} Boolean indicating whether the lyrics should be shown. +\macroname{\textbackslash ifgre@showtranslation}{}{gregoriotex-main.tex} +Boolean indicating whether the translation should be shown. + +\macroname{\textbackslash ifgre@showabovelinestext}{}{gregoriotex-main.tex} +Boolean indicating whether the above lines text should be shown. + \macroname{\textbackslash gre@initiallines}{}{gregoriotex-syllable.tex} Number of lines the initial takes up. Currently limited to 0, 1, or 2. Not currently a count, but will be changed to one in 5.0. @@ -2094,10 +2081,6 @@ \subsection{Distances} These additional distances are calculated by Gregorio based on the values for the user customizable distances and what may be going on in the score at the time of their use. -In some cases it is necessary to temporarily manipulate some of these distances for the purpose of some particular operation and then restore them to their previous values. In that case the distance will have a \verb=\gre@saved@...= register associated with it (\eg \verb=\gre@dimen@constantglyphraise= is saved to and restored from \verb=\gre@saved@dimen@constantglyphraise=). - -We also have save registries for \verb=\baselineskip=, \verb=\lineskip=, \verb=\lineskiplimit=, \verb=\parskip=, and \verb=\parfillskip= so that we can modify the way line breaking decisions are handled inside a score without affecting the rest of the document. - \macroname{\textbackslash gre@dimen@morawidth}{}{gregoriotex-spaces.tex} Width of a punctum mora (reinitialized at each score, lazily recomputed). @@ -2306,58 +2289,6 @@ \subsection{Penalties} \macroname{\textbackslash gre@restorepenalties}{}{gregoriotex-spaces.tex} Macro called at the end of the score to restore the text penalties. -\macroname{\textbackslash gre@brokenpenaltysave}{}{gregoriotex-spaces.tex} -A place to save the current value of the broken penalty so that we can change it temporarily and then restore it later. - -\macroname{\textbackslash gre@clubpenaltysave}{}{gregoriotex-spaces.tex} -A place to save the current value of the club penalty so that we can change it temporarily and then restore it later. - -\macroname{\textbackslash gre@widowpenaltysave}{}{gregoriotex-spaces.tex} -A place to save the current value of the widow penalty so that we can change it temporarily and then restore it later. - -\macroname{\textbackslash gre@emergencystretchsave}{}{gregoriotex-spaces.tex} -A place to save the current value of the emergency stretch so that we can change it temporarily and then restore it later. - -\macroname{\textbackslash gre@endafterbarpenaltysave}{}{gregoriotex-main.tex} -A place to save the current value of the end after bar penalty so that we can change it temporarily and then restore it later. - -\macroname{\textbackslash gre@endafterbaraltpenaltysave}{}{gregoriotex-main.tex} -A place to save the current value of the alternate end after bar penalty so that we can change it temporarily and then restore it later. - -\macroname{\textbackslash gre@endofelementpenaltysave}{}{gregoriotex-main.tex} -A place to save the current value of the end of element penalty so that we can change it temporarily and then restore it later. - -\macroname{\textbackslash gre@endofsyllablepenaltysave}{}{gregoriotex-main.tex} -A place to save the current value of the end of syllable penalty so that we can change it temporarily and then restore it later. - -\macroname{\textbackslash gre@endofwordpenaltysave}{}{gregoriotex-main.tex} -A place to save the current value of the end of word penalty so that we can change it temporarily and then restore it later. - -\macroname{\textbackslash gre@exhyphenpenaltysave}{}{gregoriotex-spaces.tex} -A place to save the current value of the ex hyphen penalty so that we can change it temporarily and then restore it later. - -\macroname{\textbackslash gre@hyphenpenaltysave}{}{gregoriotex-main.tex \textup{and} gregoriotex-spaces.tex} -A place to save the current value of the hyphen penalty so that we can change it temporarily and then restore it later. - -\macroname{\textbackslash gre@nobreakpenaltysave}{}{gregoriotex-main.tex} -A place to save the current value of the no break penalty so that we can change it temporarily and then restore it later. - -\macroname{\textbackslash gre@doublehyphendemeritssave}{}{gregoriotex-spaces.tex} -A place to save the current value of the double hyphen demerits so that we can change it temporarily and then restore it later. - -\macroname{\textbackslash gre@finalhyphendemeritssave}{}{gregoriotex-spaces.tex} -A place to save the current value of the final hyphen demerits so that we can change it temporarily and then restore it later. - -\macroname{\textbackslash gre@loosenesssave}{}{gregoriotex-spaces.tex} -A place to save the current value of the looseness so that we can change it temporarily and then restore it later. - -\macroname{\textbackslash gre@tolerancesave}{}{gregoriotex-spaces.tex} -A place to save the current value of the tolerance so that we can change it temporarily and then restore it later. - -\macroname{\textbackslash gre@pretolerancesave}{}{gregoriotex-spaces.tex} -A place to save the current value of the pretolerance so that we can change it temporarily and then restore it later. - - \subsection{Backwards compatibility} Depending on version of Lua\TeX / \LaTeX, some primitives have different names We define the following local aliases to account for this eventuality. diff --git a/doc/gsp-sample.tex b/doc/gsp-sample.tex index 1af999973..a24c4abad 100644 --- a/doc/gsp-sample.tex +++ b/doc/gsp-sample.tex @@ -251,7 +251,7 @@ \grechangedim{descendingpunctuminclinatumascendingshift}{-0.07918 cm plus 0.0009 cm minus 0.0009 cm}{scalable}% % space between two ascending punctum inclinatum glyphs in an descent \grechangedim{ascendingpunctuminclinatumdescendingshift}{-0.07918 cm plus 0.0009 cm minus 0.0009 cm}{scalable}% -% space between two unison punctum inclinatum glyphs (at the unison) +% Space after after a non-punctum inclinatum and before the upright punctum inclinatum \grechangedim{unisonpunctuminclinatumshift}{0.05286 cm plus 0.00728 cm minus 0.00455 cm}{scalable}% % diff --git a/doc_check.sh b/doc_check.sh index cba4b6568..7856ba66d 100755 --- a/doc_check.sh +++ b/doc_check.sh @@ -12,6 +12,7 @@ # The script is not perfect, and especially has trouble with classes of macros # which have only one entry in the documentation. +#set -x #echo on HERE=`pwd` @@ -36,16 +37,16 @@ sed -i.temp 's:.*OBSOLETE.*::' $CODEFILE sed -i.temp 's:.*DEPRECATED.*::' $CODEFILE #remove trailing comments -gsed -i.temp 's/%.*$//' $CODEFILE +sed -i.temp 's/%.*$//' $CODEFILE #remove whitespace -gsed -i.temp 's/^[ \t]*//;s/[ \t]*$//' $CODEFILE +sed -i.temp 's/^[ \t]*//;s/[ \t]*$//' $CODEFILE #remove new and trailing code sed -i.temp 's:.*\\new[a-z]*{*\(\\*[a-zA-Z@]*\)[\\}]*.*:\1:' $CODEFILE #get rid of work around def -sed -i.temp -E 's:\\def\\x{::' $CODEFILE +sed -i.temp '/\\def\\x/d' $CODEFILE #accept only first def on line sed -i.temp -E 's:\\[gex]?def:special:' $CODEFILE @@ -87,6 +88,7 @@ sed -i.temp 's:.*count@temp@.*::' $CODEFILE #registers for saved values sed -i.temp 's:\\gre@saved@.*::' $CODEFILE +sed -i.temp '/\\ifgre@saved@.*/d' $CODEFILE #macros used to process options sed -i.temp 's:\\gre@autocompile::' $CODEFILE @@ -120,7 +122,7 @@ sed -i.temp 's:\\macroname{\([^}]*\)}.*:\1:' $DOCFILE sed -i.temp 's:\\textbackslash :\\:' $DOCFILE #styles -sed -i.temp 's:.*\stylename{\([a-z]*\)}.*:\1:' $DOCFILE +sed -i.temp 's:.*stylename{\([a-z]*\)}.*:\1:' $DOCFILE #distances sed -i.temp 's:\\begin{gdimension}{\([a-z@]*\)}.*:\1:' $DOCFILE @@ -146,7 +148,7 @@ grep -h '\\gre@deprecated.*' *.tex | grep -v '\\def\\' >> $DOCFILE grep -h '\\gre@obsolete.*' *.tex | grep -v '\\def\\' >> $DOCFILE #remove whitespace -gsed -i.temp 's/^[ \t]*//;s/[ \t]*$//' $DOCFILE +sed -i.temp 's/^[ \t]*//;s/[ \t]*$//' $DOCFILE sed -i.temp 's:.*\\gre@deprecated{.*::' $DOCFILE sed -i.temp 's:.*\\gre@obsolete{.*::' $DOCFILE diff --git a/examples/main-lualatex.tex b/examples/main-lualatex.tex index 018a0a06b..9bbcb8552 100644 --- a/examples/main-lualatex.tex +++ b/examples/main-lualatex.tex @@ -1,47 +1,47 @@ % !TEX program = LuaLaTeX+se -% This is a simple template for a LuaLaTeX document using gregorio scores. +% Simple template for using Gregorio scores in a LuaLaTeX document. -\documentclass[11pt]{article} % use larger type; default would be 10pt +\documentclass{scrartcl} % set document class: manual at https://ctan.org/pkg/koma-script -% usual packages loading: -\usepackage{fontspec} -\usepackage{graphicx} % support the \includegraphics command and options -\usepackage{geometry} % See geometry.pdf to learn the layout options. There are lots. -\geometry{a4paper} % or letterpaper (US) or a5paper or.... -\usepackage{gregoriotex} % for gregorio score inclusion -\usepackage{fullpage} % to reduce the margins -\usepackage{libertine} % Decent (free) font for Gregorian, but should be changed if you have high standards +% Load packages: +\usepackage[osf,p]{libertine} % set font +\usepackage{gregoriotex} % enable Gregorio score inclusion +\usepackage[latin]{babel} % set language -\begin{document} +\setkomafont{section}{\normalfont\centering\huge\scshape} % section heading style +\setcounter{secnumdepth}{-\maxdimen} % remove section numbering -% The title: -\begin{center}\begin{huge}\textsc{Populus Sion}\end{huge}\end{center} -% Here we set the space around the initial. -% Please report to http://gregorio-project.github.io/gregoriotex/details.html for more details and options +% Set the space around the initial: +% See http://gregorio-project.github.io/gregoriotex/details.html for more details and options \grechangedim{beforeinitialshift}{2.2mm}{scalable} \grechangedim{afterinitialshift}{2.2mm}{scalable} -% Here we set the initial font. Change 43 if you want a bigger initial. +% Set the initial font (change 43 for a larger size): \grechangestyle{initial}{\fontsize{43}{43}\selectfont}% -% We set red lines here, comment it if you want black ones. +% Make staff lines red; remove for black: \gresetlinecolor{gregoriocolor} -% We set VII above the initial manually +% Use the "commentary" field of the score in the top right corner: +\gresetheadercapture{commentary}{grecommentary}{string} + +% Format annotation above initial \grechangestyle{annotation}{\small\bfseries} -\greannotation{Intr.} -\greannotation{\textsc{vii}} -% We use the "commentary" field of the score in the top right corner: -\gresetheadercapture{commentary}{grecommentary}{string} +\begin{document} + +\section{Populus Sion} + +% Add VII above the initial manually: +\greannotation{Intr.} % first line +\greannotation{\textsc{vii}} % second line -% and finally we include the scores. The file must be in the same directory as this one. +% Include the score; the file must be in the same directory: \gregorioscore[a]{PopulusSion} -\bigskip -\begin{center}\begin{huge}\textsc{Factus Est}\end{huge}\end{center} +\section{Factus est} \gregorioscore[a]{FactusEst} diff --git a/tex/gregoriosyms.sty b/tex/gregoriosyms.sty index 6945f2efc..93d55eab5 100644 --- a/tex/gregoriosyms.sty +++ b/tex/gregoriosyms.sty @@ -21,11 +21,13 @@ \ProvidesPackage{gregoriosyms} [2019/04/06 v5.2.1 GregorioTeX symbols only.]% PARSE_VERSION_DATE_LTX +\RequirePackage{iftex}% +\RequireLuaTeX + % If gregoriotex has been loaded, then we need to abort the loading process of this package here in order to avoid some conflicts. \ifcsname gregoriotex@symbols@loaded\endcsname\endinput\fi% \RequirePackage{kvoptions}% -\RequirePackage{ifluatex}% \RequirePackage{luatexbase}% \RequirePackage{luaotfload} \RequirePackage{luamplib}% diff --git a/tex/gregoriotex-common.tex b/tex/gregoriotex-common.tex index 40c5b6f06..f10acd0d4 100644 --- a/tex/gregoriotex-common.tex +++ b/tex/gregoriotex-common.tex @@ -19,6 +19,9 @@ \gre@declarefileversion{gregoriotex-common.tex}{5.2.1}% GREGORIO_VERSION +\ifnum\luatexversion<76% + \gre@error{Error: this document must be compiled with LuaTeX (lualatex) 0.76 or later}% +\fi% %%%%%%%%% %% Debugging diff --git a/tex/gregoriotex-main.tex b/tex/gregoriotex-main.tex index 6b4a3647f..75ec12511 100644 --- a/tex/gregoriotex-main.tex +++ b/tex/gregoriotex-main.tex @@ -23,16 +23,6 @@ % All gtex files must also have the same version. \xdef\gre@gregoriotexversion{5.2.1}% GREGORIO_VERSION - VersionManager.py -\ifluatex% - \ifnum\luatexversion<76% - \gre@error{Error: this document must be compiled with LuaTeX (lualatex) 0.76 or later}% - \fi% -\else% - \gre@error{Error: this document must be compiled with LuaTeX (lualatex)}% -\fi% - - - % first some macros to allow checks for version: % Tests that all gregoriotex files are of the same version. % #1 is the name of the file @@ -740,14 +730,28 @@ % - typeset the text above the lines if relevant, and making sure we execute it only once % - not do anything else +\newif\ifgre@showabovelinestext% +\gre@showabovelinestexttrue% + +\def\gresetabovelinestext#1{% + \IfStrEqCase{#1}{% + {visible}{\gre@showabovelinestexttrue}% + {invisible}{\gre@showabovelinestextfalse}% + }[% all other cases + \gre@error{Unknown option, "#1" for \protect\gresetabovelinestext\MessageBreak Possible options are: 'visible' and 'invisible'}% + ]% +}% + \xdef\gre@currenttextabovelines{}% \def\GreSetTextAboveLines#1{% - \gdef\gre@currenttextabovelines{% - \gre@typesettextabovelines{#1}{0}% - \gdef\gre@currenttextabovelines{}% - \relax % - }% + \ifgre@showabovelinestext% + \gdef\gre@currenttextabovelines{% + \gre@typesettextabovelines{#1}{0}% + \gdef\gre@currenttextabovelines{}% + \relax % + }% + \fi% }% % typesets the text or nabc neumes above the line @@ -1027,37 +1031,55 @@ ]% }% +\newif\ifgre@showtranslation% +\gre@showtranslationtrue% + +\def\gresettranslation#1{% + \IfStrEqCase{#1}{% + {visible}{\gre@showtranslationtrue}% + {invisible}{\gre@showtranslationfalse}% + }[% all other cases + \gre@error{Unknown option, "#1" for \protect\gresettranslation\MessageBreak Possible options are: 'visible' and 'invisible'}% + ]% +}% + \def\GreWriteTranslation#1{% - \ifgre@translationcentering % - \setbox\gre@box@temp@width=\hbox{#1}% - \gre@dimen@temp@five=\dimexpr((\wd\gre@box@syllabletext - \wd\gre@box@temp@width) / 2)\relax% - \gre@mark@translation % - \kern\gre@dimen@temp@five % - \raise\gre@space@dimen@spacebeneathtext\hbox to 0pt{\vbox to 0pt{\vss\hbox to 0pt{\gre@style@translation#1\endgre@style@translation\hss}}}% - \kern-\gre@dimen@temp@five % - \else % - \gre@mark@translation % - \raise\gre@space@dimen@spacebeneathtext\hbox to 0pt{\vbox to 0pt{\vss\hbox to 0pt{\gre@style@translation#1\endgre@style@translation\hss}}}% - \fi % + \ifgre@showtranslation% + \ifgre@translationcentering % + \setbox\gre@box@temp@width=\hbox{#1}% + \gre@dimen@temp@five=\dimexpr((\wd\gre@box@syllabletext - \wd\gre@box@temp@width) / 2)\relax% + \gre@mark@translation % + \kern\gre@dimen@temp@five % + \raise\gre@space@dimen@spacebeneathtext\hbox to 0pt{\vbox to 0pt{\vss\hbox to 0pt{\gre@style@translation#1\endgre@style@translation\hss}}}% + \kern-\gre@dimen@temp@five % + \else % + \gre@mark@translation % + \raise\gre@space@dimen@spacebeneathtext\hbox to 0pt{\vbox to 0pt{\vss\hbox to 0pt{\gre@style@translation#1\endgre@style@translation\hss}}}% + \fi % + \fi% }% \def\GreWriteTranslationWithCenterBeginning#1{% - \ifgre@breakintranslation\else% - \GreBeginNLBArea{0}{1}% - \fi % - \gre@attr@center=1\relax % - \gre@mark@translation % - \raise\gre@space@dimen@spacebeneathtext\hbox to 0pt{\kern 0pt\vbox to 0pt{\vss\hbox to 0pt{\gre@style@translation#1\endgre@style@translation\hss}}\kern 0pt}% - \unsetluatexattribute{\gre@attr@center}% - \relax % + \ifgre@showtranslation% + \ifgre@breakintranslation\else% + \GreBeginNLBArea{0}{1}% + \fi % + \gre@attr@center=1\relax % + \gre@mark@translation % + \raise\gre@space@dimen@spacebeneathtext\hbox to 0pt{\kern 0pt\vbox to 0pt{\vss\hbox to 0pt{\gre@style@translation#1\endgre@style@translation\hss}}\kern 0pt}% + \unsetluatexattribute{\gre@attr@center}% + \relax % + \fi% }% \newif\ifgre@mustdotranslationcenterend% \gre@mustdotranslationcenterendfalse% \def\GreTranslationCenterEnd{% - \gre@mustdotranslationcenterendtrue% - \relax % + \ifgre@showtranslation% + \gre@mustdotranslationcenterendtrue% + \relax % + \fi% }% \def\gre@dotranslationcenterend{% @@ -1248,8 +1270,6 @@ \gre@computespaces% \gre@cancelpenalties % \gre@attr@dash=0\relax % - \xdef\gre@exhyphencharsave{\the\exhyphenchar}% - \exhyphenchar=-1\relax % \gre@generatelines % \noindent% \gre@calculate@additionalspaces{#2}{#3}{#4}{#5}% @@ -1300,7 +1320,6 @@ \gre@removetranslationspace % \gre@normalinitial % \gre@restorepenalties % - \exhyphenchar=\gre@exhyphencharsave % \gre@dimen@temp@one=0pt\relax% \gre@dimen@temp@two=0pt\relax% \gre@dimen@temp@three=0pt\relax% @@ -1553,6 +1572,10 @@ %% 20: space between a punctum inclinatum and a "no-bar" glyph two pitches above %% 21: space between a punctum inclinatum and a "no-bar" glyph three or four pitches above %% 22: half-space +%% 23: Space between two puncta inclinata on a unison +%% 24: Space before a right-leaning puncta inclinatum when the pitch is ascending (up to 4 pitches away) +%% 25: Space before a left-leaning puncta inclinatum when the pitch is descending (up to 4 pitches away) +%% 26: Space after after a non-punctum inclinatum and before the upright punctum inclinatum \def\gre@get@spaceskip#1{% \gre@trace{gre@get@spaceskip{#1}}% \ifcase#1% @@ -1608,7 +1631,7 @@ \or% case 25 \gre@skip@temp@four = \gre@space@skip@ascendingpunctuminclinatumdescendingshift\relax% \or% case 26 - \gre@skip@temp@four = \gre@space@skip@unisonpunctuminclinatumshift\relax% + \gre@skip@temp@four = \gre@space@skip@uprightpunctuminclinatumshift\relax% \else% \gre@error{Unrecognized spaceskip #1}% \fi% @@ -1631,13 +1654,13 @@ % 2: no line break area due to tag \xdef\gre@nlbstate{0}% -\newcount\gre@nobreakpenaltysave% -\newcount\gre@endofwordpenaltysave% -\newcount\gre@endofsyllablepenaltysave% -\newcount\gre@endafterbarpenaltysave% -\newcount\gre@endafterbaraltpenaltysave% -\newcount\gre@endofelementpenaltysave% -%\newcount\gre@hyphenpenaltysave% in gregoriotex-spaces.tex +\newcount\gre@saved@prenlba@nobreakpenalty% +\newcount\gre@saved@prenlba@endofwordpenalty% +\newcount\gre@saved@prenlba@endofsyllablepenalty% +\newcount\gre@saved@prenlba@endafterbarpenalty% +\newcount\gre@saved@prenlba@endafterbaraltpenalty% +\newcount\gre@saved@prenlba@endofelementpenalty% +\newcount\gre@saved@prenlba@hyphenpenalty% % first argument is if if the nlba is starting in neumes or not % second argument is if it is called from translation centering or not \def\GreBeginNLBArea#1#2{% @@ -1654,20 +1677,25 @@ \fi % \fi % \ifnum\gre@nlbinitialstate=0\relax % - \global\gre@nobreakpenaltysave=\gre@space@count@nobreakpenalty\relax % - \global\gre@endofwordpenaltysave=\gre@space@count@endofwordpenalty\relax % - \global\gre@endofsyllablepenaltysave=\gre@space@count@endofsyllablepenalty\relax % - \global\gre@endafterbarpenaltysave=\gre@space@count@endafterbarpenalty\relax % - \global\gre@endafterbaraltpenaltysave=\gre@space@count@endafterbaraltpenalty\relax % - \global\gre@endofelementpenaltysave=\gre@space@count@endofelementpenalty\relax % - \global\gre@hyphenpenaltysave=\gre@space@count@hyphenpenalty\relax % - % + \global\gre@saved@prenlba@nobreakpenalty=\gre@space@count@nobreakpenalty\relax % \global\gre@space@count@nobreakpenalty=10001\relax % + % + \global\gre@saved@prenlba@endofwordpenalty=\gre@space@count@endofwordpenalty\relax % \global\gre@space@count@endofwordpenalty=10001\relax % + % + \global\gre@saved@prenlba@endofsyllablepenalty=\gre@space@count@endofsyllablepenalty\relax % \global\gre@space@count@endofsyllablepenalty=10001\relax % + % + \global\gre@saved@prenlba@endafterbarpenalty=\gre@space@count@endafterbarpenalty\relax % \global\gre@space@count@endafterbarpenalty=10001\relax % + % + \global\gre@saved@prenlba@endafterbaraltpenalty=\gre@space@count@endafterbaraltpenalty\relax % \global\gre@space@count@endafterbaraltpenalty=10001\relax % + % + \global\gre@saved@prenlba@endofelementpenalty=\gre@space@count@endofelementpenalty\relax % \global\gre@space@count@endofelementpenalty=10001\relax % + % + \global\gre@saved@prenlba@hyphenpenalty=\gre@space@count@hyphenpenalty\relax % \global\gre@space@count@hyphenpenalty=10001\relax % \fi % }% @@ -1688,13 +1716,13 @@ % if gre@nlbstate is not 0, then nothing should happend \ifnum\gre@nlbstate=0\relax % \ifnum\gre@nlbinitialstate=0\else % - \global\gre@space@count@nobreakpenalty=\gre@nobreakpenaltysave\relax % - \global\gre@space@count@endofwordpenalty=\gre@endofwordpenaltysave\relax % - \global\gre@space@count@endofsyllablepenalty=\gre@endofsyllablepenaltysave\relax % - \global\gre@space@count@endafterbarpenalty=\gre@endafterbarpenaltysave\relax % - \global\gre@space@count@endafterbaraltpenalty=\gre@endafterbaraltpenaltysave\relax % - \global\gre@space@count@endofelementpenalty=\gre@endofelementpenaltysave\relax % - \global\gre@space@count@hyphenpenalty=\gre@hyphenpenaltysave\relax % + \global\gre@space@count@nobreakpenalty=\gre@saved@prenlba@nobreakpenalty\relax % + \global\gre@space@count@endofwordpenalty=\gre@saved@prenlba@endofwordpenalty\relax % + \global\gre@space@count@endofsyllablepenalty=\gre@saved@prenlba@endofsyllablepenalty\relax % + \global\gre@space@count@endafterbarpenalty=\gre@saved@prenlba@endafterbarpenalty\relax % + \global\gre@space@count@endafterbaraltpenalty=\gre@saved@prenlba@endafterbaraltpenalty\relax % + \global\gre@space@count@endofelementpenalty=\gre@saved@prenlba@endofelementpenalty\relax % + \global\gre@space@count@hyphenpenalty=\gre@saved@prenlba@hyphenpenalty\relax % \ifcase #1\relax % 0 \gre@penalty{\the\gre@space@count@endofelementpenalty}% \or % 1 @@ -1884,12 +1912,12 @@ %%%%%%%%%%%%%%%%%%% -\def\gre@maketabl#1{\ifx\relax#1\else,"#1"\expandafter\gre@maketabl\fi} +\def\gre@maketable#1{\ifx\relax#1\else,"#1"\expandafter\gre@maketable\fi} \def\gresetgregpath#1{% \def\gre@input@path{#1}% \directlua{ - gre_input_path = {""\expandafter\gre@maketabl\gre@input@path\relax} + gre_input_path = {""\expandafter\gre@maketable\gre@input@path\relax} } } diff --git a/tex/gregoriotex-signs.tex b/tex/gregoriotex-signs.tex index 426f87e45..fee704f2f 100644 --- a/tex/gregoriotex-signs.tex +++ b/tex/gregoriotex-signs.tex @@ -238,8 +238,8 @@ \gre@trace@end% } -\def\gre@saveclefextrema#1#2{% - \gre@trace{gre@saveclefextrema{#1}{#2}}% +\def\gre@save@clefextrema#1#2{% + \gre@trace{gre@save@clefextrema{#1}{#2}}% % compute the clef extrema \ifcase#1\or % first@1 \global\let\gre@pitch@cleftop\gre@pitch@e % @@ -308,7 +308,7 @@ \def\GreInitialClefPosition#1#2{% \gre@trace{GreInitialClefPosition{#1}{#2}}% \ifgre@showclef % - \gre@saveclefextrema{#1}{#2}% + \gre@save@clefextrema{#1}{#2}% \fi % \gre@trace@end% }% @@ -325,7 +325,7 @@ %% #8: if 3, it means that we must not put a flat after the secondary clef, otherwise it's the height of the flat \def\gre@typeclef#1#2#3#4#5#6#7#8{% \gre@trace{gre@typeclef{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}}% - \gre@saveclefextrema{#2}{#7}% + \gre@save@clefextrema{#2}{#7}% \gre@boxclef{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}% \ifcase#3% \gre@update@clefwidth@current{\wd\gre@box@temp@width}% diff --git a/tex/gregoriotex-spaces.tex b/tex/gregoriotex-spaces.tex index 29846197b..dd2f808b6 100644 --- a/tex/gregoriotex-spaces.tex +++ b/tex/gregoriotex-spaces.tex @@ -35,77 +35,95 @@ -\newcount\gre@hyphenpenaltysave% -\newcount\gre@exhyphenpenaltysave% -\newcount\gre@doublehyphendemeritssave% -\newcount\gre@finalhyphendemeritssave% -\newcount\gre@brokenpenaltysave% -\newcount\gre@loosenesssave% -\newcount\gre@tolerancesave% -\newcount\gre@pretolerancesave% -\newskip\gre@emergencystretchsave% -\newcount\gre@widowpenaltysave% -\newcount\gre@clubpenaltysave% -\newskip\gre@saved@parskip% -\newskip\gre@saved@lineskip% -\newskip\gre@saved@baselineskip% -\newskip\gre@saved@lineskiplimit% +\newcount\gre@saved@prescore@hyphenpenalty% +\newcount\gre@saved@prescore@exhyphenpenalty% +\newcount\gre@saved@prescore@exhyphenchar% +\newcount\gre@saved@prescore@doublehyphendemerits% +\newcount\gre@saved@prescore@finalhyphendemerits% +\newcount\gre@saved@prescore@brokenpenalty% +\newcount\gre@saved@prescore@looseness% +\newcount\gre@saved@prescore@tolerance% +\newcount\gre@saved@prescore@pretolerance% +\newskip\gre@saved@prescore@emergencystretch% +\newcount\gre@saved@prescore@widowpenalty% +\newcount\gre@saved@prescore@clubpenalty% +\newskip\gre@saved@prescore@parskip% +\newskip\gre@saved@prescore@lineskip% +\newskip\gre@saved@prescore@baselineskip% +\newskip\gre@saved@prescore@lineskiplimit% %% The following macros cancel some useless penalties, and reinstates them %% at the end of a score \def\gre@cancelpenalties{% \gre@trace{gre@cancelpenalties}% - \global\gre@hyphenpenaltysave=\hyphenpenalty\relax % - \global\gre@exhyphenpenaltysave=\exhyphenpenalty\relax % - \global\gre@doublehyphendemeritssave=\doublehyphendemerits\relax % - \global\gre@finalhyphendemeritssave=\finalhyphendemerits\relax % - \global\gre@brokenpenaltysave=\brokenpenalty\relax % - \global\gre@loosenesssave=\looseness\relax % - \global\gre@tolerancesave=\tolerance\relax % - \global\gre@pretolerancesave=\pretolerance\relax % - \global\gre@emergencystretchsave=\emergencystretch\relax % - \global\gre@widowpenaltysave=\widowpenalty\relax % - \global\gre@clubpenaltysave=\clubpenalty\relax % - % - \global\gre@saved@parskip=\parskip% - \global\gre@saved@lineskip=\lineskip% - \global\gre@saved@baselineskip=\baselineskip% - \global\gre@saved@lineskiplimit=\lineskiplimit% + \global\gre@saved@prescore@hyphenpenalty=\hyphenpenalty\relax % \hyphenpenalty=\gre@space@count@hyphenpenalty % + % + \global\gre@saved@prescore@exhyphenpenalty=\exhyphenpenalty\relax % \exhyphenpenalty=\gre@space@count@hyphenpenalty % + % + \global\gre@saved@prescore@exhyphenchar=\exhyphenchar\relax % + \exhyphenchar=-1\relax% + % + \global\gre@saved@prescore@doublehyphendemerits=\doublehyphendemerits\relax % \doublehyphendemerits=0\relax % + % + \global\gre@saved@prescore@finalhyphendemerits=\finalhyphendemerits\relax % \finalhyphendemerits=0\relax % + % + \global\gre@saved@prescore@brokenpenalty=\brokenpenalty\relax % \brokenpenalty=\gre@space@count@brokenpenalty % + % + \global\gre@saved@prescore@looseness=\looseness\relax % \looseness=\gre@space@count@looseness % + % + \global\gre@saved@prescore@tolerance=\tolerance\relax % \tolerance=\gre@space@count@tolerance % + % + \global\gre@saved@prescore@pretolerance=\pretolerance\relax % \pretolerance=\gre@space@count@pretolerance % + % + \global\gre@saved@prescore@emergencystretch=\emergencystretch\relax % \emergencystretch=\gre@space@skip@emergencystretch\relax % + % + \global\gre@saved@prescore@widowpenalty=\widowpenalty\relax % \widowpenalty=\gre@space@count@widowpenalty % + % + \global\gre@saved@prescore@clubpenalty=\clubpenalty\relax % \clubpenalty=\gre@space@count@clubpenalty % + % + \global\gre@saved@prescore@parskip=\parskip% \parskip=\gre@space@skip@parskip% + % + \global\gre@saved@prescore@lineskip=\lineskip% \lineskip=\gre@space@skip@lineskip% + % + \global\gre@saved@prescore@baselineskip=\baselineskip% \baselineskip=\gre@space@skip@baselineskip% + % + \global\gre@saved@prescore@lineskiplimit=\lineskiplimit% \lineskiplimit=\gre@space@skip@lineskiplimit% \gre@trace@end% }% \def\gre@restorepenalties{% \gre@trace{gre@restorepenalties}% - \hyphenpenalty=\gre@hyphenpenaltysave % - \exhyphenpenalty=\gre@exhyphenpenaltysave % - \doublehyphendemerits=\gre@doublehyphendemeritssave % - \finalhyphendemerits=\gre@finalhyphendemeritssave % - \brokenpenalty=\gre@brokenpenaltysave % - \looseness=\gre@loosenesssave % - \tolerance=\gre@tolerancesave % - \pretolerance=\gre@pretolerancesave % - \emergencystretch=\gre@emergencystretchsave % - \widowpenalty=\gre@widowpenaltysave % - \clubpenalty=\gre@clubpenaltysave % - \parskip=\gre@saved@parskip% - \lineskip=\gre@saved@lineskip% - \baselineskip=\gre@saved@baselineskip% - \lineskiplimit=\gre@saved@lineskiplimit% + \hyphenpenalty=\gre@saved@prescore@hyphenpenalty % + \exhyphenpenalty=\gre@saved@prescore@exhyphenpenalty % + \exhyphenchar=\gre@saved@prescore@exhyphenchar % + \doublehyphendemerits=\gre@saved@prescore@doublehyphendemerits % + \finalhyphendemerits=\gre@saved@prescore@finalhyphendemerits % + \brokenpenalty=\gre@saved@prescore@brokenpenalty % + \looseness=\gre@saved@prescore@looseness % + \tolerance=\gre@saved@prescore@tolerance % + \pretolerance=\gre@saved@prescore@pretolerance % + \emergencystretch=\gre@saved@prescore@emergencystretch % + \widowpenalty=\gre@saved@prescore@widowpenalty % + \clubpenalty=\gre@saved@prescore@clubpenalty % + \parskip=\gre@saved@prescore@parskip% + \lineskip=\gre@saved@prescore@lineskip% + \baselineskip=\gre@saved@prescore@baselineskip% + \lineskiplimit=\gre@saved@prescore@lineskiplimit% \gre@trace@end% }% @@ -898,16 +916,6 @@ % the one taken into account for above lines nabc height \newdimen\gre@dimen@additionaltopspacenabc\relax% -% backup demensions for the previous -\newdimen\gre@saved@dimen@additionalbottomspace\relax% -\newdimen\gre@saved@dimen@additionaltopspace\relax% -\newdimen\gre@saved@dimen@additionaltopspacealt\relax% -\newdimen\gre@saved@dimen@additionaltopspacenabc\relax% -\newdimen\gre@saved@dimen@currenttranslationheight\relax% -\newdimen\gre@saved@dimen@textlower\relax% -\newdimen\gre@saved@dimen@currentabovelinestextheight\relax% -\newdimen\gre@saved@dimen@constantglyphraise\relax% - \newcount\gre@space@count@additionaltopspacethreshold\relax% \gre@space@count@additionaltopspacethreshold=2 @@ -939,29 +947,40 @@ \gre@trace@end% }% +% some backup demensions for use around discretionaries +\newdimen\gre@saved@prediscretionary@dimen@additionalbottomspace\relax% +\newdimen\gre@saved@prediscretionary@dimen@additionaltopspace\relax% +\newdimen\gre@saved@prediscretionary@dimen@additionaltopspacealt\relax% +\newdimen\gre@saved@prediscretionary@dimen@additionaltopspacenabc\relax% +\newdimen\gre@saved@prediscretionary@dimen@currenttranslationheight\relax% +\newdimen\gre@saved@prediscretionary@dimen@textlower\relax% +\newdimen\gre@saved@prediscretionary@dimen@currentabovelinestextheight\relax% +\newdimen\gre@saved@prediscretionary@dimen@constantglyphraise\relax% + + \def\gre@save@additionalspaces{% \gre@trace{gre@save@additionalspaces}% - \global\gre@saved@dimen@additionalbottomspace=\gre@dimen@additionalbottomspace\relax% - \global\gre@saved@dimen@additionaltopspace=\gre@dimen@additionaltopspace\relax% - \global\gre@saved@dimen@additionaltopspacealt=\gre@dimen@additionaltopspacealt\relax% - \global\gre@saved@dimen@additionaltopspacenabc=\gre@dimen@additionaltopspacenabc\relax% - \global\gre@saved@dimen@currenttranslationheight=\gre@dimen@currenttranslationheight\relax% - \global\gre@saved@dimen@textlower=\gre@dimen@textlower\relax% - \global\gre@saved@dimen@currentabovelinestextheight=\gre@dimen@currentabovelinestextheight\relax% - \global\gre@saved@dimen@constantglyphraise=\gre@dimen@constantglyphraise\relax% + \global\gre@saved@prediscretionary@dimen@additionalbottomspace=\gre@dimen@additionalbottomspace\relax% + \global\gre@saved@prediscretionary@dimen@additionaltopspace=\gre@dimen@additionaltopspace\relax% + \global\gre@saved@prediscretionary@dimen@additionaltopspacealt=\gre@dimen@additionaltopspacealt\relax% + \global\gre@saved@prediscretionary@dimen@additionaltopspacenabc=\gre@dimen@additionaltopspacenabc\relax% + \global\gre@saved@prediscretionary@dimen@currenttranslationheight=\gre@dimen@currenttranslationheight\relax% + \global\gre@saved@prediscretionary@dimen@textlower=\gre@dimen@textlower\relax% + \global\gre@saved@prediscretionary@dimen@currentabovelinestextheight=\gre@dimen@currentabovelinestextheight\relax% + \global\gre@saved@prediscretionary@dimen@constantglyphraise=\gre@dimen@constantglyphraise\relax% \gre@trace@end% }% \def\gre@restore@additionalspaces{% \gre@trace{gre@restore@additionalspaces}% - \global\gre@dimen@additionalbottomspace=\gre@saved@dimen@additionalbottomspace\relax% - \global\gre@dimen@additionaltopspace=\gre@saved@dimen@additionaltopspace\relax% - \global\gre@dimen@additionaltopspacealt=\gre@saved@dimen@additionaltopspacealt\relax% - \global\gre@dimen@additionaltopspacenabc=\gre@saved@dimen@additionaltopspacenabc\relax% - \global\gre@dimen@currenttranslationheight=\gre@saved@dimen@currenttranslationheight\relax% - \global\gre@dimen@textlower=\gre@saved@dimen@textlower\relax% - \global\gre@dimen@currentabovelinestextheight=\gre@saved@dimen@currentabovelinestextheight\relax% - \global\gre@dimen@constantglyphraise=\gre@saved@dimen@constantglyphraise\relax% + \global\gre@dimen@additionalbottomspace=\gre@saved@prediscretionary@dimen@additionalbottomspace\relax% + \global\gre@dimen@additionaltopspace=\gre@saved@prediscretionary@dimen@additionaltopspace\relax% + \global\gre@dimen@additionaltopspacealt=\gre@saved@prediscretionary@dimen@additionaltopspacealt\relax% + \global\gre@dimen@additionaltopspacenabc=\gre@saved@prediscretionary@dimen@additionaltopspacenabc\relax% + \global\gre@dimen@currenttranslationheight=\gre@saved@prediscretionary@dimen@currenttranslationheight\relax% + \global\gre@dimen@textlower=\gre@saved@prediscretionary@dimen@textlower\relax% + \global\gre@dimen@currentabovelinestextheight=\gre@saved@prediscretionary@dimen@currentabovelinestextheight\relax% + \global\gre@dimen@constantglyphraise=\gre@saved@prediscretionary@dimen@constantglyphraise\relax% \gre@trace@end% }% @@ -1028,7 +1047,7 @@ \def\gre@calculate@textaligncenter#1#2#3#4{% \gre@trace{gre@calculate@textaligncenter{#1}{#2}{#3}{#4}}% \ifnum#4=0\relax% - \gre@widthof{\gre@save@fixedtextformat{#1}\gre@fixedtextformat{#2#3}}% + \gre@widthof{\gre@saved@syllable@fixedtextformat{#1}\gre@fixedtextformat{#2#3}}% \else % \gre@widthof{\gre@fixedtextformat{#1}\gre@fixednexttextformat{#2#3}}% \fi % diff --git a/tex/gregoriotex-syllable.tex b/tex/gregoriotex-syllable.tex index 9c2f83c0a..a1bd374ac 100644 --- a/tex/gregoriotex-syllable.tex +++ b/tex/gregoriotex-syllable.tex @@ -371,8 +371,8 @@ \global\gre@count@lastglyphiscavum=0\relax % \global\gre@firstglyphtrue% \global\gre@boxingtrue% - \let\ifgre@lastendswithmorasave\ifgre@lastendswithmora% - \xdef\gre@savedlastoflinecount{\number\gre@lastoflinecount\relax }% + \let\ifgre@saved@prenotes@lastendswithmora\ifgre@lastendswithmora% + \xdef\gre@saved@prenotes@lastoflinecount{\number\gre@lastoflinecount\relax }% \ifgre@shownotes% \setbox\gre@box@syllablenotes=\hbox{#1}% \else% @@ -380,7 +380,6 @@ \fi% \gre@debugmsg{spacing}{Width of notes: \the\wd\gre@box@syllablenotes}% \global\gre@boxingfalse% - \global\gre@lastoflinecount=\gre@savedlastoflinecount\relax % \global\gre@firstglyphtrue% % now gre@lastendswithmora is true if this syllable ends with a % punctum mora, but we still want to keep gre@lastendswithmora if we @@ -393,7 +392,8 @@ \else % \gre@thisendswithmorafalse % \fi % - \let\ifgre@lastendswithmora\ifgre@lastendswithmorasave % + \let\ifgre@lastendswithmora\ifgre@saved@prenotes@lastendswithmora% + \global\gre@lastoflinecount=\gre@saved@prenotes@lastoflinecount\relax % \global\gre@count@lastglyphiscavum=0\relax % \global\gre@skip@bar@lastskip=0pt\relax % \global\gre@endofscorefalse % @@ -747,18 +747,18 @@ \gre@trace@end% }% -\let\gre@save@endsyllablepart\gre@nothing\relax % -\let\gre@save@fixedtextformat\gre@textnormal\relax % -\let\gre@save@pointandclick\gre@nothing\relax % +\let\gre@saved@syllable@endsyllablepart\gre@nothing\relax % +\let\gre@saved@syllable@fixedtextformat\gre@textnormal\relax % +\let\gre@saved@syllable@pointandclick\gre@nothing\relax % \def\gre@push@endsyllable#1{% \gre@trace{gre@push@endsyllable{#1}}% - \let\gre@save@endsyllablepart\gre@nothing\relax % - \let\gre@save@fixedtextformat\gre@textnormal\relax % - \let\gre@save@pointandclick\gre@nothing\relax % + \let\gre@saved@syllable@endsyllablepart\gre@nothing\relax % + \let\gre@saved@syllable@fixedtextformat\gre@textnormal\relax % + \let\gre@saved@syllable@pointandclick\gre@nothing\relax % \gre@if@rewritesyllable{% - \let\gre@save@endsyllablepart\gre@endsyllablepart\relax % - \let\gre@save@fixedtextformat\gre@fixedtextformat\relax % - \xdef\gre@save@pointandclick{#1}% + \let\gre@saved@syllable@endsyllablepart\gre@endsyllablepart\relax % + \let\gre@saved@syllable@fixedtextformat\gre@fixedtextformat\relax % + \xdef\gre@saved@syllable@pointandclick{#1}% }{}% \relax % \gre@trace@end% @@ -766,15 +766,15 @@ \def\gre@emit@syllabletext#1{% \gre@trace{gre@emit@syllabletext{#1}}% - \ifx\gre@save@endsyllablepart\gre@nothing % + \ifx\gre@saved@syllable@endsyllablepart\gre@nothing % \gre@fixedtextformat{#1}% \else % - \ifx\gre@save@fixedtextformat\gre@fixedtextformat % + \ifx\gre@saved@syllable@fixedtextformat\gre@fixedtextformat % \gre@debugmsg{syllablerewriting}{merging format when prepending previous last syllable part}% - \gre@fixedtextformat{\gre@pointandclick{\gre@save@endsyllablepart}{\gre@save@pointandclick}#1}% + \gre@fixedtextformat{\gre@pointandclick{\gre@saved@syllable@endsyllablepart}{\gre@saved@syllable@pointandclick}#1}% \else % \gre@debugmsg{syllablerewriting}{prepending previous last syllable part}% - \gre@save@fixedtextformat{\gre@pointandclick{\gre@save@endsyllablepart}{\gre@save@pointandclick}}% + \gre@saved@syllable@fixedtextformat{\gre@pointandclick{\gre@saved@syllable@endsyllablepart}{\gre@saved@syllable@pointandclick}}% \gre@fixedtextformat{#1}% \fi % \fi % @@ -855,7 +855,7 @@ #1% \gre@firstglyphtrue% \gre@dimen@bolextra = 0pt\relax% - \gre@calculate@textaligncenter{\gre@save@endsyllablepart}{\gre@firstsyllablepart}{\gre@middlesyllablepart}{0}% we first get the width between the alignment point and the end of the syllable + \gre@calculate@textaligncenter{\gre@saved@syllable@endsyllablepart}{\gre@firstsyllablepart}{\gre@middlesyllablepart}{0}% we first get the width between the alignment point and the end of the syllable \gre@syllablenotes{#9}% we put the notes in a box, so that we have the width of it % now we calculate the begin difference, that is to say \gre@dimen@notesaligncenter - \gre@dimen@textaligncenter \gre@dimen@begindifference=\dimexpr(\gre@dimen@notesaligncenter - \gre@dimen@textaligncenter)\relax % @@ -1235,7 +1235,7 @@ % there are two different cases that have almost nothing in common : the case where there is something written under the bar, and the case where there is nothing. % first of all we need to calculate previousenddifference, begindifference, enddifference and nextbegindifference. #1% - \gre@calculate@textaligncenter{\gre@save@endsyllablepart}{\gre@firstsyllablepart}{\gre@middlesyllablepart}{0}% + \gre@calculate@textaligncenter{\gre@saved@syllable@endsyllablepart}{\gre@firstsyllablepart}{\gre@middlesyllablepart}{0}% \ifgre@showlyrics% \setbox\gre@box@syllabletext=\hbox{% \IfSubStr{\gre@debug}{,barspacing,}% @@ -1252,7 +1252,7 @@ \setbox\gre@box@syllabletext=\box\voidb@x% \fi% \gre@debugmsg{barspacing}{Width of bar text: \the\wd\gre@box@syllabletext}% - \global\let\gre@newlinecommonsaved\gre@newlinecommon % + \global\let\gre@saved@prelinedelay@newlinecommon\gre@newlinecommon % \global\let\gre@newlinecommon\gre@newlinecommondelayed % \xdef\gre@newlinearg{-1}% \gre@syllablenotes{#9}% @@ -1315,7 +1315,7 @@ {\raise 12pt\hbox to 0pt{\rule{0.4pt}{12pt}\hss}}% {}% do nothing if not debugging \fi% - \global\let\gre@newlinecommon\gre@newlinecommonsaved % + \global\let\gre@newlinecommon\gre@saved@prelinedelay@newlinecommon % \GreNoBreak% % get into position to place the penalty \ifdim\gre@dimen@enddifference < 0pt\relax% @@ -1398,7 +1398,7 @@ \gre@clearsyllable{bar}% \fi% % then we check if there is something to write - \global\let\gre@newlinecommon\gre@newlinecommonsaved % + \global\let\gre@newlinecommon\gre@saved@prelinedelay@newlinecommon % \gre@debugmsg{ifdim}{ wd(gre@box@syllabletext) = 0pt}% \ifdim\wd\gre@box@syllabletext = 0 pt\relax % % the most difficult case : when there is nothing to write diff --git a/tex/gregoriotex.lua b/tex/gregoriotex.lua index 6350b1ae2..df90cb6fb 100644 --- a/tex/gregoriotex.lua +++ b/tex/gregoriotex.lua @@ -966,7 +966,7 @@ local function direct_gabc(gabc, header, allow_deprecated) local f = io.open(snippet_filename, 'w') -- trims spaces on both ends (trim6 from http://lua-users.org/wiki/StringTrim) gabc = gabc:match('^()%s*$') and '' or gabc:match('^%s*(.*%S)') - f:write('name:direct-gabc;\n'..(header or '')..'\n%%\n'..gabc:gsub('\\par ', '\n')) + f:write('name:direct-gabc;\n'..(header or '')..'\n%%\n'..gabc:gsub('\\par', '\n')) f:close() local cmd = string.format([[%s -W %s-o "%%s" -l "%s" "%s"]], gregorio_exe(), deprecated, snippet_logname, snippet_filename) @@ -995,8 +995,10 @@ local function direct_gabc(gabc, header, allow_deprecated) end glog:close() end - os.remove(snippet_filename) - os.remove(snippet_logname) + if not (debug_types_activated['snippet'] or debug_types_activated['all']) then + os.remove(snippet_filename) + os.remove(snippet_logname) + end end local function get_gregoriotexluaversion() diff --git a/tex/gregoriotex.sty b/tex/gregoriotex.sty index 230cabe5e..87f63885d 100644 --- a/tex/gregoriotex.sty +++ b/tex/gregoriotex.sty @@ -21,13 +21,15 @@ \ProvidesPackage{gregoriotex}% [2019/04/06 v5.2.1 GregorioTeX system.]% PARSE_VERSION_DATE_LTX +\RequirePackage{iftex}% +\RequireLuaTeX + % If gregoriosyms has been loaded then there are going to be some conflicts in the definitions made in that package and this one. In order to provide for a more informative error message, we check for that conflict right away \ifcsname gregoriotex@symbols@loaded\endcsname\gre@error{Loading gregoriotex after\MessageBreak gregoriosyms is not supported. Please remove the\MessageBreak loading of gregoriosyms (its contents are loaded\MessageBreak by gregoriotex)}\fi% \RequirePackage{xcolor}% \RequirePackage{luacolor}% \RequirePackage{kvoptions}% -\RequirePackage{ifluatex}% \RequirePackage{graphicx}% for \resizebox \RequirePackage{luatexbase}% \RequirePackage{luaotfload}% diff --git a/tex/gregoriotex.tex b/tex/gregoriotex.tex index b16c3c2b2..5396f9be9 100644 --- a/tex/gregoriotex.tex +++ b/tex/gregoriotex.tex @@ -23,11 +23,12 @@ % This file needs to be marked with the version number. For now I've done this with the following comment, but we should check to see if PlainTeX has something similar to the version declaration of LaTeX and use that if it does. % [2019/04/06 v5.2.1 GregorioTeX system.]% PARSE_VERSION_DATE_LTX +\input iftex.sty +\RequireLuaTeX% \edef\greoldcatcode{\the\catcode`@} \catcode`\@=11 -\input ifluatex.sty% \input luatexbase.sty% \input luamplib.sty% \input luaotfload.sty%