fancyhdr 中的 lualatex 连字问题,带有 gregoriotex 和 multicols,拉丁文本

fancyhdr 中的 lualatex 连字问题,带有 gregoriotex 和 multicols,拉丁文本

问题表现为页眉中的每个单词都变成连字符,每个音节都单独占一行,导致页眉过高。该问题时有时无,并非在每一页上都出现。

当具有多列环境的页面上有格里高利圣咏乐谱时,这种情况似乎会发生,而该乐谱又会触发或越过分页符。但是,圣咏乐谱不是浮点数 - 它是一段非常奇怪的字体的文本。多列环境仅包含文本 - 没有任何图像、乐谱或浮点数。乐谱之间的文本在多列之间或非多列之间变化的频率很高,有时会跨越页面。我将在本文末尾的 MWE 之前放置一张典型页面(来自原始文档)的图片,以展示我试图复制的风格。

将标题改为一串较长的短的、不能用连字符连接的单词似乎可以正常工作,因此这肯定是一个连字符问题。

虽然删除此示例中的拉丁名称在某些情况下可以“解决”问题,但这可能只是因为正文中的间距发生了变化。它并不能解决所有情况,因此我认为这不仅仅是一个特定的语言问题。

针对语言连字问题,从 babel 切换到 polyglossia 似乎没有帮助,除非 polyglossia 提供了命令 \disablehyphenation 和 \enablehyphenation,它们可以在标题中用来抑制此问题。这对我来说是一个“解决方案”,但可能不是每个人的“解决方案”。

MWE 不是那么 M,因为我必须为这个例子包含 gregorioscore 输入。Gregorio 接受一个圣歌的简短文本描述 - 一个 .gabc 文件 - 并将其转换为具有类似名称的 .gtex 文件。您可以使用 \input 读取 .gtex 文件,也可以使用 \gregorioscore 命令读取 .gabc 文件。两者都在 MWE 中提供,只需取消注释您测试的那个。它们应该是等效的。使用 .gtex 文件可能会消除对 gregoriotex 包的需求,但我不确定如果没有这个,其他系统上是否可以使用表示圣歌的字体。

典型页面(不是此页面)的图片显示样式: 选自《罗马夜曲》一页,2002 年

移动终端

% !TEX TS-program = lualatex
% !TEX encoding = UTF-8

%latin language setting (plus babel package below)
\documentclass[12pt,twoside,latin]{book}

%Use for English
%\documentclass[12pt,twoside]{book}

\usepackage[oldstyle]{libertine}

% Comment out for English
\usepackage[latin]{babel} 

\usepackage[letterpaper]{geometry} 

\usepackage{multicol}
\setlength\columnseprule{0.4pt}

%You may comment this line out if you use the .gtex file input instead of the .gabc file.
%\usepackage[autocompile]{gregoriotex} % for gregorio score inclusion

\usepackage{fancyhdr}
\fancyhf{}
\fancyfoot[C]{\rnum{\thepage}}
%\fancyhead[C]{Feria II in I Nocturno}
%
% English header
% \fancyhead[C]{Feria II in I Nocturn}
%
%optional english long header with small words - works fine in English language setting
%\fancyhead[C]{This Hdr is quite long but has just small words}
\renewcommand{\headrulewidth}{2pt}
\fancyfoot[C]{\thepage}
\pagestyle{fancy}

\usepackage{gregoriotex}

\usepackage{lipsum}


\begin{document}
\subsection{Feria Secunda}

\subsubsection{In 1 Nocturno}
\vspace*{0.5cm}
%Use only one of the following two lines; the gregorioscore line requires the usepackage{gregoriotex} line above
\input{ExtraTempusPaschale.Secunda.Antiphon.1-5_2_1.gtex}
%\gregorioscore{ExtraTempusPaschale.Secunda.Antiphon.1}
\vspace*{0.5cm}

\begin{multicols}{2}
\lipsum[1-5]
\end{multicols}{2}
\end{document}

