summaryrefslogtreecommitdiff
path: root/macros
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2021-07-15 03:01:01 +0000
committerNorbert Preining <norbert@preining.info>2021-07-15 03:01:01 +0000
commit55ae461252a599d6bc951065a37c16a8971fc560 (patch)
tree1b73269f29ae053c3fa9f00a365b009569df721a /macros
parent3303a89b11161d66ec78811056b85306f696cc09 (diff)
CTAN sync 202107150300
Diffstat (limited to 'macros')
-rw-r--r--macros/generic/texdimens/README.md192
-rw-r--r--macros/generic/texdimens/texdimens.sty2
-rw-r--r--macros/generic/texdimens/texdimens.tex340
-rw-r--r--macros/latex/contrib/biblatex-contrib/biblatex-philosophy/biblatex-philosophy.dtx67
-rw-r--r--macros/latex/contrib/biblatex-contrib/biblatex-philosophy/biblatex-philosophy.pdfbin539759 -> 544676 bytes
-rw-r--r--macros/latex/contrib/easybook/README.md4
-rw-r--r--macros/latex/contrib/easybook/easybook.dtx306
-rw-r--r--macros/latex/contrib/easybook/easybook.pdfbin568439 -> 571934 bytes
-rw-r--r--macros/latex/contrib/hvfloat/Changes1
-rw-r--r--macros/latex/contrib/hvfloat/doc/hvfloat.pdfbin5722381 -> 5722430 bytes
-rw-r--r--macros/latex/contrib/hvfloat/doc/hvfloat.tex2
-rw-r--r--macros/latex/contrib/hvfloat/latex/hvfloat.sty25
-rw-r--r--macros/latex/contrib/kdpbook/DEPENDS.txt2
-rw-r--r--macros/latex/contrib/kdpbook/README.md9
-rw-r--r--macros/latex/contrib/kdpbook/kdpcover-signature.pdf (renamed from macros/latex/contrib/kdpbook/images/signature.pdf)bin7256 -> 7256 bytes
-rw-r--r--macros/latex/contrib/kdpbook/kdpcover-vol-1.pdf (renamed from macros/latex/contrib/kdpbook/images/volume-1.pdf)bin8540 -> 8540 bytes
-rw-r--r--macros/latex/contrib/kdpbook/kdpcover-vol-2.pdf (renamed from macros/latex/contrib/kdpbook/images/volume-2.pdf)bin6504 -> 6504 bytes
-rw-r--r--macros/latex/contrib/kdpbook/kdpcover-vol-3.pdf (renamed from macros/latex/contrib/kdpbook/images/volume-3.pdf)bin7156 -> 7156 bytes
-rw-r--r--macros/latex/contrib/kdpbook/kdpcover-vol-4.pdf (renamed from macros/latex/contrib/kdpbook/images/volume-4.pdf)bin6723 -> 6723 bytes
-rw-r--r--macros/latex/contrib/kdpbook/kdpcover.cls32
-rw-r--r--macros/latex/contrib/kdpbook/kdpcover.pdfbin104845 -> 103975 bytes
-rw-r--r--macros/latex/contrib/kdpbook/kdpcover.tex4
-rw-r--r--macros/luatex/latex/pyluatex/pyluatex-interpreter.py (renamed from macros/luatex/latex/pyluatex/interpreter.py)0
-rw-r--r--macros/luatex/latex/pyluatex/pyluatex-json.lua (renamed from macros/luatex/latex/pyluatex/json.lua)0
-rw-r--r--macros/luatex/latex/pyluatex/pyluatex.lua4
-rw-r--r--macros/luatex/latex/pyluatex/pyluatex.pdfbin64341 -> 64343 bytes
-rw-r--r--macros/luatex/latex/pyluatex/pyluatex.sty2
-rw-r--r--macros/luatex/latex/pyluatex/pyluatex.tex6
28 files changed, 679 insertions, 319 deletions
diff --git a/macros/generic/texdimens/README.md b/macros/generic/texdimens/README.md
index 54f5a530dc..401dea828f 100644
--- a/macros/generic/texdimens/README.md
+++ b/macros/generic/texdimens/README.md
@@ -13,7 +13,7 @@ Development: https://github.com/jfbu/texdimens
## Aim of this package
Utilities and documentation related to TeX dimensional units, usable
-both with Plain (\input texdimens) and with LaTeX (\usepackage{texdimens}).
+both with Plain (`\input texdimens`) and with LaTeX (`\usepackage{texdimens}`).
The aim of this package is to address the issue of expressing dimensions
(or dimension expressions evaluated by `\dimexpr`) in the various TeX
@@ -25,9 +25,15 @@ in a faithful manner the exact outcome of those internal procedures.
The reader is supposed to be familiar with TeX basics.
This project requires the e-TeX extensions `\dimexpr` and `\numexpr`.
+The notation `<dim. expr.>` in the macro descriptions refers to a
+*dimensional expression* as accepted by `\dimexpr`. The syntax has some
+peculiarities: among them the fact that `-(...)` (for example `-(3pt)`)
+is illegal, one must use alternatives such as `0pt-(...)` or a
+sub-expression `-\dimexpr...\relax` for example.
Notice that this is WIP and inaccuracies may exist even relative to
-descriptions of TeX handlings due to limited time available for the project.
+descriptions of TeX handlings due to limited time available for the
+project.
## TeX points and scaled points
@@ -57,17 +63,16 @@ When `\foo` has been assigned as `D pt`, `\the\foo` will produce some
`E pt` where `E` is not necessarily the same as `D`. But it is guaranteed
that `E pt` defines the same dimension as `D pt̀`.
-
## Further units known to TeX on input
TeX understands on input further units: `bp`, `cm`, `mm`, `in`, `pc`,
-`cc`, `dd` and `nd`. It also understands font-dependent units `ex` and
+`cc`, `nc`, `dd` and `nd`. It also understands font-dependent units `ex` and
`em`, and PDFTeX adds the `px` dimension unit. Japanese engines also
add specific units.
`ex`, `em`, `px` and other engine-dependent units, are all currently
excluded from consideration in this project and the rest of this
-documentation is only for the `bp`, `cm`, `mm`, `in`, `pc`, `cc`, `dd`
+documentation is only for the `bp`, `cm`, `mm`, `in`, `pc`, `cc`, `nc`, `dd`
and `nd` units. When we say "unit" we mean one of those or the `pt` (the
`sp` is a special case and will be included or not tacitly in the "unit"
denomination depending on the case).
@@ -76,7 +81,7 @@ TeX associates to each such unit `uu` a fraction `phi` which is a conversion
factor. It is always `>1`:
uu phi reduced real approximation 1uu in sp= x=[65536phi]/65536 \the<1uu>
- [65536phi] (real approximation)
+ (Python output) [65536phi] (real approximation)
-- ---------- ------- ------------------ --------- -------------------- ----------
bp 7227/7200 803/800 1.00375 65781 1.0037384033203125 1.00374pt
nd 685/642 same 1.0669781931464175 69925 1.0669708251953125 1.06697pt
@@ -116,11 +121,18 @@ to an integer ratio `12`: only dimensions which in scaled points are
multiple of `12` are exactly representable in the `pc` unit.
This also means that some dimensions expressible in one unit may not be
-available with another unit. For example, it turns out that `0.6in` can
-not be expressed as `D cm`, whatever the `D`. More surprisingly perhaps
-is that `1in==2.54cm` is **false** in TeX! But it is true that
-`100in==254cm`! It is also false that `10in==25.4cm` but it is true that
-`10in==254mm`! It is false though that `1in==25.4mm`!
+available with another unit. For example, and perhaps surprisingly,
+there is no decimal `D` which would achieve `1in==Dcm`: the "step"
+between attainable dimensions is `72--73sp` for the `in` and `28--29sp`
+for the `cm`, and as `1in` differs internally from `2.54cm` by only
+`12sp` (see below the `xintsession` verbatim) it is impossible to adjust
+either the `in` side or the `cm` side to obtain equality. See in the
+[TODO] section the closest dimension attainable both via `in` and via
+`cm`.
+
+In particular `1in==2.54cm` is **false** in TeX, but it is true that
+`100in==254cm`... It is also false that `10in==25.4cm` but it is true that
+`10in==254mm`... It is false though that `1in==25.4mm`!
>>> (\dimexpr1in, \dimexpr2.54cm);
@_1 4736286, 4736274
@@ -135,17 +147,22 @@ is that `1in==2.54cm` is **false** in TeX! But it is true that
@_5 47362867, 47362867
`\maxdimen` can be expressed only with `pt`, `bp`, and `nd`. For the
-other units the maximal attainable dimensions are given in this table:
-
- 16322.78954 bp (\maxdimen = 1073741823 sp)
- 15355.51532 nd (\maxdimen = 1073741823 sp)
- 15312.02583 dd (1073741822 sp)
- 5758.31741 mm (1073741822 sp)
- 1365.33333 pc (1073741820 sp)
- 1279.62627 nc (1073741814 sp)
- 1276.00215 cc (1073741821 sp)
- 575.83174 cm (1073741822 sp)
- 226.7054 in (1073741768 sp)
+other units the maximal attainable dimensions in `sp` unit are given in
+the middle column of the next table.
+
+ maximal allowed the corresponding minimal TeX dimen denotation
+ (with 5 places) maximal attainable dim. causing "Dimension too large"
+ --------------- -------------------------- --------------------------
+ 16383.99999 pt 1073741823 sp (=\maxdimen) 16383.99999237060546875 pt
+ 16322.78954 bp 1073741823 sp (=\maxdimen) 16322.78954315185546875 bp
+ 15355.51532 nd 1073741823 sp (=\maxdimen) 15355.51532745361328125 nd
+ 15312.02584 dd 1073741822 sp 15312.02584075927734375 dd
+ 5758.31742 mm 1073741822 sp 5758.31742095947265625 mm
+ 1365.33333 pc 1073741820 sp 1365.33333587646484375 pc
+ 1279.62627 nc 1073741814 sp 1279.62627410888671875 nc
+ 1276.00215 cc 1073741821 sp 1276.00215911865234375 cc
+ 575.83174 cm 1073741822 sp 575.83174896240234375 cm
+ 226.70540 in 1073741768 sp 226.70540618896484375 in
Perhaps for these various peculiarities with dimensional units, TeX does
not provide an output facility for them similar to what `\the` achieves for
@@ -158,29 +175,28 @@ f-expandable, but (perhaps) in future final versions will expand fully
in two steps. This refinement is anyhow not really important as TeX
engines now support the `\expanded` primitive.
-All macros handle negative dimensions via their absolute value then
-taking the opposite.
-
-1. At time of writing only the `\texdimin<uu>` macros are implemented,
-The envisioned "down" and "up" variants are not done yet.
-
-2. For `dd`, `nc` and `in`, input equal to (or sufficiently close to)
-`\maxdimen` will produce also with `\texdimin<uu>` an output `D`
-representing the next "attainable" dimension above `\maxdimen` hence
-using `Duu` will trigger "Dimension too large error".
-
-3. (not yet) For input equal to (or sufficiently close to) `\maxdimen` and those
-units `uu` for which `\maxdimen` is not exactly representable, i.e. all
-units except `pt`, `bp` and `nd`, the output `D` of the "up" variants
-`\texdimin<uu>u` if used as `Duu` in a dimension assignment or
-expression will (naturally) trigger "Dimension too large" error.
-
-4. (not yet) For some units the "down" and "up" macros may trigger "Dimension too
-large" during their execution if used with an input too close to
-`\maxdimen`. "Safe" variants which are guaranteed never to trigger this
-error but have some extra overhead to filter out inputs too close to
-`\maxdimen` will *perhaps* be provided. But see 2. and 3. regarding the
-usability of the output anyhow.
+Negative dimensions behave as if replaced by their absolute value, then
+at last step the sign (if result is not zero) is applied.
+
+1. For input `X` equal to (or sufficiently close to)
+`\maxdimen` and those units `uu` for which `\maxdimen` is not exactly
+representable (i.e. all units except `pt`, `bp` and `nd`), the output `D`
+of the "up" macros `\texdimin<uu>up{X}`, if used as `Duu` in a dimension
+assignment or expression, will (naturally) trigger a "Dimension too large"
+error.
+
+2. For `dd`, `nc` and `in`, and input `X` equal to (or sufficiently
+close to) `\maxdimen` it turns out that `\texdimin<uu>{X}` produces an
+output `D` such that `Duu` is the first "virtually attainable" TeX
+dimension *beyond* `\maxdimen`. Hence `Duu` will trigger on use
+"Dimension too large error".
+
+3. For some units the "down" and "up" macros may trigger
+"Dimension too large" during their execution if used with an input too
+close to `\maxdimen`. "Safe" variants which are guaranteed never to
+trigger this error but have some extra overhead to filter out inputs too
+close to `\maxdimen` will *perhaps* be provided. But
+see 1. and 2. regarding the usability of the output anyhow.
`\texdiminpt{<dim. expr.>}`
@@ -195,19 +211,19 @@ usability of the output anyhow.
> `\maxdimen` on input produces `16322.78954` and indeed is realized as `16322.78954bp`.
-`\texdiminbpd{<dim. expr.>}` NOT YET
+`\texdiminbpdown{<dim. expr.>}`
> Produces a decimal (with up to five decimal places) `D` such that `D
> bp` represents the dimension exactly if possible. If not possible it
> will be smaller by `1sp` from the original dimension.
-`\texdiminbpu{<dim. expr.>}` NOT YET
+`\texdiminbpup{<dim. expr.>}`
> Produces a decimal (with up to five decimal places) `D` such that `D
> bp` represents the dimension exactly if possible. If not possible it
> will be larger by `1sp` from the original dimension.
-`\texdiminnd{<dim. expr.>}`
+`\texdiminndown{<dim. expr.>}`
> Produces a decimal (with up to five decimal places) `D` such that `D
> nd` represents the dimension exactly if possible. If not possible it
@@ -216,19 +232,19 @@ usability of the output anyhow.
> `\maxdimen` on input produces `15355.51532` and indeed is realized as `15355.51532nd`.
-`\texdiminndd{<dim. expr.>}` NOT YET
+`\texdiminnddown{<dim. expr.>}`
> Produces a decimal (with up to five decimal places) `D` such that `D
> nd` represents the dimension exactly if possible. If not possible it
> will be smaller by `1sp` from the original dimension.
-`\texdiminndu{<dim. expr.>}` NOT YET
+`\texdiminndup{<dim. expr.>}`
> Produces a decimal (with up to five decimal places) `D` such that `D
> nd` represents the dimension exactly if possible. If not possible it
> will be larger by `1sp` from the original dimension.
-`\texdimindd{<dim. expr.>}`
+`\texdiminddown{<dim. expr.>}`
> Produces a decimal (with up to five decimal places) `D` such that `D
> dd` represents the dimension exactly if possible. If not possible it
@@ -237,15 +253,15 @@ usability of the output anyhow.
> Warning: the output for `\maxdimen` is `15312.02585` but `15312.02585dd`
> will trigger "Dimension too large" error.
-> `\maxdimen-1sp` is atteignable via `15312.02583dd`.
+> `\maxdimen-1sp` is attainable via `15312.02584dd`.
-`\texdiminddd{<dim. expr.>}` NOT YET
+`\texdimindddown{<dim. expr.>}`
> Produces a decimal (with up to five decimal places) `D` such that `D
> dd` represents the dimension exactly if possible. If not possible it
> will be smaller by `1sp` from the original dimension.
-`\texdiminddu{<dim. expr.>}` NOT YET
+`\texdiminddup{<dim. expr.>}`
> Produces a decimal (with up to five decimal places) `D` such that `D
> dd` represents the dimension exactly if possible. If not possible it
@@ -262,13 +278,13 @@ usability of the output anyhow.
> `\maxdimen` as input produces on output `5758.31741` and indeed the
> maximal attainable dimension is `5758.31741mm` (`1073741822sp`).
-`\texdiminmmd{<dim. expr.>}` NOT YET
+`\texdiminmmdown{<dim. expr.>}`
> Produces a decimal (with up to five decimal places) `D` such that `D
> mm` represents the dimension exactly if possible. If not possible it
> will be largest representable dimension smaller than the original one.
-`\texdiminmmu{<dim. expr.>}` NOT YET
+`\texdiminmmup{<dim. expr.>}`
> Produces a decimal (with up to five decimal places) `D` such that `D
> mm` represents the dimension exactly if possible. If not possible it
@@ -284,13 +300,13 @@ usability of the output anyhow.
> `\maxdimen` as input produces on output `1365.33333` and indeed the
> maximal attainable dimension is `1365.33333pc` (`1073741820sp`).
-`\texdiminpcd{<dim. expr.>}` NOT YET
+`\texdiminpcdown{<dim. expr.>}`
> Produces a decimal (with up to five decimal places) `D` such that `D
> pc` represents the dimension exactly if possible. If not possible it
> will be largest representable dimension smaller than the original one.
-`\texdiminpcu{<dim. expr.>}` NOT YET
+`\texdiminpcup{<dim. expr.>}`
> Produces a decimal (with up to five decimal places) `D` such that `D
> pc` represents the dimension exactly if possible. If not possible it
@@ -308,13 +324,13 @@ usability of the output anyhow.
> will trigger "Dimension too large" error.
> `\maxdimen-9sp` is attainable via `1279.62627nc`.
-`\texdiminncd{<dim. expr.>}` NOT YET
+`\texdiminncdown{<dim. expr.>}`
> Produces a decimal (with up to five decimal places) `D` such that `D
> nc` represents the dimension exactly if possible. If not possible it
> will be largest representable dimension smaller than the original one.
-`\texdiminncu{<dim. expr.>}` NOT YET
+`\texdiminncup{<dim. expr.>}`
> Produces a decimal (with up to five decimal places) `D` such that `D
> nc` represents the dimension exactly if possible. If not possible it
@@ -325,19 +341,19 @@ usability of the output anyhow.
> Produces a decimal (with up to five decimal places) `D` such that `D
> cc` represents the dimension exactly if possible. If not possible it
> will either be the closest from below or from above, but it is not
-> known in advacce which one (and it is not known if the other choice
+> known in advance which one (and it is not known if the other choice
> would have been closer).
> `\maxdimen` as input produces on output `1276.00215` and indeed the
> maximal attainable dimension is `1276.00215cc` (`1073741821sp`).
-`\texdiminccd{<dim. expr.>}` NOT YET
+`\texdiminccdown{<dim. expr.>}`
> Produces a decimal (with up to five decimal places) `D` such that `D
> cc` represents the dimension exactly if possible. If not possible it
> will be largest representable dimension smaller than the original one.
-`\texdiminccu{<dim. expr.>}` NOT YET
+`\texdiminccup{<dim. expr.>}`
> Produces a decimal (with up to five decimal places) `D` such that `D
> cc` represents the dimension exactly if possible. If not possible it
@@ -354,13 +370,13 @@ usability of the output anyhow.
> `\maxdimen` as input produces on output `575.83174` and indeed the
> maximal attainable dimension is `575.83174cm` (`1073741822sp`).
-`\texdimincmd{<dim. expr.>}` NOT YET
+`\texdimincmdown{<dim. expr.>}`
> Produces a decimal (with up to five decimal places) `D` such that `D
> cm` represents the dimension exactly if possible. If not possible it
> will be largest representable dimension smaller than the original one.
-`\texdimincmu{<dim. expr.>}` NOT YET
+`\texdimincmup{<dim. expr.>}`
> Produces a decimal (with up to five decimal places) `D` such that `D
> cm` represents the dimension exactly if possible. If not possible it
@@ -378,31 +394,57 @@ usability of the output anyhow.
> will trigger "Dimension too large" error.
> `\maxdimen-55sp` is maximal attainable dimension (via `226.7054in`).
-`\texdiminind{<dim. expr.>}` NOT YET
+`\texdiminindown{<dim. expr.>}`
> Produces a decimal (with up to five decimal places) `D` such that `D
> in` represents the dimension exactly if possible. If not possible it
> will be largest representable dimension smaller than the original one.
-`\texdimininu{<dim. expr.>}` NOT YET
+`\texdimininup{<dim. expr.>}`
> Produces a decimal (with up to five decimal places) `D` such that `D
> in` represents the dimension exactly if possible. If not possible it
> will be smallest representable dimension larger than the original one.
-
## TODO
-Implement the "up" and "down" variants.
+Currently (most) macros require exhaustive expansion.
+
+Provide a macro `\texdimnearest{in,cm}{<dim.expr.>}` which would output
+the nearest dimension simultaneously representable both in `in` and in
+`cm`?
-Provide a macro `\texdimnearest{in,cm}{<dim.expr.>}` which provides the
-nearest dimension simultaneously representable both in `in` and in `cm`?
According to a reference on the web by an anonymous contributor the
-available positive dimensions in scaled points have the shape
-`floor(3613.5*k) sp` for some integer `k`. So we basically may have a
+dimensions representable with both `in` and `cm` units have the shape
+`trunc(3613.5*k) sp` for some integer `k`. So we basically may have a
delta up to about `1800sp` which is about `0.0275pt` and is still small
-(less than one hundredth of a millimeter), so perhaps such a utility for
-"safe dimensions" may be useful. Simpler however and more efficient
+(less than one hundredth of a millimeter, i.e. less than ten micron),
+so perhaps such a utility for
+"safe dimensions" may be useful. Here are for example the dimensions
+nearest to `1in` and realizable both in `in` and `cm` units:
+
+ >>> \input texdimens.tex\relax
+ (executing \input texdimens.tex\relax in background)
+ (./texdimens.tex)
+ >>> &exact
+ exact mode (floating point evaluations use 16 digits)
+ >>> (\texdiminin{4737298sp});
+ @_10 1.00021
+ >>> (\texdimincm{4737298sp});
+ @_11 2.54054
+ >>> (\dimexpr1.00021in, \dimexpr2.54054cm);
+ @_12 4737298, 4737298
+ >>> (\texdiminin{4733685sp});
+ @_13 0.99945
+ >>> (\texdimincm{4733685sp});
+ @_14 2.5386
+ >>> (\dimexpr0.99945in, \dimexpr2.5386cm);
+ @_15 4733685, 4733685
+
+As promised, one of them, the upper approximation, is at less than
+one hundredth of millimeter from the two nearby targets.
+
+Simpler however and more efficient
would be for people to finally adopt the French revolution Système
Métrique (rather than setting up giant financial paradises).
diff --git a/macros/generic/texdimens/texdimens.sty b/macros/generic/texdimens/texdimens.sty
index c29f1458e0..9aa422cb55 100644
--- a/macros/generic/texdimens/texdimens.sty
+++ b/macros/generic/texdimens/texdimens.sty
@@ -1,5 +1,5 @@
% This is file texdimens.tex, part of texdimens package, which
% is distributed under the LPPL 1.3c. Copyright (c) 2021 Jean-François Burnol
-\ProvidesPackage{texdimens}[2021/06/30 v0.9beta conversion of TeX dimensions to decimals (JFB)]
+\ProvidesPackage{texdimens}[2021/07/14 v0.9gamma conversion of TeX dimensions to decimals (JFB)]
\@@input texdimens.tex\relax
\endinput \ No newline at end of file
diff --git a/macros/generic/texdimens/texdimens.tex b/macros/generic/texdimens/texdimens.tex
index 471a07f807..7068d57db9 100644
--- a/macros/generic/texdimens/texdimens.tex
+++ b/macros/generic/texdimens/texdimens.tex
@@ -1,101 +1,329 @@
% This is file texdimens.tex, part of texdimens package, which
% is distributed under the LPPL 1.3c. Copyright (c) 2021 Jean-François Burnol
-% 2021/06/30 v0.9beta
+% 2021/07/14 v0.9gamma
\edef\texdimensendinput{\endlinechar\the\endlinechar\catcode`\noexpand _=\the\catcode`\_\relax\noexpand\endinput}%
\endlinechar13\relax%
\catcode`\_=11
% Is T sp attainable from unit "uu"?. Here we suppose T>0.
% phi>1, psi=1/phi, psi<1
-% U(N,phi)=floor(N phi) is strictly increasing
+% U(N,phi)=trunc(N phi) is strictly increasing
% U(N)<= T < U(N+1) iff N = ceil((T+1)psi) - 1
% U(M)< T <= U(M+1) iff M = ceil(T psi) - 1
% Either:
-% - M = N, i.e. T is not attainable, M=N < T psi < (T+1) psi <= N+1
-% - M = N - 1, i.e. T is attained, T psi <= N < (T+1) psi, T = floor(N phi)
+% case1: M = N, i.e. T is not attainable, M=N < T psi < (T+1) psi <= N+1
+% case2: M = N - 1, i.e. T is attained, T psi <= N < (T+1) psi, T = floor(N phi)
%
-% In the latter case:
-% - as psi<1, |N - (T+0.5) psi| < 0.5, hence N = R := round((T+0.5) psi).
-% Also works for T=0 but T<0 would need -0.5.
+% Let X = round(T psi). And let Y = trunc(X phi).
%
-% - if psi<1/2, then N = round(T psi) is simpler formula which works
-% also for attainable T<0.
+% case1: X can be N or N+1. It will be N+1 iff Y > T.
+% case2: X can be N or N-1. It will be N iff trunc((X+1)phi)>T.
%
-% This R=round((T+0.5) psi) can always be computed via \numexpr because 2T+1
-% will not trigger arithmetic overflow.
+% This is not convenient: if Y <= T it might still be that we are in case 2
+% and we must check then if trunc((X+1) phi) > T or not.
+%
+% If psi < 0.5
+% ------------
+%
+% The situation then simplifies:
+%
+% case1: X can be N or N+1. It will be N+1 iff Y = trunc(X phi) > T.
+% case2: X is necessarily N.
%
-% If Tsp>0 is not attainable, this R can produce either N or N+1 (=M+1).
+% Thus:
+% a) compute X = round(T psi)
+% b) compute Y = trunc(X phi) and test if Y > T. If true, we
+% were in case 1, replace X by X - 1, else we were either
+% in case 1 or case 2, but we can leave X as is.
+% We have thus found N.
%
-% If we try computing ceil(x) via round(x+0.5) (\numexpr rounds up)
-% this means for N, we need round((T+1)psi + 0.5), for example with
-% psi = 100/7227 for "in", this gives round((((T+1)200)+7227)/14454)
-% feasible via \numexpr only for (circa) 100 T less than \maxdimen.
+% The operation Y = trunc(X phi) can be achieved this way:
+% i) use \the\dimexpr to convert X sp into D pt,
+% ii) use \the\numexpr\dimexpr to convert "D uu" into sp.
+% These steps give Y.
%
-% We could rather compute round(T psi) but we don't know if it gives
-% N or N+1. We know it is N if round(T psi)< round((T+1) psi)
-% but if the two are the same we don't know if they are both N or
-% both N+1.
+% This way we find the maximal dimension at most T sp exactly
+% representable in "uu" unit.
%
-% It is slightly less costly to compute X = round(T psi) than R,
-% but if we then realize that X uu < T sp we do not yet know
-% if (X+1) uu = T sp or is > Tsp, except if psi<1/2, because
-% if T sp is attainable then X = round(T psi) is then necessarily N
-% so if X uu < T sp we now that T sp was not attainable.
+% The computations of X and Y can be done independently of sign of T.
+% But the final test has to be changed to Y < T if T < 0 and then
+% one must replace X by X+1. So we must filter sign.
%
-% We decide with some hesitation to not split whether psi<1/2 or
-% psi>1/2. Reverted! Currently following done only for psi>1/2,
-% i.e. bp, nd, dd.
+% If the goal is only to find a decimal D such that "D uu" is
+% exactly T sp in the case this is possible, then things are simpler
+% because from X = round(T psi) we get D such as X sp is same as D pt
+% and "D uu" will work.
+% We don't have to take sign into account for this computation.
+% But if T sp was not atteignable we don't know if this X will give
+% a D such that D uu < T sp or D uu > T sp.
%
-% 1. compute R = round((T+0.5) psi) in \numexpr. This forces
-% to check for negative T because then we would want here (T-0.5)psi
+% If psi > 0.5
+% ------------
%
-% 2. check for the "up" and "down" variants whether R uu is <, =, or > T sp.
-% But we have to choose here what "up" and "down" mean for T<0.
-% Also, computation of R uu
-% may trigger Dimension too large if T sp is not attainable,
-% close to \maxdimen, and \maxdimen itself is not attainable.
+% For example unit "bp" has phi=803/800.
+%
+% It is then not true that if T sp is atteignable, the X = round(T psi)
+% will always work.
+%
+% But it is true that R = round((T + 0.5) psi) will always work.
+% Here we must use -0.5 if T < 0, though.
+%
+% This R=round((T+0.5) psi) can always be computed via \numexpr because 2T+1
+% will not trigger arithmetic overflow.
%
-% For the envisioned "safe versions" we would tabulate first per unit
-% what is Rmax such that Rmax uu <= \maxdimen. Then the "safe" versions
-% would have an extra check of R. But for \texdimeninuuu it will
-% then not be compliant to its definition for inputs close to
-% non-attainable \maxdimen.
+% So this gives an approach to find a D such that "D uu" is exactly
+% T sp when this is possible.
+%
+% If Tsp (positive) is not attainable, this R however can produce
+% either N or N+1.
+%
+% But we can decide what happened by computing Z = trunc(R phi).
+% If and only if Z > T this means R was N+1.
+%
+% It is slightly less costly to compute X = round(T psi) than
+% R = round((T + 0.5) psi),
+% but if we then realize that trunc(X phi) < T we do not yet know
+% if trunc((X+1) phi) = T or is > T.
+%
+% To recapitulate: we have our algorithm for all units to find out
+% maximal dimension exactly atteignable in "uu" unit and at most equal
+% to (positive) T sp.
+%
+% Unfortunately the check that Y (in case psi < 0.5) or Z (in case psi >
+% 0.5) may trigger a Dimension too large error if T sp was near
+% non-atteignable \maxdimen.
+%
+% For additional envisioned "safe versions" we would tabulate first per unit
+% what is the integer Rmax such that trunc(Rmax phi) <= \maxdimen. Then
+% the "safe" versions would have an extra check of X or R before
+% proceeding further. But the "up macros" supposed to give the next
+% dimension above Tsp and exactly atteignable in "uu" unit, if compliant
+% to their description can not avoid "Dimension too large" for inputs
+% close to non-attainable \maxdimen.
%
% After having written the macros we will tabulate what is for each unit
% the maximal attainable dimension.
%
-% Hesitation about whether using simpler round(T psi) approach
-% for units > 2pt and the \texdimin<uu> macros.
+% About the macros such as \texdiminbp whose constraints are:
+% - give a decimal D such that "Duu" = "T sp" for TeX if possible
+% - else give nearest from below or above without knowing
+% which one,
%
-% Testing shows that this would not change output for \maxdimen
-% with "nc" and "in": still N+1 is returned... but it has great
-% advantage to not have to check the sign.
+% there was some hesitation about whether or not using the simpler
+% round(T psi) approach for units > 2pt and the \texdimin<uu> macros.
+% Testing showed that this did not change the output for \maxdimen
+% with the units "nc" and "in": still N+1 is returned...
+%
+% As it has great
+% advantage to not have to check the sign of the input, the
+% "simpler" approach was chosen for those units to which it
+% applies, i.e. the units uu > 2pt (phi>2, psi<1/2), i.e.
+% all units except bp, nd and dd.
+%
+\def\texdimfirstofone#1{#1}%
+% this #2 will be \fi
+\def\texdiminuudown_e#1#2#3#4{#2\expandafter\texdiminpt_\the\dimexpr\numexpr(#1-1)sp\relax}%
+\def\texdiminuuup_e#1#2#3#4{#2\expandafter\texdiminpt_\the\dimexpr\numexpr(#1+1)sp\relax}%
+% this #1 will be \fi
+\def\texdiminuuup_neg#1#2-{#1-#2}%
+%
+% pt
%
-% OK let's do this,
-% especially as I don't know if I will ever implement "up" and "down".
\def\texdiminpt#1{\expandafter\texdiminpt_\the\dimexpr#1\relax}%
{\catcode`p 12\catcode`t 12\csname expandafter\endcsname\gdef\csname texdiminpt_\endcsname#1pt{#1}}%
+%
% bp 7227/7200 = 803/800
-% complications and annoying overhead caused by sign
-% and we don't want to evaluate #1 twice in a \dimexpr; if #1 was
-% restricted to be a dimen register, we would avoid "\the and re-grab" step.
+%
\def\texdiminbp#1{\expandafter\texdiminbp_\the\numexpr\dimexpr#1;}%
\def\texdiminbp_#1#2;{\texdiminpt{\numexpr(2*#1#2+\if-#1-\fi1)*400/803sp}}%
+% \texdiminbpdown: maximal dim exactly expressible in bp and at most equal to input
+\def\texdiminbpdown#1{\expandafter\texdiminbpdown_a\the\numexpr\dimexpr#1;}%
+\def\texdiminbpdown_a#1{\if-#1\texdiminbpdown_neg\fi\texdiminbpdown_b#1}%
+\def\texdiminbpdown_b#1;{\expandafter\texdiminbpdown_c\the\numexpr(2*#1+1)*400/803;#1;}%
+\def\texdiminbpdown_c#1;{\expandafter\texdiminbpdown_d\the\dimexpr#1sp;#1;}%
+{\catcode`P 12\catcode`T 12\lowercase{\gdef\texdiminbpdown_d#1PT};#2;#3;%
+ {\ifdim#1bp>#3sp \texdiminuudown_e{#2}\fi\texdimfirstofone{#1}}%
+}%
+% The problem here is that if close to 0sp, output can be 0.0, and we do not want
+% -0.0 as output. So let's do this somewhat brutally. Anyhow, negative inputs are
+% not our priority. #1 is \fi here:
+\def\texdiminbpdown_neg#1#2-#3;{#1\expandafter\texdiminpt_\the\dimexpr-\texdiminbpdown_b#3;pt\relax}%
+% \texdiminbpup: minimal dim exactly expressible in bp and at least equal to input
+\def\texdiminbpup#1{\expandafter\texdiminbpup_a\the\numexpr\dimexpr#1;}%
+\def\texdiminbpup_a#1{\if-#1\texdiminuuup_neg\fi\texdiminbpup_b#1}%
+\def\texdiminbpup_b#1;{\expandafter\texdiminbpup_c\the\numexpr(2*#1+1)*400/803;#1;}%
+\def\texdiminbpup_c#1;{\expandafter\texdiminbpup_d\the\dimexpr#1sp;#1;}%
+{\catcode`P 12\catcode`T 12\lowercase{\gdef\texdiminbpup_d#1PT};#2;#3;%
+ {\ifdim#1bp<#3sp \texdiminuuup_e{#2}\fi\texdimfirstofone{#1}}%
+}%
+%
% nd 685/642
+%
\def\texdiminnd#1{\expandafter\texdiminnd_\the\numexpr\dimexpr#1;}%
\def\texdiminnd_#1#2;{\texdiminpt{\numexpr(2*#1#2+\if-#1-\fi1)*321/685sp}}%
+% \texdiminnddown: maximal dim exactly expressible in nd and at most equal to input
+\def\texdiminnddown#1{\expandafter\texdiminnddown_a\the\numexpr\dimexpr#1;}%
+\def\texdiminnddown_a#1{\if-#1\texdiminnddown_neg\fi\texdiminnddown_b#1}%
+\def\texdiminnddown_b#1;{\expandafter\texdiminnddown_c\the\numexpr(2*#1+1)*321/685;#1;}%
+\def\texdiminnddown_c#1;{\expandafter\texdiminnddown_d\the\dimexpr#1sp;#1;}%
+{\catcode`P 12\catcode`T 12\lowercase{\gdef\texdiminnddown_d#1PT};#2;#3;%
+ {\ifdim#1nd>#3sp \texdiminuudown_e{#2}\fi\texdimfirstofone{#1}}%
+}%
+\def\texdiminnddown_neg#1#2-#3;{#1\expandafter\texdiminpt_\the\dimexpr-\texdiminnddown_b#3;pt\relax}%
+% \texdiminndup: minimal dim exactly expressible in nd and at least equal to input
+\def\texdiminndup#1{\expandafter\texdiminndup_a\the\numexpr\dimexpr#1;}%
+\def\texdiminndup_a#1{\if-#1\texdiminuuup_neg\fi\texdiminndup_b#1}%
+\def\texdiminndup_b#1;{\expandafter\texdiminndup_c\the\numexpr(2*#1+1)*321/685;#1;}%
+\def\texdiminndup_c#1;{\expandafter\texdiminndup_d\the\dimexpr#1sp;#1;}%
+{\catcode`P 12\catcode`T 12\lowercase{\gdef\texdiminndup_d#1PT};#2;#3;%
+ {\ifdim#1nd<#3sp \texdiminuuup_e{#2}\fi\texdimfirstofone{#1}}%
+}%
+%
% dd 1238/1157
+%
\def\texdimindd#1{\expandafter\texdimindd_\the\numexpr\dimexpr#1;}%
\def\texdimindd_#1#2;{\texdiminpt{\numexpr(2*#1#2+\if-#1-\fi1)*1157/2476sp}}%
+% \texdimindddown: maximal dim exactly expressible in dd and at most equal to input
+\def\texdimindddown#1{\expandafter\texdimindddown_a\the\numexpr\dimexpr#1;}%
+\def\texdimindddown_a#1{\if-#1\texdimindddown_neg\fi\texdimindddown_b#1}%
+\def\texdimindddown_b#1;{\expandafter\texdimindddown_c\the\numexpr(2*#1+1)*1157/2476;#1;}%
+\def\texdimindddown_c#1;{\expandafter\texdimindddown_d\the\dimexpr#1sp;#1;}%
+{\catcode`P 12\catcode`T 12\lowercase{\gdef\texdimindddown_d#1PT};#2;#3;%
+ {\ifdim#1dd>#3sp \texdiminuudown_e{#2}\fi\texdimfirstofone{#1}}%
+}%
+\def\texdimindddown_neg#1#2-#3;{#1\expandafter\texdiminpt_\the\dimexpr-\texdimindddown_b#3;pt\relax}%
+% \texdiminddup: minimal dim exactly expressible in dd and at least equal to input
+\def\texdiminddup#1{\expandafter\texdiminddup_a\the\numexpr\dimexpr#1;}%
+\def\texdiminddup_a#1{\if-#1\texdiminuuup_neg\fi\texdiminddup_b#1}%
+\def\texdiminddup_b#1;{\expandafter\texdiminddup_c\the\numexpr(2*#1+1)*1157/2476;#1;}%
+\def\texdiminddup_c#1;{\expandafter\texdiminddup_d\the\dimexpr#1sp;#1;}%
+{\catcode`P 12\catcode`T 12\lowercase{\gdef\texdiminddup_d#1PT};#2;#3;%
+ {\ifdim#1dd<#3sp \texdiminuuup_e{#2}\fi\texdimfirstofone{#1}}%
+}%
+%
% mm 7227/2540 phi now >2, use from here on the simpler approach
-\def\texdiminmm#1{\texdiminpt{(#1)*2540/7227}}%
+%
+\def\texdiminmm#1{\expandafter\texdiminpt_\the\dimexpr(#1)*2540/7227\relax}%
+% \texdiminmmdown: maximal dim exactly expressible in mm and at most equal to input
+\def\texdiminmmdown#1{\expandafter\texdiminmmdown_a\the\numexpr\dimexpr#1;}%
+\def\texdiminmmdown_a#1{\if-#1\texdiminmmdown_neg\fi\texdiminmmdown_b#1}%
+\def\texdiminmmdown_b#1;{\expandafter\texdiminmmdown_c\the\numexpr#1*2540/7227;#1;}%
+\def\texdiminmmdown_c#1;{\expandafter\texdiminmmdown_d\the\dimexpr#1sp;#1;}%
+{\catcode`P 12\catcode`T 12\lowercase{\gdef\texdiminmmdown_d#1PT};#2;#3;%
+ {\ifdim#1mm>#3sp \texdiminuudown_e{#2}\fi\texdimfirstofone{#1}}%
+}%
+\def\texdiminmmdown_neg#1#2-#3;{#1\expandafter\texdiminpt_\the\dimexpr-\texdiminmmdown_b#3;pt\relax}%
+% \texdiminmmup: minimal dim exactly expressible in mm and at least equal to input
+\def\texdiminmmup#1{\expandafter\texdiminmmup_a\the\numexpr\dimexpr#1;}%
+\def\texdiminmmup_a#1{\if-#1\texdiminuuup_neg\fi\texdiminmmup_b#1}%
+\def\texdiminmmup_b#1;{\expandafter\texdiminmmup_c\the\numexpr#1*2540/7227;#1;}%
+\def\texdiminmmup_c#1;{\expandafter\texdiminmmup_d\the\dimexpr#1sp;#1;}%
+{\catcode`P 12\catcode`T 12\lowercase{\gdef\texdiminmmup_d#1PT};#2;#3;%
+ {\ifdim#1mm<#3sp \texdiminuuup_e{#2}\fi\texdimfirstofone{#1}}%
+}%
+%
% pc 12/1
-\def\texdiminpc#1{\texdiminpt{(#1)/12}}%
+%
+\def\texdiminpc#1{\expandafter\texdiminpt_\the\dimexpr(#1)/12\relax}%
+% \texdiminpcdown: maximal dim exactly expressible in pc and at most equal to input
+\def\texdiminpcdown#1{\expandafter\texdiminpcdown_a\the\numexpr\dimexpr#1;}%
+\def\texdiminpcdown_a#1{\if-#1\texdiminpcdown_neg\fi\texdiminpcdown_b#1}%
+\def\texdiminpcdown_b#1;{\expandafter\texdiminpcdown_c\the\numexpr#1/12;#1;}%
+\def\texdiminpcdown_c#1;{\expandafter\texdiminpcdown_d\the\dimexpr#1sp;#1;}%
+{\catcode`P 12\catcode`T 12\lowercase{\gdef\texdiminpcdown_d#1PT};#2;#3;%
+ {\ifdim#1pc>#3sp \texdiminuudown_e{#2}\fi\texdimfirstofone{#1}}%
+}%
+\def\texdiminpcdown_neg#1#2-#3;{#1\expandafter\texdiminpt_\the\dimexpr-\texdiminpcdown_b#3;pt\relax}%
+% \texdiminpcup: minimal dim exactly expressible in pc and at least equal to input
+\def\texdiminpcup#1{\expandafter\texdiminpcup_a\the\numexpr\dimexpr#1;}%
+\def\texdiminpcup_a#1{\if-#1\texdiminuuup_neg\fi\texdiminpcup_b#1}%
+\def\texdiminpcup_b#1;{\expandafter\texdiminpcup_c\the\numexpr#1/12;#1;}%
+\def\texdiminpcup_c#1;{\expandafter\texdiminpcup_d\the\dimexpr#1sp;#1;}%
+{\catcode`P 12\catcode`T 12\lowercase{\gdef\texdiminpcup_d#1PT};#2;#3;%
+ {\ifdim#1pc<#3sp \texdiminuuup_e{#2}\fi\texdimfirstofone{#1}}%
+}%
+%
% nc 1370/107
-\def\texdiminnc#1{\texdiminpt{(#1)*107/1370}}%
+%
+\def\texdiminnc#1{\expandafter\texdiminpt_\the\dimexpr(#1)*107/1370\relax}%
+% \texdiminncdown: maximal dim exactly expressible in nc and at most equal to input
+\def\texdiminncdown#1{\expandafter\texdiminncdown_a\the\numexpr\dimexpr#1;}%
+\def\texdiminncdown_a#1{\if-#1\texdiminncdown_neg\fi\texdiminncdown_b#1}%
+\def\texdiminncdown_b#1;{\expandafter\texdiminncdown_c\the\numexpr#1*107/1370;#1;}%
+\def\texdiminncdown_c#1;{\expandafter\texdiminncdown_d\the\dimexpr#1sp;#1;}%
+{\catcode`P 12\catcode`T 12\lowercase{\gdef\texdiminncdown_d#1PT};#2;#3;%
+ {\ifdim#1nc>#3sp \texdiminuudown_e{#2}\fi\texdimfirstofone{#1}}%
+}%
+\def\texdiminncdown_neg#1#2-#3;{#1\expandafter\texdiminpt_\the\dimexpr-\texdiminncdown_b#3;pt\relax}%
+% \texdiminncup: minimal dim exactly expressible in nc and at least equal to input
+\def\texdiminncup#1{\expandafter\texdiminncup_a\the\numexpr\dimexpr#1;}%
+\def\texdiminncup_a#1{\if-#1\texdiminuuup_neg\fi\texdiminncup_b#1}%
+\def\texdiminncup_b#1;{\expandafter\texdiminncup_c\the\numexpr#1*107/1370;#1;}%
+\def\texdiminncup_c#1;{\expandafter\texdiminncup_d\the\dimexpr#1sp;#1;}%
+{\catcode`P 12\catcode`T 12\lowercase{\gdef\texdiminncup_d#1PT};#2;#3;%
+ {\ifdim#1nc<#3sp \texdiminuuup_e{#2}\fi\texdimfirstofone{#1}}%
+}%
+%
% cc 14856/1157
-\def\texdimincc#1{\texdiminpt{(#1)*1157/14856}}%
+%
+\def\texdimincc#1{\expandafter\texdiminpt_\the\dimexpr(#1)*1157/14856\relax}%
+% \texdiminccdown: maximal dim exactly expressible in cc and at most equal to input
+\def\texdiminccdown#1{\expandafter\texdiminccdown_a\the\numexpr\dimexpr#1;}%
+\def\texdiminccdown_a#1{\if-#1\texdiminccdown_neg\fi\texdiminccdown_b#1}%
+\def\texdiminccdown_b#1;{\expandafter\texdiminccdown_c\the\numexpr#1*1157/14856;#1;}%
+\def\texdiminccdown_c#1;{\expandafter\texdiminccdown_d\the\dimexpr#1sp;#1;}%
+{\catcode`P 12\catcode`T 12\lowercase{\gdef\texdiminccdown_d#1PT};#2;#3;%
+ {\ifdim#1cc>#3sp \texdiminuudown_e{#2}\fi\texdimfirstofone{#1}}%
+}%
+\def\texdiminccdown_neg#1#2-#3;{#1\expandafter\texdiminpt_\the\dimexpr-\texdiminccdown_b#3;pt\relax}%
+% \texdiminccup: minimal dim exactly expressible in cc and at least equal to input
+\def\texdiminccup#1{\expandafter\texdiminccup_a\the\numexpr\dimexpr#1;}%
+\def\texdiminccup_a#1{\if-#1\texdiminuuup_neg\fi\texdiminccup_b#1}%
+\def\texdiminccup_b#1;{\expandafter\texdiminccup_c\the\numexpr#1*1157/14856;#1;}%
+\def\texdiminccup_c#1;{\expandafter\texdiminccup_d\the\dimexpr#1sp;#1;}%
+{\catcode`P 12\catcode`T 12\lowercase{\gdef\texdiminccup_d#1PT};#2;#3;%
+ {\ifdim#1cc<#3sp \texdiminuuup_e{#2}\fi\texdimfirstofone{#1}}%
+}%
+%
% cm 7227/254
-\def\texdimincm#1{\texdiminpt{(#1)*254/7227}}%
+%
+\def\texdimincm#1{\expandafter\texdiminpt_\the\dimexpr(#1)*254/7227\relax}%
+% \texdimincmdown: maximal dim exactly expressible in cm and at most equal to input
+\def\texdimincmdown#1{\expandafter\texdimincmdown_a\the\numexpr\dimexpr#1;}%
+\def\texdimincmdown_a#1{\if-#1\texdimincmdown_neg\fi\texdimincmdown_b#1}%
+\def\texdimincmdown_b#1;{\expandafter\texdimincmdown_c\the\numexpr#1*254/7227;#1;}%
+\def\texdimincmdown_c#1;{\expandafter\texdimincmdown_d\the\dimexpr#1sp;#1;}%
+{\catcode`P 12\catcode`T 12\lowercase{\gdef\texdimincmdown_d#1PT};#2;#3;%
+ {\ifdim#1cm>#3sp \texdiminuudown_e{#2}\fi\texdimfirstofone{#1}}%
+}%
+\def\texdimincmdown_neg#1#2-#3;{#1\expandafter\texdiminpt_\the\dimexpr-\texdimincmdown_b#3;pt\relax}%
+% \texdimincmup: minimal dim exactly expressible in cm and at least equal to input
+\def\texdimincmup#1{\expandafter\texdimincmup_a\the\numexpr\dimexpr#1;}%
+\def\texdimincmup_a#1{\if-#1\texdiminuuup_neg\fi\texdimincmup_b#1}%
+\def\texdimincmup_b#1;{\expandafter\texdimincmup_c\the\numexpr#1*254/7227;#1;}%
+\def\texdimincmup_c#1;{\expandafter\texdimincmup_d\the\dimexpr#1sp;#1;}%
+{\catcode`P 12\catcode`T 12\lowercase{\gdef\texdimincmup_d#1PT};#2;#3;%
+ {\ifdim#1cm<#3sp \texdiminuuup_e{#2}\fi\texdimfirstofone{#1}}%
+}%
+%
% in 7227/100
-\def\texdiminin#1{\texdiminpt{(#1)*100/7227}}%
+%
+\def\texdiminin#1{\expandafter\texdiminpt_\the\dimexpr(#1)*100/7227\relax}%
+% \texdiminindown: maximal dim exactly expressible in in and at most equal to input
+\def\texdiminindown#1{\expandafter\texdiminindown_a\the\numexpr\dimexpr#1;}%
+\def\texdiminindown_a#1{\if-#1\texdiminindown_neg\fi\texdiminindown_b#1}%
+\def\texdiminindown_b#1;{\expandafter\texdiminindown_c\the\numexpr#1*100/7227;#1;}%
+\def\texdiminindown_c#1;{\expandafter\texdiminindown_d\the\dimexpr#1sp;#1;}%
+{\catcode`P 12\catcode`T 12\lowercase{\gdef\texdiminindown_d#1PT};#2;#3;%
+ {\ifdim#1in>#3sp \texdiminuudown_e{#2}\fi\texdimfirstofone{#1}}%
+}%
+\def\texdiminindown_neg#1#2-#3;{#1\expandafter\texdiminpt_\the\dimexpr-\texdiminindown_b#3;pt\relax}%
+% \texdimininup: minimal dim exactly expressible in in and at least equal to input
+\def\texdimininup#1{\expandafter\texdimininup_a\the\numexpr\dimexpr#1;}%
+\def\texdimininup_a#1{\if-#1\texdiminuuup_neg\fi\texdimininup_b#1}%
+\def\texdimininup_b#1;{\expandafter\texdimininup_c\the\numexpr#1*100/7227;#1;}%
+\def\texdimininup_c#1;{\expandafter\texdimininup_d\the\dimexpr#1sp;#1;}%
+{\catcode`P 12\catcode`T 12\lowercase{\gdef\texdimininup_d#1PT};#2;#3;%
+ {\ifdim#1in<#3sp \texdiminuuup_e{#2}\fi\texdimfirstofone{#1}}%
+}%
+%
\texdimensendinput
diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-philosophy/biblatex-philosophy.dtx b/macros/latex/contrib/biblatex-contrib/biblatex-philosophy/biblatex-philosophy.dtx
index 7b5470b99e..06cf351b3c 100644
--- a/macros/latex/contrib/biblatex-contrib/biblatex-philosophy/biblatex-philosophy.dtx
+++ b/macros/latex/contrib/biblatex-contrib/biblatex-philosophy/biblatex-philosophy.dtx
@@ -84,7 +84,7 @@ This work has the LPPL maintenance status "author-maintained".
%<spanish-lbx>\ProvidesFile{spanish-philosophy.lbx}
%<french-lbx>\ProvidesFile{french-philosophy.lbx}
%<*standard-bbx|classic-bbx|modern-bbx|verbose-bbx|classic-cbx|modern-cbx|verbose-cbx|italian-lbx|english-lbx|spanish-lbx|french-lbx>
-[2021/04/20 v1.9.8d A set of styles for biblatex]
+[2021/07/16 v1.9.8e A set of styles for biblatex]
%</standard-bbx|classic-bbx|modern-bbx|verbose-bbx|classic-cbx|modern-cbx|verbose-cbx|italian-lbx|english-lbx|spanish-lbx|french-lbx>
%<*driver>
\documentclass[12pt]{ltxdoc}
@@ -253,7 +253,7 @@ This work has the LPPL maintenance status "author-maintained".
%</driver>
% \fi
%
-% \CheckSum{4370}
+% \CheckSum{4377}
%
% \CharacterTable
% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
@@ -271,6 +271,7 @@ This work has the LPPL maintenance status "author-maintained".
% Grave accent \` Left brace \{ Vertical bar \|
% Right brace \} Tilde \~}
%
+% \changes{v1.9.8e}{2021/07/16}{New option \opt{iviemph}. Updated documentation.}
% \changes{v1.9.8d}{2021/04/20}{Changed \texttt{crossrefdata} macro. Updated \file{italian-philosophy.lbx}.}
% \changes{v1.9.8c}{2020/09/30}{Maintenance release. Corrected a bug in the related entries. Added \cmd{mkrelatedparens} and \cmd{mkrelatedbrackets}.}
% \changes{v1.9.8b}{2020/05/19}{Maintenance release. Corrected a bug in \bibtype{incollection} and \bibtype{inproceeding} without editor.}
@@ -364,7 +365,7 @@ This work has the LPPL maintenance status "author-maintained".
% on the basis of Sebastian Kosch's Crimson.
% The \texttt{typewriter} font is Inconsolata,
% designed by Raph Levien and the \textsf{sans serif} text
-% is typeset in Linux Biolinum, created by Philipp H.~Pol.
+% is typeset in Linux Biolinum, created by Philipp H.~Poll.
%\end{minipage}
%
% \vfill
@@ -413,7 +414,7 @@ This work has the LPPL maintenance status "author-maintained".
%
%\begin{abstract}
%\noindent This bundle provides a small collection of bibliography and citation styles for use with Philipp Lehman's \sty{biblatex} package. The styles try to be language-indipendent but their prime aim is to match the needs of the Italian writers, particularly those concerned in the humanities. They offer useful features to compose detailed bibliographic entries including the translation data of foreign texts, annotations etc. Many options allow you to change the style defaults. Only the Italian, English, Spanish and French localizations are available for now but you can use the styles with all the languages supported by \sty{babel} or \sty{polyglossia} adding simple redefinitions.
-% \end{abstract}
+%\end{abstract}
%
% ^^A ----------------------------------------------------------------
% ^^A
@@ -489,7 +490,7 @@ This work has the LPPL maintenance status "author-maintained".
%(1986c) \emph{Computers \& Typesetting}, vol. D: \emph{\hologo{METAFONT}: The Program}, Addison-Wesley.
% \item ---
%(1986d) \emph{Computers \& Typesetting}, vol. E: \emph{Computer Modern Typefaces}, Addison-Wesley.
-% \end{bibexamplelist}
+%\end{bibexamplelist}
%
% ^^A ----------------------------------------------------------------
% ^^A
@@ -572,7 +573,7 @@ This work has the LPPL maintenance status "author-maintained".
%\textsuperscript{6} Heidegger, op. cit., p. 35.
%\end{bibexample}
%
-% All the scholarly abbreviations (\emph{latinitates}) but ``cit.'' are printed by default in normal font. With the \opt{latinemph} option you can get them in italic shape (section \ref{sec:options-verbose}).
+% All the scholarly abbreviations but ``cit.'' are printed by default in normal font. With the \opt{latinemph} option you can get them in italic shape (section \ref{sec:options-verbose}).
%
% A \sty{verbose} bibliography is similar to a \sty{classic} bibliography but with the year placed at the end of the entry:
%\begin{bibexamplelist}[frametitle=The \sty{philosophy-verbose} bibliography]
@@ -688,15 +689,16 @@ This work has the LPPL maintenance status "author-maintained".
%
%@incollection{westfahl:flying,
% author = {Daniele Chatelain and George Slusser},
-% title = {Flying to the Moon in French and American Science Fiction},
+% title = {Flying to the Moon in French and American
+% Science Fiction},
% pages = {25-33},
% crossref = {westfahl:frontier}}
%
%@incollection{westfahl:space,
% author = {Westfahl, Gary},
% title = {The True Frontier},
-% subtitle = {Confronting and Avoiding the Realities of Space in {American}
-% Science Fiction Films},
+% subtitle = {Confronting and Avoiding the Realities of Space in
+% {American} Science Fiction Films},
% pages = {55-65},
% crossref = {westfahl:frontier}}
%\end{verbatim}\end{latexcode}
@@ -718,8 +720,8 @@ This work has the LPPL maintenance status "author-maintained".
% title = {Vite matematiche},
% booktitle = {Vite matematiche},
% booksubtitle = {Protagonisti del '900 da Hilbert a Wiles},
-% editor = {Claudio Bartocci and Renato Betti and Angelo Guerraggio and
-% Roberto Lucchetti},
+% editor = {Claudio Bartocci and Renato Betti and Angelo Guerraggio
+% and Roberto Lucchetti},
% publisher = {Springer-Verlag Italia},
% location = {Milano},
% date = {2007}}
@@ -732,8 +734,8 @@ This work has the LPPL maintenance status "author-maintained".
%@incollection{hyman,
% author = {Arthur Hyman},
% editor = {O'Meara, Dominic J.},
-% title = {Aristotle's Theory of the Intellect and its Interpretation by
-% {Averroes}},
+% title = {Aristotle's Theory of the Intellect and its Interpretation
+% by {Averroes}},
% date = {1981},
% booktitle = {Studies in {Aristotle}},
% series = {Studies in Philosophy and the History of Philosophy},
@@ -846,9 +848,9 @@ This work has the LPPL maintenance status "author-maintained".
% publisher = {Max Niemeyer Verlag},
% location = {Tübingen},
% date = {2001},
-% library = {Originally published in 1927 in the \emph{Jahrbuch
-% für Philosophie und phänomenologische Forschung (vol. VIII)},
-% directed by H. Husserl}}
+% library = {Originally published in 1927 in the \emph{Jahrbuch für
+% Philosophie und phänomenologische Forschung (vol. VIII)},
+% directed by H. Husserl}}
%\end{verbatim}\end{latexcode}
%
%\fielditem{annotation}{literal}
@@ -861,8 +863,7 @@ This work has the LPPL maintenance status "author-maintained".
% reimplementation of the bibliographic facilities provided
% by \hologo{LaTeX}. The \sty{biblatex} package works with the “backend”
% (program) \sty{biber}, which is used to process \hologo{BibTeX}
-% format data files and them performs all sorting, label
-% generation (and a great deal more).}
+% format data files and them performs all sorting, label generation.}
%\end{bibexamplelist}
%\begin{latexcode}\begin{verbatim}
%@online{lehman:biblatex,
@@ -872,12 +873,12 @@ This work has the LPPL maintenance status "author-maintained".
% version = {3.7},
% date = {2016-11-16},
% annotation = {This package provides advanced bibliographic facilities
-% for use with \LaTeX. The package is a complete reimplementation
-% of the bibliographic facilities provided by \LaTeX. The
-% \texttt{biblatex} package works with the “backend” (program)
-% \texttt{biber}, which is used to process \textsc{Bib}\TeX{} format data
-% files and them performs all sorting, label generation (and
-% a great deal more).}}
+% for use with \LaTeX. The package is a complete
+% reimplementation of the bibliographic facilities provided
+% by \LaTeX. The \texttt{biblatex} package works with the
+% “backend” (program) \texttt{biber}, which is used to
+% process \textsc{Bib}\TeX{} format data files and them
+% performs all sorting, label generation.}}
%\end{verbatim}\end{latexcode}
%\end{fieldlist}
%
@@ -1083,7 +1084,7 @@ This work has the LPPL maintenance status "author-maintained".
% \begin{optionlist*}
%
%\boolitem[false]{latinemph}
-% Prints the \emph{latinitas} ``et al.'' (\emph{et alii}) in italic shape.
+% Prints ``et al.'' (\emph{et alii}) in italic shape.
%
%\boolitem[false]{square}
%
@@ -1124,7 +1125,10 @@ This work has the LPPL maintenance status "author-maintained".
% \begin{optionlist*}
%
%\boolitem[false]{latinemph}
-% Prints the \emph{latinitates} ``{ivi}'', ``{ibidem}'' and ``et al.'' in italic shape.
+% Prints the scholarly abbreviations ``ibidem'', ``et al.'', ``op. cit.'', ``idem'' in italic shape.
+%
+%\boolitem[false]{iviemph}
+% Prints the scholarly abbreviation ``ivi'' in italic shape.
%
%\boolitem[false]{commacit}
% Adds a comma at the end of the \bibfield{shorttitle} field when this is followed by the string ``cit.'':
@@ -1494,6 +1498,7 @@ This work has the LPPL maintenance status "author-maintained".
\newtoggle{bbx:scauthorsbib}
\newtoggle{cbx:scauthorscitefn}
\newtoggle{cbx:latinemph}
+\newtoggle{cbx:iviemph}
\DeclareBibliographyOption{annotation}[true]{%
\settoggle{bbx:annotation}{#1}}
@@ -1509,6 +1514,8 @@ This work has the LPPL maintenance status "author-maintained".
\settoggle{cbx:shorthandintro}{#1}}
\DeclareBibliographyOption{latinemph}[true]{%
\settoggle{cbx:latinemph}{#1}}
+\DeclareBibliographyOption{iviemph}[true]{%
+ \settoggle{cbx:iviemph}{#1}}
% \end{macrocode}
% Also the multi-value options have a default value, which is declared
% in the optional bracketed argument of the \cmd{DeclareBibliographyOption} commands below.
@@ -1572,6 +1579,7 @@ This work has the LPPL maintenance status "author-maintained".
library = true,
annotation = false,
latinemph = false,
+ iviemph = false,
classical = false,
inbeforejournal = false,
lowscauthors = false,
@@ -1644,11 +1652,12 @@ This work has the LPPL maintenance status "author-maintained".
%
% \subsubsection{New commands}
%
-% The \cmd{mkibid} command is provided for formatting the \emph{latinitates} ``et al.'', ``ivi'', ``ibidem''.
+% The \cmd{mkibid} command is provided for formatting ``et al.'', ``ibidem'' and other abbreviations.
% Actually the command is introduce for formatting ``et al.'' considering that it is already defined by \sty{verbose-trad2.cbx}
-% which uses it for ``ivi'' and ``ibidem''.
+% which uses it for ``ivi'' and ``ibidem''. A new command \cmd{mkivi} is use to format only the string ``ivi''.
% \begin{macrocode}
\providecommand*{\mkibid}[1]{\iftoggle{cbx:latinemph}{\mkbibemph{#1}}{#1}}
+\providecommand*{\mkivi}[1]{\iftoggle{cbx:iviemph}{\mkbibemph{#1}}{#1}}
% \end{macrocode}
% We (re)define some internal commands for the punctuation. The new \cmd{volnumpunct} command is provided
% to separate volume and number in \bibtype{article} entries.
@@ -4467,7 +4476,7 @@ This work has the LPPL maintenance status "author-maintained".
{\usebibmacro{cite:loccit}}{%
\printtext{%
\bibhyperlink{cite\csuse{cbx@lastcite@\thefield{entrykey}}}{%
- \bibstring[\mkibid]{ibidem}}}}}%
+ \bibstring[\mkivi]{ibidem}}}}}%
\renewbibmacro*{cite:title}{%
\ifsingletitle{\usebibmacro{cite:opcit}}{%
diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-philosophy/biblatex-philosophy.pdf b/macros/latex/contrib/biblatex-contrib/biblatex-philosophy/biblatex-philosophy.pdf
index 6e7969f276..d989cda6df 100644
--- a/macros/latex/contrib/biblatex-contrib/biblatex-philosophy/biblatex-philosophy.pdf
+++ b/macros/latex/contrib/biblatex-contrib/biblatex-philosophy/biblatex-philosophy.pdf
Binary files differ
diff --git a/macros/latex/contrib/easybook/README.md b/macros/latex/contrib/easybook/README.md
index 7c769767e1..33c2e966c2 100644
--- a/macros/latex/contrib/easybook/README.md
+++ b/macros/latex/contrib/easybook/README.md
@@ -1,6 +1,6 @@
# Easybook document class
-Easybook is based on the ctexbook book document class to create a minimalist style template, which can be seen as a further packaging and enhancement of ctexbook. Although the ctex document class provides better Chinese support, it is generally necessary to load more macro packages for customization if you want to achieve personalized functions. Easybook has considered some details and has loaded some commonly used macro packages to achieve general typesetting requirements. It also has the function of article file type, so that users can easily set it up. It is suitable for typesetting Chinese and English dissertations, academic books or notes.
+Easybook is a minimalist style template based on the ctexbook book document class, and it also has the functions of the book and article document classes, its basic macro package easybase can also be used with CTeX and standard document classes. Easybook considers some details and loads some almost necessary macro packages for packaging and improvement, and provides multiple commands and interfaces to make settings easy for users. It is suitable for typesetting Chinese and English dissertations, academic books or notes.
## License
@@ -12,7 +12,7 @@ This work may be distributed and/or modified under the conditions of the CC-BY 4
# easybook 文档类
-easybook 是基于 ctexbook 书籍文档类创建以极简为风格的模板,可以看作对 ctexbook 的进一步包装与增强。虽然 ctex 文档类提供了较好的中文支持,但想实现个性化功能一般需要在其基础上载入更多宏包来定制。easybook 考虑了一些细节并已载入一些常用宏包用于实现一般的排版需求,同时也具有 article 档类的功能,使用户可以简便地进行设置。它适用于排版中英文学位论文、学术书籍或者是笔记。
+easybook 是基于 ctexbook 书籍文档类创建以极简为风格的模板,同时兼具 book 与 article 文档类的用途,它的基础宏包 easybase 还可以搭配 CTeX 和标准文档类使用。easybook 考虑了一些细节并载入一些几乎必备的宏包进行包装和改进,提供多个命令和接口可以使用户简便地进行设置。它适用于排版中英文学位论文、学术书籍或者是笔记。
## 协议
diff --git a/macros/latex/contrib/easybook/easybook.dtx b/macros/latex/contrib/easybook/easybook.dtx
index 2070d0dfd9..f7c4e25dfe 100644
--- a/macros/latex/contrib/easybook/easybook.dtx
+++ b/macros/latex/contrib/easybook/easybook.dtx
@@ -28,11 +28,11 @@
%
% \title{\sffamily easybook 文档类手册}
% \author{瞿毅}
-% \date{2021/07/13\hskip\ccwd\relax v1.27d\thanks{\url{https://gitee.com/texl3/easybook}}}
+% \date{2021/07/14\hskip\ccwd\relax v1.27e\thanks{\url{https://gitee.com/texl3/easybook}}}
%
% \maketitle
% \begin{abstract}
-% \cls{easybook} 是基于 \cls{ctexbook} 书籍文档类创建以极简为风格的模板,可以看作对 \cls{ctexbook} 的进一步包装与增强。虽然 \CTeX 文档类提供了较好的中文支持,但想实现个性化功能一般需要在其基础上载入更多宏包来定制。\cls{easybook} 考虑了一些细节并已载入一些常用宏包用于实现一般的排版需求,同时也具有 \cls{article} 文档类的功能,使用户可以简便地进行设置。它适用于排版中英文学位论文、学术书籍或者是笔记。
+% \cls{easybook} 是基于 \cls{ctexbook} 书籍文档类创建以极简为风格的模板,同时兼具 \cls{book} 与 \cls{article} 文档类的用途,它的基础宏包 \pkg{easybase} 还可以搭配 \CTeX 和标准文档类使用。\cls{easybook} 考虑了一些细节并载入一些几乎必备的宏包进行包装和改进,提供多个命令和接口可以使用户简便地进行设置。它适用于排版中英文学位论文、学术书籍或者是笔记。
% \end{abstract}
% \tableofcontents
%
@@ -148,7 +148,7 @@
% cjkfont = <adobe|fandol|founder|mac|macnew|macold|ubuntu|windows|none>
% \end{syntax}
% 中文字体采用 \CTeX 宏集包含的字库并与其一致,具体配置方案可以查看 \CTeX 使用手册。它与 \opt{fontset} 选项是等效的,如果没有指定 \opt{cjkfont} 的值,将会自动检测用户的操作系统并选择相应的字体。
-% \changes{v1.27d}{2021/07/12}{新增 \opt{cjkfont} 选项设置中文字体,原 \opt{font} 选项设置英文字体,中文字体使用 \CTeX 的字库。}
+% \changes{v1.27e}{2021/07/12}{新增 \opt{cjkfont} 选项设置中文字体,原 \opt{font} 选项设置英文字体,中文字体使用 \CTeX 的字库。}
% \end{function}
%
% 如果需要使用其它中文字体,可以在启用选项 \opt{cjkfont = none} 后,再使用 \pkg{xeCJK} 宏包的相关命令设置字体以及声明字体族:
@@ -666,30 +666,37 @@
% \end{ctexexam}
%
% \subsubsection{脚注格式}
-% \begin{function}[EXP,added = 2021-05-12]{fnmargin,fnparskip,fnparindent,fnhang,fnmark-pos,fnmark-num,fnmark-num,fnmark-form,afterfnmark}
+% \begin{function}[EXP,added = 2021-05-12,updated = 2021-07-14]{fnmargin,fnparskip,fnparindent,footnotetype,fnmark-pos,fnmark-num,fnmark-num,fnmark-form,fntext-form,afterfnmark}
% \begin{syntax}
% fnmargin = <刚性长度|(0.75\tn{ccwd})>
% fnparskip = <弹性长度|(0ex)>
% fnparindent = <刚性长度|(2\tn{ccwd})>
-% fnhang = <(true)|false>
+% footnotetype = <(hang)|default|bottom>
% fnmark-pos = <normal|(super)>
% fnmark-num = <(plain)|pifont|pifont*|pifont-sans|pifont-sans*>
% fnmark-form = <格式代码>
+% fntext-form = <格式代码>
% afterfnmark = <格式代码>
% \end{syntax}
% \ding{229} 以上选项路径为 \opt{hdrset/...} \\
% \changes{v1.25}{2021/05/12}{增加脚注样式设置选项。}
+% \changes{v1.27e}{2021/07/14}{增加脚注内容格式选项 \opt{fntext-form} 和脚注类型选项 \opt{footnotetype}。}
% \end{function}
%
% \begin{optdesc}
-% \item[fnmargin] 脚注首段缩进距离,等于长度 \tn{footnotemargin} 的值。
-% \item[fnparskip] 脚注段落间距,仅在脚注为悬挂缩进时有效。
-% \item[fnparindent] 脚注段落缩进,仅在脚注为悬挂缩进时有效。
-% \item[fnhang] 脚注是否为悬挂缩进的格式,默认开启。
-% \item[fnmark-pos] 设置脚注编号的位置,正常文本或是上标形式。
-% \item[fnmark-num] 脚注编号的格式,默认为原生样式 \opt{plain},还可以改为 \opt{pifont} 的各个版本,从左往右依次为普通版、阴文衬线版、阳文无衬线版和阴文无衬线版,缺点是它们的编号仅包括 1-10。
-% \item[fnmark-form] 脚注标记的格式,在此设置字体命令会覆盖 \opt{subfont/footnote} 的设置,最后一个格式命令可以带有一个参数,这个参数接受脚注编号,一般配合 \opt{fnmark-num = plain} 使用。
-% \item[afterfnmark] 脚注标记后的代码,由于脚注标记处于水平盒子中,它一般用于设置标记与文本间的距离。
+% \item[fnmargin] 脚注首段缩进距离,等于长度 \tn{footnotemargin} 的值。
+% \item[fnparskip] 脚注段落间距,等于长度 \tn{footparskip} 的值。
+% \item[fnparindent] 脚注段落缩进,等于长度 \tn{footparindent} 的值。
+% \item[footnotetype] 脚注的类型,悬挂缩进 \opt{hang} 是默认值,\opt{default} 是原始的类型,在一些浮动体排版的情况下,脚注可能位于页面中间,\opt{bottom} 使脚注始终位于页面底端。这是个复合选项,\opt{bottom} 可以与前两种类型重复或复合使用:
+% \begin{ctexexam}
+% \hdrset{footnotetype = default,footnotetype = bottom}
+% \hdrset{footnotetype = {hang,bottom}}
+% \end{ctexexam}
+% \item[fnmark-pos] 设置脚注编号的位置,正常文本或是上标形式。
+% \item[fnmark-num] 脚注编号的格式,默认为原生样式 \opt{plain},还可以改为 \opt{pifont} 的各个版本,从左往右依次为普通版、阴文衬线版、阳文无衬线版和阴文无衬线版,缺点是它们的编号仅包括 1-10。
+% \item[fnmark-form] 脚注标记的格式,在此设置字体命令会覆盖 \opt{subfont/footnote} 的设置,最后一个格式命令可以带有一个参数,这个参数接受脚注标记,一般配合 \opt{fnmark-num = plain} 使用。
+% \item[fntext-form] 脚注内容的格式,在此设置字体命令会覆盖 \opt{subfont/footnote} 的设置,最后一个格式命令可以带有一个参数,这个参数接受脚注内容。
+% \item[afterfnmark] 脚注标记后的代码,由于脚注标记处于水平盒子中,它一般用于设置标记与文本间的距离。
% \end{optdesc}
%
% \subsection{目录样式}
@@ -844,7 +851,7 @@
% \tn{end}\{hangparas\}
% \end{syntax}
% \tn{hangpara} 命令使其后的一个段落保持悬挂缩进,\env{hangparas} 环境使其中的段落均保持悬挂缩进。缩进将以 \meta{缩进长度} 从每个段落的 \meta{缩进开始行数} 开始。
-% \changes{v1.27d}{2021/07/11}{增加悬挂缩进段落命令 \tn{hangpara} 和环境 \env{hangparas}。}
+% \changes{v1.27e}{2021/07/11}{增加悬挂缩进段落命令 \tn{hangpara} 和环境 \env{hangparas}。}
% \end{function}
%
% \subsection{代码}
@@ -1094,7 +1101,6 @@
% \begin{description}[font = \normalfont\sffamily]
% \item[ctex] 提供中文排版的通用框架。
% \item[xcolor] 提供任意颜色的设定与混合,已载入了 \opt{svgnames} 颜色库。
-% \item[footmisc] 更改脚注排版的方法的集合。
% \item[amsmath] 提供 \LaTeX 中的数学功能。
% \item[thmtools] 用于通常需要的排版定理支持。
% \item[marginnote] 增强了边注输出的功能。
@@ -1174,7 +1180,7 @@
%<*class>
\NeedsTeXFormat{LaTeX2e}[2020/10/01]
\RequirePackage{l3keys2e}
-\ProvidesExplClass{easybook}{2021/07/13}{1.27d}
+\ProvidesExplClass{easybook}{2021/07/14}{1.27e}
{Typeset Chinese theses or books}
\bool_set_false:N \l__eb_compile_draft_bool
@@ -1469,18 +1475,20 @@
%<*package>
\NeedsTeXFormat{LaTeX2e}[2020/10/01]
\RequirePackage{l3keys2e,etoolbox}
-\ProvidesExplPackage{easybase}{2021/07/13}{1.27d}
+\ProvidesExplPackage{easybase}{2021/07/14}{1.27e}
{Typeset Chinese theses or books}
-\cs_generate_variant:Nn \ctex_define:nn { nx }
\cs_generate_variant:Nn \int_to_arabic:n { v }
\cs_generate_variant:Nn \int_to_alph:n { v }
\cs_generate_variant:Nn \dim_add:Nn { NV,Nv }
-\cs_generate_variant:Nn \eb_put_hyperref:n { x }
-\cs_generate_variant:Nn \seq_set_from_clist:Nn { No }
-\cs_generate_variant:Nn \int_compare:nNnT { oNnT }
+\cs_generate_variant:Nn \dim_set:Nn { NV }
\cs_generate_variant:Nn \prop_set_from_keyval:Nn { NV }
+\cs_generate_variant:Nn \skip_set:Nn { NV }
+\cs_generate_variant:Nn \seq_set_from_clist:Nn { No }
+\cs_generate_variant:Nn \ctex_define:nn { nx }
+\cs_generate_variant:Nn \eb_put_hyperref:n { x }
\cs_generate_variant:Nn \eb_at_begin_environment:nn { on }
+
\cs_new_protected:Npn \ctex_define:nn #1
{ \keys_define:nn { ctex/#1 } }
\cs_new_protected:Npn \eb_clist_map_inline:nn #1#2
@@ -1535,8 +1543,7 @@
\NewDocumentCommand{\LoadPackage}{O{}m}
{
\seq_set_split:Nnn \l_tmpb_seq { + } {#2}
- \int_compare:oNnT
- { \seq_count:N \l_tmpb_seq } = { 1 }
+ \int_compare:nNnT { \seq_count:N \l_tmpb_seq } = { 1 }
{ \PassOptionsToPackage{#1}{#2} }
\seq_map_function:NN
\l_tmpb_seq \eb_match_load_package:n
@@ -1656,7 +1663,6 @@
\LoadPackage
{
- footmisc[stable,bottom]+
spbmark[ctex]+
ulem[normalem]+
enumitem[shortlabels,inline]+
@@ -1758,8 +1764,6 @@
{ \use:c { eb@mark@#1@label@layout }{##1} }
}
}
-
-\tl_new:N \l__eb_fnmark_number_choice_tl
\cs_gset_eq:NN \easyhead \fancyhead
\cs_gset_eq:NN \easyfoot \fancyfoot
\NewDocumentCommand{\markrule}
@@ -1773,26 +1777,6 @@
\tl_if_novalue:nF {#5} { \vspace*{#5} }
\group_end:
}
-\cs_new:Npn \eb_fnmark_counter_pifont:N #1
- { \ding{\int_eval:n { 171 + #1 }} }
-\cs_new:Npn \eb_fnmark_counter_pifont_neg:N #1
- { \ding{\int_eval:n { 181 + #1 }} }
-\cs_new:Npn \eb_fnmark_counter_pifont_sans:N #1
- { \ding{\int_eval:n { 191 + #1 }} }
-\cs_new:Npn \eb_fnmark_counter_pifont_sans_neg:N #1
- { \ding{\int_eval:n { 201 + #1 }} }
-\cs_new:Npn \eb_footnote_counter:N #1
- {
- \str_case:VnF \l__eb_fnmark_number_choice_tl
- {
- { plain } { \int_use:N #1 }
- { pifont } { \eb_fnmark_counter_pifont:N #1 }
- { pifont* } { \eb_fnmark_counter_pifont_neg:N #1 }
- { pifont-sans } { \eb_fnmark_counter_pifont_sans:N #1 }
- { pifont-sans* } { \eb_fnmark_counter_pifont_sans_neg:N #1 }
- }
- { \int_use:N #1 }
- }
\ctex_define:nn { hdrset }
{
head-foot .tl_set:N = \l__eb_fancyhf_content_tl,
@@ -1832,32 +1816,7 @@
footrule .initial:n = { },
footnoterule .tl_gset:N = \footnoterule,
footnoterule .initial:n =
- { \markrule[0.35\textwidth]{\l__eb_rule_width_dim}[+2.6pt] },
-
- fnmargin .dim_set:N = \footnotemargin,
- fnmargin .initial:n = 0.75\ccwd,
- fnparskip .tl_set:N = \hangfootparskip,
- fnparskip .initial:n = 0ex,
- fnparindent .tl_set:N = \hangfootparindent,
- fnparindent .initial:n = 2\ccwd,
-
- fnhang .bool_set:N = \l__eb_footnote_hang_bool,
- fnhang .default:n = true,
- fnhang .initial:n = true,
- fnmark-pos .tl_set:N = \l__eb_fnmark_position_tl,
- fnmark-pos .initial:n = super,
- afterfnmark .tl_set:N = \l__eb_fnmark_after_tl,
- afterfnmark .initial:n =
- { \tl_if_eq:NnF \l__eb_fnmark_position_tl { super } { \space } },
- fnmark-form .tl_set:N = \l__eb_fnmark_format_tl,
-
- fnmark-num .choices:nn =
- { plain,pifont,pifont*,pifont-sans,pifont-sans* }
- {
- \tl_gset_eq:NN
- \l__eb_fnmark_number_choice_tl \l_keys_choice_tl
- },
- fnmark-num .value_required:n = true
+ { \markrule[0.35\textwidth]{\l__eb_rule_width_dim}[+2.6pt] }
}
\cs_set_eq:NN \eb_mark_uppercase:n \text_uppercase:n
@@ -1910,17 +1869,60 @@
\cs_if_exist:NF \kaishu { \cs_gset_eq:NN \kaishu \itshape }
}
+\tl_new:N \l__eb_fnmark_number_choice_tl
+\bool_new:N \l__eb_fntext_bottom_bool
\ctex_define:nn { style }
{
footwith .choices:nn =
{ part,page,chapter }
- {
- \tl_set_eq:NN
- \l__eb_foot_counter_parent_choice_tl \l_keys_choice_tl
- },
+ { \tl_set:Nn \l__eb_foot_counter_parent_choice_tl {#1} },
footwith .value_required:n = true,
footwith .initial:n = chapter
}
+\ctex_define:nn { hdrset }
+ {
+ fnmargin .dim_set:N = \footnotemargin,
+ fnmargin .initial:n = 0.75\ccwd,
+ fnparskip .skip_set:N = \footparskip,
+ fnparskip .initial:n = 0ex,
+ fnparindent .dim_set:N = \footparindent,
+ fnparindent .initial:n = 2\ccwd,
+ fntext-form .tl_set:N = \l__eb_fntext_format_tl,
+
+ fnmark-pos .tl_set:N = \l__eb_fnmark_position_tl,
+ fnmark-pos .initial:n = super,
+ afterfnmark .tl_set:N = \l__eb_fnmark_after_tl,
+ afterfnmark .initial:n =
+ { \tl_if_eq:NnF \l__eb_fnmark_position_tl { super } { \space } },
+ fnmark-form .tl_set:N = \l__eb_fnmark_format_tl,
+
+ footnotetype .multichoices:nn =
+ { default,hang,bottom,para }
+ {
+ \tl_if_eq:nnTF { bottom } {#1}
+ { \bool_set_true:N \l__eb_fntext_bottom_bool }
+ { \tl_set:Nn \l__eb_footnotetype_choice_tl {#1} }
+ },
+ footnotetype .value_required:n = true,
+ footnotetype .initial:n = hang,
+
+ fnmark-num .choices:nn =
+ { plain,pifont,pifont*,pifont-sans,pifont-sans* }
+ { \tl_set:Nn \l__eb_fnmark_number_choice_tl {#1} },
+ fnmark-num .value_required:n = true,
+
+ unknown .code:n =
+ {
+ \msg_warning:nnx
+ { easybase } { ignore-hdrset } { \l_keys_key_str }
+ }
+ }
+\msg_new:nnn { easybase } { ignore-hdrset }
+ {
+ #1~is~an~unknown~hdrset~option. \\
+ Please~check~the~user~manual~for~the~supported~options.
+ }
+
\eb_at_end_preamble:n
{
\group_begin:
@@ -1936,9 +1938,88 @@
{ part } { \counterwithin*{footnote}{part} }
{ page } { \counterwithin*{footnote}{page} }
}
- \bool_if:NTF \l__eb_footnote_hang_bool
- { \booltrue{FN@hangfoot} }
- { \boolfalse{FN@hangfoot} }
+ \bool_if:NT \l__eb_fntext_bottom_bool
+ {
+ \cs_set:Npn \@makecol
+ {
+ \setbox\@outputbox\box\@cclv
+ \xdef\@freelist{\@freelist\@midlist}
+ \global\let\@midlist\@empty
+ \@combinefloats
+ \eb@footmisc@ifvoid\footins{}
+ {
+ \setbox\@outputbox\vbox
+ \bgroup
+ \boxmaxdepth\@maxdepth
+ \unvbox\@outputbox
+ \vfill\relax
+ \vskip\skip\footins
+ \color@begingroup
+ \normalcolor\footnoterule
+ \unvbox\footins
+ \color@endgroup
+ \egroup
+ }
+ \eb@footmisc@ifvoid\@kludgeins
+ {\@makespecialcolbox}
+ {
+ \setbox\@outputbox\vbox to\@colht
+ {
+ \@texttop\dimen@\dp\@outputbox
+ \unvbox\@outputbox
+ \vskip -\dimen@\@textbottom
+ }
+ }
+ \global\maxdepth\@maxdepth
+ }
+ }
+ }
+\cs_set:Npn \@makefntext #1
+ {
+ \group_begin:
+ \str_case:Vn \l__eb_footnotetype_choice_tl
+ {
+ { hang } { \use_i:nn }
+ { default } { \use_ii:nn }
+ }
+ {
+ \hbox_set:Nn \l_tmpa_box
+ {
+ \dim_compare:nNnTF { \footnotemargin } > { 0pt }
+ { \hbox_to_wd:nn { \footnotemargin } { \eb@makefnmark\hss } }
+ { \eb@makefnmark }
+ }
+ \dim_set:Nn \leftmargin { \box_wd:N \l_tmpa_box }
+ \dim_zero:N \rightmargin
+ \dim_set_eq:NN \linewidth \columnwidth
+ \dim_sub:Nn \linewidth { \leftmargin }
+ \parshape\@ne\leftmargin\linewidth
+ \@setpar{{\@@par}}
+ \mode_leave_vertical:
+ \hbox_overlap_left:n { \box_use:N \l_tmpa_box }
+ }
+ {
+ \noindent
+ \dim_compare:nNnTF { \footnotemargin } > { 0pt }
+ { \hbox_to_wd:nn { \footnotemargin } { \hss\eb@makefnmark } }
+ {
+ \dim_compare:nNnTF { \footnotemargin } = { 0pt }
+ { \hbox_overlap_left:n { \eb@makefnmark } }
+ {
+ \hbox_overlap_left:n
+ {
+ \hbox_to_wd:nn
+ { -\footnotemargin }
+ { \eb@makefnmark\hss }
+ }
+ }
+ }
+ }
+ \skip_set:NV \parskip \footparskip
+ \dim_set:NV \parindent \footparindent
+ \l__eb_fntext_format_tl{#1}
+ \tl_if_eq:NnT \l__eb_footnotetype_choice_tl { hang } { \par }
+ \group_end:
}
\eb_patch_cmd:nnn { \@footnotetext,\@mpfootnotetext }
{ \reset@font }
@@ -1949,22 +2030,16 @@
}
\ProvideDocumentCommand{\super}{mo}{\textsuperscript{#1}}
\providecommand{\spb@textsuperscript@save}{\textsuperscript}
-\ctex_after_end_preamble:n
+\cs_set:Npn \@makefnmark
{
- \ExplSyntaxOn\char_set_catcode_letter:N \@
- \eb_patch_cmd:nnn { \H@@footnotemark,\@footnotemark }
- { \@makefnmark }
+ \hbox:n
{
- \hbox:n
- {
- \tl_use:N \l__eb_subfont_footnote_tl
- \tl_use:N \l__eb_fnmark_format_tl
- {\super{\@thefnmark}[0pt]}
- }
+ \tl_use:N \l__eb_subfont_footnote_tl
+ \tl_use:N \l__eb_fnmark_format_tl
+ {\super{\@thefnmark}[0pt]}
}
- \ExplSyntaxOff\char_set_catcode_other:N \@
}
-\cs_set:Npn \@makefnmark
+\cs_new:Npn \eb@makefnmark
{
\hbox:n
{
@@ -1978,7 +2053,7 @@
}
}
\tl_clear:N \@thefnmark
-\cs_new:Npn \eb@makefnmark #1
+\cs_new:Npn \eb@@makefnmark #1
{
\tl_if_empty:oF {#1}
{
@@ -1987,12 +2062,33 @@
\group_end:
}
}
+\cs_new:Npn \eb_fnmark_counter_pifont:N #1
+ { \ding{\int_eval:n { 171 + #1 }} }
+\cs_new:Npn \eb_fnmark_counter_pifont_neg:N #1
+ { \ding{\int_eval:n { 181 + #1 }} }
+\cs_new:Npn \eb_fnmark_counter_pifont_sans:N #1
+ { \ding{\int_eval:n { 191 + #1 }} }
+\cs_new:Npn \eb_fnmark_counter_pifont_sans_neg:N #1
+ { \ding{\int_eval:n { 201 + #1 }} }
+\cs_new:Npn \eb_footnote_counter:N #1
+ {
+ \str_case:VnF \l__eb_fnmark_number_choice_tl
+ {
+ { plain } { \int_use:N #1 }
+ { pifont } { \eb_fnmark_counter_pifont:N #1 }
+ { pifont* } { \eb_fnmark_counter_pifont_neg:N #1 }
+ { pifont-sans } { \eb_fnmark_counter_pifont_sans:N #1 }
+ { pifont-sans* } { \eb_fnmark_counter_pifont_sans_neg:N #1 }
+ }
+ { \int_use:N #1 }
+ }
\cs_new:Npn \Footnote #1 { \Footnotemark{#1}\@footnotetext }
-\cs_new:Npn \Footnotemark #1 { \eb@makefnmark{#1}\@footnotemark }
-\cs_new:Npn \Footnotetext #1 { \eb@makefnmark{#1}\@footnotetext }
+\cs_new:Npn \Footnotemark #1 { \eb@@makefnmark{#1}\@footnotemark }
+\cs_new:Npn \Footnotetext #1 { \eb@@makefnmark{#1}\@footnotetext }
\cs_new:Npn \eb_alph:n #1 { \int_to_alph:v { c@#1 } }
\cs_set:Npn \thefootnote { \eb_footnote_counter:N \c@footnote }
\cs_set:Npn \thempfootnote { \eb_alph:n { mpfootnote } }
+\cs_new:Npn \eb@footmisc@ifvoid #1#2#3 { \ifvoid #1#2\else #3\fi }
\contentsuse{lstlisting}{lol}
\seq_put_left:Nn \c__ctex_headings_seq { chapter }
@@ -2470,6 +2566,7 @@
\ctex_at_end_package:nn { imakeidx }
{
+ \makeindex
\RenewDocumentCommand{\printindex}{st+oD(){\imki@jobname}}
{
\group_begin:
@@ -2559,10 +2656,7 @@
noto,notosans,times,libertine,
charter,garamond,none,nc,stix
}
- {
- \tl_gset_eq:NN
- \l__eb_subfont_math_choice_tl \l_keys_choice_tl
- },
+ { \tl_set:Nn \l__eb_subfont_math_choice_tl {#1} },
math .value_required:n = true,
math .initial:n = times
}
@@ -2746,8 +2840,6 @@
\cs_set_eq:NN \eb@declaretheoremsyle@save \declaretheoremstyle
\RenewDocumentCommand{\declaretheorem}{O{}mO{}}
{\AfterPreamble{\eb@declaretheorem@save[#1,#3]{#2}}}
-\cs_new_protected:Npn \eb@declaretheorem #1#2
- { \declaretheorem[#2]{#1} }
\RenewDocumentCommand{\declaretheoremstyle}{O{}mO{}}
{\eb@declaretheoremsyle@save[#1,#3]{#2}}
\cs_set_eq:NN \newtheorem \declaretheorem
@@ -2755,11 +2847,10 @@
{mO{\text_titlecase_first:n {#1}}mD(){tc-theorem}O{}}
{
\eb_thm_name_set:nnn {#1} {#2} {#3}
- \eb@declaretheorem{#1}
- {
- name = \tl_use:c { c__eb_name_#1_tl },
- style = easy-theorem,#5
- }
+ \declaretheorem{#1}[
+ name = \tl_use:c { c__eb_name_#1_tl },
+ style = easy-theorem,#5
+ ]
\bool_if:NT \l__eb_thmbox_bool
{
\@ifpackageloaded{tcolorbox}
@@ -2892,7 +2983,7 @@
{
\skip_set:Nn \abovedisplayskip { 6pt plus 1pt minus 1pt }
\skip_set:Nn \belowdisplayskip { 6pt plus 1pt minus 1pt }
- \skip_set:Nn \abovedisplayshortskip { 0pt }
+ \skip_set:Nn \abovedisplayshortskip { 0pt plus 1pt minus 1pt }
\skip_set:Nn \belowdisplayshortskip { 6pt plus 1pt minus 1pt }
}
\ctex_at_end_package:nn { unicode-math }
@@ -3200,7 +3291,6 @@
\urlstyle{same}
\eb_allow_urlbreak:
\exp_args:NV \hypersetup \l__eb_hyperref_clist
- \use:c { makeindex }
}
\labelformat{part}{\CTEXthepart}
@@ -3242,7 +3332,7 @@
}
%</package>
%<*tcolorbox>
-\ProvidesExplFile{eb-tcolorbox.cfg}{2021/07/13}{1.27d}
+\ProvidesExplFile{eb-tcolorbox.cfg}{2021/07/14}{1.27e}
{Customization of tcolorbox for easybook}
\cs_new_protected:Npn \eb_tcb_theorem_set:n #1
diff --git a/macros/latex/contrib/easybook/easybook.pdf b/macros/latex/contrib/easybook/easybook.pdf
index 017c449994..fdc057e91b 100644
--- a/macros/latex/contrib/easybook/easybook.pdf
+++ b/macros/latex/contrib/easybook/easybook.pdf
Binary files differ
diff --git a/macros/latex/contrib/hvfloat/Changes b/macros/latex/contrib/hvfloat/Changes
index 3de2f35087..b7466e9816 100644
--- a/macros/latex/contrib/hvfloat/Changes
+++ b/macros/latex/contrib/hvfloat/Changes
@@ -1,4 +1,5 @@
hvfloat.sty:
+2.33 2021-07-14 - fix for doublePAGE, needs length setting inside the macro
2.32 2021-06-29 - make multi and multisubflots caption align with the bottom
- added graphicx option doublefullPage
- prevent vertical centering for a doublepage on the right
diff --git a/macros/latex/contrib/hvfloat/doc/hvfloat.pdf b/macros/latex/contrib/hvfloat/doc/hvfloat.pdf
index 3fcd284a96..66228e90ca 100644
--- a/macros/latex/contrib/hvfloat/doc/hvfloat.pdf
+++ b/macros/latex/contrib/hvfloat/doc/hvfloat.pdf
Binary files differ
diff --git a/macros/latex/contrib/hvfloat/doc/hvfloat.tex b/macros/latex/contrib/hvfloat/doc/hvfloat.tex
index afe13b5bc4..d1db08c76b 100644
--- a/macros/latex/contrib/hvfloat/doc/hvfloat.tex
+++ b/macros/latex/contrib/hvfloat/doc/hvfloat.tex
@@ -1,4 +1,4 @@
-%% $Id: hvfloat.tex 122 2021-06-26 12:35:53Z herbert $
+%% $Id: hvfloat.tex 126 2021-06-29 12:56:04Z herbert $
\listfiles
\errorcontextlines=100
\documentclass[twoside,paper=a4,usegeometry]{scrartcl}
diff --git a/macros/latex/contrib/hvfloat/latex/hvfloat.sty b/macros/latex/contrib/hvfloat/latex/hvfloat.sty
index 3d54b4f981..4d9e265b62 100644
--- a/macros/latex/contrib/hvfloat/latex/hvfloat.sty
+++ b/macros/latex/contrib/hvfloat/latex/hvfloat.sty
@@ -15,8 +15,8 @@
%% `hvfloat' offers rotating of captions and objects for floats
%%
\NeedsTeXFormat{LaTeX2e}
-\def\fileversion{2.32}
-\def\filedate{2021/06/26}
+\def\fileversion{2.33}
+\def\filedate{2021/07/14}
%\message{`hvfloat' v\fileversion, \filedate\space (Herbert Voss)}
\ProvidesPackage{hvfloat}[\filedate\space v\fileversion\space special floating objects (hv)]
\let\hvFloatFileVersion\fileversion
@@ -1258,13 +1258,12 @@
\def\do@hvFloat@doublePAGE#1{% image on left and right page with caption on the right ----------------------------------
% #1-> 0/1 caption under/right
- \global\setlength\hv@tempWidthA{\the\dimexpr1in+\oddsidemargin-\hvSet@bindCorrection}%
- \global\setlength\hv@leftPageObjectWidth{\the\dimexpr\paperwidth-1in-\evensidemargin-\hvSet@bindCorrection}%
+% \global\setlength\hv@tempWidthA{\the\dimexpr1in+\oddsidemargin-\hvSet@bindCorrection}%
+% \global\setlength\hv@leftPageObjectWidth{\the\dimexpr\paperwidth-1in-\evensidemargin-\hvSet@bindCorrection}%
\expandafter\global\expandafter\savebox\expandafter\hvObjectBox\expandafter{\ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}%
\expandafter\global\expandafter\savebox\expandafter\hv@boxLeftPage\expandafter{\clipbox*{0 -\depth{} \hv@leftPageObjectWidth{} \height}{\usebox\hvObjectBox}}%
\expandafter\global\expandafter\savebox\expandafter\hv@boxRightPage\expandafter{\clipbox*{\hv@leftPageObjectWidth{} -\depth{} \width{} \height}{\usebox\hvObjectBox}}%
-% \endgroup% started at main macro \hvFloat
- \checkoddpage
+ \checkoddpage
\ifoddpage
\if@twocolumn
\if@firstcolumn
@@ -1283,7 +1282,7 @@
\afterpage{\afterpage{\do@hvFloat@doublePAGECaptionRight{#1}}}%
\fi
\else
- \afterpage{\do@hvFloat@doublePAGECaptionRight{#1}}%
+ \afterpage{\do@hvFloat@doublePAGECaptionRight{#1}}% onecolumn/left page
\fi
\fi
\endgroup% startet at main macro
@@ -1293,15 +1292,21 @@
% #1-> 0/1 caption under/right
\afterpage{%
\hfuzz=\maxdimen
- \expandafter\hvFloatSet\expandafter{\hv@save@setting}%
- \global\savebox{\hvObjectBox}{\ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}%
+ \expandafter\hvFloatSet\expandafter{\hv@save@setting}%
+ \ifhv@useOBox
+ \global\let\hvObjectBox\hvOBox
+ \else
+ \global\savebox\hvObjectBox{\hv@floatObject}%
+ \fi
\noindent
+ \global\setlength\hv@tempWidthA{\the\dimexpr1in+\oddsidemargin-\hvSet@bindCorrection}%
+ \global\setlength\hv@leftPageObjectWidth{\the\dimexpr\paperwidth-1in-\evensidemargin-\hvSet@bindCorrection}%
\clipbox*{0 -\depth{} \hv@leftPageObjectWidth{} \height}{\usebox\hvObjectBox}%
\null\newpage\if@twocolumn\null\newpage\fi
\expandafter\global\expandafter\savebox\expandafter\hvObjectBox\expandafter{\ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}%
\noindent
\hspace*{\dimexpr-\hv@tempWidthA}%
- \clipbox*{\the\hv@leftPageObjectWidth{} -\depth{} \width{} \height{}}{\usebox\hvObjectBox}%
+ \clipbox*{\the\hv@leftPageObjectWidth{} -\depth{} \width{} \height{}}{\usebox\hvObjectBox}%
\begingroup
\ifnum#1>0
\medskip
diff --git a/macros/latex/contrib/kdpbook/DEPENDS.txt b/macros/latex/contrib/kdpbook/DEPENDS.txt
index 2be9f7df5e..75af288d41 100644
--- a/macros/latex/contrib/kdpbook/DEPENDS.txt
+++ b/macros/latex/contrib/kdpbook/DEPENDS.txt
@@ -1,4 +1,4 @@
-hard shellesc
+hard iexec
hard xkeyval
hard anyfontsize
hard tikz
diff --git a/macros/latex/contrib/kdpbook/README.md b/macros/latex/contrib/kdpbook/README.md
index 5c5765b4fc..a3fe02d0f9 100644
--- a/macros/latex/contrib/kdpbook/README.md
+++ b/macros/latex/contrib/kdpbook/README.md
@@ -1,4 +1,4 @@
-[![make](https://github.com/yegor256/kdpcover/actions/workflows/make.yml/badge.svg)](https://github.com/yegor256/kdpcover/actions/workflows/make.yml)
+[![make](https://github.com/yegor256/kdpcover/actions/workflows/latexmk.yml/badge.svg)](https://github.com/yegor256/kdpcover/actions/workflows/latexmk.yml)
[![License](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/yegor256/kdpcover/blob/master/LICENSE.txt)
This LaTeX class I use to format covers for [my books](https://www.yegor256.com/books.html),
@@ -7,7 +7,7 @@ The problem this class solves is [the necessity](https://kdp.amazon.com/en_US/he
to change the size of the cover PDF respectfully
to the number of pages in the book — the bigger
the book, the larger must be the cover. The provided class makes necessary
-calculations on-fly, using the `qpdf` took from GhostScript. Obviously,
+calculations on-fly, using the [`qpdf`](http://qpdf.sourceforge.net/) tool. Obviously,
you need to have it installed. Also, you must
run `pdflatex` with the `--shell-escape` option, in order to allow LaTeX to run `qpdf`.
@@ -18,14 +18,15 @@ and then use in the preamble:
```tex
\documentclass[pdf=my-book.pdf]{kdpcover}
\begin{document}
-% Here you print the cover as you with, but I recommend
+% Here you print the cover as you wish, but I recommend
% you to use the commands available in the class, such as:
\putSpine{my book, vol. 1}
\putAuthor{Yegor Bugayenko}
\end{document}
```
-The full example and all commands are available in the `kdpcover.tex` file.
+The full example and all commands are available in the
+[`kdpcover.tex`](https://github.com/yegor256/kdpcover/blob/master/kdpcover.tex) file.
If you want to contribute yourself, make a fork, then create a branch,
then run `make` in the root directory.
diff --git a/macros/latex/contrib/kdpbook/images/signature.pdf b/macros/latex/contrib/kdpbook/kdpcover-signature.pdf
index af185666b2..af185666b2 100644
--- a/macros/latex/contrib/kdpbook/images/signature.pdf
+++ b/macros/latex/contrib/kdpbook/kdpcover-signature.pdf
Binary files differ
diff --git a/macros/latex/contrib/kdpbook/images/volume-1.pdf b/macros/latex/contrib/kdpbook/kdpcover-vol-1.pdf
index 8ccf53f517..8ccf53f517 100644
--- a/macros/latex/contrib/kdpbook/images/volume-1.pdf
+++ b/macros/latex/contrib/kdpbook/kdpcover-vol-1.pdf
Binary files differ
diff --git a/macros/latex/contrib/kdpbook/images/volume-2.pdf b/macros/latex/contrib/kdpbook/kdpcover-vol-2.pdf
index 4dd3c14199..4dd3c14199 100644
--- a/macros/latex/contrib/kdpbook/images/volume-2.pdf
+++ b/macros/latex/contrib/kdpbook/kdpcover-vol-2.pdf
Binary files differ
diff --git a/macros/latex/contrib/kdpbook/images/volume-3.pdf b/macros/latex/contrib/kdpbook/kdpcover-vol-3.pdf
index a554387e49..a554387e49 100644
--- a/macros/latex/contrib/kdpbook/images/volume-3.pdf
+++ b/macros/latex/contrib/kdpbook/kdpcover-vol-3.pdf
Binary files differ
diff --git a/macros/latex/contrib/kdpbook/images/volume-4.pdf b/macros/latex/contrib/kdpbook/kdpcover-vol-4.pdf
index a2d12b0d43..a2d12b0d43 100644
--- a/macros/latex/contrib/kdpbook/images/volume-4.pdf
+++ b/macros/latex/contrib/kdpbook/kdpcover-vol-4.pdf
Binary files differ
diff --git a/macros/latex/contrib/kdpbook/kdpcover.cls b/macros/latex/contrib/kdpbook/kdpcover.cls
index 91603e47bf..1e33276217 100644
--- a/macros/latex/contrib/kdpbook/kdpcover.cls
+++ b/macros/latex/contrib/kdpbook/kdpcover.cls
@@ -21,34 +21,18 @@
% SOFTWARE.
\NeedsTeXFormat{LaTeX2e}
-\ProvidesClass{kdpcover}[2021/06/04 0.1.0 Cover for KDP book]
+\ProvidesClass{kdpcover}[2021/07/14 0.2.1 Cover for KDP book]
\LoadClass{article}
\newcommand*\kdppages{100}
\newlength\kdpxsize
\newlength\kdpysize
-\RequirePackage{shellesc}
+\RequirePackage{iexec}
\RequirePackage{xkeyval}
-\DeclareOptionX{6x9}{
- \setlength\kdpxsize{6in}
- \setlength\kdpysize{9in}
-}
+\DeclareOptionX{6x9}{\setlength\kdpxsize{6in}\setlength\kdpysize{9in}}
\DeclareOptionX{pages}{\renewcommand*\kdppages{#1}}
-\makeatletter\newcommand{\kdpexec}[3][1=]{%
- \begingroup
- \let\%\@percentchar
- \let\{\@charlb
- \let\}\@charrb
- \ShellEscape{#3 > #2}%
- \endgroup%
- \ifthenelse{\isempty{#1}}{\input{#2}}{}%
-}\makeatother
-\makeatletter\let\primitiveinput\@@input\makeatother%
-\DeclareOptionX{pdf}{
- \kdpexec[noprint]{totalpages.exc}{qpdf --show-npages #1 | tr -d '[[:space:]]' | \{ cat; echo \%; \}}%
- \renewcommand{\kdppages}{\primitiveinput totalpages.exc }
-}
+\DeclareOptionX{pdf}{\renewcommand*{\kdppages}{\iexec{qpdf --show-npages #1 | tr -d '[[:space:]]' | \{ cat; echo \%; \}}}}
\ProcessOptionsX\relax
\RequirePackage{anyfontsize}
@@ -74,7 +58,7 @@
\RequirePackage[absolute]{textpos}
\TPGrid{16}{16}
-\newcommand\putSpine[2]{
+\newcommand\putSpine[2][kdpcover-signature]{
\begin{textblock}{2.4}[0.5,0](8,0)
\begin{tikzpicture}
\node [rectangle, inner sep=0em, fill=black, minimum width=2.4\TPHorizModule, minimum height=16\TPVertModule] at (0,0) {};
@@ -88,7 +72,7 @@
\end{tikzpicture}
\end{textblock}
\begin{textblock}{2.4}[0.5,1](8,14)
- \centerline{\includegraphics[width=0.32in]{#2}}
+ \centerline{\includegraphics[width=0.32in]{#1}}
\end{textblock}
}
@@ -101,7 +85,7 @@
\newcommand\putVolume[1]{
\begin{textblock}{2}[1,1](15,14)
\raggedleft
- \includegraphics[height=0.4in]{images/volume-#1}
+ \includegraphics[height=0.4in]{kdpcover-vol-#1}
\end{textblock}
}
@@ -139,7 +123,7 @@
\begin{textblock}{4}[0,1](10,14)
#1
\quad
- \kdpexec[]{date.exc}{git log -n 1 --pretty='format:\%ad' --date='format:\%e-\%b-\%Y'}
+ \iexec{git log -n 1 --pretty='format:\%ad' --date='format:\%e-\%b-\%Y'}
\end{textblock}
}
diff --git a/macros/latex/contrib/kdpbook/kdpcover.pdf b/macros/latex/contrib/kdpbook/kdpcover.pdf
index 7c9f844d5a..0b99980c10 100644
--- a/macros/latex/contrib/kdpbook/kdpcover.pdf
+++ b/macros/latex/contrib/kdpbook/kdpcover.pdf
Binary files differ
diff --git a/macros/latex/contrib/kdpbook/kdpcover.tex b/macros/latex/contrib/kdpbook/kdpcover.tex
index ef2c073d60..93b9f91eac 100644
--- a/macros/latex/contrib/kdpbook/kdpcover.tex
+++ b/macros/latex/contrib/kdpbook/kdpcover.tex
@@ -28,7 +28,7 @@
% a good practice to mention the volume number at the end of the text,
% if you have more than one volume, e.g. "my book, vol. 1". I suggest
% using small caps in the text only.
-\putSpine{kdpcover, a LaTeX class for KDP books}{./images/signature}
+\putSpine{kdpcover, a LaTeX class for KDP books}
% This one prints the volume picture. It is intentionally made large,
% in order to make it obvious.
@@ -37,7 +37,7 @@
% Here we print the version and it will also add the date of the latest
% Git commit in the current directory. If it's not a Git repository,
% the date won't be printed.
-\putVersion{0.1.0}
+\putVersion{0.2.1}
% This prints the price, which is a good practice to mention, I believe.
\putPrice{\$0.00}
diff --git a/macros/luatex/latex/pyluatex/interpreter.py b/macros/luatex/latex/pyluatex/pyluatex-interpreter.py
index 4a17b5f5b0..4a17b5f5b0 100644
--- a/macros/luatex/latex/pyluatex/interpreter.py
+++ b/macros/luatex/latex/pyluatex/pyluatex-interpreter.py
diff --git a/macros/luatex/latex/pyluatex/json.lua b/macros/luatex/latex/pyluatex/pyluatex-json.lua
index 711ef78619..711ef78619 100644
--- a/macros/luatex/latex/pyluatex/json.lua
+++ b/macros/luatex/latex/pyluatex/pyluatex-json.lua
diff --git a/macros/luatex/latex/pyluatex/pyluatex.lua b/macros/luatex/latex/pyluatex/pyluatex.lua
index 01a06f548e..07d8ea49d3 100644
--- a/macros/luatex/latex/pyluatex/pyluatex.lua
+++ b/macros/luatex/latex/pyluatex/pyluatex.lua
@@ -22,7 +22,7 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
--]]
-local json = require("json")
+local json = require("pyluatex-json")
local socket = require("socket")
pyluatex = pyluatex or {
@@ -32,7 +32,7 @@ pyluatex = pyluatex or {
-- status.filename: path to pyluatex.sty
local folder = file.pathpart(file.collapsepath(status.filename, true))
-local script = file.join(folder, "interpreter.py")
+local script = file.join(folder, "pyluatex-interpreter.py")
local tcp = nil
local python_lines = {}
diff --git a/macros/luatex/latex/pyluatex/pyluatex.pdf b/macros/luatex/latex/pyluatex/pyluatex.pdf
index bfb1a27576..2ff342d0f8 100644
--- a/macros/luatex/latex/pyluatex/pyluatex.pdf
+++ b/macros/luatex/latex/pyluatex/pyluatex.pdf
Binary files differ
diff --git a/macros/luatex/latex/pyluatex/pyluatex.sty b/macros/luatex/latex/pyluatex/pyluatex.sty
index b5c8298bca..752f19d0e7 100644
--- a/macros/luatex/latex/pyluatex/pyluatex.sty
+++ b/macros/luatex/latex/pyluatex/pyluatex.sty
@@ -9,7 +9,7 @@
%% version 2005/12/01 or later.
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{pyluatex}[2021/07/12 v0.1.1 Execute Python code on the fly]
+\ProvidesPackage{pyluatex}[2021/07/14 v0.1.2 Execute Python code on the fly]
\RequirePackage{expl3}
\ExplSyntaxOn
diff --git a/macros/luatex/latex/pyluatex/pyluatex.tex b/macros/luatex/latex/pyluatex/pyluatex.tex
index 4552698539..a6a66fbde2 100644
--- a/macros/luatex/latex/pyluatex/pyluatex.tex
+++ b/macros/luatex/latex/pyluatex/pyluatex.tex
@@ -15,7 +15,7 @@
\usepackage{url}
\title{The \emph{pyluatex} package}
\author{Tobias Enderle\\\url{https://github.com/tndrle/PyLuaTeX}}
-\date{v0.1.1 (2021/07/12)}
+\date{v0.1.2 (2021/07/14)}
\begin{document}
\maketitle
\raggedright
@@ -91,8 +91,8 @@ The final folder structure must be
\begin{tcblisting}{breakable,listing only,
size=fbox,colframe=black!8,boxrule=3pt,colback=black!8}
TEXMF/tex/latex/pyluatex/
-|-- interpreter.py
-|-- json.lua
+|-- pyluatex-interpreter.py
+|-- pyluatex-json.lua
|-- pyluatex.lua
|-- pyluatex.sty
|-- ...