summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/longdivision
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2023-10-22 03:01:19 +0000
committerNorbert Preining <norbert@preining.info>2023-10-22 03:01:19 +0000
commitd42d70e713e5b740e457a4d56e4dad6e5e0e9b94 (patch)
tree020391925db7b9afead4249591b40fc4fa292da0 /macros/latex/contrib/longdivision
parent6deeaf1bda76263051b929f5d5401c98d85e74ef (diff)
CTAN sync 202310220301
Diffstat (limited to 'macros/latex/contrib/longdivision')
-rw-r--r--macros/latex/contrib/longdivision/README.md10
-rw-r--r--macros/latex/contrib/longdivision/longdivision.sty30
-rw-r--r--macros/latex/contrib/longdivision/longdivision_manual.pdfbin152721 -> 159288 bytes
-rw-r--r--macros/latex/contrib/longdivision/longdivision_manual.tex2
4 files changed, 34 insertions, 8 deletions
diff --git a/macros/latex/contrib/longdivision/README.md b/macros/latex/contrib/longdivision/README.md
index b25cec2d36..84dbff5a02 100644
--- a/macros/latex/contrib/longdivision/README.md
+++ b/macros/latex/contrib/longdivision/README.md
@@ -1,8 +1,8 @@
-longdivision v1.2.0
+longdivision v1.2.2
========================
Author: Hood Chatham
Email: hood@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 @@ The current development copy is hosted at https://github.com/hoodmane/longdivisi
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.
diff --git a/macros/latex/contrib/longdivision/longdivision.sty b/macros/latex/contrib/longdivision/longdivision.sty
index 114417fd62..3599fc5f9b 100644
--- a/macros/latex/contrib/longdivision/longdivision.sty
+++ b/macros/latex/contrib/longdivision/longdivision.sty
@@ -1,7 +1,7 @@
-%% Package: longdivision.sty version 1.2.1
+%% Package: longdivision.sty version 1.2.2
%% Author: Hood Chatham
%% Email: hood@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 } { } }
diff --git a/macros/latex/contrib/longdivision/longdivision_manual.pdf b/macros/latex/contrib/longdivision/longdivision_manual.pdf
index 21e6b7a06c..324aa6908f 100644
--- a/macros/latex/contrib/longdivision/longdivision_manual.pdf
+++ b/macros/latex/contrib/longdivision/longdivision_manual.pdf
Binary files differ
diff --git a/macros/latex/contrib/longdivision/longdivision_manual.tex b/macros/latex/contrib/longdivision/longdivision_manual.tex
index 325e2b993a..690744909e 100644
--- a/macros/latex/contrib/longdivision/longdivision_manual.tex
+++ b/macros/latex/contrib/longdivision/longdivision_manual.tex
@@ -1,5 +1,5 @@
\documentclass{ltxdoc}
-\def\version{Version 1.2.1}
+\def\version{Version 1.2.2}
\let\ifluatex\relax
\usepackage{ifluatex}