texlive[68609] Master/texmf-dist: longdivision (21oct23)

commits+karl at tug.org commits+karl at tug.org
Sat Oct 21 22:17:03 CEST 2023


Revision: 68609
          https://tug.org/svn/texlive?view=revision&revision=68609
Author:   karl
Date:     2023-10-21 22:17:03 +0200 (Sat, 21 Oct 2023)
Log Message:
-----------
longdivision (21oct23)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/longdivision/README.md
    trunk/Master/texmf-dist/doc/latex/longdivision/longdivision_manual.pdf
    trunk/Master/texmf-dist/doc/latex/longdivision/longdivision_manual.tex
    trunk/Master/texmf-dist/tex/latex/longdivision/longdivision.sty

Modified: trunk/Master/texmf-dist/doc/latex/longdivision/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/longdivision/README.md	2023-10-21 20:16:54 UTC (rev 68608)
+++ trunk/Master/texmf-dist/doc/latex/longdivision/README.md	2023-10-21 20:17:03 UTC (rev 68609)
@@ -1,8 +1,8 @@
-longdivision v1.2.0
+longdivision v1.2.2
 ========================
 Author: Hood Chatham
 Email: hood at mit.edu
-Date: 2020-05-09
+Date: 2023-10-21
 Description: 
 License: All files have the Latex Project Public License.
 Files:
@@ -41,6 +41,12 @@
 
 Changelog:
 ==========
+## [1.2.1](2023-10-21)
+### Fixed:
+- The decimal separator no longer goes missing when the "stage" is set to a low
+  enough number that digits after the decimal separator are not inspected.
+- Added "brazilian" style (contributed by gh-user Felipe-Math)
+
 ## [1.2.1](2021-07-17)
 ### Fixed:
 - The stage option works again.

Modified: trunk/Master/texmf-dist/doc/latex/longdivision/longdivision_manual.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/longdivision/longdivision_manual.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/longdivision/longdivision_manual.tex	2023-10-21 20:16:54 UTC (rev 68608)
+++ trunk/Master/texmf-dist/doc/latex/longdivision/longdivision_manual.tex	2023-10-21 20:17:03 UTC (rev 68609)
@@ -1,5 +1,5 @@
 \documentclass{ltxdoc}
-\def\version{Version 1.2.1}
+\def\version{Version 1.2.2}
 
 \let\ifluatex\relax
 \usepackage{ifluatex}

Modified: trunk/Master/texmf-dist/tex/latex/longdivision/longdivision.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/longdivision/longdivision.sty	2023-10-21 20:16:54 UTC (rev 68608)
+++ trunk/Master/texmf-dist/tex/latex/longdivision/longdivision.sty	2023-10-21 20:17:03 UTC (rev 68609)
@@ -1,7 +1,7 @@
-%% Package: longdivision.sty version 1.2.1
+%% Package: longdivision.sty version 1.2.2
 %% Author: Hood Chatham
 %% Email: hood at mit.edu
-%% Date: 2021-07-17
+%% Date: 2023-10-21
 %% License: Latex Project Public License
 
 
@@ -243,6 +243,8 @@
 % Note that \int_eval:n wouldn't work here because it inserts a "\relax" token that would not get eaten by \numexpr if
 % #1 contains a decimal point. This "\relax" causes trouble for the division main loop.
 \cs_new:Nn \longdiv_start_i:nn {
+    % As a side effect, longdiv_if_decimal_number locates the decimal point.
+    % This is used by \longdiv_insert_separators
     \longdiv_if_decimal_number:nF { #1 } {
         \longdiv_error:nwnn { dividend_invalid }
     }
@@ -269,9 +271,12 @@
 }
 
 
-% Parse through the dividend token by token
-% Check that every token is a digit with the exception of at most one .
+% Parse through the dividend token by token Check that every token is a digit
+% with the exception of at most one . While we're at it, record the location of
+% the decimal separator. Note that this odd side effect means if we used it more
+% than once we'd have to rearrange this.
 \prg_new_conditional:Nnn \longdiv_if_decimal_number:n { F } {
+    \int_set_eq:NN \l__longdiv_point_digit_dividend_int { 0 }
     \longdiv_if_decimal_number_before_point:N #1 \q_stop
 }
 
@@ -282,6 +287,8 @@
         \longdiv_if_token_is_decimal_separator:NTF #1 {
             \longdiv_if_decimal_number_seen_point:N
         }{
+            % Saw another digit before decimal separator
+            \int_incr:N \l__longdiv_point_digit_dividend_int
             \longdiv_if_digit:nF { #1 }{
                 \prg_return_false:
                 \use_none_delimit_by_q_stop:w
@@ -395,7 +402,6 @@
     \bool_if:NF \l__longdiv_seen_digit_bool {
         \tl_put_right:Nn \l__longdiv_quotient_tl { 0 } % Add a leading zero
     }
-    \int_set_eq:NN \l__longdiv_point_digit_dividend_int { \l__longdiv_position_int } % Record the position of the point
     \bool_set_true:N \l__longdiv_seen_point_bool
     \int_set:Nn \l__longdiv_point_digit_quotient_int { \tl_count:N \l__longdiv_quotient_tl }
 }
@@ -951,6 +957,20 @@
     }
 }
 
+% Credit Felipe-Math
+% https://github.com/hoodmane/longdivision/issues/9
+\longdiv_define_style:nn { brazilian } {
+    \begingroup
+    \def\arraystretch{1.1}
+    \begin{tabular}{@{}ll}
+        \longdivdividend & \multicolumn{1}{|l}{\longdivdivisor}\\\cline{2-2}
+        & \longdivquotient\\[-\arraystretch\baselineskip]
+        \longdivwork &
+    \end{tabular}%
+    \endgroup
+}
+
+
 \bool_new:N \l__longdiv_is_tikz_loaded_bool
 \AtBeginDocument{ \@ifpackageloaded { tikz }{ \bool_gset_true:N \l__longdiv_is_tikz_loaded_bool } { } }
 



More information about the tex-live-commits mailing list.