文件 ExtraTempusPaschale.Secunda.Antiphon.1.gabc。如果安装了 gregoriotex 5.2.1,则与 gregorioscore 命令一起使用。在这种情况下,您不需要下面的 .gtex 文件。

name: Dominus ;
office-part: Antiphona;
commentary: {\itshape\mdseries Ps.13,2;\/} Off.m.h.135;
mode: 2;
mode-differential:d;
annotation: 1.Ant;   
annotation: II.d;    
%%
(f3) DO([alt:Extra Tempus Paschale.]h)mi(g)nus(h) <sp>*</sp>( )
 de(f) cœ(g)lo(f) pro(e)spé(g)xit(f) (,)
 su(f)per(e) fí(f)li(h)os(g) hó(e)mi(gh)num.(f) (::) 
<eu> E(h) U(h) O(h) U(g) A(ef) E.(f)  </eu> (::)

文件 ExtraTempusPaschale.Secunda.Antiphon.1-5_2_1.gtex。如果您可以从上面的 .gabc 文件编译,请不要使用。Gregorio Tex 将为您创建并包含它。

% File generated by gregorio 5.2.1
\GregorioTeXAPIVersion{5.2.1}%
% Name: Dominus 
\GreBeginHeaders %
\GreHeader{name}{Dominus }%
\GreHeader{office-part}{Antiphona}%
\GreHeader{commentary}{\string\123\string\092itshape\string\092mdseries Ps.13,2;\string\092/\string\125 Off.m.h.135}%
\GreHeader{mode}{2}%
\GreHeader{mode-differential}{d}%
\GreHeader{annotation}{1.Ant}%
\GreHeader{annotation}{II.d}%
\GreEndHeaders %
\GreBeginScore{502c932081554682fd50cc8f4a972b3d670d7f44}{10}{7}{0}{1}{}{4}{\GreInitialClefPosition{3}{0}}%
\GreAnnotationLines{1.Ant}{II.d}%
\GreMode{\GreModeNumber{2}}{}{}%
\GreSetLargestClef{f}{3}{3}{c}{0}{3}%
\GreScoreOpening{%
}{%
\GreSetInitialClef{f}{3}{3}{c}{0}{3}{1}%
}{%
}{\GreSyllable}{\GreSetFirstSyllableText{D}{O}{}{{}{\GreFirstWord{\GreFirstSyllable{\GreFirstSyllableInitial{O}}}}{}}{{\GreFirstWord{\GreFirstSyllable{\GreFirstSyllableInitial{D}}}}{\GreFirstWord{\GreFirstSyllable{O}}}{}}{}}{}{\GreFirstWord}{0}{\GreSetNextSyllable{\GreFirstWord{m}}{\GreFirstWord{i}}{}{\GreFirstWord{m}}{\GreFirstWord{i}}}{}{0}{}{%
\GreSyllableNoteCount{1}%
\GreSetTextAboveLines{Extra Tempus Paschale.}%
\GreGlyph{\GreCPPunctum}{10}{\GreNextCustos{9}{}}{0}%
{%
\GreGlyphHeights{10}{10}%
}{}{}%
}%
\GreSyllable{\GreSetThisSyllable{\GreFirstWord{m}}{\GreFirstWord{i}}{}{\GreFirstWord{m}}{\GreFirstWord{i}}}{}{\GreFirstWord}{0}{\GreSetNextSyllable{\GreFirstWord{n}}{\GreFirstWord{u}}{\GreFirstWord{s}}{\GreFirstWord{n}}{\GreFirstWord{u}\GreFirstWord{s}}}{}{0}{}{%
\GreSyllableNoteCount{1}%
\GreGlyph{\GreCPPunctum}{9}{\GreNextCustos{10}{}}{0}%
{%
\GreGlyphHeights{9}{9}%
}{}{}%
}%
\GreSyllable{\GreSetThisSyllable{\GreFirstWord{n}}{\GreFirstWord{u}}{\GreFirstWord{s}}{\GreFirstWord{n}}{\GreFirstWord{u}\GreFirstWord{s}}}{}{\GreFirstWord}{1}{\GreSetNextSyllable{}{\GreSpecial{*}}{}{\GreSpecial{*}}{}}{}{0}{}{%
\GreSyllableNoteCount{1}%
\GreGlyph{\GreCPPunctum}{10}{\GreNextCustos{8}{}}{0}%
{%
\GreGlyphHeights{10}{10}%
}{}{}%
}%
%
\GreSyllable{\GreSetThisSyllable{}{\GreSpecial{*}}{}{\GreSpecial{*}}{}}{}{\GreUnstyled}{1}{\GreSetNextSyllable{d}{e}{}{d}{e}}{}{0}{}{%
\GreSyllableNoteCount{0}%
\GreEndOfElement{2}{0}{0}%
}%
%
\GreSyllable{\GreSetThisSyllable{d}{e}{}{d}{e}}{}{\GreUnstyled}{1}{\GreSetNextSyllable{c}{œ}{}{c}{œ}}{}{0}{}{%
\GreSyllableNoteCount{1}%
\GreGlyph{\GreCPPunctum}{8}{\GreNextCustos{9}{}}{0}%
{%
\GreGlyphHeights{8}{8}%
}{}{}%
}%
%
\GreSyllable{\GreSetThisSyllable{c}{œ}{}{c}{œ}}{}{\GreUnstyled}{0}{\GreSetNextSyllable{l}{o}{}{l}{o}}{}{0}{}{%
\GreSyllableNoteCount{1}%
\GreGlyph{\GreCPPunctum}{9}{\GreNextCustos{8}{}}{0}%
{%
\GreGlyphHeights{9}{9}%
}{}{}%
}%
\GreSyllable{\GreSetThisSyllable{l}{o}{}{l}{o}}{}{\GreUnstyled}{1}{\GreSetNextSyllable{pr}{o}{}{p}{ro}}{}{0}{}{%
\GreSyllableNoteCount{1}%
\GreGlyph{\GreCPPunctum}{8}{\GreNextCustos{7}{}}{0}%
{%
\GreGlyphHeights{8}{8}%
}{}{}%
}%
%
\GreSyllable{\GreSetThisSyllable{pr}{o}{}{p}{ro}}{}{\GreUnstyled}{0}{\GreSetNextSyllable{sp}{é}{}{s}{pé}}{}{0}{}{%
\GreSyllableNoteCount{1}%
\GreGlyph{\GreCPPunctum}{7}{\GreNextCustos{9}{}}{0}%
{%
\GreGlyphHeights{7}{7}%
}{}{}%
}%
\GreSyllable{\GreSetThisSyllable{sp}{é}{}{s}{pé}}{}{\GreUnstyled}{0}{\GreSetNextSyllable{x}{i}{t}{x}{it}}{}{0}{}{%
\GreSyllableNoteCount{1}%
\GreGlyph{\GreCPPunctum}{9}{\GreNextCustos{8}{}}{0}%
{%
\GreGlyphHeights{9}{9}%
}{}{}%
}%
\GreSyllable{\GreSetThisSyllable{x}{i}{t}{x}{it}}{}{\GreUnstyled}{1}{\GreSetNextSyllable{}{}{}{}{}}{}{11}{}{%
\GreSyllableNoteCount{1}%
\GreGlyph{\GreCPPunctum}{8}{\GreNextCustos{8}{}}{0}%
{%
\GreGlyphHeights{8}{8}%
}{}{}%
}%
%
\GreBarSyllable{\GreSetThisSyllable{}{}{}{}{}}{}{\GreUnstyled}{1}{\GreSetNextSyllable{s}{u}{}{s}{u}}{}{0}{}{%
\GreSyllableNoteCount{0}%
\GreDivisioMinima{0}{}{1}%
}%
%
\GreSyllable{\GreSetThisSyllable{s}{u}{}{s}{u}}{}{\GreUnstyled}{0}{\GreSetNextSyllable{p}{e}{r}{p}{er}}{}{0}{}{%
\GreSyllableNoteCount{1}%
\GreGlyph{\GreCPPunctum}{8}{\GreNextCustos{7}{}}{0}%
{%
\GreGlyphHeights{8}{8}%
}{}{}%
}%
\GreSyllable{\GreSetThisSyllable{p}{e}{r}{p}{er}}{}{\GreUnstyled}{1}{\GreSetNextSyllable{f}{í}{}{f}{í}}{}{0}{}{%
\GreSyllableNoteCount{1}%
\GreGlyph{\GreCPPunctum}{7}{\GreNextCustos{8}{}}{0}%
{%
\GreGlyphHeights{7}{7}%
}{}{}%
}%
%
\GreSyllable{\GreSetThisSyllable{f}{í}{}{f}{í}}{}{\GreUnstyled}{0}{\GreSetNextSyllable{l}{i}{}{l}{i}}{}{0}{}{%
\GreSyllableNoteCount{1}%
\GreGlyph{\GreCPPunctum}{8}{\GreNextCustos{10}{}}{0}%
{%
\GreGlyphHeights{8}{8}%
}{}{}%
}%
\GreSyllable{\GreSetThisSyllable{l}{i}{}{l}{i}}{}{\GreUnstyled}{0}{\GreSetNextSyllable{}{o}{s}{o}{s}}{}{0}{}{%
\GreSyllableNoteCount{1}%
\GreGlyph{\GreCPPunctum}{10}{\GreNextCustos{9}{}}{0}%
{%
\GreGlyphHeights{10}{10}%
}{}{}%
}%
\GreSyllable{\GreSetThisSyllable{}{o}{s}{o}{s}}{}{\GreUnstyled}{1}{\GreSetNextSyllable{h}{ó}{}{h}{ó}}{}{0}{}{%
\GreSyllableNoteCount{1}%
\GreGlyph{\GreCPPunctum}{9}{\GreNextCustos{7}{}}{0}%
{%
\GreGlyphHeights{9}{9}%
}{}{}%
}%
%
\GreSyllable{\GreSetThisSyllable{h}{ó}{}{h}{ó}}{}{\GreUnstyled}{0}{\GreSetNextSyllable{m}{i}{}{m}{i}}{}{0}{}{%
\GreSyllableNoteCount{1}%
\GreGlyph{\GreCPPunctum}{7}{\GreNextCustos{9}{}}{0}%
{%
\GreGlyphHeights{7}{7}%
}{}{}%
}%
\GreSyllable{\GreSetThisSyllable{m}{i}{}{m}{i}}{}{\GreUnstyled}{0}{\GreSetNextSyllable{n}{u}{m\GreProtrusion{\GreProtrusionFactor{period}}{.}}{n}{um\GreProtrusion{\GreProtrusionFactor{period}}{.}}}{}{0}{}{%
\GreSyllableNoteCount{2}%
\GreGlyph{\GreCPPesOneNothing}{9}{\GreNextCustos{8}{}}{0}%
{%
\GreGlyphHeights{10}{9}%
}{}{}%
}%
\GreSyllable{\GreSetThisSyllable{n}{u}{m\GreProtrusion{\GreProtrusionFactor{period}}{.}}{n}{um\GreProtrusion{\GreProtrusionFactor{period}}{.}}}{}{\GreUnstyled}{1}{\GreSetNextSyllable{}{}{}{}{}}{}{15}{}{%
\GreSyllableNoteCount{1}%
\GreGlyph{\GreCPPunctum}{8}{\GreNextCustos{10}{}}{0}%
{%
\GreGlyphHeights{8}{8}%
}{}{}%
}%
%
\GreBarSyllable{\GreSetThisSyllable{}{}{}{}{}}{}{\GreUnstyled}{1}{\GreSetNextSyllable{ }{E}{}{ }{E}\GreLastSyllableBeforeEUOUAE{1}{0}}{}{0}{}{%
\GreSyllableNoteCount{0}%
\GreDivisioFinalis{0}{}%
%
\GreNextSyllableBeginsEUOUAE{1}{0}%
}%
%
\GreBeginEUOUAE{1}%
\GreSyllable{\GreSetThisSyllable{ }{E}{}{ }{E}}{}{\GreUnstyled}{1}{\GreSetNextSyllable{}{U}{}{U}{}}{}{0}{}{%
\GreSyllableNoteCount{1}%
\GreGlyph{\GreCPPunctum}{10}{\GreNextCustos{10}{}}{0}%
{%
\GreGlyphHeights{10}{10}%
}{}{}%
}%
%
\GreSyllable{\GreSetThisSyllable{}{U}{}{U}{}}{}{\GreUnstyled}{1}{\GreSetNextSyllable{}{O}{}{O}{}}{}{0}{}{%
\GreSyllableNoteCount{1}%
\GreGlyph{\GreCPPunctum}{10}{\GreNextCustos{10}{}}{0}%
{%
\GreGlyphHeights{10}{10}%
}{}{}%
}%
%
\GreSyllable{\GreSetThisSyllable{}{O}{}{O}{}}{}{\GreUnstyled}{1}{\GreSetNextSyllable{}{U}{}{U}{}}{}{0}{}{%
\GreSyllableNoteCount{1}%
\GreGlyph{\GreCPPunctum}{10}{\GreNextCustos{9}{}}{0}%
{%
\GreGlyphHeights{10}{10}%
}{}{}%
}%
%
\GreSyllable{\GreSetThisSyllable{}{U}{}{U}{}}{}{\GreUnstyled}{1}{\GreSetNextSyllable{}{A}{}{A}{}}{}{0}{}{%
\GreSyllableNoteCount{1}%
\GreGlyph{\GreCPPunctum}{9}{\GreNextCustos{7}{}}{0}%
{%
\GreGlyphHeights{9}{9}%
}{}{}%
}%
%
\GreSyllable{\GreSetThisSyllable{}{A}{}{A}{}}{}{\GreUnstyled}{1}{\GreSetNextSyllable{}{E}{\GreProtrusion{\GreProtrusionFactor{period}}{.}}{E}{\GreProtrusion{\GreProtrusionFactor{period}}{.}}}{}{0}{}{%
\GreSyllableNoteCount{2}%
\GreGlyph{\GreCPPesOneNothing}{7}{\GreNextCustos{8}{}}{0}%
{%
\GreGlyphHeights{8}{7}%
}{}{}%
}%
%
\GreSyllable{\GreSetThisSyllable{}{E}{\GreProtrusion{\GreProtrusionFactor{period}}{.}}{E}{\GreProtrusion{\GreProtrusionFactor{period}}{.}}}{}{\GreUnstyled}{1}{\GreSetNextSyllable{}{ }{}{ }{}}{}{15}{}{%
\GreSyllableNoteCount{1}%
\GreGlyph{\GreCPPunctum}{8}{\GreNextCustos{9}{}}{0}%
{%
\GreGlyphHeights{8}{8}%
}{}{}%
}%
%
\GreBarSyllable{\GreSetThisSyllable{}{ }{}{ }{}}{}{\GreUnstyled}{1}{\GreSetNextSyllable{}{}{}{}{}\GreLastOfLine}{}{16}{}{%
\GreSyllableNoteCount{0}%
\GreLastOfScore\GreDivisioFinalis{1}{}%
}%
%
\GreEndEUOUAE{1}%
\GreEndScore %
\endinput %

答案1

gregoriotex\hyphenpenalty由于内部原因设置为-200。负数\hyphenpenalty表示 LuaTeX 应将以连字符结尾的行视为更好的比没有连字符的行更长。由于在像标题这样的居中上下文中,没有其他理由不使行更长,因此 LuaTeX 会尽可能地使用连字符。您可以通过在本地将\hyphenpenalty标题改回更合理的值来避免这种情况。

例如\fancyhead[C]{Feria II in I Nocturno}改为\fancyhead[C]{\hyphenpenalty=50 Feria II in I Nocturno}

相关内容