texlive[73287] Master/texmf-dist: scaletextbullet (3jan25)
commits+karl at tug.org
commits+karl at tug.org
Fri Jan 3 23:49:05 CET 2025
Revision: 73287
https://tug.org/svn/texlive?view=revision&revision=73287
Author: karl
Date: 2025-01-03 23:49:05 +0100 (Fri, 03 Jan 2025)
Log Message:
-----------
scaletextbullet (3jan25)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/latex/scaletextbullet/CHANGELOG.md
trunk/Master/texmf-dist/doc/latex/scaletextbullet/README.txt
trunk/Master/texmf-dist/doc/latex/scaletextbullet/beery.cls
trunk/Master/texmf-dist/doc/latex/scaletextbullet/scaletextbullet.pdf
trunk/Master/texmf-dist/doc/latex/scaletextbullet/scaletextbullet.tex
trunk/Master/texmf-dist/tex/latex/scaletextbullet/scaletextbullet.sty
Modified: trunk/Master/texmf-dist/doc/latex/scaletextbullet/CHANGELOG.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/scaletextbullet/CHANGELOG.md 2025-01-03 22:48:56 UTC (rev 73286)
+++ trunk/Master/texmf-dist/doc/latex/scaletextbullet/CHANGELOG.md 2025-01-03 22:49:05 UTC (rev 73287)
@@ -7,6 +7,14 @@
## [Unreleased]
+## [v1.0.4] - 2025-01-03
+
+### Changed
+- The internal function that scales of the size of the `\textbullet` without
+ moving its vertical center now uses more accurate floating point
+ computations.
+- Code improvements.
+
## [v1.0.3] - 2024-12-09
### Changed
Modified: trunk/Master/texmf-dist/doc/latex/scaletextbullet/README.txt
===================================================================
--- trunk/Master/texmf-dist/doc/latex/scaletextbullet/README.txt 2025-01-03 22:48:56 UTC (rev 73286)
+++ trunk/Master/texmf-dist/doc/latex/scaletextbullet/README.txt 2025-01-03 22:49:05 UTC (rev 73287)
@@ -1,6 +1,6 @@
Package: scaletextbullet -- Resize the \textbullet without changing its
vertical center
-Copyright: 2024 (c) Oliver Beery <beeryoliver at gmail.com>
+Copyright: 2024-2025 (c) Oliver Beery <beeryoliver at gmail.com>
CTAN: https://ctan.org/pkg/scaletextbullet
Repository: https://github.com/beeryoliver/scaletextbullet
License: The LaTeX Project Public License 1.3c
Modified: trunk/Master/texmf-dist/doc/latex/scaletextbullet/beery.cls
===================================================================
--- trunk/Master/texmf-dist/doc/latex/scaletextbullet/beery.cls 2025-01-03 22:48:56 UTC (rev 73286)
+++ trunk/Master/texmf-dist/doc/latex/scaletextbullet/beery.cls 2025-01-03 22:49:05 UTC (rev 73287)
@@ -4,7 +4,7 @@
\NeedsTeXFormat{LaTeX2e}[2023-11-01]
\ProvidesExplClass
{beery}
- {2024-12-09}
+ {2025-01-03}
{}
{}
@@ -43,7 +43,8 @@
\tl_const:Nn \c_beery_alphabet_tl { abcdefghijklmnopqrstuvwxyz }
\NewExpandableDocumentCommand \alphabet { } { \c_beery_alphabet_tl }
-\NewDocumentCommand \Key { m o o }
+\NewDocumentCommand \Key
+ { >{ \TrimSpaces } m >{ \TrimSpaces } o >{ \TrimSpaces } o }
{
\mode_leave_vertical:
\group_begin:
@@ -57,10 +58,12 @@
{ #1 $\,=\,$ #2 \hspace* { \fill } \hbox:n { initial $\,=\,$ #3 } }
\group_end:
}
-\NewDocumentCommand \Value { m } { \texttt {#1} }
-\NewDocumentCommand \cmd { m } { \texttt { \token_to_str:N #1 } \@ }
-\NewDocumentCommand \cs { m } { \texttt { \token_to_str:c {#1} } \@ }
-\NewDocumentCommand \marg { m }
+\NewDocumentCommand \Value { >{ \TrimSpaces } m } { \texttt {#1} }
+\NewDocumentCommand \cmd { >{ \TrimSpaces } m }
+ { \texttt { \token_to_str:N #1 } \@ }
+\NewDocumentCommand \cs { >{ \TrimSpaces } m }
+ { \texttt { \token_to_str:c {#1} } \@ }
+\NewDocumentCommand \marg { >{ \TrimSpaces } m }
{
\allowbreak
\texttt { \c_left_brace_str }
@@ -69,7 +72,7 @@
$\rangle$
\texttt { \c_right_brace_str }
}
-\NewDocumentCommand \oarg { m }
+\NewDocumentCommand \oarg { >{ \TrimSpaces } m }
{
\allowbreak
\texttt { [ }
@@ -79,16 +82,16 @@
\texttt { ] }
}
\NewDocumentCommand \sarg { } { $\langle$ \texttt {*} $\rangle$ }
-\NewDocumentCommand \meta { m }
+\NewDocumentCommand \meta { >{ \TrimSpaces } m }
{
$\langle$
{ \normalfont \itshape #1 }
$\rangle$
}
-\NewDocumentCommand \cls { m } { \textsf {#1} }
-\NewDocumentCommand \env { m } { \texttt {#1} }
-\NewDocumentCommand \pkg { m } { \textsf {#1} }
-\NewDocumentCommand \latin { m } { \textit {#1} }
+\NewDocumentCommand \cls { >{ \TrimSpaces } m } { \textsf {#1} }
+\NewDocumentCommand \env { >{ \TrimSpaces } m } { \texttt {#1} }
+\NewDocumentCommand \pkg { >{ \TrimSpaces } m } { \textsf {#1} }
+\NewDocumentCommand \latin { >{ \TrimSpaces } m } { \textit {#1} }
% PAGE STYLE
@@ -97,13 +100,19 @@
\dim_log:N \c_beery_alphabet_dim
\dim_const:Nn \c_beery_big_dim { \l_fontscale_normalsize_baselineskip_skip }
-\dim_const:Nn \c_beery_medium_dim { \c_beery_big_dim / 2 }
-\dim_const:Nn \c_beery_small_dim { \c_beery_big_dim / 4 }
+\dim_const:Nn \c_beery_medium_dim
+ { \fp_to_dim:n { \dim_to_fp:n { \c_beery_big_dim / 2 } } }
+\dim_const:Nn \c_beery_small_dim
+ { \fp_to_dim:n { \dim_to_fp:n { \c_beery_big_dim / 4 } } }
+\dim_log:N \c_beery_big_dim
+\dim_log:N \c_beery_medium_dim
+\dim_log:N \c_beery_small_dim
+
\skip_const:Nn \c_beery_big_skip
{
\c_beery_big_dim
- plus \dim_eval:n { \c_beery_big_dim / 2 }
- minus \dim_eval:n { \c_beery_big_dim / 3 }
+ plus \fp_to_dim:n { \dim_to_fp:n { \c_beery_big_dim } / 2 }
+ minus \fp_to_dim:n { \dim_to_fp:n { \c_beery_big_dim } / 3 }
}
\skip_const:Nn \c_beery_medium_skip { \c_beery_big_skip / 2 }
\skip_const:Nn \c_beery_small_skip { \c_beery_big_skip / 4 }
@@ -110,6 +119,9 @@
\skip_set_eq:NN \bigskipamount \c_beery_big_skip
\skip_set_eq:NN \medskipamount \c_beery_medium_skip
\skip_set_eq:NN \smallskipamount \c_beery_small_skip
+\skip_log:N \c_beery_big_skip
+\skip_log:N \c_beery_medium_skip
+\skip_log:N \c_beery_small_skip
\raggedbottom
\int_set:Nn \vbadness { 100 }
@@ -121,10 +133,10 @@
{
a4paper
, textwidth =
- \dim_eval:n { \fp_to_dim:n { \c_e_fp * \c_beery_alphabet_dim } }
+ \fp_to_dim:n { \c_e_fp * \dim_to_fp:n { \c_beery_alphabet_dim } }
, textheight =
- \dim_eval:n
- { \fp_to_dim:n { 1.6180 * \c_e_fp * \c_beery_alphabet_dim } }
+ \fp_to_dim:n
+ { 1.6180 * \c_e_fp * \dim_to_fp:n { \c_beery_alphabet_dim } }
, heightrounded
, centering
, headheight = \l_fontscale_footnotesize_baselineskip_skip
@@ -137,7 +149,7 @@
\RequirePackage { fancyhdr }
\pagestyle { fancy }
\fancyhf { }
-\cs_set:Npn \headrulewidth { 0pt }
+\renewcommand \headrulewidth { 0pt }
\fancyfoot [ C ]
{ \footnotesize \thepage \c_space_tl of~ \pageref { LastPage } }
@@ -145,8 +157,7 @@
\nonfrenchspacing
\linespread { 1 }
-\skip_set_eq:NN \parskip \c_beery_medium_skip
-\dim_zero:N \parindent
+\RequirePackage [ skip = \c_beery_medium_skip ] { parskip }
\RequirePackage [ raggedrightboxes ] { ragged2e }
\skip_set:Nn \RaggedRightRightskip { 0pt plus 0.5 \linewidth }
\dim_zero:N \RaggedRightParindent
@@ -170,21 +181,19 @@
\titlespacing* \section % section
{ 0pt } % indent
{
- - \parskip
- + \c_beery_big_dim
- plus \fp_eval:n { 1 / 2 * 4 } \c_beery_big_dim
- minus \fp_eval:n { 1 / 3 / 4 } \c_beery_big_dim
+ \c_beery_big_dim
+ plus \fp_to_dim:n { 1 / 2 * 4 * \dim_to_fp:n { \c_beery_big_dim } }
+ minus \fp_to_dim:n { 1 / 3 / 4 * \dim_to_fp:n { \c_beery_big_dim } }
} % before
- { - \parskip + \c_beery_medium_skip } % after
+ { \c_beery_medium_skip } % after
\titlespacing* \subsection
{ 0pt }
{
- - \parskip
- + \fp_eval:n { 4 / 3 } \c_beery_medium_dim
- plus \fp_eval:n { 1 / 2 * 4 } \c_beery_medium_dim
- minus \fp_eval:n { 1 / 3 / 4 } \c_beery_medium_dim
+ \fp_to_dim:n { 4 / 3 * \dim_to_fp:n { \c_beery_medium_dim } }
+ plus \fp_to_dim:n { 1 / 2 * 4 * \dim_to_fp:n { \c_beery_medium_dim } }
+ minus \fp_to_dim:n { 1 / 3 / 4 * \dim_to_fp:n { \c_beery_medium_dim } }
}
- { - \parskip + \c_beery_medium_skip }
+ { \c_beery_medium_skip }
\titleformat \section % section
[ block ] % shape
@@ -250,8 +259,9 @@
\renewcommand \topfraction { 1 }
\skip_set:Nn \textfloatsep
{
- \c_beery_big_dim plus \c_beery_big_dim minus
- \dim_eval:n { \c_beery_big_dim / 3 }
+ \c_beery_big_dim
+ plus \c_beery_big_dim
+ minus \fp_to_dim:n { \dim_to_fp:n { \c_beery_big_dim } / 3 }
}
\RequirePackage { tabularray }
@@ -265,10 +275,14 @@
\dim_set:Nn \footnotesep { \f at linespread \footnotesep }
\coffin_new:N \l__beery_footnote_coffin
% 1.2 = baselineskip-size-ratio
+% \f at linespread must not be empty here
\dim_const:Nn \c_beery_footnote_baselineheight_dim
{
\fp_to_dim:n
- { ( 1.2 * \f at linespread - 1 ) * \l_fontscale_footnotesize_size_dim }
+ {
+ ( 1.2 * \f at linespread - 1 )
+ * \dim_to_fp:n { \l_fontscale_footnotesize_size_dim }
+ }
}
\RenewDocumentCommand \@makefntext { +m }
{
@@ -280,7 +294,8 @@
{
\fp_to_dim:n
{
- ( 1 - \l_fontscale_footnotesize_scale_fp ) / 2 * \textwidth
+ ( 1 - \l_fontscale_footnotesize_scale_fp ) / 2
+ * \dim_to_fp:n { \textwidth }
}
}
\dim_set_eq:NN \rightmargin \leftmargin
Modified: trunk/Master/texmf-dist/doc/latex/scaletextbullet/scaletextbullet.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/latex/scaletextbullet/scaletextbullet.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/scaletextbullet/scaletextbullet.tex 2025-01-03 22:48:56 UTC (rev 73286)
+++ trunk/Master/texmf-dist/doc/latex/scaletextbullet/scaletextbullet.tex 2025-01-03 22:49:05 UTC (rev 73287)
@@ -16,7 +16,7 @@
Oliver Beery
-Version 1.0.3\quad{}9 December 2024
+Version 1.0.4\quad{}3 January 2025
\section{Introduction}
Modified: trunk/Master/texmf-dist/tex/latex/scaletextbullet/scaletextbullet.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/scaletextbullet/scaletextbullet.sty 2025-01-03 22:48:56 UTC (rev 73286)
+++ trunk/Master/texmf-dist/tex/latex/scaletextbullet/scaletextbullet.sty 2025-01-03 22:49:05 UTC (rev 73287)
@@ -1,6 +1,6 @@
% Package : scaletextbullet -- Resize the \textbullet without changing its
% vertical center
-% Copyright : 2024 (c) Oliver Beery <beeryoliver at gmail.com>
+% Copyright : 2024-2025 (c) Oliver Beery <beeryoliver at gmail.com>
% CTAN : https://ctan.org/pkg/scaletextbullet
% Repository: https://github.com/beeryoliver/scaletextbullet
% License : The LaTeX Project Public License 1.3c
@@ -9,8 +9,8 @@
\NeedsTeXFormat{LaTeX2e}[2023-11-01]
\ProvidesExplPackage
{scaletextbullet}
- {2024-12-09}
- {1.0.3}
+ {2025-01-03}
+ {1.0.4}
{Resize the \noexpand\textbullet without changing its vertical center.}
% l3kernel version 2023-10-10 added many 'e'-variants.
@@ -27,16 +27,26 @@
% This package does not require any other packages!
+% MESSAGES
+
+\msg_new:nnn { scaletextbullet } { factor-out-of-bounds }
+ { Invalid~ \iow_char:N \\textbullet~ factor~ '#1'~ \msg_line_context:. }
+\msg_new:nnn { scaletextbullet } { scale-out-of-bounds }
+ { Invalid~ scale~ factor~ '#1'~ \msg_line_context:. }
+\msg_new:nnn { scaletextbullet } { count-out-of-bounds }
+ {
+ Invalid~ number~ of~ \iow_char:N \\textbullet s~ '#1'~ \msg_line_context:.
+ }
+
% SOME VARIABLES
-\tl_new:N \l__scaletextbullet_factor_tl
-\tl_set:Nn \l__scaletextbullet_factor_tl { 0.4 }
+\fp_new:N \l__scaletextbullet_factor_fp
+\fp_set:Nn \l__scaletextbullet_factor_fp { 0.4 }
-% Used to speed up \ScaleTextBullets{2}, \ScaleTextBullets{3}, and
-% \ScaleTextBullets{4}.
-\fp_const:Nn \c__scaletextbullet_ii_fp { 2 ^ -0.5 }
-\fp_const:Nn \c__scaletextbullet_iii_fp { 3 ^ -0.5 }
-\fp_const:Nn \c__scaletextbullet_iv_fp { 0.5 }
+% Used only to speed up floating point calculations.
+\fp_const:Nn \c__scaletextbullet_one_half_fp { 0.5 }
+\fp_const:Nn \c__scaletextbullet_scaletextbullets_two_fp { 2 ^ -0.5 }
+\fp_const:Nn \c__scaletextbullet_scaletextbullets_three_fp { 3 ^ -0.5 }
% Scratch variables
\int_new:N \l__scaletextbullet_tmp_int
@@ -54,12 +64,12 @@
\q_stop
}
% Argument processor
-\int_new:N \l__scaletextbullet_arg_process_int
\cs_new_protected:Npn \__scaletextbullet_arg_process_int:n #1
{
- \__scaletextbullet_int_set_from_user:Nn \l__scaletextbullet_arg_process_int
- {#1}
- \tl_set:NV \ProcessedArgument \l__scaletextbullet_arg_process_int
+ \group_begin:
+ \__scaletextbullet_int_set_from_user:Nn \l_tmpa_int {#1}
+ \exp_args:NNNV \group_end:
+ \tl_set:Nn \ProcessedArgument \l_tmpa_int
}
% Lowers the \textbullet to the baseline, scales it by a factor of #2, and
% then raises it back to the vertical center.
@@ -71,9 +81,19 @@
{
\hbox_set:Nn #1 { \textbullet }
\dim_set:Nn \l__scaletextbullet_bottom_dim
- { \box_ht:N #1 - \l__scaletextbullet_factor_tl \box_wd:N #1 }
+ {
+ \box_ht:N #1
+ - \fp_to_dim:n
+ { \l__scaletextbullet_factor_fp * \dim_to_fp:n { \box_wd:N #1 } }
+ }
\dim_set:Nn \l__scaletextbullet_center_dim
- { ( \box_ht:N #1 + \l__scaletextbullet_bottom_dim ) / 2 }
+ {
+ \fp_to_dim:n
+ {
+ \dim_to_fp:n { \box_ht:N #1 + \l__scaletextbullet_bottom_dim }
+ * \c__scaletextbullet_one_half_fp
+ }
+ }
\hbox_set:Nn #1
{
\box_move_down:nn { \l__scaletextbullet_bottom_dim } { \box_use:N #1 }
@@ -81,22 +101,18 @@
\box_scale:Nnn #1 {#2} {#2}
\hbox_set:Nn #1
{
- \box_move_up:nn { \l__scaletextbullet_center_dim - 0.5 \box_ht:N #1 }
+ \box_move_up:nn
+ {
+ \l__scaletextbullet_center_dim
+ - \fp_to_dim:n
+ {
+ \dim_to_fp:n { \box_ht:N #1 } * \c__scaletextbullet_one_half_fp
+ }
+ }
{ \box_use:N #1 }
}
}
-% MESSAGES
-
-\msg_new:nnn { scaletextbullet } { factor-out-of-bounds }
- { Invalid~ \iow_char:N \\textbullet~ factor~ '#1'~ \msg_line_context:. }
-\msg_new:nnn { scaletextbullet } { scale-out-of-bounds }
- { Invalid~ scale~ factor~ '#1'~ \msg_line_context:. }
-\msg_new:nnn { scaletextbullet } { count-out-of-bounds }
- {
- Invalid~ number~ of~ \iow_char:N \\textbullet s~ '#1'~ \msg_line_context:.
- }
-
% DOCUMENT COMMANDS
\NewDocumentCommand \SetTextBulletFactor { m }
@@ -103,15 +119,11 @@
{ \__scaletextbullet_set_factor:n {#1} }
\cs_new_protected:Npn \__scaletextbullet_set_factor:n #1
{
- \fp_set:Nn \l__scaletextbullet_tmp_fp {#1}
- \fp_compare:nTF { \c_zero_fp < \l__scaletextbullet_tmp_fp <= \c_one_fp }
+ \fp_set:Nn \l__scaletextbullet_factor_fp {#1}
+ \fp_compare:nF { \c_zero_fp < \l__scaletextbullet_factor_fp <= \c_one_fp }
{
- \tl_set:Ne \l__scaletextbullet_factor_tl
- { \fp_use:N \l__scaletextbullet_tmp_fp }
- }
- {
\msg_error:nne { scaletextbullet } { factor-out-of-bounds }
- { \fp_use:N \l__scaletextbullet_tmp_fp }
+ { \fp_use:N \l__scaletextbullet_factor_fp }
}
}
@@ -124,7 +136,7 @@
{
\__scaletextbullet_box_scale:Nn \l__scaletextbullet_tmp_box
{ \l__scaletextbullet_tmp_fp }
- \box_use_drop:N \l__scaletextbullet_tmp_box
+ \box_use:N \l__scaletextbullet_tmp_box
}
{
\fp_compare:nNnF \l__scaletextbullet_tmp_fp = \c_zero_fp
@@ -155,22 +167,22 @@
{ 2 }
{
\fp_set_eq:NN \l__scaletextbullet_tmp_fp
- \c__scaletextbullet_ii_fp
+ \c__scaletextbullet_scaletextbullets_two_fp
}
{ 3 }
{
\fp_set_eq:NN \l__scaletextbullet_tmp_fp
- \c__scaletextbullet_iii_fp
+ \c__scaletextbullet_scaletextbullets_three_fp
}
{ 4 }
{
\fp_set_eq:NN \l__scaletextbullet_tmp_fp
- \c__scaletextbullet_iv_fp
+ \c__scaletextbullet_one_half_fp
}
}
{
\fp_set:Nn \l__scaletextbullet_tmp_fp
- { \l__scaletextbullet_tmp_int ^ -0.5 }
+ { \int_use:N \l__scaletextbullet_tmp_int ^ -0.5 }
}
\__scaletextbullet_box_scale:Nn \l__scaletextbullet_tmp_box
{ \l__scaletextbullet_tmp_fp }
@@ -178,7 +190,7 @@
{ \box_use:N \l__scaletextbullet_tmp_box }
}
{
- \int_compare:nNnF \l__scaletextbullet_tmp_int = 0
+ \int_if_zero:nF { \l__scaletextbullet_tmp_int }
{
\msg_error:nnV { scaletextbullet } { count-out-of-bounds }
\l__scaletextbullet_tmp_int
@@ -199,7 +211,7 @@
{ \box_use:N \l__scaletextbullet_tmp_box }
}
{
- \int_compare:nNnF \l__scaletextbullet_tmp_int = 0
+ \int_if_zero:nF { \l__scaletextbullet_tmp_int }
{
\msg_error:nnV { scaletextbullet } { count-out-of-bounds }
\l__scaletextbullet_tmp_int
@@ -226,12 +238,17 @@
\fp_set:Nn \l__scaletextbullet_tmp_fp { ##1 ^ -0.5 }
\__scaletextbullet_box_scale:Nn \l__scaletextbullet_tmp_box
{ \l__scaletextbullet_tmp_fp }
- \box_use_drop:N \l__scaletextbullet_tmp_box
+ \box_use:N \l__scaletextbullet_tmp_box
}
\,
\group_begin:
\dim_set:Nn \fboxrule { 0.1pt }
\dim_zero:N \fboxsep
- \framebox [ \l__scaletextbullet_factor_tl \width ] { \textbullet }
+ \framebox
+ [
+ \fp_to_dim:n
+ { \l__scaletextbullet_factor_fp * \dim_to_fp:n { \width } }
+ ]
+ { \textbullet }
\group_end:
}
\ No newline at end of file
More information about the tex-live-commits
mailing list.