summaryrefslogtreecommitdiff
path: root/macros
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2024-09-03 03:03:24 +0000
committerNorbert Preining <norbert@preining.info>2024-09-03 03:03:24 +0000
commitd62e0417014cfe0dc6c41513f5a94be51b84ecc8 (patch)
treec1d2904810ac3af84257bf072218cb8631f13e56 /macros
parent3db8670ef00e32f264e65d1d585ffae78289ee38 (diff)
CTAN sync 202409030303
Diffstat (limited to 'macros')
-rw-r--r--macros/latex/contrib/jwjournal/README.md26
-rw-r--r--macros/latex/contrib/jwjournal/jwjournal-demo-cn.pdfbin125619 -> 129845 bytes
-rw-r--r--macros/latex/contrib/jwjournal/jwjournal-demo-cn.tex4
-rw-r--r--macros/latex/contrib/jwjournal/jwjournal-demo-de.pdfbin0 -> 201988 bytes
-rw-r--r--macros/latex/contrib/jwjournal/jwjournal-demo-de.tex118
-rw-r--r--macros/latex/contrib/jwjournal/jwjournal.cls26
-rw-r--r--macros/latex/contrib/media9/ChangeLog5
-rw-r--r--macros/latex/contrib/media9/doc/media9.pdfbin3685849 -> 3685879 bytes
-rw-r--r--macros/latex/contrib/media9/media9.sty8
-rw-r--r--macros/latex/contrib/media9/pdfbase.sty14
-rw-r--r--macros/latex/contrib/profcollege/doc/profcollege-doc.pdfbin10839547 -> 10843224 bytes
-rw-r--r--macros/latex/contrib/profcollege/latex/PfCBillard.tex17
-rw-r--r--macros/latex/contrib/profcollege/latex/PfCCheque.tex125
-rw-r--r--macros/latex/contrib/profcollege/latex/PfCDecomposerNombrePremier.tex8
-rw-r--r--macros/latex/contrib/profcollege/latex/PfCLego.tex10
-rw-r--r--macros/latex/contrib/profcollege/latex/PfCRepresentationGraphique.tex2
-rw-r--r--macros/latex/contrib/profcollege/latex/PfCRepresenterFraction.tex575
-rw-r--r--macros/latex/contrib/profcollege/latex/ProfCollege.sty5
-rw-r--r--macros/luatex/latex/domaincoloring/Changes2
-rw-r--r--macros/luatex/latex/domaincoloring/doc/domaincoloring-doc.pdfbin3237055 -> 4083668 bytes
-rw-r--r--macros/luatex/latex/domaincoloring/doc/domaincoloring-doc.tex202
-rw-r--r--macros/luatex/latex/domaincoloring/latex/domaincoloring.sty46
-rw-r--r--macros/luatex/latex/domaincoloring/lua/domaincoloring-functions.lua19
-rw-r--r--macros/luatex/latex/domaincoloring/lua/domaincoloring.lua70
24 files changed, 1139 insertions, 143 deletions
diff --git a/macros/latex/contrib/jwjournal/README.md b/macros/latex/contrib/jwjournal/README.md
index 6185459348..f48c6a8745 100644
--- a/macros/latex/contrib/jwjournal/README.md
+++ b/macros/latex/contrib/jwjournal/README.md
@@ -1,7 +1,9 @@
-<!-- Copyright (C) 2023 by Jinwen XU -->
+<!-- Copyright (C) 2023-2024 by Jinwen XU -->
# `jwjournal`, a personal LaTeX class for writing journals
+> Package dependencies: [`enumitem`](https://ctan.org/pkg/enumitem), [*`einfart`*](https://ctan.org/pkg/minimalist), [`minimalist`](https://ctan.org/pkg/minimalist), [`needspace`](https://ctan.org/pkg/needspace), [`projlib`](https://ctan.org/pkg/projlib), [`tcolorbox`](https://ctan.org/pkg/tcolorbox).
+
## Introduction
A typical journal entry produced by `jwjournal` looks like this:
@@ -25,9 +27,9 @@ Codewise, it is as simple as below:
(( <0.45> {example-image-c}
```
-> It is also possible to write the date as `2023/01/01`.
+> It is also possible to write the date with other separators, such as `2023/01/01` or `2023.01.01`.
-> With the options `month-day-year` or `day-month-year`, you can also write date in the format `mm-dd-yyyy` or `dd-mm-yyyy`, respectively. You may refer to the English and French demo documents for examples.
+> With the options `month-day-year` or `day-month-year`, you can also write date in the format `mm-dd-yyyy` or `dd-mm-yyyy`, respectively. You may refer to the English, French and German demo documents for examples.
Every day of the week has its unique color, like this:
![image](https://github.com/Jinwen-XU/jwjournal/raw/main/screenshots/demo2.png)
@@ -44,7 +46,7 @@ By the way, the conversion from plain date string like `2023-01-01` to natural l
The structure of the document is very simple:
```latex
-\documentclass[11pt, paperstyle = light yellow, color entry]{jwjournal}
+\documentclass[11pt, paperstyle = light yellow, color entry, use indent = false]{jwjournal}
\UseLanguage{⟨language⟩} % For English this line can be omitted.
\begin{document}
@@ -62,6 +64,12 @@ The available class options include:
- `color entry` adds more color to the title of each entry;
- `scroll` turns the scroll mode on, which generates a single-page pdf similar to a long screenshot.
+> There are also some relevant options provided by the base class of `jwjournal`:
+> - `use indent = false`: disable the paragraph indentation and add some space between each paragraph instead.
+> - `use style = ⟨provided style⟩`: select the designing style of the current article; for our purpose here, it is recommended to use the style `classical` (with this the option `use indent = false` is added by default), together with the options `title in boldface` and `title in sffamily`, see the comment below regarding the usage of "Section".
+>
+> You may refer to the demo documents to see their actual usage.
+
Here are the major syntaxes for your main text:
1) Title
- Any line begins with date like `2023-01-01` or `2023/01/01` would be regard as the *Title* line.
@@ -70,7 +78,7 @@ Here are the major syntaxes for your main text:
```
2023-01-01 Sunny | Apartment
```
- > With the options `month-day-year` or `day-month-year`, you can also write date in the format `mm-dd-yyyy` or `dd-mm-yyyy`, respectively. You may refer to the English and French demo documents for examples.
+ > With the options `month-day-year` or `day-month-year`, you can also write date in the format `mm-dd-yyyy` or `dd-mm-yyyy`, respectively. You may refer to the English, French and German demo documents for examples.
1) Note
- Any line begins with something like `[Note]` would be regard as the *Note* line.
- Example:
@@ -241,6 +249,12 @@ Language and date format can both be set in two ways: as class option or with co
### Scroll mode
The scroll mode is achieved by directly accessing `\pdfpageheight` (pdfTeX and XeTeX) or `\pageheight` (LuaTeX). The minimal page height is set to be `10in`. It is worth noting that in order to calculate the height needed, the entire content are put into a single box, which puts a limitation on the length of your document (but this usually wouldn't be a problem).
-# License
+
+## Acknowledgement
+
+The author would like to thank his friend Junzhuo Zhao for his valuable help with the German language. Danke schön!
+
+
+## License
This work is released under the LaTeX Project Public License, v1.3c or later.
diff --git a/macros/latex/contrib/jwjournal/jwjournal-demo-cn.pdf b/macros/latex/contrib/jwjournal/jwjournal-demo-cn.pdf
index 010d83d024..ba83bdf73e 100644
--- a/macros/latex/contrib/jwjournal/jwjournal-demo-cn.pdf
+++ b/macros/latex/contrib/jwjournal/jwjournal-demo-cn.pdf
Binary files differ
diff --git a/macros/latex/contrib/jwjournal/jwjournal-demo-cn.tex b/macros/latex/contrib/jwjournal/jwjournal-demo-cn.tex
index 213bf34d51..639fabf903 100644
--- a/macros/latex/contrib/jwjournal/jwjournal-demo-cn.tex
+++ b/macros/latex/contrib/jwjournal/jwjournal-demo-cn.tex
@@ -14,9 +14,9 @@
在文中出现的日期和标注不会被识别: 2023-12-25、[标注]、【标注】,放心使用!
[文本]
- 你可以使用*斜体*、**粗体**或者***两者结合***。
+ 你可以使用*斜体*、**粗体**或者***两者结合***(具体效果取决于字体设置)。
\\
- 数学模式下的星号不会被识别:
+ 数学模式下的星号不会被识别:$a^* b^*$。
【说明】 % 【...】与 [...] 效果相同
在一些特殊情况需要把星号用 \texttt{\{\}} 隔开:**像**{}***这***{}*样*。
diff --git a/macros/latex/contrib/jwjournal/jwjournal-demo-de.pdf b/macros/latex/contrib/jwjournal/jwjournal-demo-de.pdf
new file mode 100644
index 0000000000..4f4efc58cc
--- /dev/null
+++ b/macros/latex/contrib/jwjournal/jwjournal-demo-de.pdf
Binary files differ
diff --git a/macros/latex/contrib/jwjournal/jwjournal-demo-de.tex b/macros/latex/contrib/jwjournal/jwjournal-demo-de.tex
new file mode 100644
index 0000000000..ac4ff8b96f
--- /dev/null
+++ b/macros/latex/contrib/jwjournal/jwjournal-demo-de.tex
@@ -0,0 +1,118 @@
+\documentclass[11pt, paperstyle=light yellow, color entry, day-month-year,
+ title in boldface, title in sffamily, use style = classical]{jwjournal}
+% "paperstyle = ..." passt die Papierfarbe an, Optionen sind: lightyellow、yellow、parchment、green、lightgray、gray、nord、dark
+% "color entry" fügt dem Titel jedes Eintrags mehr Farbe hinzu
+% "scroll" schaltet den Scroll-Modus ein und kann ein einseitiges PDF ähnlich einem langen Screenshot generieren
+
+\UseLanguage { German }
+
+\begin{document}
+
+
+01.01.2024 Sonnig | Ort
+
+ Im Text erscheinende Daten und Anmerkungen werden nicht erkannt: 25.12.2023, [Anmerkung], können Sie diese ruhig schreiben.
+
+ [Text]
+ Sie können Text in *kursiv*, **fett** oder ***beides*** schreiben.
+ \\
+ Sternchen im Mathematikmodus werden nicht erkannt: $a^* b^*$.
+
+ [Anmerkung] In einigen Sonderfällen kann es notwendig sein, die Sternchen mit~\texttt{\{\}} zu trennen: **genau**{}***wie***{}*dieses*.
+
+ >>> Sie können Text in einen farbigen Block wie diesen einfügen.
+
+ Bilder können eingefügt über:
+
+ || <.4> {example-image} % oder || {example-image} <.4>
+ >> (Anmerkung zum Bild)
+ >> (Weitere Bemerkung...)
+
+ +++
+ Sie können das Bild auch links oder rechts anzeigen:
+ (( <.4> {example-image-a} % oder (( {example-image-a} <.4>
+ -> <.3> % fügen Sie etwas vertikalen Abstand hinzu, hier ist „0.3\baselineskip“
+ )) <.4> {example-image-b} % oder )) {example-image-b} <.4>
+
+
+## {\textsc{Ein neuer Abschnitt}}
+
+02.01.2024
+Unbekannt (das Wetter kann je nach Wunsch auch in die zweite Zeile geschrieben werden)
+
+ Die Farbe der Beschriftungen ändert sich je nach Datum und langer Text wird automatisch umbrochen und eingerückt:
+
+ [Hinweis] Ich habe heute nicht gelernt, aber ich habe sehr, sehr, sehr, sehr, sehr, sehr, sehr, sehr, sehr, sehr, sehr viel Code geschrieben: `Inline-Code`.
+
+ [Achtung] Sonderzeichen im Inline-Code müssen maskiert werden. Beispielsweise sollte `\textbackslash` als `\textbackslash textbackslash` geschrieben werden, `\{` sollte als `\textbackslash\{` geschrieben werden, `\%` sollte als `\textbackslash\%` geschrieben werden usw.
+
+ -----
+
+ Drei oder mehr \textquote{\texttt{-}} in einem separaten Absatz ergeben eine Trennlinie ---
+
+ ---
+
+ --- aber die aktuelle Zeile wird nicht abgeglichen, da sich hinter \texttt{-}\texttt{-}\texttt{-} zusätzlicher Text befindet.
+
+ -----
+
+ Wenn auf die Beschriftung mehrere Absätze folgen, können Sie \texttt{\textbackslash\textbackslash} und \texttt{\slash\slash} verwenden, um sie zu verketten, sodass alle Texte richtig eingerückt werden:
+
+ [Beschriftung] Etwas Text.
+ //
+ Mehr Text (mit \texttt{\slash\slash}, also mit etwas vertikalem Abstand zum obigen Text).
+ //
+ Mehr Text (dasselbe, mit etwas vertikalem Abstand zum obigen Text).
+ //
+ (Einige Anmerkungen)
+ \\
+ (Eine weitere Anmerkung, die aufgrund der Verwendung von \texttt{\textbackslash\textbackslash} direkt neben der obigen Anmerkung)
+ \\
+ (Weitere Anmerkungen --- ähnlich, direkt neben der obigen Anmerkung)
+
+
+
+03.01.2024
+
+ [Anmerkung] Wenn nur das Datum geschrieben wird, dann gäbe es kein zweites Trennzeichen danach.
+
+
++++
+04.01.2024 Bewölkt
+
+ Drei Pluszeichen \texttt{+++} können die aktuelle Seite um etwa eine Zeile vergrößern. Manchmal fallen ein einzelner Satz oder ein paar Wörter auf die nächste Seite --- in solchen Fällen können Sie es verwenden, um den Anzeigeeffekt zu verbessern.
+
+
+
+05.01.2024 Bewölkt --- Arbeit zu Hause
+===============================================
+
+Sie können Ihren Code auch so organisieren.
+
+
+==========
+06.01.2024 Sonnig --- Arbeit zu Hause
+==========
+
+Oder so...
+
+
+
+07.01.2024 Bewölkt
+
+ ...
+
+
+
+08.01.2024 Bewölkt
+
+ Eine Woche später wird die Farbe wieder auf die vorherige zurückgesetzt.
+
+
+
+09.01.2024 Bewölkt
+
+ ...
+
+
+\end{document}
diff --git a/macros/latex/contrib/jwjournal/jwjournal.cls b/macros/latex/contrib/jwjournal/jwjournal.cls
index 3b968ce12e..3e84c935ba 100644
--- a/macros/latex/contrib/jwjournal/jwjournal.cls
+++ b/macros/latex/contrib/jwjournal/jwjournal.cls
@@ -1,6 +1,6 @@
%%
-%% Copyright (C) 2023 by Jinwen XU
-%% -------------------------------
+%% Copyright (C) 2023-2024 by Jinwen XU
+%% ------------------------------------
%%
%% This file may be distributed and/or modified under the conditions of
%% the LaTeX Project Public License, either version 1.3c of this license
@@ -12,7 +12,7 @@
\NeedsTeXFormat{LaTeX2e}[2022-06-01]
\ProvidesExplClass
{jwjournal}
- {2023/12/19} {}
+ {2024/09/01} {}
{JW's journal class}
\keys_define:nn { jwjournal }
@@ -33,11 +33,11 @@
\sys_if_engine_pdftex:TF
{
- \PassOptionsToClass { use indent = false } { minimart }
+ % \PassOptionsToClass { use indent = false } { minimart }
\LoadClass { minimart }
}
{
- \PassOptionsToClass { use indent = false } { einfart }
+ % \PassOptionsToClass { use indent = false } { einfart }
\LoadClass { einfart }
}
@@ -554,14 +554,14 @@
}
\regex_replace_once:nnN { ❄️ (.*) ❄️ } { ❄️ \1 } \l_jwjournal_tmp_tl
- \regex_replace_once:nnN
- { ❄️ (\ *)? (\d{4}-\d{1,2}-\d{1,2}) (\ *)? (.*) }
- { \c{JWJournalEntry} {\2} {\4} }
- \l_jwjournal_tmp_tl
- \regex_replace_once:nnN
- { ❄️ (\ *)? (\d{1,2}-\d{1,2}-\d{4}) (\ *)? (.*) }
- { \c{JWJournalEntry} {\2} {\4} }
- \l_jwjournal_tmp_tl
+ % \regex_replace_once:nnN
+ % { ❄️ (\ *)? (\d{4}-\d{1,2}-\d{1,2}) (\ *)? (.*) }
+ % { \c{JWJournalEntry} {\2} {\4} }
+ % \l_jwjournal_tmp_tl
+ % \regex_replace_once:nnN
+ % { ❄️ (\ *)? (\d{1,2}-\d{1,2}-\d{4}) (\ *)? (.*) }
+ % { \c{JWJournalEntry} {\2} {\4} }
+ % \l_jwjournal_tmp_tl
\regex_replace_once:nnN
{ ❄️ (\ *)? (\d{4} \D \d{1,2} \D \d{1,2}) (\ *)? (.*) }
{ \c{JWJournalEntry} {\2} {\4} }
diff --git a/macros/latex/contrib/media9/ChangeLog b/macros/latex/contrib/media9/ChangeLog
index 712cf2598e..293d408e4e 100644
--- a/macros/latex/contrib/media9/ChangeLog
+++ b/macros/latex/contrib/media9/ChangeLog
@@ -1,3 +1,8 @@
+2024-09-02
+ * v1.27 : media9.sty
+ * v0.57 : pdfbase.sty
+ * fix : internal page counter
+
2024-08-28
* v1.26 : media9.sty
* v0.56 : pdfbase.sty
diff --git a/macros/latex/contrib/media9/doc/media9.pdf b/macros/latex/contrib/media9/doc/media9.pdf
index 526dc37408..0596f0c160 100644
--- a/macros/latex/contrib/media9/doc/media9.pdf
+++ b/macros/latex/contrib/media9/doc/media9.pdf
Binary files differ
diff --git a/macros/latex/contrib/media9/media9.sty b/macros/latex/contrib/media9/media9.sty
index 9651cd0468..a32e487478 100644
--- a/macros/latex/contrib/media9/media9.sty
+++ b/macros/latex/contrib/media9/media9.sty
@@ -39,8 +39,8 @@
%
% The Current Maintainer of this work is A. Grahn.
-\def\g@mix@date@tl{2024/08/28}
-\def\g@mix@version@tl{1.26}
+\def\g@mix@date@tl{2024/09/02}
+\def\g@mix@version@tl{1.27}
\NeedsTeXFormat{LaTeX2e}[2022-06-01]
\ProvidesExplPackage{media9}{\g@mix@date@tl}{\g@mix@version@tl}
@@ -2446,8 +2446,8 @@
%
% The Current Maintainer of this work is A. Grahn.
-\def\g@mix@date@tl{2024/08/28}
-\def\g@mix@version@tl{1.26}
+\def\g@mix@date@tl{2024/09/02}
+\def\g@mix@version@tl{1.27}
\NeedsTeXFormat{LaTeX2e}[2022-06-01]
\ProvidesExplPackage{media9}{\g@mix@date@tl}{\g@mix@version@tl}
diff --git a/macros/latex/contrib/media9/pdfbase.sty b/macros/latex/contrib/media9/pdfbase.sty
index 66c76fff80..54242a5d9c 100644
--- a/macros/latex/contrib/media9/pdfbase.sty
+++ b/macros/latex/contrib/media9/pdfbase.sty
@@ -156,8 +156,8 @@
%
% The Current Maintainer of this work is A. Grahn.
-\def\g@pbs@date@tl{2024/08/28}
-\def\g@pbs@version@tl{0.56}
+\def\g@pbs@date@tl{2024/09/02}
+\def\g@pbs@version@tl{0.57}
\NeedsTeXFormat{LaTeX2e}[2022-06-01]
\ProvidesExplPackage{pdfbase}{\g@pbs@date@tl}{\g@pbs@version@tl}
@@ -1311,6 +1311,7 @@
% modify page output routine for inserting actions at begin and end
\cs_set_eq:NN\pbs_outputpage_orig:\@outputpage
\cs_set_protected_nopar:Npn\@outputpage{
+ \int_gincr:N\g_pbs_page_int
\vbox_set:Nn\@outputbox{
%begin of page
\seq_map_inline:Nn\g_pbs_bop_seq{##1}
@@ -1334,8 +1335,6 @@
\pbs_makecol_orig:
}
-\AddToHook{shipout}{\int_gincr:N\g_pbs_page_int}
-
\AddToHook{shipout/foreground}{
%insert /Properties into current page's resources
\put(0,0){\pbs_insert_properties_entry:}
@@ -1557,8 +1556,8 @@
%
% The Current Maintainer of this work is A. Grahn.
-\def\g@pbs@date@tl{2024/08/28}
-\def\g@pbs@version@tl{0.56}
+\def\g@pbs@date@tl{2024/09/02}
+\def\g@pbs@version@tl{0.57}
\NeedsTeXFormat{LaTeX2e}[2022-06-01]
\ProvidesExplPackage{pdfbase}{\g@pbs@date@tl}{\g@pbs@version@tl}
@@ -2639,6 +2638,7 @@
% modify page output routine for inserting actions at begin and end
\cs_set_eq:NN\pbs_outputpage_orig:\@outputpage
\cs_set_protected_nopar:Npn\@outputpage{
+ \int_gincr:N\g_pbs_page_int
\vbox_set:Nn\@outputbox{
%begin of page
\seq_map_inline:Nn\g_pbs_bop_seq{##1}
@@ -2662,8 +2662,6 @@
\pbs_makecol_orig:
}
-\AddToHook{shipout}{\int_gincr:N\g_pbs_page_int}
-
\AddToHook{shipout/background}{
% workaround for curious AR bug (pdf annot or link placed on
% OCG remains active although OCG is hidden)
diff --git a/macros/latex/contrib/profcollege/doc/profcollege-doc.pdf b/macros/latex/contrib/profcollege/doc/profcollege-doc.pdf
index 794f5fdcb0..787b93d169 100644
--- a/macros/latex/contrib/profcollege/doc/profcollege-doc.pdf
+++ b/macros/latex/contrib/profcollege/doc/profcollege-doc.pdf
Binary files differ
diff --git a/macros/latex/contrib/profcollege/latex/PfCBillard.tex b/macros/latex/contrib/profcollege/latex/PfCBillard.tex
index 758e752977..dc0082cef8 100644
--- a/macros/latex/contrib/profcollege/latex/PfCBillard.tex
+++ b/macros/latex/contrib/profcollege/latex/PfCBillard.tex
@@ -1,8 +1,8 @@
%%%
% Billard
%%%
-\def\filedateBillard{2024/08/04}%
-\def\fileversionBillard{0.1}%
+\def\filedateBillard{2024/08/28}%
+\def\fileversionBillard{0.1a}%
\message{-- \filedateBillard\space v\fileversionBillard}%
%
\newtoks\tokPfCMotBillard{}%
@@ -231,11 +231,9 @@
}%
\def\MPBillardSolution#1#2#3{%
- % \mplibcodeinherit{enable}%
\mplibforcehmode
\xdef\PfCNomBillard{\useKV[ClesBillard]{Nom}}
\begin{mplibcode}[\PfCNomBillard]
-% Figure(0,0,\useKV[ClesBillard]{Longueur}+2cm,\useKV[ClesBillard]{Largeur}+3cm);
trace rec;
% Tracés
drawarrow Pt[1]--(Pt[1]+1.5cm*unitvector(Pt[2]-Pt[1])) withpen pencircle scaled 1.25;
@@ -257,14 +255,16 @@
else:
dotlabel.bot(TEX(substring(0,1) of #1),Pt[1]);
fi;
+ path segmenttest;
for k=2 upto BLong:
- if (demidroite(1/1000[Pt[k-1],Pt[k]],Pt[k]) intersectiontimes cote[1])<>(-1,-1):
+ segmenttest:=(9/10)[Pt[k-1],Pt[k]]--(11/10)[Pt[k-1],Pt[k]];
+ if segmenttest intersectiontimes cote[1]<>(-1,-1):
dotlabel.bot(TEX(substring(k-1,k) of #1),Pt[k]);
- elseif (demidroite(1/1000[Pt[k-1],Pt[k]],Pt[k]) intersectiontimes cote[2])<>(-1,-1):
+ elseif segmenttest intersectiontimes cote[2]<>(-1,-1):
dotlabel.rt(TEX(substring(k-1,k) of #1),Pt[k]);
- elseif (demidroite(1/1000[Pt[k-1],Pt[k]],Pt[k]) intersectiontimes cote[3])<>(-1,-1):
+ elseif segmenttest intersectiontimes cote[3]<>(-1,-1):
dotlabel.top(TEX(substring(k-1,k) of #1),Pt[k]);
- elseif (demidroite(1/1000[Pt[k-1],Pt[k]],Pt[k]) intersectiontimes cote[4])<>(-1,-1):
+ elseif segmenttest intersectiontimes cote[4]<>(-1,-1):
dotlabel.lft(TEX(substring(k-1,k) of #1),Pt[k]);
fi;
endfor;
@@ -274,5 +274,4 @@
label.top(TEX(substring(k-1,k) of #1),((xpart(Co),5mm)-center Reponse)+(k-1)*(7mm,0)+(2.5mm,0));
endfor;
\end{mplibcode}%
-% \mplibcodeinherit{disable}%
}% \ No newline at end of file
diff --git a/macros/latex/contrib/profcollege/latex/PfCCheque.tex b/macros/latex/contrib/profcollege/latex/PfCCheque.tex
new file mode 100644
index 0000000000..531af4efc1
--- /dev/null
+++ b/macros/latex/contrib/profcollege/latex/PfCCheque.tex
@@ -0,0 +1,125 @@
+%%%
+% PfCCheque
+%%%
+\def\filedateCheque{2024/09/03}%
+\def\fileversionCheque{0.1}%
+\message{-- \filedateCheque\space v\fileversionCheque}%
+\newlength{\oldbaseline}
+\newlength{\PfCTailleCursive}
+
+\setKVdefault[Cheque]{Sigle=CMF,Banque=Crédit Mathématique de France,Date=\today,Lieu={},Lire=false,Destinataire=Institut Curie,Solution=false,Longueur=15,Taille=\normalsize,Ajust=0pt}
+
+%https://tex.stackexchange.com/questions/406015/defining-macro-gsetlength-as-global-setlength-reliable
+\makeatletter
+\gdef\gsetlength#1#2{%
+ \begingroup
+ \setlength\skip@{#2}% Local assignment to a scratch register.
+ \global#1=\skip@ % Global assignement to #1;
+ % \relax is not necessary because of the following \endgroup.
+ \endgroup % \skip@ is restored by end of group.
+}
+\makeatother
+
+\NewDocumentCommand{\Cheque}{om}{%
+ \useKVdefault[Cheque]%
+ \setKV[Cheque]{#1}%
+ \setbox1=\hbox{\useKV[Cheque]{Taille}\myfontCursive abcdefghijklmnopqrstuvwxyz}%
+ {\useKV[Cheque]{Taille}\myfontCursive\gsetlength{\oldbaseline}{\baselineskip}\normalsize}%
+ \setlength{\PfCTailleCursive}{0.5\ht1+\useKV[Cheque]{Ajust}}%
+ \BuildCheque{#2}%
+}%
+
+\NewDocumentCommand{\BuildCheque}{m}{%
+ \ifluatex
+ \mplibforcehmode
+ \begin{mplibcode}
+ boolean Solution,Lire;
+ Solution=\useKV[Cheque]{Solution};
+ Lire=\useKV[Cheque]{Lire};
+ Longueur=\useKV[Cheque]{Longueur};
+ baselinecp=\fpeval{\oldbaseline};
+ %
+ pair A,B,C,D,M[],N[];
+ A=(0,0);
+ B-A=u*(Longueur,0);
+ C-B=u*(0,5);
+ D-C=A-B;
+ %
+ M1=1/3[D,A];
+ %
+ picture Payez;
+ Payez=image(
+ label.rt(TEX("Payez contre ce chèque"),M1);
+ );
+ %
+ M20=(xpart(M1),ypart(llcorner Payez));
+ M2-M20=(0,-baselinecp);
+ M3-M2=u*(0,-0.5);
+ M4-M3=M2-M1;
+ M5-M4=u*(0.4*Longueur,-0.25);
+ M6-M4=u*(0,-0.25)+u*(0.5,0);
+ M7-M6=u*(2,0);
+ %
+ A:=(xpart(M4),ypart(M6)-1u);
+ B:=A+C-D;
+ %
+ N1=1/2[M1,M2]+0.8*(B-A);
+ N2-N1=M2-M1;
+ N3-N2=0.18*(B-A);
+ N4-N3=N1-N2;
+ drawoptions(withcolor NavyBlue);
+ picture BaseLettre;
+ %%%%%%%%%%%%%%%%
+ fill polygone(A,B,C,D) withcolor 0.8[LightSteelBlue,white];
+ trace polygone(A,B,C,D);
+ draw Payez;
+ label.rt(TEX("{\sffamily \Huge \useKV[Cheque]{Sigle}}"),D+u*(0,-0.5));
+ label.rt(TEX("{\sffamily \useKV[Cheque]{Banque}}"),D+u*(0,-1));
+ trace (lrcorner Payez)--(0.75[(xpart(M1),ypart(lrcorner Payez)),(xpart(M1+B-A),ypart(lrcorner Payez))]);
+ label.rt(TEX("\tiny non endossable sauf au profit d'une banque ou d'un établissement assimilé."),M1+u*(0,-0.300));
+ trace 1/90[M2,M2+B-A]--(0.75[M2,M2+B-A]);
+ label.rt(TEX("À \useKV[Cheque]{Destinataire}"),M3);
+ trace 1/45[M3+u*(0,-0.2),M3+u*(0,-0.2)+B-A]--(0.75[M3+u*(0,-0.2),M3+u*(0,-0.2)+B-A]);
+ fill polygone(N1,N2,N3,N4) withcolor white;
+ trace polygone(N1,N2,N3,N4) withpen pencircle scaled 1.2 withcolor NavyBlue;
+ if Lire=false:
+ label.rt(TEX("\si{\EuRo}~#1"),iso(N1,N2));
+ else:
+ if Solution:
+ label.rt(TEX("\si{\EuRo}~\num{#1}"),iso(N1,N2));
+ fi;
+ fi;
+ label.rt(TEX("À~\hbox to"&decimal(Longueur/5)&"cm{\hrulefill}\quad Le~\hbox to"&decimal(Longueur/5)&"cm{\hrulefill}"),M5);
+ label.top(TEX("\Huge \si{\EuRo}uro"),iso(N4,N1)+u*(0,1));
+ label(TEX("\tiny « à régler exclusivement en euros »"),iso(N4,N1)+u*(-0.5,1));
+ label(TEX("\ChoixAlea{100000}{999999}{\numcheque}\numcheque"),iso(M6,M7));
+ trace cotationmil(M6,M7,2.5mm,25,TEX("\scriptsize chèque \no"));
+ %%
+% drawoptions(withcolor red);
+% draw (llcorner Payez)--(llcorner Payez+B-A);
+% draw M2--(M2+B-A);
+% drawoptions();
+ picture Sous;
+ Sous=image(%
+ label(TEX("\begin{minipage}{\fpeval{0.75*"&decimal(Longueur)&"}cm}
+ \hspace{"&decimal(abs(lrcorner Payez-llcorner Payez))&"pt}\myfontCursive\useKV[Cheque]{Taille}\Ecriture{#1}~euros
+ \end{minipage}"),(0,0));
+ );
+ pair PointBase,PointTest,Decalage;
+ PointBase=1/2[M20,M2+(u*0.75Longueur,0)];
+ PointTest=(0,0);%
+ if abs(llcorner Sous-ulcorner Sous)>baselinecp:
+ Decalage=(8pt,\fpeval{\PfCTailleCursive});
+ else:
+ Decalage=(8pt,2*\fpeval{\PfCTailleCursive});
+ fi;
+ if Lire:
+ draw Sous shifted (PointBase-PointTest+Decalage);
+ else:
+ if Solution:
+ draw Sous shifted (PointBase-PointTest+Decalage);
+ fi;
+ fi;
+ \end{mplibcode}
+ \fi%
+}% \ No newline at end of file
diff --git a/macros/latex/contrib/profcollege/latex/PfCDecomposerNombrePremier.tex b/macros/latex/contrib/profcollege/latex/PfCDecomposerNombrePremier.tex
index 7bbc738f70..a741919482 100644
--- a/macros/latex/contrib/profcollege/latex/PfCDecomposerNombrePremier.tex
+++ b/macros/latex/contrib/profcollege/latex/PfCDecomposerNombrePremier.tex
@@ -1,8 +1,8 @@
%%%
% Nombre Premier
%%%
-\def\filedateDecompNbPremier{2024/08/04}%
-\def\fileversionDecompNbPremier{0.1}%
+\def\filedateDecompNbPremier{2024/09/01}%
+\def\fileversionDecompNbPremier{0.1a}%
\message{-- \filedateDecompNbPremier\space v\fileversionDecompNbPremier}%
%
\setKVdefault[ClesNombrePremier]{Tableau=false,TableauVide=false,TableauVertical=false,TableauVerticalVide=false,Exposant=false,Longue=false,All=false,Arbre=false,ArbreVide=false,ArbreComplet=false,ArbreDessine=false,ArbreDessineVide=false,Entoure=false,Entourefin=false,Diviseurs=false,DiviseursT=false,Dot=\dotfill,Impose=false,ImposeAll=false,Potence=false,Decalage=10,Vide=false,CouleurFeuillage=ForestGreen,CouleurTronc=BurlyWood,CouleurFruits=Red,CouleurTexte=white,Poisson=false,Echelle=1cm,AngleArete=45,CouleurPoisson=white,Visible=false,Solution=false}%
@@ -963,13 +963,13 @@
\begin{tabular}{c|c}%
1&\num{#1}\\
\xintFor* ##1 in {\xintSeq {1}{\fpeval{(\cnpT+1)/2}}}\do{%
- \DiviseurNumero{#1}{##1}\num{\fpeval{\dnpT}}\uppercase{&}\DiviseurNumero{#1}{##1}\xintifboolexpr{\dnpT=\fpeval{#1/\dnpT}}{}{\num{\fpeval{#1/\dnpT}}}\\
+ \DiviseurNumero{#1}{##1}\num{\fpeval{\dnpT}}\uppercase{&}\DiviseurNumero{#1}{##1}\xintifboolexpr{\dnpT==\fpeval{#1/\dnpT}}{\num{\fpeval{\dnpT}}}{\num{\fpeval{#1/\dnpT}}}\\
}
\end{tabular}%
\else%
\begin{tabular}{c|c}
1&\num{#1}
- \ifnum\cnpT>2\relax\\
+ \ifnum\cnpT>1\relax\\
\xintFor* ##1 in {\xintSeq {1}{\fpeval{\cnpT/2}}}\do{%
\DiviseurNumero{#1}{##1}\num{\fpeval{\dnpT}}\uppercase{&}\DiviseurNumero{#1}{##1}\num{\fpeval{#1/\dnpT}}\\
}
diff --git a/macros/latex/contrib/profcollege/latex/PfCLego.tex b/macros/latex/contrib/profcollege/latex/PfCLego.tex
index 6d89f82408..80bc5ddc1a 100644
--- a/macros/latex/contrib/profcollege/latex/PfCLego.tex
+++ b/macros/latex/contrib/profcollege/latex/PfCLego.tex
@@ -1,8 +1,8 @@
%%%
% Lego
%%%
-\def\filedateLego{2024/08/04}%
-\def\fileversionLego{0.1}%
+\def\filedateLego{2024/09/01}%
+\def\fileversionLego{0.1a}%
\message{-- \filedateLego\space v\fileversionLego}%
%
\setKVdefault[Lego]{Echelle=1,Couleur=LightSteelBlue,Unite=8,Diviseur=2,Perso=false,Plaque=false,Largeura=2,Largeurb=2,Unique=false}%
@@ -31,10 +31,14 @@
}{%
\xdef\PfCNbCouleurs{\fpeval{floor(\useKV[Lego]{Unite}/\useKV[Lego]{Diviseur})}}%
}%
- \ChoixCouleur{\PfCNbCouleurs}%
\ifboolKV[Lego]{Perso}{%
+ \setsepchar{,}\ignoreemptyitems%
+ \readlist*\ListeAvantChoixCouleurs{\PfCFooLegoListePerso}%
+ \ChoixCouleur{\ListeAvantChoixCouleurslen}%
+ \reademptyitems%
\BuildBarreLego{\FooCouleur}{\PfCFooLegoListePerso}%
}{%
+ \ChoixCouleur{\PfCNbCouleurs}%
\BuildBarreLego{\FooCouleur}{}%
}%
}%
diff --git a/macros/latex/contrib/profcollege/latex/PfCRepresentationGraphique.tex b/macros/latex/contrib/profcollege/latex/PfCRepresentationGraphique.tex
index 3eed5f9d03..47ed10c376 100644
--- a/macros/latex/contrib/profcollege/latex/PfCRepresentationGraphique.tex
+++ b/macros/latex/contrib/profcollege/latex/PfCRepresentationGraphique.tex
@@ -91,7 +91,7 @@
fi;
endfor;
label.ulft(TEX("\num{"&decimal(ymin)&"}"),(0,0) shifted Origine);
- for k=1 step pasgrady until (ymax-ymin):
+ for k=pasgrady step pasgrady until (ymax-ymin):
trace ((-0.5mm,0)--(0.5mm,0)) shifted ((0,k*y.u) shifted Origine) withpen pencircle scaled1.25;
label.lft(TEX("\num{"&decimal(ymin+k)&"}"),(0,k*y.u) shifted Origine);
endfor;
diff --git a/macros/latex/contrib/profcollege/latex/PfCRepresenterFraction.tex b/macros/latex/contrib/profcollege/latex/PfCRepresenterFraction.tex
index e8b37b8c6c..2beb3ee5ed 100644
--- a/macros/latex/contrib/profcollege/latex/PfCRepresenterFraction.tex
+++ b/macros/latex/contrib/profcollege/latex/PfCRepresenterFraction.tex
@@ -1,11 +1,11 @@
%%%
% Fractions
%%%
-\def\filedateRepFrac{2024/08/04}%
-\def\fileversionRepFrac{0.1}%
+\def\filedateRepFrac{2024/08/30}%
+\def\fileversionRepFrac{0.1a}%
\message{-- \filedateRepFrac\space v\fileversionRepFrac}%
%
-\setKVdefault[ClesFraction]{Rayon=2cm,Disque,Regulier=false,Segment=false,Rectangle=false,Longueur=5cm,Largeur=2cm,Cotes=5,Triangle=false,Parts=3,Eprouvette=false,Couleur=green,Reponse=false,Multiple=1,Hachures=false,Epaisseur=1}
+\setKVdefault[ClesFraction]{Rayon=2cm,Disque,Regulier=false,Segment=false,Rectangle=false,Longueur=5cm,Largeur=2cm,Cotes=5,Triangle=false,Parts=3,Eprouvette=false,Couleur=green,Reponse=false,Multiple=1,Hachures=false,Epaisseur=1,Aleatoire=false}
\def\MPFractionEprouvetteCode{%
Hauteur=\useKV[ClesFraction]{Longueur};
@@ -84,6 +84,7 @@
\ifluatex
\mplibforcehmode
\begin{mplibcode}
+ % Pas d'aléa ici : l'eau ne peut pas être en lévitation :)
\MPFractionEprouvetteCode
trace eprouvette(#2,#1);
\end{mplibcode}
@@ -94,6 +95,107 @@
\fi
}
+\def\MPFractionRegulierCodeAlea{%
+ Rayon=\useKV[ClesFraction]{Rayon};
+ Cotes=\useKV[ClesFraction]{Cotes};
+ color ColPolyReg;
+ ColPolyReg=\useKV[ClesFraction]{Couleur};
+ boolean Hachures,Reponse;
+ Reponse=\useKV[ClesFraction]{Reponse};
+ Hachures=\useKV[ClesFraction]{Hachures};
+ Epaisseur=\useKV[ClesFraction]{Epaisseur};
+ pair O,A[],B[];
+ O=u*(0,0);
+ path cc,cd;
+ cc=cercles(O,Rayon);
+ for k=0 upto Cotes:
+ A[k]=pointarc(cc,k*(360/Cotes));
+ endfor;
+ cd=polygone(A0 for k=1 upto Cotes-1:,A[k] endfor);
+ path part[];
+ vardef FractionPolyReg(expr nume,deno)=
+ for k=0 upto deno:
+ B[k]=point(k*(Cotes/deno)) of cd;
+ dotlabel("",B[k]);
+ endfor;
+ for k=0 upto deno-1:
+ part[k]=O--B[k] for l=1 upto Cotes-1:if (B[k]--B[k+1]) intersectiontimes (O--A[l])<>(-1,-1):--A[l] fi endfor --B[k+1]--cycle;%O--arccercle(B[k],B[k+1],O)--cycle;
+ endfor;
+ m=(nume div deno);
+ if (nume mod deno)=0:m:=m-1; fi;
+ picture RetourFraction;
+ RetourFraction=image(%
+ Reste=((nume div deno)+1)*deno;
+ RetiensPart=0;
+ if Reponse:
+ if m>0:
+ for l=0 upto (m-1):
+ for k=0 upto deno-1:
+ if RetiensPart<nume:
+ if Reste>(nume-RetiensPart):
+ test:=uniformdeviate(1);
+ if test>0.5:
+ RetiensPart:=RetiensPart+1;
+ if Hachures:
+ drawoptions(withpen pencircle scaled Epaisseur);
+ draw hachurage(part[k] shifted(l*(2*Rayon+0.5cm,0)),1.5*360/deno,0.25,0) withcolor ColPolyReg;
+ else:
+ fill part[k] shifted(l*(2*Rayon+0.5cm,0)) withcolor ColPolyReg;
+ fi;
+ fi;
+ else:
+ RetiensPart:=RetiensPart+1;
+ if Hachures:
+ drawoptions(withpen pencircle scaled Epaisseur);
+ draw hachurage(part[k] shifted(l*(2*Rayon+0.5cm,0)),1.5*360/deno,0.25,0) withcolor ColPolyReg;
+ else:
+ fill part[k] shifted(l*(2*Rayon+0.5cm,0)) withcolor ColPolyReg;
+ fi;
+ fi;
+ fi;
+ Reste:=Reste-1;
+ endfor;
+ endfor;
+ fi;
+ for k=0 upto deno-1:
+ if RetiensPart<nume:
+ if Reste>(nume-RetiensPart):
+ test:=uniformdeviate(1);
+ if test>0.5:
+ RetiensPart:=RetiensPart+1;
+ if Hachures:
+ drawoptions(withpen pencircle scaled Epaisseur);
+ draw hachurage(part[k] shifted(m*(2*Rayon+0.5cm,0)),1.5*360/deno,0.25,0) withcolor ColPolyReg;
+ else:
+ fill part[k] shifted(m*(2*Rayon+0.5cm,0)) withcolor ColPolyReg;
+ fi;
+ fi;
+ else:
+ RetiensPart:=RetiensPart+1;
+ if Hachures:
+ drawoptions(withpen pencircle scaled Epaisseur);
+ draw hachurage(part[k] shifted(m*(2*Rayon+0.5cm,0)),1.5*360/deno,0.25,0) withcolor ColPolyReg;
+ else:
+ fill part[k] shifted(m*(2*Rayon+0.5cm,0)) withcolor ColPolyReg;
+ fi;
+ fi;
+ fi;
+ Reste:=Reste-1;
+ endfor;
+ fi;
+ drawoptions(withpen pencircle scaled Epaisseur);
+ for l=0 upto m:
+ draw cd shifted(l*(2*Rayon+0.5cm,0));
+ for k=0 upto (deno-1):
+ draw segment(O,B[k]) shifted(l*(2*Rayon+0.5cm,0));
+ endfor;
+ endfor;
+ drawoptions();
+ );
+ RetourFraction
+ enddef;
+}%
+
\def\MPFractionRegulierCode{%
Rayon=\useKV[ClesFraction]{Rayon};
Cotes=\useKV[ClesFraction]{Cotes};
@@ -172,7 +274,13 @@
\ifluatex
\mplibforcehmode
\begin{mplibcode}
+ boolean Alea;
+ Alea=\useKV[ClesFraction]{Aleatoire};
+ if Alea:
+ \MPFractionRegulierCodeAlea;
+ else:
\MPFractionRegulierCode
+ fi;
trace FractionPolyReg(#1,#2);
\end{mplibcode}
\else
@@ -182,6 +290,122 @@
\fi
}%
+\def\MPFractionTriangleCodeAlea{%
+ Longueur:=\useKV[ClesFraction]{Longueur};
+ nbparts:=\useKV[ClesFraction]{Parts};
+ color ColTriangle;
+ ColTriangle=\useKV[ClesFraction]{Couleur};
+ boolean Hachures,Reponse;
+ Reponse=\useKV[ClesFraction]{Reponse};
+ Hachures=\useKV[ClesFraction]{Hachures};
+ Epaisseur=\useKV[ClesFraction]{Epaisseur};
+ nbtriangle=0;
+ %
+ vardef Ligne(expr longueur)=
+ for k=0 upto 2*(longueur-1):
+ nbtriangle:=nbtriangle+1;
+ if (k mod 2)=0:
+ M[nbtriangle]=(Tria shifted(0.5*k*(1/nbparts)*(B-A))) shifted((nbparts-longueur)*(1/nbparts)*(C-A));
+ else:
+ M[nbtriangle]=(Trir shifted(0.5*(k-1)*(1/nbparts)*(B-A))) shifted((nbparts-longueur)*(1/nbparts)*(C-A));
+ fi;
+ endfor;
+ enddef;
+ %
+ pair A,B,C;
+ A=u*(0.5,0.5);
+ B-A=(Longueur,0);
+ C=rotation(B,A,60);
+ %
+ path Tria,Trir,M[];
+ Tria=polygone(A,(1/nbparts)[A,B],(1/nbparts)[A,C]);
+ Trir=symetrie(Tria,(1/nbparts)[A,B],(1/nbparts)[A,C]);
+ %
+ for k=nbparts downto 1:
+ Ligne(k);
+ endfor;
+ %
+ picture FondTriangle;
+ FondTriangle=image(
+ for k=1 upto nbtriangle:
+ trace M[k];
+ endfor;
+ );
+ %
+ vardef FractionTriangle(expr nume,deno)=
+ m:=nume div deno;
+ if (nume mod deno)=0:
+ m:=m-1;
+ fi;
+ picture RetourFraction;
+ RetourFraction=image(
+ Reste=((nume div deno)+1)*deno;
+ RetiensPart=0;
+ if Reponse:
+ if m>0:
+ for l=0 upto (m-1):
+ for k=1 upto nbtriangle:
+ if RetiensPart<nume:
+ if Reste>(nume-RetiensPart):
+ test:=uniformdeviate(1);
+ if test>0.5:
+ RetiensPart:=RetiensPart+1;
+ if Hachures:
+ drawoptions(withpen pencircle scaled Epaisseur);
+ draw hachurage(M[k] shifted(l*(Longueur+1cm,0)),90,0.2,0) withcolor ColTriangle;
+ else:
+ fill M[k] shifted(l*(Longueur+1cm,0)) withcolor ColTriangle;
+ fi;
+ fi;
+ else:
+ RetiensPart:=RetiensPart+1;
+ if Hachures:
+ drawoptions(withpen pencircle scaled Epaisseur);
+ draw hachurage(M[k] shifted(l*(Longueur+1cm,0)),90,0.2,0) withcolor ColTriangle;
+ else:
+ fill M[k] shifted(l*(Longueur+1cm,0)) withcolor ColTriangle;
+ fi;
+ fi;
+ fi;
+ Reste:=Reste-1;
+ endfor;
+ endfor;
+ fi;
+ for k=1 upto nbtriangle:
+ if RetiensPart<nume:
+ if Reste>(nume-RetiensPart):
+ test:=uniformdeviate(1);
+ if test>0.5:
+ RetiensPart:=RetiensPart+1;
+ if Hachures:
+ drawoptions(withpen pencircle scaled Epaisseur);
+ draw hachurage(M[k] shifted(m*(Longueur+1cm,0)),90,0.2,0) withcolor ColTriangle;
+ else:
+ fill M[k] shifted(m*(Longueur+1cm,0)) withcolor ColTriangle;
+ fi;
+ fi;
+ else:
+ RetiensPart:=RetiensPart+1;
+ if Hachures:
+ drawoptions(withpen pencircle scaled Epaisseur);
+ draw hachurage(M[k] shifted(m*(Longueur+1cm,0)),90,0.2,0) withcolor ColTriangle;
+ else:
+ fill M[k] shifted(m*(Longueur+1cm,0)) withcolor ColTriangle;
+ fi;
+ fi;
+ fi;
+ Reste:=Reste-1;
+ endfor;
+ fi;
+ drawoptions(withpen pencircle scaled Epaisseur);
+ for l=0 upto m:
+ trace FondTriangle shifted(l*(Longueur+1cm,0));
+ endfor;
+ );
+ RetourFraction
+enddef;
+}%
+
\def\MPFractionTriangleCode{%
Longueur:=\useKV[ClesFraction]{Longueur};
nbparts:=\useKV[ClesFraction]{Parts};
@@ -245,7 +469,7 @@
trace hachurage(polygone(A,B,C) shifted(l*(Longueur+1cm,0)),90,0.2,0) withcolor ColTriangle;
drawoptions(withpen pencircle scaled Epaisseur);
else:
- remplis polygone(A,B,C) withcolor ColRectangle;
+ remplis polygone(A,B,C) withcolor ColTriangle;
fi;
fi;
for k=1 upto nbparts:
@@ -264,7 +488,13 @@
\ifluatex
\mplibforcehmode
\begin{mplibcode}
- \MPFractionTriangleCode
+ boolean Alea;
+ Alea=\useKV[ClesFraction]{Aleatoire};
+ if Alea:
+ \MPFractionTriangleCodeAlea;
+ else:
+ \MPFractionTriangleCode;
+ fi;
draw FractionTriangle(#1,#2);
\end{mplibcode}
\else
@@ -274,6 +504,117 @@
\fi
}%
+\def\MPFractionRectangleCodeAlea{%
+ Longueur=\useKV[ClesFraction]{Longueur};
+ Largeur=\useKV[ClesFraction]{Largeur};
+ color ColRectangle;
+ ColRectangle=\useKV[ClesFraction]{Couleur};
+ boolean Hachures,Reponse;
+ Reponse=\useKV[ClesFraction]{Reponse};
+ Hachures=\useKV[ClesFraction]{Hachures};
+ Epaisseur=\useKV[ClesFraction]{Epaisseur};
+ Multiple=\useKV[ClesFraction]{Multiple};
+ %
+ pair A,B,C,D,M[],N[],R[],S[];
+ A=(0,0);
+ B-A=(Longueur,0);
+ C-B=(0,Largeur);
+ D-C=A-B;
+ vardef FractionRectangle(expr nume,deno)=
+ m=nume div deno;
+ if (nume mod deno)=0:
+ m:=m-1;
+ fi;
+ numeric parts;
+ parts=(deno div Multiple);
+ for k=0 upto parts:
+ M[k]=(k/parts)[A,B];
+ N[k]=(k/parts)[D,C];
+ endfor;
+ if Multiple>1:
+ for k=0 upto Multiple:
+ R[k]=(k/Multiple)[A,D];
+ S[k]=(k/Multiple)[B,C];
+ endfor;
+ fi;
+ picture FondRectangle;
+ FondRectangle=image(%
+ path case[];
+ for k=0 upto Multiple-1:
+ for l=0 step Multiple until (deno-1):
+ case[k*(deno div Multiple)+(l div Multiple)]=(unitsquare xscaled (Multiple*abs(A-B)/deno) yscaled (abs(D-A)/Multiple)) shifted (((l/deno)[A,B]-A)+((k/Multiple)[A,D]-A));
+ trace case[k*(deno div Multiple)+(l div Multiple)];
+ endfor;
+ endfor;
+ );
+ picture RetourRectangle;
+ RetourRectangle=image(
+ Reste=((nume div deno)+1)*deno;
+ RetiensPart=0;
+ if Reponse:
+ if m>0:
+ for l=0 upto (m-1):
+ for k=0 upto deno-1:
+ if RetiensPart<nume:
+ if Reste>(nume-RetiensPart):
+ test:=uniformdeviate(1);
+ if test>0.5:
+ RetiensPart:=RetiensPart+1;
+ if Hachures:
+ drawoptions(withpen pencircle scaled Epaisseur);
+ draw hachurage(case[k] shifted(l*(Longueur+1cm,0)),45,0.25,0) withcolor ColRectangle;
+ else:
+ fill case[k] shifted(l*(Longueur+1cm,0)) withcolor ColRectangle;
+ fi;
+ fi;
+ else:
+ RetiensPart:=RetiensPart+1;
+ if Hachures:
+ drawoptions(withpen pencircle scaled Epaisseur);
+ draw hachurage(case[k] shifted(l*(Longueur+1cm,0)),45,0.25,0) withcolor ColRectangle;
+ else:
+ fill case[k] shifted(l*(Longueur+1cm,0)) withcolor ColRectangle;
+ fi;
+ fi;
+ fi;
+ Reste:=Reste-1;
+ endfor;
+ endfor;
+ fi;
+ for k=0 upto deno-1:
+ if RetiensPart<nume:
+ if Reste>(nume-RetiensPart):
+ test:=uniformdeviate(1);
+ if test>0.5:
+ RetiensPart:=RetiensPart+1;
+ if Hachures:
+ drawoptions(withpen pencircle scaled Epaisseur);
+ draw hachurage(case[k] shifted(m*(Longueur+1cm,0)),45,0.25,0) withcolor ColRectangle;
+ else:
+ fill case[k] shifted(m*(Longueur+1cm,0)) withcolor ColRectangle;
+ fi;
+ fi;
+ else:
+ RetiensPart:=RetiensPart+1;
+ if Hachures:
+ drawoptions(withpen pencircle scaled Epaisseur);
+ draw hachurage(case[k] shifted(m*(Longueur+1cm,0)),45,0.25,0) withcolor ColRectangle;
+ else:
+ fill case[k] shifted(m*(Longueur+1cm,0)) withcolor ColRectangle;
+ fi;
+ fi;
+ fi;
+ Reste:=Reste-1;
+ endfor;
+ fi;
+ for l=0 upto m:
+ trace FondRectangle shifted(l*(Longueur+1cm,0));
+ endfor;
+ );
+ RetourRectangle
+ enddef;
+}%
+
\def\MPFractionRectangleCode{%
Longueur=\useKV[ClesFraction]{Longueur};
Largeur=\useKV[ClesFraction]{Largeur};
@@ -382,7 +723,13 @@
\ifluatex%
\mplibforcehmode%
\begin{mplibcode}
- \MPFractionRectangleCode
+ boolean Alea;
+ Alea=\useKV[ClesFraction]{Aleatoire};
+ if Alea:
+ \MPFractionRectangleCodeAlea;
+ else:
+ \MPFractionRectangleCode;
+ fi;
trace FractionRectangle(#1,#2);
\end{mplibcode}
\else%
@@ -392,6 +739,101 @@
\fi%
}%
+\def\MPFractionDisqueCodeAlea{%
+ Rayon=\useKV[ClesFraction]{Rayon};
+ Epaisseur=\useKV[ClesFraction]{Epaisseur};
+ color ColDisque;
+ ColDisque=\useKV[ClesFraction]{Couleur};
+ boolean Hachures,Reponse;
+ Hachures=\useKV[ClesFraction]{Hachures};
+ Reponse:=\useKV[ClesFraction]{Reponse};
+ %
+ pair A,B[];
+ A=(0,0);
+ path cc,part[];
+ cc=cercles(A,Rayon);
+ vardef FractionDisque(expr nume,deno)=
+ for k=0 upto deno+1:
+ B[k]=pointarc(cc,(360/deno)*k);
+ endfor;
+ for k=0 upto deno-1:
+ part[k]=A--arccercle(B[k],B[k+1],A)--cycle;
+ endfor;
+ m=(nume div deno);
+ if (nume mod deno)=0:m:=m-1; fi;
+ picture RetourFraction;
+ RetourFraction=image(%
+ Reste=((nume div deno)+1)*deno;
+ RetiensPart=0;
+ if Reponse:
+ if m>0:
+ for l=0 upto (m-1):
+ for k=0 upto deno-1:
+ if RetiensPart<nume:
+ if Reste>(nume-RetiensPart):
+ test:=uniformdeviate(1);
+ if test>0.5:
+ RetiensPart:=RetiensPart+1;
+ if Hachures:
+ drawoptions(withpen pencircle scaled Epaisseur);
+ draw hachurage(part[k] shifted(l*(2*Rayon+1cm,0)),1.5*360/deno,0.25,0) withcolor ColDisque;
+ else:
+ fill part[k] shifted(l*(2*Rayon+1cm,0)) withcolor ColDisque;
+ fi;
+ fi;
+ else:
+ RetiensPart:=RetiensPart+1;
+ if Hachures:
+ drawoptions(withpen pencircle scaled Epaisseur);
+ draw hachurage(part[k] shifted(l*(2*Rayon+1cm,0)),1.5*360/deno,0.25,0) withcolor ColDisque;
+ else:
+ fill part[k] shifted(l*(2*Rayon+1cm,0)) withcolor ColDisque;
+ fi;
+ fi;
+ fi;
+ Reste:=Reste-1;
+ endfor;
+ endfor;
+ fi;
+ for k=0 upto deno-1:
+ if RetiensPart<nume:
+ if Reste>(nume-RetiensPart):
+ test:=uniformdeviate(1);
+ if test>0.5:
+ RetiensPart:=RetiensPart+1;
+ if Hachures:
+ drawoptions(withpen pencircle scaled Epaisseur);
+ draw hachurage(part[k] shifted(m*(2*Rayon+1cm,0)),1.5*360/deno,0.25,0) withcolor ColDisque;
+ else:
+ fill part[k] shifted(m*(2*Rayon+1cm,0)) withcolor ColDisque;
+ fi;
+ fi;
+ else:
+ RetiensPart:=RetiensPart+1;
+ if Hachures:
+ drawoptions(withpen pencircle scaled Epaisseur);
+ draw hachurage(part[k] shifted(m*(2*Rayon+1cm,0)),1.5*360/deno,0.25,0) withcolor ColDisque;
+ else:
+ fill part[k] shifted(m*(2*Rayon+1cm,0)) withcolor ColDisque;
+ fi;
+ fi;
+ fi;
+ Reste:=Reste-1;
+ endfor;
+ fi;
+ drawoptions(withpen pencircle scaled Epaisseur);
+ for l=0 upto m:
+ draw cc shifted(l*(2*Rayon+1cm,0));
+ for k=0 upto (deno-1):
+ draw segment(A,B[k]) shifted(l*(2*Rayon+1cm,0));
+ endfor;
+ endfor;
+ drawoptions();
+ );
+ RetourFraction
+ enddef;
+}%
+
\def\MPFractionDisqueCode{%
Rayon=\useKV[ClesFraction]{Rayon};
Epaisseur=\useKV[ClesFraction]{Epaisseur};
@@ -448,7 +890,13 @@
\ifluatex
\mplibforcehmode
\begin{mplibcode}
+ boolean Alea;
+ Alea=\useKV[ClesFraction]{Aleatoire};
+ if Alea:
+ \MPFractionDisqueCodeAlea;
+ else:
\MPFractionDisqueCode
+ fi;
trace FractionDisque(#1,#2);
\end{mplibcode}
\else
@@ -458,6 +906,115 @@
\fi
}
+\def\MPFractionSegmentCodeAlea{%
+ Longueur=\useKV[ClesFraction]{Longueur};
+ color ColSegment;
+ ColSegment=\useKV[ClesFraction]{Couleur};
+ boolean Hachures,Reponse;
+ Reponse=\useKV[ClesFraction]{Reponse};
+ Hachures=\useKV[ClesFraction]{Hachures};
+ Epaisseur=\useKV[ClesFraction]{Epaisseur};
+ %
+ pair A,C,B[];
+ A=(0,0);
+ C-A=(Longueur,0);
+ %
+ path part[];
+ %
+ vardef FractionSegment(expr nume,deno)=
+ for k=0 upto deno:
+ B[k]=(k/deno)[A,C];
+ endfor;
+ for k=0 upto deno-1:
+ part[k]=polygone(B[k]+u*(0,-0.15),B[k+1]+u*(0,-0.15),B[k+1]+u*(0,0.15),B[k]+u*(0,0.15));
+ endfor;
+ m=nume div deno;
+ picture RetourFraction;
+ RetourFraction=image(
+ Reste=((nume div deno)+1)*deno;
+ RetiensPart=0;
+ % Reponse
+ if Reponse:
+ if m>0:
+ for l=0 upto (m-1):
+ for k=0 upto deno-1:
+ if RetiensPart<nume:
+ if Reste>(nume-RetiensPart):
+ test:=uniformdeviate(1);
+ if test>0.5:
+ RetiensPart:=RetiensPart+1;
+ if Hachures:
+ drawoptions(withpen pencircle scaled Epaisseur);
+ draw hachurage(part[k] shifted(l*(Longueur+1cm,0)),120,0.2,0) withcolor ColSegment;
+ drawoptions();
+ else:
+ draw (segment(B[k],B[k+1]) shifted(l*(Longueur+1cm,0))) withpen pencircle scaled 2 withcolor ColSegment;
+ fi;
+ fi;
+ else:
+ RetiensPart:=RetiensPart+1;
+ if Hachures:
+ drawoptions(withpen pencircle scaled Epaisseur);
+ draw hachurage(part[k] shifted(l*(Longueur+1cm,0)),120,0.2,0) withcolor ColSegment;
+ drawoptions();
+ else:
+ draw (segment(B[k],B[k+1]) shifted(l*(Longueur+1cm,0))) withpen pencircle scaled 2 withcolor ColSegment;
+ fi;
+ fi;
+ fi;
+ Reste:=Reste-1;
+ endfor;
+ endfor;
+ fi;
+ for k=0 upto deno-1:
+ if RetiensPart<nume:
+ if Reste>(nume-RetiensPart):
+ test:=uniformdeviate(1);
+ if test>0.5:
+ RetiensPart:=RetiensPart+1;
+ if Hachures:
+ drawoptions(withpen pencircle scaled Epaisseur);
+ draw hachurage(part[k] shifted(m*(Longueur+1cm,0)),120,0.2,0) withcolor ColSegment;
+ drawoptions();
+ else:
+ draw (segment(B[k],B[k+1]) shifted(m*(Longueur+1cm,0))) withpen pencircle scaled 2 withcolor ColSegment;
+ fi;
+ fi;
+ else:
+ RetiensPart:=RetiensPart+1;
+ if Hachures:
+ drawoptions(withpen pencircle scaled Epaisseur);
+ draw hachurage(part[k] shifted(m*(Longueur+1cm,0)),120,0.2,0) withcolor ColSegment;
+ else:
+ draw (segment(B[k],B[k+1]) shifted(m*(Longueur+1cm,0))) withpen pencircle scaled 2 withcolor ColSegment;
+ fi;
+ fi;
+ fi;
+ Reste:=Reste-1;
+ endfor;
+ fi;
+ %fin Reponse
+ if Hachures:drawoptions(withpen pencircle scaled Epaisseur);fi;
+ % draw (segment(B[0],B[nume mod deno]) shifted(m*(Longueur+1cm,0)));
+ for l=0 upto m:
+ draw segment(A,C) shifted(l*(Longueur+1cm,0));
+ endfor;
+ marque_p:="tiretv";
+ for l=0 upto m-1:
+ for k=0 upto deno:
+ pointe(B[k] shifted(l*(Longueur+1cm,0)));
+ endfor;
+ endfor;
+ if (nume mod deno)<>0:
+ for k=0 upto deno:
+ pointe(B[k] shifted(m*(Longueur+1cm,0)));
+ endfor;
+ fi;
+ );
+ RetourFraction
+ enddef;
+}
+
\def\MPFractionSegmentCode{%
Longueur=\useKV[ClesFraction]{Longueur};
color ColSegment;
@@ -529,7 +1086,13 @@
\ifluatex
\mplibforcehmode
\begin{mplibcode}
+ boolean Alea;
+ Alea=\useKV[ClesFraction]{Aleatoire};
+ if Alea:
+ \MPFractionSegmentCodeAlea;
+ else:
\MPFractionSegmentCode
+ fi;
trace FractionSegment(#1,#2);
\end{mplibcode}
\else
diff --git a/macros/latex/contrib/profcollege/latex/ProfCollege.sty b/macros/latex/contrib/profcollege/latex/ProfCollege.sty
index cfef5e5232..a7b20bf698 100644
--- a/macros/latex/contrib/profcollege/latex/ProfCollege.sty
+++ b/macros/latex/contrib/profcollege/latex/ProfCollege.sty
@@ -2,9 +2,9 @@
% licence : Released under the LaTeX Project Public License v1.3c
% or later, see http://www.latex-project.org/lppl.txtf
\NeedsTeXFormat{LaTeX2e}%
-\def\filedate{2024/08/27}%
+\def\filedate{2024/09/03}%
\let\PfCfiledate\filedate%
-\def\fileversion{0.99-A-h}%
+\def\fileversion{0.99-A-i}%
\let\PfCfileversion\fileversion%
\ProvidesPackage{ProfCollege}[\filedate\space v\fileversion\space Aide pour utiliser LaTeX au college]%
@@ -856,6 +856,7 @@
\def\PfCSymbolTimes{\times}%
\def\PfCSymbolDiv{\div}%
+\input{PfCCheque}
\input{PfCCalculsDetailles}
\input{PfCTableauDoubleEntree}
\input{PfCUrneProba}
diff --git a/macros/luatex/latex/domaincoloring/Changes b/macros/luatex/latex/domaincoloring/Changes
index 2a0bf9d092..0f357dc758 100644
--- a/macros/luatex/latex/domaincoloring/Changes
+++ b/macros/luatex/latex/domaincoloring/Changes
@@ -1,3 +1,5 @@
+0.05 2024-09-02 - added Rmax for circled images
+ - modified bgcolor option
0.04 2024-08-29 - bugfix for phi (was [0,2pi], bust must be [0,1])
0.03 2024-08-26 - use \jobname for temporary file
- added option force for not creating already existing pdf's
diff --git a/macros/luatex/latex/domaincoloring/doc/domaincoloring-doc.pdf b/macros/luatex/latex/domaincoloring/doc/domaincoloring-doc.pdf
index 85f6c6baae..4a59a83dee 100644
--- a/macros/luatex/latex/domaincoloring/doc/domaincoloring-doc.pdf
+++ b/macros/luatex/latex/domaincoloring/doc/domaincoloring-doc.pdf
Binary files differ
diff --git a/macros/luatex/latex/domaincoloring/doc/domaincoloring-doc.tex b/macros/luatex/latex/domaincoloring/doc/domaincoloring-doc.tex
index e9c6870d23..bbfbfb0abb 100644
--- a/macros/luatex/latex/domaincoloring/doc/domaincoloring-doc.tex
+++ b/macros/luatex/latex/domaincoloring/doc/domaincoloring-doc.tex
@@ -1,4 +1,4 @@
-%% $Id: domaincoloring-doc.tex 968 2024-08-29 11:44:46Z herbert $
+%% $Id: domaincoloring-doc.tex 979 2024-09-02 16:07:29Z herbert $
%
\listfiles
@@ -53,7 +53,7 @@ usual:
\usepackage{domaincoloring}
\end{verbatim}
-The needs the following Lua modules:
+The package needs the following Lua modules:
\begin{itemize}
\item \texttt{domaincoloring.lua} the main module
@@ -61,7 +61,7 @@ The needs the following Lua modules:
\item \texttt{domaincoloring-functions.lua} for predefined complex functions
\end{itemize}
-The function module has to be managed by the user himself, if needed.
+The function module has to be managed by the user himself, if needed.
@@ -70,7 +70,8 @@ The function module has to be managed by the user himself, if needed.
There is only one macro which does the external call of the Lua program \verb|domaincoloring.lua|.
This program creates the image which is then included into the document. The \LaTeX-run needs
the \verb|--shell-escape| option to allow the external run of the program to convert the created
-ppm-file into a png file..
+eps-file into a pdf file, which is then included by the command \Lcs{includegraphics} into
+the document.
\begin{verbatim}
@@ -78,6 +79,58 @@ ppm-file into a png file..
\end{verbatim}
Every math function has to be preceeded by \texttt{cmath} if it has a complex argument.
+The following complex functions are supported:
+
+\begin{verbatim}
+complex(re,im) creates a complex number from real and imaginary components.
+re(z) real part of z
+im(z) imaginary part of z
+arg(z) argument of z
+abs(z) absolute value of z
+sqrt(z) z^0.5
+pow(x,y) x^y
+exp(z) e^z
+ln(z) e^? = z
+log(b,z) ln(z)/ln(b)
+sin(z)
+cos(z)
+tan(z)
+sinh(z)
+cosh(z)
+tanh(z)
+asin(z)
+acos(z)
+atan(z)
+atan2(y,x)
+asinh(z)
+acosh(z)
+atanh(z)
+polar(z) returns r,phi = cmath.abs(z),cmath.arg(z)
+rect(r,phi) returns a complex number from polar = r*e^(i*phi)
+diff(z) returns re(z)^2-im(z)^2
+zeta(z[,accuracy=1e4]) riemann zeta function
+lintegrate(f,H,[L=0,n=sensible for H])
+cx(string) creates a complex number from a string (e.g. "1.1-i" -> 1.1+-1i)
+cx(re,im) same as complex(re,im)
+\end{verbatim}
+
+The default trigonometrical functions can be used without a preceeding \verb|math|:
+
+\begin{verbatim}
+e=math.exp(1)
+pi=math.pi
+abs=math.abs
+exp=math.exp
+log=math.log
+cos=math.cos
+sin=math.sin
+cosh=math.cosh
+sinh=math.sinh
+sqrt=math.sqrt
+atan2=math.atan2
+\end{verbatim}
+
+
\subsection{Options}
@@ -87,11 +140,11 @@ Every math function has to be preceeded by \texttt{cmath} if it has a complex ar
\Lkeyword{domain} & {-2,2,-2,2} & the (re,im)-coordinates for the complex system\\
\Lkeyword{resolution} & 500 & the number of steps for the re,im interval. One value will be for
both axes. Two values like \verb|{500,600}| for real axis and imaginary axis,\\
-\Lkeyword{filename} & \Lcs{jobname-tmp} & name of the created external file, must be unique\\
+\Lkeyword{Rmax} & 0 & forces a circle output if $\text{Rmax}>0$ \\
\Lkeyword{funcName} & \texttt{\{\}} & corresponding to external file\\
\Lkeyword{grfOptions} &scale=0.5 & optional arguments for \Lcs{includegraphics}\\
\Lkeyword{hsvrgb} & {phi+pi,1,r} & for the conversion into rgb\\
-\Lkeyword{bgcolor} & -1 & change color to white as background for all values $-1\le r+g+b\le\text{bgcolor}$\\
+\Lkeyword{bgcolor} & \texttt{\{0,0,0\}} & change color to value as background\\
\Lkeyword{invers} & false & inverted colors with $color=|color-255|$\\
\Lkeyword{force} & true & With \texttt{force=false} an existing pdf file will be used
without calculating a new one.\\
@@ -106,16 +159,15 @@ without calculating a new one.\\
\subsection{The default with function $f(z)=z$ and $f(z)=1/z$}
\begin{lstlisting}
-\DomainColoring{z} % default filename \jobname-tmp.png
+\DomainColoring{z} % default filename \jobname-tmp0.png
\end{lstlisting}
\noindent
\DomainColoring{z}%\qquad
-%\DomainColoring[filename=demo2.png,bgcolor=true]{z}
-\subsection{Defining domain, color mode, resolution and filename}
+\subsection{Defining domain, color mode, resolution and Rmax}
\begin{align}
f(z) &= \cos(z)/\sin(z^4-1)
@@ -125,49 +177,80 @@ in Lua-notation: \verb|cmath.cos(z)/cmath.sin(z^4-1)|. All complex functions
must be preceeded by \texttt{cmath.}. For real functions the prefix \texttt{math.}
can be omitted.
+
+The backgroundcolor can be set with \Lkeyword{bgcolor}\texttt{=\{R,G,B\}} (values between 0 and 255).
+This color will replace the default backgroundcolor \texttt{\{0,0,0\}}. With a negative value
+for R, eg. -10, it replaces all colors which have a sum of $R+G+B <10$ with the color defined by
+the value for G, eg. 255. A setting of \Lkeyword{bgcolor}\texttt{\{=-8,255,255\}} is the same as
+\Lkeyword{bgcolor}\texttt{\{=-8,255,0\}}, becaus the last value is not used. A given color
+\texttt{\{=3,3,1\}} will be replaced by \texttt{\{=255,255,255\}}, because $3+3+1<8$ and a color
+\texttt{\{=6,2,3\}} will be unchanged, it is greater than 8.
+
+
\begin{lstlisting}
\DomainColoring[domain={-2.5,2.5,-2.5,2.5},resolution=500,hsvrgb={phi,1,r},
-grfOptions={width=0.32\linewidth},
- filename=\jobname-tmp1a]{cmath.cos(z)/cmath.sin(z^4-1)}
+grfOptions={width=0.32\linewidth}]{cmath.cos(z)/cmath.sin(z^4-1)}
\hfill
-\frame{\DomainColoring[domain={-2.5,2.5,-2.5,2.5},resolution=500,
- bgcolor=3,hsvrgb={phi,1,r},grfOptions={width=0.32\linewidth},
- filename=\jobname-tmp1b]{cmath.cos(z)/cmath.sin(z^4-1)}}
+\frame{\DomainColoring[domain={-2.5,2.5,-2.5,2.5},resolution=500,bgcolor={-8,255,255},
+ hsvrgb={phi,1,r},grfOptions={width=0.32\linewidth}]{cmath.cos(z)/cmath.sin(z^4-1)}}
\hfill
-\frame{\DomainColoring[domain={-2.5,2.5,-2.5,2.5},resolution=500,invers=true,
- hsvrgb={phi,1,r}, grfOptions={width=0.32\linewidth},
- filename=\jobname-tmp1c]{cmath.cos(z)/cmath.sin(z^4-1)}}
+\frame{\DomainColoring[domain={-2.5,2.5,-2.5,2.5},resolution=500,invers,
+ hsvrgb={phi,1,r}, grfOptions={width=0.32\linewidth}]{cmath.cos(z)/cmath.sin(z^4-1)}}
\end{lstlisting}
\noindent
\DomainColoring[domain={-2.5,2.5,-2.5,2.5},resolution=500,hsvrgb={phi,1,r},
-grfOptions={width=0.32\linewidth},
- filename=\jobname-tmp1a]{cmath.cos(z)/cmath.sin(z^4-1)}
+grfOptions={width=0.32\linewidth}]{cmath.cos(z)/cmath.sin(z^4-1)}
\hfill
-\frame{\DomainColoring[domain={-2.5,2.5,-2.5,2.5},resolution=500,bgcolor=3,hsvrgb={phi,1,r},
-grfOptions={width=0.32\linewidth},
- filename=\jobname-tmp1b]{cmath.cos(z)/cmath.sin(z^4-1)}}
+\frame{\DomainColoring[domain={-2.5,2.5,-2.5,2.5},resolution=500,bgcolor={-8,255,255},hsvrgb={phi,1,r},
+grfOptions={width=0.32\linewidth}]{cmath.cos(z)/cmath.sin(z^4-1)}}
\hfill
-\frame{\DomainColoring[domain={-2.5,2.5,-2.5,2.5},resolution=500,invers=true,hsvrgb={phi,1,r},
-grfOptions={width=0.32\linewidth},
- filename=\jobname-tmp1c]{cmath.cos(z)/cmath.sin(z^4-1)}}
+\frame{\DomainColoring[domain={-2.5,2.5,-2.5,2.5},resolution=500,invers,hsvrgb={phi,1,r},
+grfOptions={width=0.32\linewidth}]{cmath.cos(z)/cmath.sin(z^4-1)}}
+
+
+
+
+
+
+
+The optional argument \Lkeyword{Rmax} allows to crop everything around the circle with radius
+\Lkeyword{Rmax}:
+
+\begin{lstlisting}
+\DomainColoring[domain={-1,1,-1,1},resolution=500,hsvrgb={phi,1,r},
+grfOptions={width=0.32\linewidth}, Rmax=1, bgcolor={1,1,1}]{cmath.cos(z)/cmath.sin(z^4-1)}
+\hfill
+\frame{\DomainColoring[domain={-1,1,-1,1},resolution=500,bgcolor={-8,255,1},hsvrgb={phi,1,r},
+grfOptions={width=0.32\linewidth},Rmax=1]{cmath.cos(z)/cmath.sin(z^4-1)}}
+\hfill
+\frame{\DomainColoring[domain={-1,1,-1,1},resolution=500,invers=true,hsvrgb={phi,1,r},
+grfOptions={width=0.32\linewidth},Rmax=1]{cmath.cos(z)/cmath.sin(z^4-1)}}
+\end{lstlisting}
+
+\DomainColoring[domain={-1,1,-1,1},resolution=500,hsvrgb={phi,1,r},
+grfOptions={width=0.32\linewidth}, Rmax=1]{cmath.cos(z)/cmath.sin(z^4-1)}
+\hfill
+\frame{\DomainColoring[domain={-1,1,-1,1},resolution=500,bgcolor={-8,255,1},hsvrgb={phi,1,r},
+grfOptions={width=0.32\linewidth},Rmax=1]{cmath.cos(z)/cmath.sin(z^4-1)}}
+\hfill
+\frame{\DomainColoring[domain={-1,1,-1,1},resolution=500,Rmax=1,invers,hsvrgb={phi,1,r},
+grfOptions={width=0.32\linewidth}]{cmath.cos(z)/cmath.sin(z^4-1)}}
-With \Lkeyword{bgcolor}\texttt{=<int>} all RGB-combinations with a sum $R+G+B <= \text{int}$ are set to
-the color white.
\subsection{Option for \Lcs{includegraphics}}
With \Lkeyword{grfOptions} one can define optional arguments for \Lcs{includegraphics}:
\begin{lstlisting}
-\DomainColoring[grfOptions={width=0.49\linewidth},filename=\jobname-tmp2a]{cmath.sin(z)}\hfill
+\DomainColoring[grfOptions={width=0.49\linewidth}]{cmath.sin(z)}\hfill
\hfill
-\DomainColoring[grfOptions={width=0.49\linewidth},filename=\jobname-tmp2b]{cmath.sin(0.9*z)*cmath.sin(z)}
+\DomainColoring[grfOptions={width=0.49\linewidth}]{cmath.sin(0.9*z)*cmath.sin(z)}
\end{lstlisting}
\noindent
-\DomainColoring[grfOptions={width=0.49\linewidth},filename=\jobname-tmp2a]{cmath.sin(z)}
+\DomainColoring[grfOptions={width=0.49\linewidth}]{cmath.sin(z)}
\hfill
-\DomainColoring[grfOptions={width=0.49\linewidth},filename=\jobname-tmp2b]{cmath.sin(0.9*z)*cmath.sin(z)}
+\DomainColoring[grfOptions={width=0.49\linewidth}]{cmath.sin(0.9*z)*cmath.sin(z)}
\subsection{Higher resolution}
@@ -179,17 +262,16 @@ for both axes.
\begin{lstlisting}
-\DomainColoring[filename=\jobname-tmp3,resolution=1000,grfOptions={width=0.49\linewidth}]{z^3-1}
+\DomainColoring[resolution=1000,grfOptions={width=0.49\linewidth}]{z^3-1}
\hfill
-\DomainColoring[filename=\jobname-tmp4,resolution=1000,
+\DomainColoring[resolution=1000,
grfOptions={width=0.49\linewidth}]{(z+1)^2*(z-1)/((z+i)*(z-i)^2)}
\end{lstlisting}
\noindent
-\DomainColoring[filename=\jobname-tmp3,resolution=1000,
- grfOptions={width=0.49\linewidth}]{z^3-1}
+\DomainColoring[resolution=1000,grfOptions={width=0.49\linewidth}]{z^3-1}
\hfill
-\DomainColoring[filename=\jobname-tmp4,resolution=1000,
+\DomainColoring[resolution=1000,
grfOptions={width=0.49\linewidth}]{cmath.sin(z)*cmath.cos(z)}
@@ -210,18 +292,18 @@ for the hsv color model with a constant second value for saturation. $\phi$ is u
for hue. For example: \verb|hsvrgb=phi,1,r|, which gives
\begin{lstlisting}
-\DomainColoring[filename=\jobname-tmp5a,resolution=1000,
- grfOptions={width=0.49\linewidth},hsvrgb={phi,1,r}]{cmath.sin(z)*cmath.sin(0.99*z)}
+\DomainColoring[resolution=1000,grfOptions={width=0.49\linewidth},domain={-2,2,-2,2},
+ funcName=f10,hsvrgb={phi,1,r}]{}
\hfill
-\DomainColoring[filename=\jobname-tmp5b,resolution=1000,,hsvrgb={phi,r,1},
- grfOptions={width=0.49\linewidth}]{cmath.sin(z)*cmath.sin(0.99*z)} % the default
+\DomainColoring[resolution=1000,hsvrgb={phi,1,r^2/(1+r^2)},Rmax=2,domain={-2,2,-2,2},
+ grfOptions={width=0.49\linewidth}]{cmath.sin(z)*cmath.sin(0.99*z)}
\end{lstlisting}
\noindent
-\DomainColoring[filename=\jobname-tmp5a,resolution=1000,
- grfOptions={width=0.49\linewidth},funcName=f10,hsvrgb={phi,1,r}]{cmath.sin(z)*cmath.sin(0.99*z)} % the default
+\DomainColoring[resolution=1000,grfOptions={width=0.49\linewidth},domain={-2,2,-2,2},
+ funcName=f10,hsvrgb={phi,1,r}]{} % the default
\hfill
-\DomainColoring[filename=\jobname-tmp5b,resolution=1000,,hsvrgb={phi,r,1},
+\DomainColoring[resolution=1000,hsvrgb={phi,1,r^2/(1+r^2)},Rmax=2,domain={-2,2,-2,2},
grfOptions={width=0.49\linewidth}]{cmath.sin(z)*cmath.sin(0.99*z)}
%For $r$ and $\phi$ we have to use $r$ and $phi$.
@@ -229,6 +311,32 @@ The optional argument \Lkeyword{hsvrgb} must define three values which can use t
phi and r in any mathematical combination. It must only be compatible to the Lua math conventions,
e.g. \texttt{hsvrgb=\{phi+2,0.5,2/r\}}
+\begin{lstlisting}
+\DomainColoring[resolution={1000,1000},
+ domain={-5,5,-5,5}, grfOptions={width=0.32\linewidth},
+ hsvrgb={0.5,r/5,5-r},funcName=f16]{}
+\hfill
+\DomainColoring[resolution={1000,1000},
+ domain={-5,5,-5,5}, grfOptions={width=0.32\linewidth},
+ hsvrgb={0.5,5-r,5/r},funcName=f16]{}
+\hfill
+\DomainColoring[resolution={1000,1000},
+ domain={-5,5,-5,5}, grfOptions={width=0.32\linewidth},
+ hsvrgb={phi,r/5,5-r},funcName=f16]{}
+\end{lstlisting}
+
+\noindent
+\DomainColoring[resolution={1000,1000},
+ domain={-5,5,-5,5}, grfOptions={width=0.32\linewidth},
+ hsvrgb={0.5,r/5,5-r},funcName=f16]{}
+\hfill
+\DomainColoring[resolution={1000,1000},
+ domain={-5,5,-5,5}, grfOptions={width=0.32\linewidth},
+ hsvrgb={0.5,5-r,5/r},funcName=f16]{}
+\hfill
+\DomainColoring[resolution={1000,1000},
+ domain={-5,5,-5,5}, grfOptions={width=0.32\linewidth},
+ hsvrgb={phi,r/5,5-r},funcName=f16]{}
@@ -241,19 +349,19 @@ of \Lcs{DomainColoring} has no meaning and can be empty.
\begin{lstlisting}
\DomainColoring[domain={-1.5,1.5,-1.5,1.5},resolution={1001,1001},hsvrgb={phi,1,1/r},
- filename=\jobname-tmp4.png, grfOptions={width=0.49\linewidth},funcName=f12,bgcolor=5]{}
+ grfOptions={width=0.49\linewidth},funcName=f12,bgcolor={1,1,1}]{}
\hfill
\DomainColoring[domain={-2.5,1.5,-2,2},resolution={1001,1001},hsvrgb={phi,1,1/r},
- filename=\jobname-tmp5.png, grfOptions={width=0.49\linewidth},funcName=f13,bgcolor=5]{}
+ grfOptions={width=0.49\linewidth},funcName=f13,bgcolor={1,1,1}]{}
\end{lstlisting}
\noindent
\DomainColoring[domain={-1.5,1.5,-1.5,1.5},resolution={1001,1001},hsvrgb={phi,1,1/r},
- filename=\jobname-tmp4.png, grfOptions={width=0.49\linewidth},funcName=f12,bgcolor=5]{}
+ grfOptions={width=0.49\linewidth},funcName=f12,bgcolor={1,1,1}]{}
\hfill
\DomainColoring[domain={-2.5,1.5,-2,2},resolution={1001,1001},hsvrgb={phi,1,1/r},
- filename=\jobname-tmp5.png, grfOptions={width=0.49\linewidth},funcName=f13,bgcolor=5]{}
+ grfOptions={width=0.49\linewidth},funcName=f13,bgcolor={1,1,1}]{}
diff --git a/macros/luatex/latex/domaincoloring/latex/domaincoloring.sty b/macros/luatex/latex/domaincoloring/latex/domaincoloring.sty
index 0eefeb37a4..253edbc5fb 100644
--- a/macros/luatex/latex/domaincoloring/latex/domaincoloring.sty
+++ b/macros/luatex/latex/domaincoloring/latex/domaincoloring.sty
@@ -1,4 +1,4 @@
-%% $Id: domaincoloring.sty 968 2024-08-29 11:44:46Z herbert $
+%% $Id: domaincoloring.sty 979 2024-09-02 16:07:29Z herbert $
%% This is file `domaincoloring.sty',
%%
%% Copyright (C) 2024- Herbert Voss
@@ -14,8 +14,8 @@
\RequirePackage{graphicx}
\RequirePackage{shellesc}
-\def\fileversion{0.04}
-\def\filedate{2024/08/29}
+\def\fileversion{0.05}
+\def\filedate{2024/09/02}
\message{`DCol' v\fileversion, \filedate}
\ProvidesPackage{domaincoloring}
[\filedate\ \fileversion\ package for domain coloring of complex functions]
@@ -24,9 +24,6 @@
\PackageError{shellesc}{ShellEscape not enabled! Use --shell-escape}%
\fi
-% Change ^ to normal character to describe functions with lua
-\catcode`\^=11\relax % for power symbol in Lua
-
\define@key{DCol}{domain}{\def\@domaincoloring@domain{#1}}
\define@key{DCol}{resolution}{\@domaincoloring@res@i#1,\@nil}
\def\@domaincoloring@res@i#1,#2\@nil{%
@@ -35,24 +32,30 @@
\else
\def\@domaincoloring@res{#1,#2}%
\fi}
+\define@key{DCol}{Rmax}{\def\@domaincoloring@Rmax{#1}}
\define@key{DCol}{bgcolor}{\def\@domaincoloring@bgcolor{#1}}
-\define@key{DCol}{filename}{\def\@domaincoloring@filename{#1}}
\define@key{DCol}{hsvrgb}{\def\@domaincoloring@hsvrgb{#1}}
\define@key{DCol}{funcName}{\def\@domaincoloring@funcName{#1}}
-\define@key{DCol}{invers}{\def\@domaincoloring@invers{#1}}
\define@key{DCol}{grfOptions}{\def\@domaincoloring@grf{#1}}
+\define@boolkey{DCol}[DCol@]{invers}[true]{}
\define@boolkey{DCol}[DCol@]{force}[true]{}
\define@boolkey{DCol}[DCol@]{grid}[true]{}
+\newcounter{DCol@imageCTR}
+\setcounter{DCol@imageCTR}{0}
+\def\@domaincoloring@filename{\jobname-tmp\theDCol@imageCTR}
+
+
\def\setDColkeys#1{\edef\x{\noexpand\setkeys{DCol}{#1}}\x}
\setDColkeys{
funcName={}, % corresponding to external file
hsvrgb={phi,1,1}, % given (r,phi) of the complex value
- filename=\jobname-tmp, % the external image filename
+% filename=\jobname-tmp, % the external image filename
resolution=500, % pixel per (x|y) interval
domain={-2,2,-2,2}, % x|y domain
- bgcolor=-1, % R+G+B value, changes only 0,0,0 -> 255,255,255
+ Rmax=0, % max value vor |z|. 0 is same as inactive
+ bgcolor={0,0,0}, % R+G+B value, changes only 1,1,1 -> 255,255,255
invers=false, % 0 or 1 vor inverted colors
grfOptions={scale=0.5}, % LaTeX options for the included image
force=true, % only valid for the documentation
@@ -62,7 +65,12 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\DomainColoring{\@ifnextchar[\DomainColoring@i{\DomainColoring@i[]}}
-\def\DomainColoring@i[#1]#2{%
+
+\begingroup
+% Change ^ to normal character to describe functions with lua
+\catcode`\^=11\relax % for power symbol in Lua
+
+\gdef\DomainColoring@i[#1]#2{%
\begingroup
\setDColkeys{#1}%
\ifDCol@force\else
@@ -73,19 +81,27 @@
require("domaincoloring-complex-numbers")
require ("domaincoloring")
createData("\jobname",
- "#2","\@domaincoloring@funcName", % user defined, function no from -functions.lua
- {\@domaincoloring@domain},{\@domaincoloring@res},
+ "#2",
+ "\@domaincoloring@funcName", % user defined, function number from file
+ % domaincoloring-functions.lua
+ {\@domaincoloring@domain},{\@domaincoloring@res},\@domaincoloring@Rmax,
"\@domaincoloring@hsvrgb",
- \@domaincoloring@bgcolor,"\@domaincoloring@invers",
- \ifDCol@grid "true" \else "false" \fi)}%
+ {\@domaincoloring@bgcolor},
+ \ifDCol@invers "true" \else "false" \fi,
+ \ifDCol@grid "true" \else "false" \fi)
+ }%
\typeout{Convert \jobname-domain.eps file to \@domaincoloring@filename.pdf}%
\ShellEscape{epstopdf \jobname-domain.eps \@domaincoloring@filename.pdf}%
\fi
%
\expandafter\includegraphics\expandafter[\@domaincoloring@grf]{\@domaincoloring@filename.pdf}%
+ \stepcounter{DCol@imageCTR}%
+ \gdef\@domaincoloring@filename{\jobname-tmp\theDCol@imageCTR}%
\endgroup
\ignorespaces
}
\catcode`\^=7\relax
+\endgroup
+
\endinput
diff --git a/macros/luatex/latex/domaincoloring/lua/domaincoloring-functions.lua b/macros/luatex/latex/domaincoloring/lua/domaincoloring-functions.lua
index 0d7b70b058..bb0ca0c5b0 100644
--- a/macros/luatex/latex/domaincoloring/lua/domaincoloring-functions.lua
+++ b/macros/luatex/latex/domaincoloring/lua/domaincoloring-functions.lua
@@ -1,4 +1,4 @@
--- $Id: domaincoloring-functions.lua 968 2024-08-29 11:44:46Z herbert $
+-- $Id: domaincoloring-functions.lua 978 2024-09-02 15:27:30Z herbert $
kpse.set_program_name("luatex")
@@ -92,4 +92,19 @@ function f15(z)
C1 = C
end
return C
-end \ No newline at end of file
+end
+
+function f16(z)
+ local A = z^2 - z -2
+ local B = z^2 + complex(1,1)
+ return A/B
+end
+
+function f17(z)
+ return e^(z^cmath.sin(z^cmath.tan(z^cmath.cos(z))))
+end
+
+function f18(z)
+ return (z+0.5)*(z-0.5)/z
+end
+
diff --git a/macros/luatex/latex/domaincoloring/lua/domaincoloring.lua b/macros/luatex/latex/domaincoloring/lua/domaincoloring.lua
index 636c4f28df..3eb5496df5 100644
--- a/macros/luatex/latex/domaincoloring/lua/domaincoloring.lua
+++ b/macros/luatex/latex/domaincoloring/lua/domaincoloring.lua
@@ -1,4 +1,4 @@
--- $Id: domaincoloring.lua 968 2024-08-29 11:44:46Z herbert $
+-- $Id: domaincoloring.lua 978 2024-09-02 15:27:30Z herbert $
-----------------------------------------------------------------------
-- FILE: domaincoloring.lua
@@ -9,7 +9,7 @@
--
-----------------------------------------------------------------------
-local version = 0.04
+local version = 0.05
kpse.set_program_name("luatex")
@@ -28,10 +28,10 @@ local function HSVtoRGB(h, s, v)
local p = v * (1 - s)
local q = v * (1 - s * f)
local t = v * (1 - s * (1 - f))
- v = math.floor(255*v) % 256
- p = math.floor(255*p) % 256
- q = math.floor(255*q) % 256
- t = math.floor(255*t) % 256
+ v = math.floor(255*v) % 256
+ p = math.floor(255*p) % 256
+ q = math.floor(255*q) % 256
+ t = math.floor(255*t) % 256
if i == 0 then return v,t,p
elseif i == 1 then return q,v,p
elseif i == 2 then return p,v,t
@@ -42,14 +42,31 @@ local function HSVtoRGB(h, s, v)
end
end
+--[[
+local function HSVtoRGB(h, s, v)
+ h = math.floor(h * 360)
+ local k1 = v*(1-s)
+ local k2 = v - k1
+ local r = math.min (math.max (3*math.abs (((h )/180)%2-1)-1, 0), 1)
+ local g = math.min (math.max (3*math.abs (((h -120)/180)%2-1)-1, 0), 1)
+ local b = math.min (math.max (3*math.abs (((h +120)/180)%2-1)-1, 0), 1)
+ return k1 + k2 * r * 255, k1 + k2 * g * 255, k1 + k2 * b * 255
+end
+]]
+
+
function my_color_scheme(z,hsvrgb)
r, phi = cmath.polar(z)
+-- print(r,tostring(phi))
-- phi is in -pi,+pi; change it to [0;2pi] and normalize it to [0;1]
- phi = (phi+pi)/(2*pi)
+ phi = (phi+pi)/(2*pi)
+-- phi = (phi+pi)*180/pi
h_str,s_str,v_str = hsvrgb:match("([^,]+),([^,]+),([^,]+)")
+ --print(h_str,s_str,v_str)
-- print(load("return "..h_str)(),load("return "..s_str)(),load("return "..v_str)())
R,G,B = HSVtoRGB(load("return "..h_str)(),load("return "..s_str)(),load("return "..v_str)()) -- h,s,v) -- (phi+3.14,1,r)
- return {R,G,B}
+-- print(R,G,B)
+ return {math.floor(R+0.5),math.floor(G+0.5),math.floor(B+0.5)}
end
@@ -141,7 +158,7 @@ DisplayImage
if data[row][col][k] ~= data[row][col][k] then -- check for nan
outFile:write("FF")
else
- local num = data[row][col][k]
+ num = data[row][col][k]
if num < 16 then
hex = string.format("0%X", num)
else
@@ -245,8 +262,14 @@ function write_data(name,data,domain,res) -- only valid for writing ppm files
--os.execute("pnmtopng apfel.ppm >"..fileName..".png") -- ppm -> png Format
end
-function plot(fString, domain, res, funcName, hsvrgb, bgColor, invers)
+function plot(fString, domain, res, maxR, funcName, hsvrgb, bgColor, invers)
print("\nLua: calculating data with "..tostring(fString).." ... ")
+ local colorBGsum = bgColor[1] -- {-30, 255, 255}
+ if colorBGsum < 0 then -- color[1]+... < 30 will be {255,255,255}
+ for i=1,3 do
+ bgColor[i] = bgColor[2]
+ end
+ end
local left = domain[1]
local right = domain[2]
local bottom = domain[3]
@@ -270,19 +293,22 @@ function plot(fString, domain, res, funcName, hsvrgb, bgColor, invers)
fz = fString(z) -- use func number from external file
else
fz = load("return "..fString)() -- for example: cmath.cos(z)/cmath.sin(z^4-1)
- end
- color = my_color_scheme(fz,hsvrgb)
+ end
+-- if fz == complex(nan,nani) then
+-- color = { 0, 0, 0}
+-- print("Complex division by zero!!")
+-- else
+ color = my_color_scheme(fz,hsvrgb)
+-- end
+ if maxR > 0 and cmath.abs(z) > maxR then color = { 0, 0, 0 } end
if invers == "true" then
for c=1,#color do
color[c] = math.abs(color[c]-255)
end
end
- if bgColor > -1 then
- if color[1] + color[2] + color[3] <= bgColor then
- color = { 255, 255, 255 }
- end
- end
--- print(x,y,color[1],color[2],color[3])
+ local colorSum = color[1]+color[2]+color[3]
+ if color == {0, 0, 0} then color = bgColor end -- only one color
+ if colorBGsum < 0 and colorSum < math.abs(colorBGsum) then color = {255,255,255} end
img[row][col] = color
end
end
@@ -296,11 +322,13 @@ end
Resolution: (points per Interval) xRes,yRes
funcName: true/false (see f)
]]
-function createData(jobname,f,funcName,Domain,Resolution,hsvrgb,bgColor,invers,grid)
+
+function createData(jobname,f,funcName,Domain,Resolution,maxR,hsvrgb,bgColor,invers,grid)
+ print("Lua:createData: ",jobname,f,funcName,Domain,Resolution,maxR,hsvrgb,bgColor,invers,grid)
if funcName == "" then
- img = plot(f,Domain,Resolution,false,hsvrgb,bgColor,invers)
+ img = plot(f,Domain,Resolution,maxR,false,hsvrgb,bgColor,invers)
else
- img = plot(load("return "..funcName)(),Domain,Resolution,true,hsvrgb,bgColor,invers)
+ img = plot(load("return "..funcName)(),Domain,Resolution,maxR,true,hsvrgb,bgColor,invers)
end
-- write_data("domain.ppm",img,Resolution)
write_eps_data(jobname.."-domain.eps",img,Domain,Resolution,grid)