texlive[69403] Master/texmf-dist: lua-typo (12jan24)
commits+karl at tug.org
commits+karl at tug.org
Fri Jan 12 22:44:09 CET 2024
Revision: 69403
https://tug.org/svn/texlive?view=revision&revision=69403
Author: karl
Date: 2024-01-12 22:44:09 +0100 (Fri, 12 Jan 2024)
Log Message:
-----------
lua-typo (12jan24)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/lualatex/lua-typo/README.md
trunk/Master/texmf-dist/doc/lualatex/lua-typo/lua-typo-demo.pdf
trunk/Master/texmf-dist/doc/lualatex/lua-typo/lua-typo-fr.pdf
trunk/Master/texmf-dist/doc/lualatex/lua-typo/lua-typo.pdf
trunk/Master/texmf-dist/source/lualatex/lua-typo/lua-typo.dtx
trunk/Master/texmf-dist/tex/lualatex/lua-typo/lua-typo.cfg
trunk/Master/texmf-dist/tex/lualatex/lua-typo/lua-typo.sty
Modified: trunk/Master/texmf-dist/doc/lualatex/lua-typo/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/lualatex/lua-typo/README.md 2024-01-12 21:43:53 UTC (rev 69402)
+++ trunk/Master/texmf-dist/doc/lualatex/lua-typo/README.md 2024-01-12 21:44:09 UTC (rev 69403)
@@ -80,31 +80,35 @@
- debugging stuff added.
* v.0.61:
- - bug fixes and documentation enhanced.
+ - bug fixes and documentation enhanced;
- colours `mygrey` and `myred` renamed as `LTgrey` and `LTred`.
* v.0.65:
- new option `ShortFinalWord` to detect short end-of-sentence word
- on top of next page.
+ on top of next page;
- code cleaning.
* v.0.70:
- - Options handled via `ltkeys` instead of `kvoptions`.
+ - options handled via `ltkeys` instead of `kvoptions`;
- Code cleaning, bug fixes.
* v.0.80:
- - Config file `lua-typo.cfg` changed (new colours added, all colour
- numbers are shifted by 1).
- - Colours no longer override each other, a special colour has been
- added for lines affected by multiple flaws (f.i. widow+overfull).
- - Bug fix (file `.typo`): in footnotes, line numbers for homeoarchy
+ - config file `lua-typo.cfg` changed (new colours added, all colour
+ numbers are shifted by 1);
+ - colours no longer override each other, a special colour has been
+ added for lines affected by multiple flaws (f.i. widow+overfull);
+ - bug fix (file `.typo`): in footnotes, line numbers for homeoarchy
were not reset.
* v.0.85:
- - A warning is issued if some pages fail to be checked properly.
- - Margin notes checking added (over/underfull lines, position).
- - Code cleaning, bug fixes.
+ - a warning is issued if some pages fail to be checked properly;
+ - margin notes checking added (over/underfull lines, position);
+ - code cleaning, bug fixes.
+
+* v.0.86:
+ - corrected typo in the `signature` function;
+ - compatibility with package `stfloats` added.
--
-Copyright 2020--2023 Daniel Flipo
+Copyright 2020--2024 Daniel Flipo
E-mail: daniel (dot) flipo (at) free (dot) fr
Modified: trunk/Master/texmf-dist/doc/lualatex/lua-typo/lua-typo-demo.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/lualatex/lua-typo/lua-typo-fr.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/lualatex/lua-typo/lua-typo.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/source/lualatex/lua-typo/lua-typo.dtx
===================================================================
--- trunk/Master/texmf-dist/source/lualatex/lua-typo/lua-typo.dtx 2024-01-12 21:43:53 UTC (rev 69402)
+++ trunk/Master/texmf-dist/source/lualatex/lua-typo/lua-typo.dtx 2024-01-12 21:44:09 UTC (rev 69403)
@@ -12,7 +12,7 @@
%
% Lua-Typo package for LaTeX version 2e
%
-% Copyright © 2020-2023 by Daniel Flipo
+% Copyright © 2020-2024 by Daniel Flipo
%
% Please report errors to: daniel (dot) flipo (at) free (dot) fr
%
@@ -166,11 +166,15 @@
% ne va pas provoquer d’autres désordres bien plus graves.\\
% b) Inversement, il n’est pas exclu que \pkg{lua-typo} comporte
% des bogues l’empêchant de détecter des lignes potentiellement
-% imparfaites.
+% imparfaites. Depuis la version~0.85, le fichier \file{.typo}
+% fournit, s’il y a lieu, une liste de pages « suspectes », celles où
+% aucune ligne de texte n’a été trouvée. L’avertissement peut être
+% anodin (page contenant uniquement des illustrations par exemple) ou
+% révéler un défaut de détection.
%
% \pkg{lua-typo} est largement configurable et devrait pouvoir
-% s’adapter aux exigences variables des auteurs ou correcteurs : voir
-% ci-dessous la liste des options et le fichier de configuration
+% s’adapter aux exigences variables des auteurs ou correcteurs :
+% voir ci-dessous la liste des options et le fichier de configuration
% \file{lua-typo.cfg}.
%
% \pkg{lua-typo} ne corrigeant aucun des « défauts » relevés, quels
@@ -489,7 +493,10 @@
% Moreover, correcting a potential issue somewhere may result in
% other much more serious flaws somewhere else …\\
% b) Conversely, possible bugs in \pkg{lua-typo} might hide issues
-% that should normally be highlighted.
+% that should normally be highlighted. Starting with version~0.85,
+% the \file{<jobname>.typo} file lists, if any, the pages on which
+% no text line could be found. The warning may be irrelevant (page
+% only composed of figures) or point out a possible bug.
%
% \pkg{lua-typo} is highly configurable in order to meet the
% variable expectations of authors and correctors: see the options’
@@ -579,12 +586,12 @@
% please note that \opt{All} has to be the first one, as options are
% taken into account as they are read \emph{i.e.} from left to right.
%
+% \newpage
% The list of all available options is printed to the \file{.log}
% file when option \opt{ShowOptions} is passed to \pkg{lua-typo},
% this option provides an easy way to get their names without having
% to look into the documentation.
%
-% \newpage
% With option \opt{None}, \pkg{lua-typo} \emph{does absolutely
% nothing}, all checks are disabled as the main function is not added
% to any LuaTeX callback. It not quite equivalent to commenting out
@@ -745,7 +752,7 @@
%<+scan>\ProvidesPackage{scan-page}
%<+dtx>\ProvidesFile{lua-typo.dtx}
%<*dtx|sty|scan>
- [2023-09-13 v.0.85 Daniel Flipo]
+ [2024-01-12 v.0.86 Daniel Flipo]
%</dtx|sty|scan>
%<*sty>
% \fi
@@ -1426,6 +1433,8 @@
% \changes{v0.65}{2023/03/02}{All ligatures are now split using the
% node’s `components’ field rather than a table.}
%
+% \changes{v0.86}{2024/01/10}{Typo corrected in the signature function.}
+%
% The first function adds a (non-nil) node to a signature of type
% string, nil nodes are ignored.
% It returns the augmented string and its length
@@ -1469,7 +1478,7 @@
local c2 = ""
if pre and pre.char then
if pre.components then
- for nn in traverse_id(GLYPH, post.components) do
+ for nn in traverse_id(GLYPH, pre.components) do
c1 = c1 .. utf8.char(nn.char)
end
else
@@ -2174,11 +2183,14 @@
% \changes{v0.50}{2021/05/02}{New function `get\_pagebody’ required for
% callback `pre\_shipout\_filter’.}
%
+% \changes{v0.86}{2024/01/10}{Package `stfloats’ adds 1sp to the
+% external \cs{vbox}. Be less picky regarding height test.}
+%
% \begin{macrocode}
local get_pagebody = function (head)
local textht = tex.getdimen("textheight")
local fn = head.list
- local body = nil
+ local body
repeat
fn = fn.next
until fn.id == VLIST and fn.height > 0
@@ -2189,9 +2201,17 @@
%<dbg> texio.write(' ht=' .. ht .. ' dp=' .. dp)
first = fn.list
for n in traverse_id(VLIST,first) do
- if n.subtype == 0 and n.height == textht then
+% \end{macrocode}
+% Package `stfloats’ seems to add 1sp to the external \cs{vbox}
+% for each float found on the page.
+% Add $\pm8$sp tolerance when comparing |n.height| to
+% |\textheight|.
+% \begin{macrocode}
+ if n.subtype == 0 and n.height >= textht-1 and
+ n.height <= textht+8 then
%<dbg> local ht = string.format("%.1fpt", n.height/65536)
%<dbg> texio.write_nl('BODY found: ht=' .. ht)
+%<dbg> texio.write_nl(', ' .. n.height .. 'sp')
%<dbg> texio.write_nl(' ')
body = n
break
@@ -2199,13 +2219,17 @@
%<dbg> texio.write_nl('Skip short VLIST:')
%<dbg> local ht = string.format("%.1fpt", n.height/65536)
%<dbg> local dp = string.format("%.1fpt", n.depth/65536)
-%<dbg> texio.write(' ht=' .. ht .. ' dp=' .. dp)
- first = n.list
- for n in traverse_id(VLIST,first) do
- if n.subtype == 0 and n.height == textht then
-%<dbg> local ht = string.format("%.1fpt", n.height/65536)
-%<dbg> texio.write_nl(' BODY: ht=' .. ht)
- body = n
+%<dbg> texio.write('ht=' .. ht .. ', ' .. n.height .. 'sp')
+%<dbg> texio.write('; dp=' .. dp)
+ local ff = n.list
+ for nn in traverse_id(VLIST,ff) do
+%<dbg> ht = string.format("%.1fpt", nn.height/65536)
+%<dbg> texio.write_nl(' VLIST: ht=' .. ht)
+%<dbg> texio.write(', ' .. nn.height .. 'sp')
+ if nn.subtype == 0 and nn.height >= textht-1 and
+ nn.height <= textht+8 then
+%<dbg> texio.write(' got BODY!')
+ body = nn
break
end
end
@@ -2697,7 +2721,7 @@
% \begin{macrocode}
page_bottom, body_bottom = check_EOP (nextnode)
% \end{macrocode}
-% Let’s check for an ``Overfull box’’. For a displayed equation
+% Let’s check for an `Overfull box’. For a displayed equation
% it is straightforward. A set of aligned equations all have the
% same (maximal) width; in order to avoid highlighting the whole
% set, we have to look for glues at the end of embedded
@@ -2855,22 +2879,25 @@
%
% \begin{macrocode}
luatypo.check_page = function (head)
- local textwd = tex.getdimen("textwidth")
- local textht = tex.getdimen("textheight")
- local checked, boxed, n2, n3, col, colno
+ local pageno = tex.getcount("c at page")
local body = get_pagebody(head)
- local pageno = tex.getcount("c at page")
+ local textwd, textht, checked, boxed
+ local top, first, next
+ local n2, n3, col, colno
local vpos = 0
local footnote = false
- local top = body
- local first = body.list
- local next
local count = 0
-%<dbg> texio.write_nl('Body=' .. tostring(node.type(top.id)))
-%<dbg> texio.write('-' .. tostring(top.subtype))
-%<dbg> texio.write('; First=' .. tostring(node.type(first.id)))
-%<dbg> texio.write('-' .. tostring(first.subtype))
-%<dbg> texio.write_nl(' ')
+ if body then
+ top = body
+ first = body.list
+ textwd = tex.getdimen("textwidth")
+ textht = tex.getdimen("textheight")
+%<dbg> texio.write_nl('Body=' .. tostring(node.type(top.id)))
+%<dbg> texio.write('-' .. tostring(top.subtype))
+%<dbg> texio.write('; First=' .. tostring(node.type(first.id)))
+%<dbg> texio.write('-' .. tostring(first.subtype))
+%<dbg> texio.write_nl(' ')
+ end
if ((first and first.id == HLIST and first.subtype == BOX) or
(first and first.id == VLIST and first.subtype == 0)) and
(first.width == textwd and first.height > 0 and not boxed) then
@@ -2880,12 +2907,13 @@
% \begin{macrocode}
%<dbg> local boxwd = string.format("%.1fpt", first.width/65536)
%<dbg> texio.write_nl('One step down: boxwd=' .. boxwd)
+%<dbg> texio.write_nl('Glue order=' .. tostring(first.glue_order))
%<dbg> texio.write_nl(' ')
top = body.list
% \end{macrocode}
% A float on top of a page is a VLIST-0 included in a VLIST-0 (body),
% it should not trigger this step down. Workaround: the body will be
-% read again.
+% scanned again.
% \begin{macrocode}
if first.id == VLIST then
boxed = body
@@ -3131,8 +3159,9 @@
%% Language specific settings (example for French):
%% short words (two letters max) to be avoided at end of lines.
-%%\luatypoOneChar{french}{"À Ô Y"}
-%%\luatypoTwoChars{french}{"Je Tu Il On Au De"}
+%%\luatypoOneChar{french}{"A À Ô Y"}
+%%\luatypoTwoChars{french}{"Ah Au Ça Çà Ce De Il Je La Là Le Ma Me Ne Ni
+%% Oh On Or Ou Où Sa Se Si Ta Tu Va Vu"}
% \end{macrocode}
%
% \iffalse
@@ -3258,7 +3287,7 @@
local get_pagebody = function (head)
local textht = tex.getdimen("textheight")
local fn = head.list
- local body = nil
+ local body
repeat
fn = fn.next
until fn.id == VLIST and fn.height > 0
@@ -3267,9 +3296,11 @@
local dp = string.format("%.1fpt", fn.depth/65536)
texio.write_nl("SKIP vlist: ht=" .. ht .. " dp=" .. dp)
for n in traverse_id(VLIST,first) do
- if n.subtype == 0 and n.height == textht then
+ if n.subtype == 0 and n.height >= textht-1 and
+ n.height <= textht+8 then
local ht = string.format("%.1fpt", n.height/65536)
- texio.write_nl(' BODY: ' .. ht)
+ texio.write_nl(' BODY found: ' .. ht)
+ texio.write(', ' .. n.height .. 'sp')
texio.write_nl(' ')
body = n
break
@@ -3277,13 +3308,15 @@
local ht = string.format("%.1fpt", n.height/65536)
local dp = string.format("%.1fpt", n.depth/65536)
texio.write_nl(' SKIP vlist: ht=' .. ht .. ' dp=' .. dp)
- first = n.list
- for n in traverse_id(VLIST,first) do
- if n.subtype == 0 and n.height == textht then
- ht = string.format("%.1fpt", n.height/65536)
+ local ff = n.list
+ for nn in traverse_id(VLIST,ff) do
+ if nn.subtype == 0 and nn.height >= textht-1 and
+ nn.height <= textht+8 then
+ ht = string.format("%.1fpt", nn.height/65536)
texio.write_nl(' BODY: ' .. ht)
+ texio.write(', ' .. nn.height .. 'sp')
texio.write_nl(' ')
- body = n
+ body = nn
break
end
end
@@ -3360,6 +3393,12 @@
texio.write(tostring(node.type(body.id)))
texio.write('-')
texio.write(tostring(body.subtype))
+ else
+ texio.write_nl('Function get_pagebody returned NIL!')
+ texio.write_nl('=> Scanning whole page: node type ')
+ texio.write(tostring(node.type(head.id)))
+ texio.write('-')
+ texio.write(tostring(head.subtype))
end
while head do
texio.write_nl(tostring(node.type(head.id)))
Modified: trunk/Master/texmf-dist/tex/lualatex/lua-typo/lua-typo.cfg
===================================================================
--- trunk/Master/texmf-dist/tex/lualatex/lua-typo/lua-typo.cfg 2024-01-12 21:43:53 UTC (rev 69402)
+++ trunk/Master/texmf-dist/tex/lualatex/lua-typo/lua-typo.cfg 2024-01-12 21:44:09 UTC (rev 69403)
@@ -55,8 +55,9 @@
%% Language specific settings (example for French):
%% short words (two letters max) to be avoided at end of lines.
-%%\luatypoOneChar{french}{"À Ô Y"}
-%%\luatypoTwoChars{french}{"Je Tu Il On Au De"}
+%%\luatypoOneChar{french}{"A À Ô Y"}
+%%\luatypoTwoChars{french}{"Ah Au Ça Çà Ce De Il Je La Là Le Ma Me Ne Ni
+%% Oh On Or Ou Où Sa Se Si Ta Tu Va Vu"}
%%
%%
%% End of file `lua-typo.cfg'.
Modified: trunk/Master/texmf-dist/tex/lualatex/lua-typo/lua-typo.sty
===================================================================
--- trunk/Master/texmf-dist/tex/lualatex/lua-typo/lua-typo.sty 2024-01-12 21:43:53 UTC (rev 69402)
+++ trunk/Master/texmf-dist/tex/lualatex/lua-typo/lua-typo.sty 2024-01-12 21:44:09 UTC (rev 69403)
@@ -11,7 +11,7 @@
%%
\NeedsTeXFormat{LaTeX2e}[2021/06/01]
\ProvidesPackage{lua-typo}
- [2023-09-13 v.0.85 Daniel Flipo]
+ [2024-01-12 v.0.86 Daniel Flipo]
\DeclareRelease{v0.4}{2021-01-01}{lua-typo-2021-04-18.sty}
\DeclareRelease{v0.65}{2023-03-08}{lua-typo-2023-03-08.sty}
\DeclareCurrentRelease{}{2023-09-13}
@@ -506,7 +506,7 @@
local c2 = ""
if pre and pre.char then
if pre.components then
- for nn in traverse_id(GLYPH, post.components) do
+ for nn in traverse_id(GLYPH, pre.components) do
c1 = c1 .. utf8.char(nn.char)
end
else
@@ -990,20 +990,22 @@
local get_pagebody = function (head)
local textht = tex.getdimen("textheight")
local fn = head.list
- local body = nil
+ local body
repeat
fn = fn.next
until fn.id == VLIST and fn.height > 0
first = fn.list
for n in traverse_id(VLIST,first) do
- if n.subtype == 0 and n.height == textht then
+ if n.subtype == 0 and n.height >= textht-1 and
+ n.height <= textht+8 then
body = n
break
else
- first = n.list
- for n in traverse_id(VLIST,first) do
- if n.subtype == 0 and n.height == textht then
- body = n
+ local ff = n.list
+ for nn in traverse_id(VLIST,ff) do
+ if nn.subtype == 0 and nn.height >= textht-1 and
+ nn.height <= textht+8 then
+ body = nn
break
end
end
@@ -1396,17 +1398,20 @@
return head, done
end
luatypo.check_page = function (head)
- local textwd = tex.getdimen("textwidth")
- local textht = tex.getdimen("textheight")
- local checked, boxed, n2, n3, col, colno
+ local pageno = tex.getcount("c at page")
local body = get_pagebody(head)
- local pageno = tex.getcount("c at page")
+ local textwd, textht, checked, boxed
+ local top, first, next
+ local n2, n3, col, colno
local vpos = 0
local footnote = false
- local top = body
- local first = body.list
- local next
local count = 0
+ if body then
+ top = body
+ first = body.list
+ textwd = tex.getdimen("textwidth")
+ textht = tex.getdimen("textheight")
+ end
if ((first and first.id == HLIST and first.subtype == BOX) or
(first and first.id == VLIST and first.subtype == 0)) and
(first.width == textwd and first.height > 0 and not boxed) then
More information about the tex-live-commits
mailing list.