lua-widow-control:是否可以将警告更改为信息

lua-widow-control:是否可以将警告更改为信息

我正在使用 nice 包lua-widow-control来稍微改善文档的外观。但是,警告消息“未在页面 ... 上删除寡妇/孤儿/损坏的连字符”太长(包含太多行),并且当文档变得冗长时,大量此类警告消息有时会淹没其他重要警告。我想知道在文档未完成时是否有某种方法可以将这些消息从“警告”级别更改为“信息”?

下面是此类警告消息的一个示例。

Widow/Orphan/Broken Hyphen NOT removed on page 10
[10] [11]
warning  (pdf backend): ignoring duplicate destination with the name 'page.11'
[11] (./the-document.aux))
(see the transcript file for additional information)
 4014 words of node memory still in use:
   9 hlist, 2 vlist, 2 rule, 1 local_par, 4 glue, 4 kern, 2 penalty, 2 sub_mlist, 1 margin_kern, 6 glyph, 1546 attribute, 76 glue_spec, 102 attribute_list, 1 write, 10 user_defined nodes
   avail lists: 1:31,2:99181,3:1431,4:947,5:244,6:94,7:8887,8:42,9:4342,10:45,11:552
</usr/local/texlive/2023/texmf-dist/fonts/opentype/public/kpfonts-otf/KpMath-Sans.otf></usr/local/texlive/2023/texmf-dist/fonts/opentype/public/lm-math/latinmodern-math.otf></usr/local/texlive/2023/texmf-dist/fonts/opentype/public/tex-gyre-math/texgyrepagella-math.otf></Users/username/Library/Fonts/PalatinoSansLTPro-Regular.OTF></usr/local/texlive/2023/texmf-dist/fonts/opentype/public/newcomputermodern/NewCMMono10-Bold.otf></usr/local/texlive/2023/texmf-dist/fonts/opentype/public/fontawesome5/FontAwesome5Free-Solid-900.otf></Users/username/Library/Fonts/pala.TTF></usr/local/texlive/2023/texmf-dist/fonts/opentype/public/newcomputermodern/NewCMMono10-Regular.otf></usr/local/texlive/2023/texmf-dist/fonts/opentype/public/kpfonts-otf/KpMath-Regular.otf></usr/local/texlive/2023/texmf-dist/fonts/opentype/public/kpfonts-otf/KpMath-Regular.otf></usr/local/texlive/2023/texmf-dist/fonts/opentype/public/tex-gyre/texgyreheros-bold.otf></usr/local/texlive/2023/texmf-dist/fonts/opentype/public/tex-gyre/texgyreheros-regular.otf></usr/local/texlive/2023/texmf-dist/fonts/opentype/public/kpfonts-otf/KpMath-Regular.otf></usr/local/texlive/2023/texmf-dist/fonts/opentype/public/tex-gyre-math/texgyrepagella-math.otf></usr/local/texlive/2023/texmf-dist/fonts/opentype/public/tex-gyre-math/texgyrepagella-math.otf></Users/username/Library/Fonts/palabi.TTF></Users/username/Library/Fonts/palai.TTF></Users/username/Library/Fonts/pala.TTF></Users/username/Library/Fonts/palab.TTF></Users/username/Library/Fonts/SourceHanSerif.ttc></Users/username/Library/Fonts/SourceHanSerif.ttc></Users/username/Library/Fonts/SourceHanSerif.ttc></Users/username/Library/Fonts/SourceHanSerif.ttc></usr/local/texlive/2023/texmf-dist/fonts/type1/public/amsfonts/euler/eurb10.pfb></usr/local/texlive/2023/texmf-dist/fonts/type1/public/amsfonts/euler/eurb7.pfb></usr/local/texlive/2023/texmf-dist/fonts/type1/public/amsfonts/symbols/msam10.pfb>
Output written on the-document.pdf (...).
SyncTeX written on the-document.synctex.gz.
Transcript written on the-document.log.
Latexmk: Getting log file 'the-document.log'
Latexmk: Examining 'the-document.fls'
Latexmk: Examining 'the-document.log'
Latexmk: Index file 'the-document.idx' was written
Latexmk: Log file says output to 'the-document.pdf'
Latexmk: All targets () are up-to-date

答案1

消息来自

--- When we are unable to remove a widow/orphan, print a warning
---
--- @return nil
local function remove_widows_fail()
    warning("Widow/Orphan/Broken Hyphen NOT removed on page " .. pagenum)

texmf-dist/tex/luatex/lua-widow-control/lua-widow-control.lua

因此,它是声明内部的本地定义函数调用 ( warning) local。因此,根据设计,您无法从外部对其进行修补。

但是,您可以将该文件复制到当前目录(或路径中的任何位置),然后在第 242 行左右看到

        warning = function(str) luatexbase.module_warning(lwc.name, str) end
        info = function(str) luatexbase.module_info(lwc.name, str) end

如果你改为,_warning那么_info就会warning()info()只写入日志

相关内容