From f53e32586563f8905b64242c461f777360059e2e Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Tue, 15 Feb 2022 03:01:03 +0000 Subject: CTAN sync 202202150301 --- macros/latex/contrib/easybook/easybook.dtx | 25 +- macros/latex/contrib/easybook/easybook.pdf | Bin 578140 -> 578143 bytes macros/latex/contrib/easybook/easybook.tex | 6 +- macros/latex/contrib/footmisc/announce.txt | 13 - macros/latex/contrib/footmisc/changes.txt | 8 + macros/latex/contrib/footmisc/footmisc-code.pdf | Bin 361197 -> 363566 bytes macros/latex/contrib/footmisc/footmisc-doc.pdf | Bin 246681 -> 249496 bytes macros/latex/contrib/footmisc/footmisc.dtx | 217 +++-- macros/latex/contrib/kanbun/README.md | 2 +- macros/latex/contrib/kanbun/kanbun-en.pdf | Bin 403013 -> 403429 bytes macros/latex/contrib/kanbun/kanbun-ja.pdf | Bin 463363 -> 463253 bytes macros/latex/contrib/kanbun/kanbun.lua | 29 +- macros/latex/contrib/kanbun/kanbun.sty | 156 +++- macros/latex/contrib/kanbun/kanbun.tex | 27 +- macros/latex/contrib/proflycee/README.md | 13 + .../latex/contrib/proflycee/doc/ProfLycee-doc.pdf | Bin 0 -> 362084 bytes .../latex/contrib/proflycee/doc/ProfLycee-doc.tex | 989 +++++++++++++++++++++ macros/latex/contrib/proflycee/tex/ProfLycee.sty | 361 ++++++++ 18 files changed, 1696 insertions(+), 150 deletions(-) delete mode 100644 macros/latex/contrib/footmisc/announce.txt create mode 100644 macros/latex/contrib/proflycee/README.md create mode 100644 macros/latex/contrib/proflycee/doc/ProfLycee-doc.pdf create mode 100644 macros/latex/contrib/proflycee/doc/ProfLycee-doc.tex create mode 100644 macros/latex/contrib/proflycee/tex/ProfLycee.sty (limited to 'macros/latex') diff --git a/macros/latex/contrib/easybook/easybook.dtx b/macros/latex/contrib/easybook/easybook.dtx index 0e348a84ed..52c3418055 100644 --- a/macros/latex/contrib/easybook/easybook.dtx +++ b/macros/latex/contrib/easybook/easybook.dtx @@ -15,7 +15,7 @@ %<*class> \NeedsTeXFormat{LaTeX2e}[2020/10/01] \RequirePackage{l3keys2e} -\ProvidesExplClass{easybook}{2022/02/13}{1.625} +\ProvidesExplClass{easybook}{2022/02/14}{1.626} {Typeset Chinese theses or books} \bool_set_false:N \l__eb_compile_draft_bool @@ -303,7 +303,7 @@ %<*package> \NeedsTeXFormat{LaTeX2e}[2020/10/01] \RequirePackage{l3keys2e,etoolbox} -\ProvidesExplPackage{easybase}{2022/02/13}{1.625} +\ProvidesExplPackage{easybase}{2022/02/14}{1.626} {Typeset Chinese theses or books} \cs_generate_variant:Nn \dim_set:Nn { NV } @@ -1027,16 +1027,25 @@ \cs_set_eq:NN \eb@makefntext@save \@makefntext \ctex_at_end_package:nn { footmisc } { - \notbool{FN@para} + \eb_package_date_check:nn { footmisc } { 2022/02/10 } + \notbool{FN@para}{\cs_set_eq:NN \@makefntext \eb@makefntext@save}{} + \ifboolexpr { - \cs_set_eq:NN \@makefntext \eb@makefntext@save - \msg_warning:nn { easybase } { footmisc } - }{} + bool {FN@hangfoot} or + bool {FN@perpage} or + bool {FN@robust} or + ( + notbool {FN@abovefloats} and + bool {FN@fixskip} and + test {\ifnumcomp{\FN@ORspacehandling}{=}{1}} + ) + } + {\msg_warning:nn { easybase } { footmisc }}{} } \msg_new:nnn { easybase } { footmisc } { It~is~not~recommended~that~you~use~the \\ - hang,~symbol,~marginal,~flushmargin~or~bottom \\ + hang,~symbol,~perpage,~marginal,~flushmargin~or~bottom \\ options~of~the~'footmisc'~package. } @@ -2261,7 +2270,7 @@ } % %<*tcolorbox> -\ProvidesExplFile{eb-tcolorbox.cfg}{2022/02/13}{1.625} +\ProvidesExplFile{eb-tcolorbox.cfg}{2022/02/14}{1.626} {Customization of tcolorbox for easybook} \cs_set_protected:Npn \addtotcbstyle #1#2 diff --git a/macros/latex/contrib/easybook/easybook.pdf b/macros/latex/contrib/easybook/easybook.pdf index a1d8867b06..c58bf2d8aa 100644 Binary files a/macros/latex/contrib/easybook/easybook.pdf and b/macros/latex/contrib/easybook/easybook.pdf differ diff --git a/macros/latex/contrib/easybook/easybook.tex b/macros/latex/contrib/easybook/easybook.tex index 55f6bfda13..8dfe779fa2 100644 --- a/macros/latex/contrib/easybook/easybook.tex +++ b/macros/latex/contrib/easybook/easybook.tex @@ -21,8 +21,8 @@ name = easybook, color-scheme = blue, title = EASYBOOK 使用手册, - version = v1.625, - date = 2022/02/13, + version = v1.626, + date = 2022/02/14, authors = 瞿毅, info = 排版简体中文学位论文和书籍, email = q1jx@foxmail.com, @@ -1277,7 +1277,7 @@ \item 文档类移除预置的定理环境,改为由用户自行定义环境。 \item 考虑到功能性和实用性不强弃用摘要环境 \env*{outline} 和习题环境 \env*{exercise}。 \end{version} - \begin{version}[v = 1.625,date = 2022/02/13] + \begin{version}[v = 1.626,date = 2022/02/14] \added \item 增加目录条目下方执行的代码选项 \option{tocbelow}。 \changed diff --git a/macros/latex/contrib/footmisc/announce.txt b/macros/latex/contrib/footmisc/announce.txt deleted file mode 100644 index 8e91587a5d..0000000000 --- a/macros/latex/contrib/footmisc/announce.txt +++ /dev/null @@ -1,13 +0,0 @@ - Previous version was 5.5b from 2011. This is now version 6. A few - bugs have been fixed and the following new options have been added: - - - bottomfloats - - bottomfootnotes - - abovefloats - - belowfloats - - For details see the package documentation. - - There is a rollback possibility using either a date '[=YYYY-MM-DD]' - or the string '[=v5]' as the second optional argument to \usepackage, - e.g., \usepackage{footmisc}[=v5]. diff --git a/macros/latex/contrib/footmisc/changes.txt b/macros/latex/contrib/footmisc/changes.txt index 68c78d6187..b5389c24db 100644 --- a/macros/latex/contrib/footmisc/changes.txt +++ b/macros/latex/contrib/footmisc/changes.txt @@ -1,3 +1,11 @@ +2022-02-14 Frank Mittelbach + + * footmisc.dtx: + Corrected the "bottom" option so that it behaves like in v5. Dropped + "bottomfloats" because everxything can be expressed with combinations + of the four options "bottom" (footnotes at the bottom), "bottomfloats", + "abovefloats", and "belowfloats". (gh/1) + 2022-02-05 Frank Mittelbach * footmisc.dtx: diff --git a/macros/latex/contrib/footmisc/footmisc-code.pdf b/macros/latex/contrib/footmisc/footmisc-code.pdf index 51cecd5aa6..3707200bb3 100644 Binary files a/macros/latex/contrib/footmisc/footmisc-code.pdf and b/macros/latex/contrib/footmisc/footmisc-code.pdf differ diff --git a/macros/latex/contrib/footmisc/footmisc-doc.pdf b/macros/latex/contrib/footmisc/footmisc-doc.pdf index 81007b198d..93f3d0f8ce 100644 Binary files a/macros/latex/contrib/footmisc/footmisc-doc.pdf and b/macros/latex/contrib/footmisc/footmisc-doc.pdf differ diff --git a/macros/latex/contrib/footmisc/footmisc.dtx b/macros/latex/contrib/footmisc/footmisc.dtx index 096889ce60..2a9ea7bc13 100644 --- a/macros/latex/contrib/footmisc/footmisc.dtx +++ b/macros/latex/contrib/footmisc/footmisc.dtx @@ -35,10 +35,10 @@ %<+package>\providecommand\DeclareCurrentRelease[2]{} %<+package> %<+package>\DeclareRelease{v5}{2011-06-06}{footmisc-2011-06-06.sty} -%<+package>\DeclareCurrentRelease{}{2022-02-10} +%<+package>\DeclareCurrentRelease{}{2022-02-14} %\ProvidesPackage{footmisc}% %<*!debugins> - [2022/02/10 v6.0a + [2022/02/14 v6.0b % % a miscellany of footnote facilities% %<*dtx> @@ -104,7 +104,7 @@ % \maketitle % % -% \newcommand\fmi[1]{\begin{quote} TODO: \itshape #1\end{quote}} +% \newcommand\fmi[1]{\begin{quote} NOTE: \itshape #1\end{quote}} % \newcommand\NEW[1]{\marginpar{\mbox{}\hfill\fbox{New: #1}}} % \providecommand\pkg[1]{\texttt{#1}} % @@ -143,7 +143,7 @@ % got around finishing the changes he started to make in 2018. % % In 2022 a few new options (\texttt{abovefloats}, -% \texttt{belowfloats}, \texttt{bottomfloats}, and \texttt{bottomfootnotes}) +% \texttt{belowfloats}, and \texttt{bottomfloats} % got introduced and the package now works % with \textsf{hyperref} regardless of loading order. There arem % however, still a few restrictions when using both packages together, @@ -347,11 +347,24 @@ % \end{itemize} % These can be achieved by applying one or more of the options % discussed below. -%^^A \texttt{abovefloats}, \texttt{belowfloats}, \texttt{bottom}, -%^^A \texttt{bottomfloats}, or \texttt{bottomfootnotes}. % % % +% \subsubsection{Option \texttt{bottom}} +% +% This option forces footnotes (but not the floats) to the bottom of the page and +% therefore by default also implies \texttt{belowfloats}. If +% \cs{raggedbottom} is in force then the excess space goes above the +% footnotes if any are present. If \cs{flushbottom} is in force there +% is no visible difference to just specifying \texttt{belowfloats}. + +% \subsubsection{Option \texttt{bottomfloats}} +% +% If\NEW{2022-02} +% you want force only floats to the bottom while the footnotes stay close to the text +% use the option \texttt{bottomfloats}. If not overwritten this +% implies \texttt{abovefloats}. +% % \subsubsection{Options \texttt{abovefloats} and \texttt{belowfloats}} % % These\NEW{2022-02} @@ -361,21 +374,25 @@ % in section~\ref{sec:spacebug}. % % -% \subsubsection{Option \texttt{bottom}} -% -% This option forces footnotes \emph{and} floats to the bottom and -% also implies \texttt{belowfloats}. If you want both at the bottom -% but footnotes first, then add \texttt{abovefloats} in addition. -% -% \subsubsection{Options \texttt{bottomfloats} and -% \texttt{bottomfootnotes}} +% \subsubsection{Combining the four options} % -% If\NEW{2022-02} -% you want force only floats or only footnotes to the bottom then -% use one of these options. As they naturally define the order, i.e., -% in case of \texttt{bottomfloats} footnotes are obviously earlier, the -% options \texttt{abovefloats} and \texttt{belowfloats} are -% meaningless and are ignored if given. +% By\NEW{2022-02} +% default, \texttt{bottom} and \texttt{bottomfloats} options put any excess +% space (i.e., when \cs{raggedbottom} is in force) between floats +% and footnotes if both are present on a given page. If only one of +% them is present, the excess space goes below the text. If you prefer +% both footnotes and floats at the bottom instead, you can achieve this as follows: +% \begin{description} +% \item[\normalfont\texttt{bottom,abovefloats}] This puts the footnotes above any +% floats and both at the bottom when present. +% \item[\normalfont\texttt{bottomfloats,belowfloats}] This puts +% floats and footnotes at the bottom but +% footnotes last if both are present. If there are only footnotes +% they are still placed at the very bottom (think of them as being +% placed below the float ``area'' even if that has no floats inside). +% \end{description} +% The other combinations are duplicates, e.g., +% \texttt{bottom,belowfloats} is the same as just specifying \texttt{bottom}. % % % \subsubsection{Fixing a strange behavior of \LaTeX} @@ -585,6 +602,11 @@ % preliminary work towards interworking with \textsf{footmisc} has % been completed, but more remains to be done at the time of % writing. +% +% \item[\normalfont\textsf{hyperref}] The \textsf{hyperref} package +% works together with \textsf{footmisc} (as proved by this +% documentation), but at this point in time not all options of +% \textsf{footmisc} can be used --- this will change over time. % \end{description} % % \StopEventually{} @@ -796,29 +818,39 @@ % \subsection{The footnote/float placement options} % % We have up to three blocks on a page (four if you count -% top-floats). If there is any excess space that needs to be added the +% top-floats but they don't matter here). If there is any excess space that needs to be added the % question is where that goes: % \begin{enumerate} % \item above footnotes and floats; % \item between footnotes and floats; % \item after footnotes and floats; -% \item nowhere in particular (everything is equally spaced out). +% \item nowhere in particular (everything is equally spaced out if +% \cs{flushbottom} is in force and close together otherwise). % \end{enumerate} -% Technically, the last two cases can be combined in one: -% \cs{raggedbottom} adds some ``fill'' space at the very bottom (which -% covers case 3) and \cs{flushbottom} puts nothing in this place, so -% covers case 4 if we do not add any \cs{vfill} elsewhere. -% +% We handle that with a 3-way switch differenciating the different +% bottom cases: \texttt{bottom}, \texttt{bottomfloats} or neither of +% the two options. Within those with split the coding based on whether +% or not \texttt{abovefloats} was given (explicitly or implicitly). + % -% \begin{macro}{\FN@ORspacehandling} +% \begin{macro}{\FN@bottomcases} % We record in which case we want to be in -% \cs{FN@ORspacehandling}. The default is case 3. +% \cs{FN@bottomcases}. The default is case 3 (no option). % \begin{macrocode} -\let\FN@ORspacehandling\thr@@ +\let\FN@bottomcases\thr@@ % \end{macrocode} % \end{macro} % % +% \subsubsection{The \texttt{abovefloats}, \texttt{belowfloats} options} +% +% \begin{macro}{\ifFN@abovefloats} +% All this needs to do is to set a flag to say that it should happen. +% \begin{macrocode} +\newif\ifFN@abovefloats \FN@abovefloatstrue +% \end{macrocode} +% \end{macro} +% % % \subsubsection{The \texttt{bottom} option} % @@ -827,7 +859,7 @@ % by default below the floats. % \begin{macrocode} \DeclareOption{bottom}{% - \let\FN@ORspacehandling\@ne + \let\FN@bottomcases\@ne \FN@abovefloatsfalse % \end{macrocode} % We also state that we want to fix \LaTeX{} space issue (as we do @@ -838,40 +870,30 @@ % \end{macrocode} % \end{macro} % -% \subsection{The \texttt{abovefloats}, \texttt{belowfloats} options} % -% \begin{macro}{\ifFN@abovefloats} -% All this needs to do is to set a flag to say that it should happen. +% \subsubsection{The \texttt{bottomfloats} option} +% +% \begin{macro}{ds@bottomfloats,ds@bottomfootnotes} +% This option is for case 2. By default the footnotes are above +% (close to the text). % \begin{macrocode} -\newif\ifFN@abovefloats \FN@abovefloatstrue +\DeclareOption{bottomfloats}{% + \let\FN@bottomcases\tw@ + \FN@abovefloatstrue \FN@fixskiptrue +} % \end{macrocode} % \end{macro} % -% % \begin{macro}{ds@abovefloats,ds@belowfloats} -% These options change the order and that's it. +% These options change the order and that's it. The important +% aspect is that they are declared after the last two, otherwise +% they can't overwrite them. % \begin{macrocode} \DeclareOption{abovefloats}{\FN@abovefloatstrue \FN@fixskiptrue} \DeclareOption{belowfloats}{\FN@abovefloatsfalse \FN@fixskiptrue} % \end{macrocode} % \end{macro} % -% \subsection{The \texttt{bottomfloats}, \texttt{bottomfootnotes} options} -% -% \begin{macro}{ds@bottomfloats,ds@bottomfootnotes} -% These options are for case 2. In addition they have to say what -% comes first. -% \begin{macrocode} -\DeclareOption{bottomfloats}{% - \let\FN@ORspacehandling\tw@ - \FN@abovefloatstrue \FN@fixskiptrue -} -\DeclareOption{bottomfootnotes}{% - \let\FN@ORspacehandling\tw@ - \FN@abovefloatsfalse \FN@fixskiptrue -} -% \end{macrocode} -% \end{macro} % % % \subsection{The \texttt{marginal} option} @@ -1229,21 +1251,18 @@ % used by \verb=#1= if wanted. % \begin{macrocode} \def\@outputbox@append #1{% -% \if!\detokenize{#1}!\else \setbox\@outputbox \vbox {% \boxmaxdepth \@maxdepth \@outputbox@depth\dp\@outputbox % if needed in #1 \unvbox \@outputbox #1% }% -% \fi } % \end{macrocode} % \end{macro} % % % -% % \begin{macro}{\@outputbox@appendfootnotes} % % This command appends the footnotes to the \cs{@outputbox} (if @@ -1358,24 +1377,68 @@ % \end{macrocode} % \end{macro} % +% \fmi{Some temp interfaces until configuration points are available.} +% +% \begin{macro}{\@if@flushbottom@TF} +% Test for \cs{flushbottom} (currently not used). +% \begin{macrocode} +\def\@if@flushbottom@TF{% + \ifx\@textbottom\relax + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\@if@footnotes@TF} +% Test if footnotes are present on the current page. +% \begin{macrocode} +\def\@if@footnotes@TF{% + \ifvoid\footins + \expandafter\@secondoftwo + \else + \expandafter\@firstoftwo + \fi +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\@if@bfloats@TF} +% Test if bottom floats are around. +% \begin{macrocode} +\def\@if@bfloats@TF{% + \ifx \@botlist\@empty + \expandafter\@secondoftwo + \else + \expandafter\@firstoftwo + \fi +} +% \end{macrocode} +% \end{macro} +% +% % % % \subsection{The \cs{@makecol} configuration based on options} % % % Placement of footnotes in relation to main galley and floats is -% covered by the value of \cs{FN@ORspacehandling} (distribution of -% space) and the status of the switch \texttt{@abovefloats}. +% covered by the value of \cs{FN@bottomcases} (type of bottom option) +% and the status of the switch \texttt{@abovefloats}. % % \begin{macrocode} -\ifcase \FN@ORspacehandling\relax +\ifcase \FN@bottomcases\relax %--------------------------------------------------------- % 0 = undefined %--------------------------------------------------------- \ERROR \or %--------------------------------------------------------- -% 1 = space above footnotes and floats +% 1 = bottom option given %--------------------------------------------------------- % \end{macrocode} % All excess space are above the footnote and bottom float @@ -1384,27 +1447,33 @@ \ifFN@abovefloats %--------------------------------------------------------- % \end{macrocode} -% Footnotes above floats both at bottom: +% If footnotes above floats floats both are at the bottom: % \begin{macrocode} \def\@makecol@appendblocks {% - \@outputbox@append{\vfill}% + \@if@footnotes@TF + {\@outputbox@append{\vfill}}% + {\@if@bfloats@TF{\@outputbox@append{\vfill}}% + {\@outputbox@reinsertbskip}}% \@outputbox@appendfootnotes \@outputbox@attachfloats } %--------------------------------------------------------- \else % \end{macrocode} -% Footnotes below floats: +% Otherwise only the footnotes are at the very bottom and floats +% stay close to the text: % \begin{macrocode} \def\@makecol@appendblocks {% - \@outputbox@append{\vfill}% \@outputbox@attachfloats + \@if@footnotes@TF + {\@outputbox@append{\vfill}}% + {\@outputbox@reinsertbskip}% \@outputbox@appendfootnotes } \fi \or %--------------------------------------------------------- -% 2 = space between footnotes and floats (or floats and footnotes) +% 2 = bottomfloats option given %--------------------------------------------------------- \ifFN@abovefloats %--------------------------------------------------------- @@ -1413,27 +1482,35 @@ % \begin{macrocode} \def\@makecol@appendblocks {% \@outputbox@appendfootnotes - \@outputbox@append{\vfill}% + \@if@bfloats@TF + {\@outputbox@append{\vfill}}% + {\@outputbox@reinsertbskip}% \@outputbox@attachfloats } %--------------------------------------------------------- \else % \end{macrocode} -% Then the other way around: +% If \texttt{belowfloats} was given too, then the excess space ends +% up directly below the text % \begin{macrocode} \def\@makecol@appendblocks {% + \@if@footnotes@TF + {\@outputbox@append{\vfill}}% + {\@if@bfloats@TF{\@outputbox@append{\vfill}}% + {\@outputbox@reinsertbskip}}% \@outputbox@attachfloats - \@outputbox@append{\vfill}% \@outputbox@appendfootnotes } %--------------------------------------------------------- \fi \or %--------------------------------------------------------- -% 3 = space below footnotes and floats +% 3 = neither bottom nor bottomfloats given %--------------------------------------------------------- % \end{macrocode} -% If the excess spaces goes on the bottom we don't append +% In this case any excess space distribution is handled by +% \cs{raggedbottom} or \cs{flushbottom} settings. In case of +% \cs{raggedbottom} it goes to the bottom but we don't append % \cs{vfill} there. Instead we make use of the fact that % \cs{raggedbottom} already puts a stretchable space there, and if % we are in a \cs{flushbottom} scenario then any excess space is diff --git a/macros/latex/contrib/kanbun/README.md b/macros/latex/contrib/kanbun/README.md index 3b6e755d2d..4b60a6d997 100644 --- a/macros/latex/contrib/kanbun/README.md +++ b/macros/latex/contrib/kanbun/README.md @@ -2,7 +2,7 @@ The `kanbun` package, like other *kanbun-kundoku* (漢文訓読) LaTeX packages (such as `gckanbun`), allows users to manually input macros for elements in a *kanbun-kundoku* paragraph. -More importantly, it accepts plain text input in the “*kanbun* annotation” form when used with LuaLaTeX, which allows typesetting *kanbun-kundoku* paragraphs efficiently. +More importantly, it accepts input with light markup in the “*kanbun* annotation” form when used with LuaLaTeX, which allows typesetting *kanbun-kundoku* paragraphs efficiently. ## Licence diff --git a/macros/latex/contrib/kanbun/kanbun-en.pdf b/macros/latex/contrib/kanbun/kanbun-en.pdf index 0158947906..7b100aaca4 100644 Binary files a/macros/latex/contrib/kanbun/kanbun-en.pdf and b/macros/latex/contrib/kanbun/kanbun-en.pdf differ diff --git a/macros/latex/contrib/kanbun/kanbun-ja.pdf b/macros/latex/contrib/kanbun/kanbun-ja.pdf index 624e1ba592..f8c030f46b 100644 Binary files a/macros/latex/contrib/kanbun/kanbun-ja.pdf and b/macros/latex/contrib/kanbun/kanbun-ja.pdf differ diff --git a/macros/latex/contrib/kanbun/kanbun.lua b/macros/latex/contrib/kanbun/kanbun.lua index 9f8f01aab3..3d24708abf 100644 --- a/macros/latex/contrib/kanbun/kanbun.lua +++ b/macros/latex/contrib/kanbun/kanbun.lua @@ -1,3 +1,20 @@ +-- Copyright 2022 Yuanhao Chen + +-- This work may be distributed and/or modified under the +-- conditions of the LaTeX Project Public License, either version 1.3 +-- of this license or (at your option) any later version. +-- The latest version of this license is in +-- http://www.latex-project.org/lppl.txt +-- and version 1.3 or later is part of all distributions of LaTeX +-- version 2005/12/01 or later. +-- +-- This work has the LPPL maintenance status `maintained'. +-- +-- The Current Maintainer of this work is Yuanhao Chen. +-- +-- This work consists of the files kanbun.sty, kanbun.lua, +-- kanbun-example.tex and kanbun.tex. + function directtex(str) coroutine.yield(str) end @@ -25,10 +42,10 @@ function main_loop() brackets["furigana4saidokumoji"] = {"‹","›"} brackets["okurigana4saidokumoji"] = {"«","»"} -- - -- other_brackets["punctuation"] = {"⦉","⦊"} - -- other_brackets["kanji"] = {"⌊","⌋"} - -- other_brackets["multikanji"] = {"‘","’"} - -- other_brackets["unit"] = {"“","”"} + brackets["punctuation"] = {"⦉","⦊"} + -- brackets["kanji"] = {"⌊","⌋"} + -- brackets["multikanji"] = {"‘","’"} + -- brackets["unit"] = {"“","”"} -- left_brackets = {} right_brackets = {} @@ -218,6 +235,10 @@ function main_loop() output = "{\\kanbunfont"..table.concat(annotated_lines_table, "\\par").."\\par}" directtex("\\def\\printkanbun{"..output.."}") directtex("\\def\\printkanbuncode{\\directlua{print('')print(output)}}") + -- nopar output + nopar_output = table.concat(annotated_lines_table, "\\\\") + directtex("\\def\\printkanbunnopar{"..nopar_output.."}") + directtex("\\def\\printkanbunnoparcode{\\directlua{print('')print(nopar_output)}}") -- end loop in TeX directtex("\\continuefalse") diff --git a/macros/latex/contrib/kanbun/kanbun.sty b/macros/latex/contrib/kanbun/kanbun.sty index f730245e09..9f5f8f8d56 100644 --- a/macros/latex/contrib/kanbun/kanbun.sty +++ b/macros/latex/contrib/kanbun/kanbun.sty @@ -18,16 +18,14 @@ \NeedsTeXFormat{LaTeX2e}[2021/06/01] \RequirePackage{expl3,xparse,l3keys2e,ifluatex} \ProvidesExplClass{kanbun} - {2022/01/17} {1.1} {漢文の訓点文の組版} + {2022/02/13} {1.2} {漢文の訓点文の組版} \ExplSyntaxOn \cs_generate_variant:Nn \str_if_eq:nnTF { V } \cs_generate_variant:Nn \str_case:nnTF { V } +\cs_generate_variant:Nn \str_case:nnTF { f } % vars used in options -\tl_set:Nn \kanbun_scale { 2 } -\newlength\kanbun_init_zw -\setlength\kanbun_init_zw{1em} \@ifpackageloaded{luatexja-fontspec}{ \tl_set:Nn \kanbun_rubyfontcmd_default { \addjfontfeatures{RawFeature={+ruby}} } \tl_set:Nn \kanbun_fontcmd_default { \addjfontfeatures{RawFeature={+trad}} } @@ -39,32 +37,38 @@ % options \keys_define:nn { kanbun } { - , scale .tl_set:N = \kanbun_scale + , scale .fp_set:N = \kanbun_scale , scale .initial:n = { 2 } , fontcmd .tl_set:N = \kanbun_fontcmd , fontcmd .initial:n = \kanbun_fontcmd_default , rubyfontcmd .tl_set:N = \kanbun_rubyfontcmd , rubyfontcmd .initial:n = \kanbun_rubyfontcmd_default - , unit .tl_set:N = \kanbun_zw - , unit .initial:n = { \kanbun_init_zw } - , yokoaki .tl_set:N = \kanbun_yokoaki - , yokoaki .initial:n = { \kanbun_scale } - , tateaki .tl_set:N = \kanbun_tateaki + , unit .dim_set:N = \kanbun_zw + , unit .initial:n = { 1em } + , yokoaki .fp_set:N = \kanbun_yokoaki + , yokoaki .initial:n = { 2 } + , tateaki .fp_set:N = \kanbun_tateaki , tateaki .initial:n = { 2 } - , okuriintrusion .tl_set:N = \kanbun_okuriintrusion + , okuriintrusion .fp_set:N = \kanbun_okuriintrusion , okuriintrusion .initial:n = { 1 } - , kumi .tl_set:N = \kanbun_kumi + , kumi .str_set:N = \kanbun_kumi , kumi .initial:n = { aki } , aki .code:n = \keys_set:nn { kanbun } { kumi = aki } , beta .code:n = \keys_set:nn { kanbun } { kumi = beta } } \ProcessKeysOptions { kanbun } +\DeclareDocumentCommand \setkanbun { m } { + \keys_set:nn { kanbun } { #1 } +} % other vars \tl_set:Nn \kanbun_rubyfontsize_rubyfontcmd { \kanbun_rubyfontcmd\fontsize{\fp_eval:n {1/\kanbun_scale}\kanbun_zw}{0pt}\selectfont } \newlength{\kanbun_furilen} +\newlength{\kanbun_okurilen} +\newlength{\kanbun_furiokuri_firstline_len} +\int_new:N \kanbun_furiokuri_firstline_start_index \tl_set:Nn \kanbun_tateten_width { 1/30 } -\tl_set:Nn \kanbunzwtosp { \fp_eval:n {\dim_ratio:nn { 1 \kanbun_zw } { 1 sp } } } +\tl_set:Nn \kanbunzwtosp { \fp_eval:n { \dim_ratio:nn { 1 \kanbun_zw } { 1 sp } } } \tl_set:Nn \kanbun_unit_glue { \str_if_eq:VnTF \kanbun_kumi { aki } { \penalty0 @@ -90,18 +94,18 @@ \tl_set:Nn \central_punct {} \process_punct{ #4 } \tl_set:Nn \kanbun_central_punct_box { - \kanbun_ensure_height{1\kanbun_zw} { + \kanbun_ensure_height{\kanbun_zw} { \str_if_eq:VnTF \kanbun_kumi { aki } { - \hbox{\kern 1\kanbun_zw{\hbox to \fp_eval:n { \kanbun_tateaki/\kanbun_scale }\kanbun_zw{\hss{\central_punct}\hss}}} + \hbox{\kern \kanbun_zw{\hbox to \fp_eval:n { \kanbun_tateaki/\kanbun_scale }\kanbun_zw{\hss{\central_punct}\hss}}} } { - \hbox{\kern 1\kanbun_zw{\central_punct}} + \hbox{\kern \kanbun_zw{\central_punct}} } } } \tl_set:Nn \kanbun_left_punct_phantom { - \kanbun_ensure_height{1\kanbun_zw} { + \kanbun_ensure_height{\kanbun_zw} { \str_if_eq:VnTF \kanbun_kumi { aki } { } { \str_if_eq:nnTF { #2 } { } { } { @@ -111,9 +115,16 @@ } } \tl_set:Nn \kanbun_right_punct_box { - \kanbun_ensure_height{1\kanbun_zw} { + \kanbun_ensure_height{\kanbun_zw} { + \vfill % make sure punct stay on baseline in yoko direction (xeCJK) \str_if_eq:VnTF \right_punct { } { } { - \hbox{\kern 1\kanbun_zw{\right_punct}} + \hbox{ + \kern \kanbun_zw + \bool_if:NTF \kanbun_first_right_punct_is_kagi { + \phantom{ \kanbun_rubyfontsize_rubyfontcmd\kaeriten{#5} } + } { } + \right_punct + } } } } @@ -121,32 +132,36 @@ \tl_set:Nn \unit_content { \kanbun_left_punct_phantom % compensate for width of left punct \vbox{ - \kanbun_ensure_height{\fp_eval:n { 1/\kanbun_scale }\kanbun_zw}{\hbox{\kanbun_rubyfontsize_rubyfontcmd{#1}}} % right kana + \bool_set_true:N \kanbun_is_right_kana + \kanbun_ensure_height{ 0pt }{\hbox{\kanbun_rubyfontsize_rubyfontcmd{#1}}} % right kana \nointerlineskip % - \kanbun_ensure_height{1\kanbun_zw}{\llap{#2}} % left punct + \vspace*{\fp_eval:n { 0.5/\kanbun_scale }\kanbun_zw} + \kanbun_ensure_height{\kanbun_zw}{\llap{#2}} % left punct \nointerlineskip % \vspace*{-1 \kanbun_zw} - \kanbun_ensure_height{1\kanbun_zw}{ - \hbox to 1\kanbun_zw{\hss{#3}\hss} + \kanbun_ensure_height{\kanbun_zw}{ + \hbox to \kanbun_zw{\hss{#3}\hss} } % kanji \nointerlineskip % \vspace*{-1 \kanbun_zw} - \kanbun_ensure_height{\fp_eval:n { 1/\kanbun_scale }\kanbun_zw}{\hbox{\kern 1\kanbun_zw{\ninojiten_punct}}} % ninojiten + \kanbun_ensure_height{\fp_eval:n { 1/\kanbun_scale }\kanbun_zw}{\hbox{\kern \kanbun_zw{\ninojiten_punct}}} % ninojiten \nointerlineskip % \vspace*{\fp_eval:n { -1/\kanbun_scale }\kanbun_zw} \kanbun_right_punct_box % right punct \nointerlineskip % - \vspace*{-1\kanbun_zw} + \vspace*{-\kanbun_zw} \kanbun_central_punct_box % central punct \nointerlineskip % \vspace*{ \fp_eval:n { -1/\kanbun_scale }\kanbun_zw } - \kanbun_ensure_height{\fp_eval:n { 1/\kanbun_scale }\kanbun_zw}{\hbox{\kanbun_rubyfontsize_rubyfontcmd\kern 1\kanbun_zw{\kaeriten{#5}}}} % kaeriten + \kanbun_ensure_height{\fp_eval:n { 1/\kanbun_scale }\kanbun_zw}{\hbox{\kanbun_rubyfontsize_rubyfontcmd\kern \kanbun_zw{\kaeriten{#5}}}} % kaeriten \nointerlineskip % - \kanbun_ensure_height{\fp_eval:n { 1/\kanbun_scale }\kanbun_zw}{\hbox{\kanbun_rubyfontsize_rubyfontcmd{#6}}} % left kana + \vspace*{\fp_eval:n { 0.5/\kanbun_scale }\kanbun_zw} + \bool_set_false:N \kanbun_is_right_kana + \kanbun_ensure_height{ 0pt }{\hbox{\kanbun_rubyfontsize_rubyfontcmd{#6}}} % left kana } } \str_if_eq:VnTF \kanbun_kumi { aki } { - \setbox\kanbun_current_kanjiunit \hbox to \fp_eval:n { 1+\kanbun_tateaki/\kanbun_scale }\kanbun_zw{ \unit_content } + \setbox\kanbun_current_kanjiunit \hbox to \kanbun_zw{ \unit_content \hss} }{ \setbox\kanbun_current_kanjiunit \hbox{ \unit_content } } @@ -162,10 +177,12 @@ \str_if_eq:VnTF \kanbun_kumi { aki } { \usebox\kanbun_current_kanjiunit + \hskip\fp_eval:n { \kanbun_tateaki/\kanbun_scale }\kanbun_zw } { \discretionary{ - \usebox\kanbun_current_kanjiunit\kern\dimexpr1\kanbun_zw-\wd\kanbun_current_kanjiunit\relax + \usebox\kanbun_current_kanjiunit + \kern\dim_eval:n { \kanbun_zw - \box_wd:N \kanbun_current_kanjiunit } }{ % }{ @@ -182,15 +199,63 @@ \nobreak \kanbun_unit_glue } +\cs_new:Nn \kanbun_dim_to_fp_and_round:n { + \fp_eval:n { round( \dim_to_fp:n { #1 }, 0 ) } +} +\cs_new:Nn \kanbun_typeset_normal_kana:nn { + \dim_compare:nNnTF { \kanbun_furilen } < { \fp_eval:n { 1-\kanbun_okuriintrusion/\kanbun_scale }\kanbun_zw } + { \makebox[\fp_eval:n { 1-\kanbun_okuriintrusion/\kanbun_scale }\kanbun_zw][l]{ #1 } } + { #1 } + #2 +} +\cs_new:Nn \kanbun_typeset_long_kana_by_raising_okurigana:nn { + \makebox[ \dim_eval:n { \fp_eval:n { 1 + \kanbun_tateaki / \kanbun_scale }\kanbun_zw - \kanbun_okurilen } ][l]{ #1 } + #2 +} +\cs_new:Nn \kanbun_typeset_long_kana:n { + \str_set:Nn \kanbun_furiokuri_all { #1 } + \int_set:Nn \kanbun_furiokuri_firstline_start_index { -1 } + \settowidth{ \kanbun_furiokuri_firstline_len }{ } + % + \fp_while_do:nn { + \kanbun_dim_to_fp_and_round:n { \kanbun_furiokuri_firstline_len } < \kanbun_dim_to_fp_and_round:n { \fp_eval:n { (\kanbun_okuriintrusion + \kanbun_tateaki) / \kanbun_scale }\kanbun_zw } + % \kanbun_dim_to_fp_and_round:n { \kanbun_furiokuri_firstline_len } < \kanbun_dim_to_fp_and_round:n { ( \kanbun_furilen + \kanbun_okurilen ) / 2 } + } { + \int_decr:N \kanbun_furiokuri_firstline_start_index + \settowidth{ \kanbun_furiokuri_firstline_len }{ \str_range:Nnn \kanbun_furiokuri_all { \kanbun_furiokuri_firstline_start_index } { -1 } } + } + % output + \rlap{\raisebox{ \bool_if:NTF \kanbun_is_right_kana { } { - } \fp_eval:n { 1 / \kanbun_scale }\kanbun_zw }[0pt][0pt]{ + \kern \fp_eval:n { .5/\kanbun_scale }\kanbun_zw + \kern \fp_to_dim:n { min( 0, \kanbun_dim_to_fp_and_round:n { \fp_eval:n { 2 * (\kanbun_okuriintrusion + \kanbun_tateaki) / \kanbun_scale }\kanbun_zw - \kanbun_furilen - \kanbun_okurilen } ) } + \str_range:Nnn \kanbun_furiokuri_all { 1 } { \kanbun_furiokuri_firstline_start_index - 1 } + }} + \kern \fp_eval:n { 1-\kanbun_okuriintrusion/\kanbun_scale }\kanbun_zw \str_range:Nnn \kanbun_furiokuri_all { \kanbun_furiokuri_firstline_start_index } { -1 } +} \NewDocumentCommand { \furiokuri } { m m } { - \settowidth{\kanbun_furilen}{#1} - \ifdim\kanbun_furilen < \fp_eval:n {1-\kanbun_okuriintrusion/\kanbun_scale}\kanbun_zw - \makebox[\fp_eval:n {1-\kanbun_okuriintrusion/\kanbun_scale}\kanbun_zw][l]{#1} - \else - #1 - \fi - #2 + \settowidth{ \kanbun_furilen }{ #1 } + \settowidth{ \kanbun_okurilen }{ #2 } + + \str_if_eq:VnTF \kanbun_kumi { aki } + { + \fp_compare:nTF { \kanbun_dim_to_fp_and_round:n { \kanbun_furilen + \kanbun_okurilen } > \kanbun_dim_to_fp_and_round:n {\fp_eval:n { 1 + \kanbun_tateaki / \kanbun_scale }\kanbun_zw} } { + \kanbun_typeset_long_kana:n { #1 #2 } + } { + \fp_compare:nTF { \kanbun_dim_to_fp_and_round:n { \kanbun_okurilen } >= \kanbun_dim_to_fp_and_round:n { \fp_eval:n { (\kanbun_okuriintrusion + \kanbun_tateaki) / \kanbun_scale }\kanbun_zw } } { + \fp_compare:nTF { \kanbun_dim_to_fp_and_round:n { \kanbun_okurilen } <= \kanbun_dim_to_fp_and_round:n { \fp_eval:n { 1 + (\kanbun_tateaki - 1) / \kanbun_scale }\kanbun_zw } } { + \kanbun_typeset_long_kana_by_raising_okurigana:nn { #1 } { #2 } + } { + \kanbun_typeset_long_kana:n { #1 #2 } + } + } { + \kanbun_typeset_normal_kana:nn { #1 } { #2 } + } + } + } + { + \kanbun_typeset_normal_kana:nn { #1 } { #2 } + } } \NewDocumentCommand { \kaeriten } { m } { @@ -212,13 +277,13 @@ { — } { \tl_put_right:Nn \central_punct { \tateten } } { ― } { \tl_put_right:Nn \central_punct { \tateten } } { ㆐ } { \tl_put_right:Nn \central_punct { \tateten } } - % { : } { \tl_put_right:Nn \central_punct { \hbox to 1\kanbun_zw{\hss{:}\hss} } } - % { ・ } { \tl_put_right:Nn \central_punct { \hbox to 1\kanbun_zw{\hss{・}\hss} } } + % { : } { \tl_put_right:Nn \central_punct { \hbox to \kanbun_zw{\hss{:}\hss} } } + % { ・ } { \tl_put_right:Nn \central_punct { \hbox to \kanbun_zw{\hss{・}\hss} } } { : } { \tl_put_right:Nn \right_punct { \hbox to 0.5\kanbun_zw{\hss{:}\hss} } } { ・ } { \tl_put_right:Nn \right_punct { \hbox to 0.5\kanbun_zw{\hss{・}\hss} } } - { … } { \tl_put_right:Nn \central_punct { \hbox to 1\kanbun_zw{\hss{…}\hss} } } - { ! } { \tl_put_right:Nn \central_punct { \hbox to 1\kanbun_zw{\hss{!}\hss} } } - { ? } { \tl_put_right:Nn \central_punct { \hbox to 1\kanbun_zw{\hss{?}\hss} } } + { … } { \tl_put_right:Nn \central_punct { \hbox to \kanbun_zw{\hss{…}\hss} } } + { ! } { \tl_put_right:Nn \central_punct { \hbox to \kanbun_zw{\hss{!}\hss} } } + { ? } { \tl_put_right:Nn \central_punct { \hbox to \kanbun_zw{\hss{?}\hss} } } { 〻 } { \tl_put_right:Nn \ninojiten_punct { \ninojiten } \tl_put_right:Nn \right_punct { \phantom{\ninojiten} } @@ -227,8 +292,14 @@ \tl_put_right:Nn \right_punct { \hbox to 0.5\kanbun_zw{\hfil#1\hss} } } } +% \bool_new:N \NewDocumentCommand { \process_punct } { m } { + \bool_set_false:N \kanbun_first_right_punct_is_kagi + \str_case:fnTF { \str_range:nnn { #1 } { 1 } { 1 } } { + { 」 } { \bool_set_true:N \kanbun_first_right_punct_is_kagi } + { 』 } { \bool_set_true:N \kanbun_first_right_punct_is_kagi } + } { } { } \str_map_function:nN { #1 } \process_punct_map } \NewDocumentCommand { \multifuriokuri } { O{2\kanbun_zw} m m } @@ -256,7 +327,8 @@ { \kanbun_rubyfontsize_rubyfontcmd 〻 } % corrects fontsize of ruby base -\NewDocumentCommand { \kanbunfont } {} { \parindent=0pt\kanbun_fontcmd\fontsize{\kanbun_zw}{\fp_eval:n {1+\kanbun_yokoaki/\kanbun_scale}\kanbun_zw}\selectfont} +% \NewDocumentCommand { \kanbunfont } {} { \parindent=0pt\kanbun_fontcmd\fontsize{\kanbun_zw}{\fp_eval:n {1+\kanbun_yokoaki/\kanbun_scale}\kanbun_zw}\selectfont} +\NewDocumentCommand { \kanbunfont } {} { \kanbun_fontcmd\fontsize{\kanbun_zw}{\fp_eval:n {1+\kanbun_yokoaki/\kanbun_scale}\kanbun_zw}\selectfont} \NewDocumentEnvironment { kanjipar } { +b } { { diff --git a/macros/latex/contrib/kanbun/kanbun.tex b/macros/latex/contrib/kanbun/kanbun.tex index 2945b0505b..3a4b519b80 100644 --- a/macros/latex/contrib/kanbun/kanbun.tex +++ b/macros/latex/contrib/kanbun/kanbun.tex @@ -42,6 +42,7 @@ ExplSyntaxOn, ExplSyntaxOff, kanjiunit, + setkanbun, } }} {} @@ -119,8 +120,8 @@ } } \date{ - \en{\scshape 17 january 2022, v1.1} - \ja{2022年1月17日, v1.1} + \en{\scshape 13 february 2022, v1.2} + \ja{2022年2月13日, v1.2} } @@ -231,12 +232,10 @@ \end{optionlist} \SaveVerb{kanbunprefix}|\kanbun_| -\en{After initialising the options, you can still change the option values through \sty{exlp3} syntax, with a prefix \UseVerb{kanbunprefix} to option names. For example, to switch to \emph{beta-gumi}, you could use} -\ja{オプションを初期化する後でも、 \sty{exlp3} \ruby[pre=1]{構文}{シンタックス}でオプション名に \UseVerb{kanbunprefix} をプリフィックスして再アサインできる。例えば、ベタ組に再設定するには下記のコードを使う。} +\en{After initialising the options, you can still change the option values through the command \cmd{setkanbun}. For example, to switch to \emph{beta-gumi}, you could use} +\ja{オプションを初期化する後でも、 \cmd{setkanbun} を使ってオプションを変更できる。例えば、ベタ組に再設定するには下記のコードを使う。} \begin{example} -\ExplSyntaxOn -\tl_set:Nn \kanbun_kumi { beta } -\ExplSyntaxOff +\setkanbun{beta} \end{example} \subsection[\en{Basic usage without \LuaLaTeX}\ja{\LuaLaTeX{}を使わない場合の基本使用}]{\en{Basic usage without \LuaLaTeX{} (not recommended)}\ja{\LuaLaTeX{}を使わない場合の基本使用(お薦めではない)}} @@ -317,13 +316,23 @@ \cmditem{printkanbun} - \en{Where you would like to use the most recently saved \emph{kanbun-kundoku} paragraph, use \cmd{printkanbun}.} - \ja{最近保存された漢文訓読を使用するには、 \cmd{printkanbun} を使う。} + \en{Where you would like to use the most recently saved \emph{kanbun-kundoku} paragraph, use \cmd{printkanbun}. It automatically calls \cmd{kanbunfont} and \cmd{par} to set the font size and line spacing and make paragraphs.} + \ja{最近保存された漢文訓読を使用するには、 \cmd{printkanbun} を使う。自動的に \cmd{kanbunfont} と \cmd{par} を挿入して寸法やインテルを設定し、段落を作成する。} \cmditem{printkanbuncode} \en{If you wish to make modifications on the result or to use the result with a non-\LuaTeX{} engine, it is possible to obtain the macros using \cmd{printkanbuncode} (prints in the terminal), and continue to work from there.} \ja{処理の結果を一部変更する、もしくは結果を\LuaTeX{}でないエンジンで使用するには、結果のマクロを \cmd{printkanbuncode} で入手して(端末に出力)、そこから作業を続けることが可能。} + + \cmditem{printkanbunnopar} + + \en{The no-paragraph counterpart of \cmd{printkanbun}, which does not invoke \cmd{kanbunfont}, and uses \verb|\\| instead of \cmd{par}.} + \ja{\cmd{printkanbun} に対応する段落無しのバージョン。\cmd{kanbunfont}を使用せず、 \cmd{par} の代わりに \verb|\\| を使用する。} + + \cmditem{printkanbunnoparcode} + + \en{The no-paragraph counterpart of \cmd{printkanbuncode}.} + \ja{\cmd{printkanbuncode} に対応する段落無しのバージョン。} \end{ltxsyntax} \en{You can always save \cmd{printkanbun} to a macro for use later and start a new annotated \emph{kanbun} block, as in the following example.} diff --git a/macros/latex/contrib/proflycee/README.md b/macros/latex/contrib/proflycee/README.md new file mode 100644 index 0000000000..d987cf2976 --- /dev/null +++ b/macros/latex/contrib/proflycee/README.md @@ -0,0 +1,13 @@ +You are a french mathematics teacher ? +proflycee may be a useful package to daily use of LaTeX. + +---------------- + +Vous êtes un enseignant de mathématiques en lycée ? +lycee est un package qui pourra vous aider à utiliser LaTeX au quotidien. + +---------------- + +Author : Cédric Pierquet +email : cpierquet@outlook.fr +Licence : Released under the LaTeX Project Public License v1.3c or later, see http://www.latex-project.org/lppl.txt diff --git a/macros/latex/contrib/proflycee/doc/ProfLycee-doc.pdf b/macros/latex/contrib/proflycee/doc/ProfLycee-doc.pdf new file mode 100644 index 0000000000..28ebf75edb Binary files /dev/null and b/macros/latex/contrib/proflycee/doc/ProfLycee-doc.pdf differ diff --git a/macros/latex/contrib/proflycee/doc/ProfLycee-doc.tex b/macros/latex/contrib/proflycee/doc/ProfLycee-doc.tex new file mode 100644 index 0000000000..c328b4035f --- /dev/null +++ b/macros/latex/contrib/proflycee/doc/ProfLycee-doc.tex @@ -0,0 +1,989 @@ +% !TeX TXS-program:compile = txs:///pythonpdfse + +\documentclass{article} +\usepackage[utf8]{inputenc} +\usepackage[T1]{fontenc} +\usepackage[upright]{fourier} +\usepackage[scaled=0.875]{helvet} +\renewcommand\ttdefault{lmtt} +\usepackage[scaled=0.875]{cabin} +\usepackage{ProfLycee} +\usepackage[most]{tcolorbox} +\usetikzlibrary{hobby} +\usepackage[french]{babel} +\usepackage{siunitx} +\usepackage{graphics} +\usepackage{hvlogos} +\usepackage{simplekv} +\usepackage{listofitems} +\usepackage{xintexpr} +\usepackage{codehigh} +\usepackage{hyperref} +\hypersetup{pdfborder=0 0 0} + +\usepackage{listings} + +\lstset{% + classoffset = 0,% + language = [LaTeX]TeX,% + basicstyle = \ttfamily,% + breaklines = true,% + commentstyle =\color{gray},% + columns=fullflexible,% + keepspaces, + frame=tb,% + %texcsstyle=*\color{blue},%pour colorer la contre-oblique + alsoletter={\\},% + keywordstyle=\color{blue},% + emph=[1]{tkz,ProfLycee,ProfCollege},% + emphstyle=[1]{\color{blue}},% + emph=[3]{beamer},% + emphstyle=[3]{\color{red}},% + classoffset=1,% + keywords={Ecran},% + keywordstyle=\color{green},% + classoffset=0,% + literate=*{[}{{\textcolor{orange}{[}}}{1} + {]}{{\textcolor{orange}{]}}}{1} + {\{}{\textcolor{amber}{\{}}{1} + {\}}{\textcolor{amber}{\}}}{1} + {\&}{\textcolor{red}{\&}}{1} + {\\[}{{\textcolor{purple}{\textbackslash[}}}{2} + {\\]}{{\textcolor{purple}{\textbackslash]}}}{2} + {$}{{\textcolor{purple}{\$}}}{1}%$ + {_}{{\textcolor{purple}{\_}}}{1}% + {^}{{\textcolor{purple}{\^{}}}}{1}%, +} + +\usepackage{minted} +\sisetup{locale=FR} +\usepackage{geometry} +\geometry{margin=1.5cm} +\usepackage{newverbs} +\newverbcommand{\pverb}{\color{purple}}{} +\newverbcommand{\rverb}{\color{red}}{} +\newverbcommand{\vverb}{\color{ForestGreen}}{} +\newverbcommand{\averb}{\color{CadetBlue}}{} +\newverbcommand{\overb}{\color{orange}}{} +\newverbcommand{\bverb}{\color{blue}}{} +\setlength{\parindent}{0pt} +\definecolor{LightGray}{gray}{0.9} + +\tcbset{vignettes/.style={% + nobeforeafter,box align=base,boxsep=0pt,enhanced,sharp corners=all,rounded corners=southeast,% + boxrule=0.75pt,left=7pt,right=1pt,top=0pt,bottom=0.25pt,% + %before upper={{\normalsize \vphantom{pf}}} + } +} +\tcbset{vignettelatex/.style={% + fontupper={\vphantom{pf}\footnotesize\ttfamily}, + vignettes,% + colframe=CadetBlue,coltitle=white,colback=CadetBlue!5,% + overlay={\begin{tcbclipinterior}% + \fill[fill=lightgray!50]($(interior.south west)$) rectangle node[rotate=90]{\tiny \sffamily{\textcolor{CadetBlue}{\scalebox{0.6}[0.75]{\textbf{\LaTeX}}}}} ($(interior.north west)+(5pt,0pt)$);% + \end{tcbclipinterior}} + } +} +\newcommand\ctex[1]{\tcbox[vignettelatex]{#1}} + +%gestion de la fenêtre v2 directement dans le tikzpicture +\tikzset{% + xmin/.store in=\xmin,xmin/.default=-5,xmin=-5, + xmax/.store in=\xmax,xmax/.default=5,xmax=5, + ymin/.store in=\ymin,ymin/.default=-5,ymin=-5, + ymax/.store in=\ymax,ymax/.default=5,ymax=5, + xgrille/.store in=\xgrille,xgrille/.default=1,xgrille=1, + xgrilles/.store in=\xgrilles,xgrilles/.default=0.5,xgrilles=0.5, + ygrille/.store in=\ygrille,ygrille/.default=1,ygrille=1, + ygrilles/.store in=\ygrilles,ygrilles/.default=0.5,ygrilles=0.5, + xunit/.store in=\xunit,unit/.default=1,xunit=1, + yunit/.store in=\yunit,unit/.default=1,yunit=1 +} +\newcommand\tgrilles[1][ultra thin,lightgray]{% + \draw[xstep=\xgrilles,ystep=\ygrilles,#1] (\xmin,\ymin) grid (\xmax,\ymax);% +} +\newcommand\tgrillep[1][thin,gray]{% + \draw[xstep=\xgrille,ystep=\ygrille,#1] (\xmin,\ymin) grid (\xmax,\ymax);% +} + +\newcommand\genfenetre{% + %styles + \tikzset{noeudexpl/.style={purple,font=\sffamily\small}} + \tikzset{portionexpl/.style={orange,thick,<->}} + \tikzset{expl/.style={midway,inner sep=1pt,above right=0,orange,font=\sffamily\scriptsize,rotate=45}} + \tikzset{coeffs/.style={CadetBlue!50!black,circle,draw=CadetBlue,thick,fill=CadetBlue!5,font=\small\ttfamily}} + \tikzset{tangente/.style={teal,line width=1pt,dashed}} + %grilles & axes + \tgrilles[line width=0.3pt,lightgray!50] + \tgrillep[line width=0.6pt,lightgray!50] + \draw[line width=1.5pt,->,gray] (\xmin,0)--(\xmax,0) ; + \draw[line width=1.5pt,->,gray] (0,\ymin)--(0,\ymax) ; + \foreach \x in {0,1,...,10} {\draw[gray,line width=1.5pt] (\x,4pt) -- (\x,-4pt) ;} + \foreach \y in {0,1,...,6} {\draw[gray,line width=1.5pt] (4pt,\y) -- (-4pt,\y) ;} +} + +\newcommand\gennotice{% + %notice + \draw (0,1) node[noeudexpl,below] {point 1} ; + \draw (4,3.667) node[noeudexpl,above] {point 2} ; + \draw (7.5,1.75) node[noeudexpl,below] {point 3} ; + \draw (9,2) node[noeudexpl,above] {point 4} ; + \draw (10,0) node[noeudexpl,below] {point 5} ; + \draw[portionexpl] (0,6)--(4,6) node[expl] {portion 1} ; + \draw[portionexpl] (4,6)--(7.5,6) node[expl] {portion 2} ; + \draw[portionexpl] (7.5,6)--(9,6) node[expl] {portion 3} ; + \draw[portionexpl] (9,6)--(10,6) node[expl] {portion 4} ; + \draw[orange,densely dashed,thick] (4,0)--(4,6) (7.5,0)--(7.5,6) (9,0)--(9,6) (10,0)--(10,6) ; +} + +\newcommand\gentangentes{% + %tangentes + \draw[tangente] (0,1)--(1,1) ; + \draw[tangente,domain=3:5] plot (\x,{-1/3*(\x-9)+2}) ; + \draw[tangente] (6.5,1.75)--(8.5,1.75) ; + \draw[tangente,domain=8:10] plot (\x,{-1/3*(\x-9)+2}) ; + \draw[tangente,domain=9.5:10] plot (\x,{-10*(\x-10)+0}) ;% +} + +\newcommand\listecoeffs[4]{% + \draw (0,5.5) node[left,CadetBlue,font=\small\ttfamily] {Coeffs} ; + \node[coeffs] at (2,5.5) {#1} ; + \node[coeffs] at ({(4+7.5)/2},5.5) {#2} ; + \node[coeffs] at ({(7.5+9)/2},5.5) {#3} ; + \node[coeffs] at ({(9+10)/2},5.5) {#4} ;% +} + +\title{% +\begin{minipage}{0.75\linewidth} + \begin{tcolorbox}[colframe=yellow,colback=yellow!15] + \begin{center} + \begin{tabular}{c} + \lstinline!ProfLycee!\\ + \\ + Quelques \textit{petites} commandes pour \LaTeX{} (au lycée) + \end{tabular} + \end{center} + \end{tcolorbox} +\end{minipage} +} +\author{ + \begin{tabular}{c} + Cédric Pierquet\\ + {\ttfamily c pierquet -- at -- outlook . fr} + \end{tabular} +} +\date{Version 1.0.2 -- 13 Février 2022} + +\newcommand\Cle[1]{{\bfseries\sffamily\textlangle #1\textrangle}} + +\begin{document} + +\thispagestyle{empty} + +\maketitle + +{\Large \bfseries Résumé : } + +\medskip + +\noindent Quelques commandes (dans des environnements \TikZ) pour faciliter l'utilisation + de \LaTeX{} pour les enseignants de mathématiques en lycée.\\ + +\bigskip + +\tableofcontents + +\newpage + +\section{Introduction} + +\subsection{\og Philosophie \fg{} du package} + +Ce \ctex{package}, très largement inspiré (et beaucoup moins abouti !) de l'excellent \ctex{ProfCollege} de C. Poulain et des excellents \ctex{tkz-*} d'A. Matthes, va définir quelques outils pour des situations particulières qui ne sont pas encore dans \ctex{ProfCollege}. + +On peut le voir comme un (maigre) complément à \ctex{ProfCollege}, et je précise que la syntaxe est très proche (car pertinente de base) et donc pas de raison de changer une équipe qui gagne ! + +\medskip + +L'idée est donc de conserver l'idée de \Cle{Clés} qui sont : +% +\begin{itemize} + \item modifiables ; + \item définies (en majorité) par défaut pour chaque commande. +\end{itemize} + +\medskip + +J'ai utilisé allègrement les \ctex{packages} du phénoménal C. Tellechea, je vous conseille d'aller jeter un œil sur ce qu'il est possible de faire en \LaTeX{} avec \ctex{listofitems}, \ctex{randomlist}, \ctex{simplekv} et \ctex{xstring} ! + +\subsection{Outils disponibles} + +Le \ctex{package}, qui s'enrichira peut-être au fil du temps permet -- pour le moment -- de : + +\begin{itemize} + \item tracer des splines cubiques avec gestion \textit{assez fine} des tangentes ; + \item tracer des tangentes (ou portions) de tangentes sur la même base que pour les splines ; + \item simuler une fenêtre de logiciel formel (\textit{à la manière de} \textsf{XCas}). +\end{itemize} + +\medskip + +À noter que le commandes disponibles sont liées à un environnement \ctex{tikzpicture}, elles ne sont pas autonomes mais permettent de conserver -- en parallèle -- toute commande liée à \TikZ{} ! + +\bigskip + +\begin{center} + \begin{tikzpicture}[x=0.9cm,y=0.9cm,xmin=-1,xmax=11,xgrille=1,xgrilles=0.5,ymin=-1,ymax=5,ygrille=1,ygrilles=0.5] + %axes et grilles + \draw[xstep=\xgrilles,ystep=\ygrilles,line width=0.3pt,lightgray!50] (\xmin,\ymin) grid (\xmax,\ymax); + \draw[xstep=\xgrilles,ystep=\ygrilles,line width=0.6pt,lightgray!50] (\xmin,\ymin) grid (\xmax,\ymax); + \draw[line width=1.5pt,->,gray] (\xmin,0)--(\xmax,0) ; + \draw[line width=1.5pt,->,gray] (0,\ymin)--(0,\ymax) ; + \foreach \x in {0,1,...,10} {\draw[gray,line width=1.5pt] (\x,4pt) -- (\x,-4pt) ;} + \foreach \y in {0,1,...,4} {\draw[gray,line width=1.5pt] (4pt,\y) -- (-4pt,\y) ;} + \draw[darkgray] (1,-4pt) node[below,font=\sffamily] {1} ; + \draw[darkgray] (-4pt,1) node[left,font=\sffamily] {1} ; + %splines + \def\LISTE{0/1/0§4/3.667/-0.333§7.5/1.75/0§9/2/-0.333§10/0/-10} + \splinetikz[liste=\LISTE,affpoints=true,coeffs=3,couleur=red] + %tangentes + \tangentetikz[liste=\LISTE,xl=0,xr=1,couleur=ForestGreen,style=dashed] + \tangentetikz[liste=\LISTE,xl=1,xr=1,couleur=ForestGreen,style=dashed,point=2] + \tangentetikz[liste=\LISTE,xl=1,xr=1,couleur=ForestGreen,style=dashed,point=3] + \tangentetikz[liste=\LISTE,xl=1,xr=1,couleur=ForestGreen,style=dashed,point=4] + \tangentetikz[liste=\LISTE,xl=0.5,xr=0,couleur=ForestGreen,style=dashed,point=5] + + \end{tikzpicture} +\end{center} + +\medskip + +\begin{center} + \begin{tikzpicture}[x=1cm,y=1cm,line width=1pt] + \paramCF[titre=true] + \ligneCF{\textsf{(x+1)\CFchap2}}{$\mathsf{x^2+2x+1}$} + \ligneCF{\texttt{(x+1)\CFchap2}}{$\mathtt{x^2+2x+1}$} + \ligneCF{\textsf{Dérivée[(x+5)*exp(-0.1*x)]}}{$\mathsf{\rightarrow (0.5-0.1*x)*exp(-0.1*x)}$} + \end{tikzpicture} +\end{center} + +\newpage + +\section{L'outil \og splinetikz \fg} + +\subsection{Courbe d'interpolation} + +On va utiliser les notions suivantes pour paramétrer le tracé \og automatique \fg{} grâce à \ctex{..controls} : +% +\begin{itemize} + \item il faut rentrer les \textcolor{purple}{\textsf{points de contrôle}} ; + \item il faut préciser les \textcolor{ForestGreen}{\textsf{pentes des tangentes}} (pour le moment on travaille avec les mêmes à gauche et à droite\ldots) ; + \item on peut paramétrer les \textcolor{Aquamarine}{\textsf{coefficients}} pour \og affiner \fg{} les portions. +\end{itemize} + +\medskip + +Pour déclarer les paramètres : +% +\begin{itemize} + \item liste des points de contrôle par : \verb|liste=x1/y1/d1§x2/y2/d2§...| + \begin{itemize} + \item il faut au-moins deux points ; + \item avec les points \pverb|(xi;yi)| et \vverb|f'(xi)=di|. + \end{itemize} + \item coefficients de contrôle par \verb|coeffs=...| : + \begin{itemize} + \item \averb|coeffs=x| pour mettre tous les coefficients à x ; + \item \averb|coeffs=C1§C2§...| pour spécifier les coefficients par portion (donc il faut avoir autant de § que pour les points !) ; + \item \averb|coeffs=C1G/C1D§...| pour spécifier les coefficients par portion et par partie gauche/droite ; + \item on peut mixer avec \averb|coeffs=C1§C2G/C2D§...|. + \end{itemize} +\end{itemize} + +\subsection{Clés et options} + +La commande \ctex{\textbackslash splinetikz} se présente sous la forme : + +\begin{minted}[frame=lines,framesep=2mm,bgcolor=LightGray,fontsize=\footnotesize,tabsize=2]{tex} +\begin{tikzpicture} + ... + \splinetikz[liste=...,coeffs=...,affpoints=...,couleur=...,epaisseur=...,taillepoints=...,couleurpoints=...,style=...] + ... +\end{tikzpicture} +\end{minted} + +Certains paramètres peuvent être gérés directement dans la commande \ctex{\textbackslash splinetikz} : + +\begin{itemize} + \item la couleur de la courbe est \textcolor{red}{rouge}, gérée par la \textsf{clé} \Cle{couleur=...} ; + \item l'épaisseur de la courbe est de \textcolor{red}{1.25pt}, gérée par la \textsf{clé} \Cle{epaisseur=...} ; + \item du style supplémentaire pour la courbe peut être rajouté, grâce à la \textsf{clé} \Cle{style=...} ; + \item les coefficients de \textit{compensation} sont par défaut à 3, gérés par la \textsf{clé} \Cle{coeffs=...} + \item les points de contrôle ne sont pas affichés par défaut, mais \textsf{clé booléenne} \Cle{affpoints=true} permet de les afficher ; + \item la taille des points de contrôle est géré par la \textsf{clé} \Cle{taillepoints=...}. +\end{itemize} + +\newpage + +\subsection{Exemples} + +La commande : + +\begin{minted}[frame=lines,framesep=2mm,bgcolor=LightGray,fontsize=\footnotesize,tabsize=2]{tex} +\begin{center} + \begin{tikzpicture}[x=0.9cm,y=0.9cm,xmin=-1,xmax=11,xgrille=1,xgrilles=0.5,ymin=-1,ymax=5,ygrille=1,ygrilles=0.5] + %axes et grilles + \draw[xstep=\xgrilles,ystep=\ygrilles,line width=0.3pt,lightgray!50] (\xmin,\ymin) grid (\xmax,\ymax); + \draw[xstep=\xgrilles,ystep=\ygrilles,line width=0.6pt,lightgray!50] (\xmin,\ymin) grid (\xmax,\ymax); + \draw[line width=1.5pt,->,gray] (\xmin,0)--(\xmax,0) ; + \draw[line width=1.5pt,->,gray] (0,\ymin)--(0,\ymax) ; + \foreach \x in {0,1,...,10} {\draw[gray,line width=1.5pt] (\x,4pt) -- (\x,-4pt) ;} + \foreach \y in {0,1,...,4} {\draw[gray,line width=1.5pt] (4pt,\y) -- (-4pt,\y) ;} + \draw[darkgray] (1,-4pt) node[below,font=\sffamily] {1} ; + \draw[darkgray] (-4pt,1) node[left,font=\sffamily] {1} ; + %splines + \def\LISTE{0/1/0§4/3.667/-0.333§7.5/1.75/0§9/2/-0.333§10/0/-10} + \splinetikz[liste=\LISTE,affpoints=true,coeffs=3,couleur=red] + \end{tikzpicture} +\end{center} +\end{minted} + +produit la figure suivante : + +\begin{center} + \begin{tikzpicture}[x=0.9cm,y=0.9cm,xmin=-1,xmax=11,xgrille=1,xgrilles=0.5,ymin=-1,ymax=5,ygrille=1,ygrilles=0.5] + %axes et grilles + \draw[xstep=\xgrilles,ystep=\ygrilles,line width=0.3pt,lightgray!50] (\xmin,\ymin) grid (\xmax,\ymax); + \draw[xstep=\xgrilles,ystep=\ygrilles,line width=0.6pt,lightgray!50] (\xmin,\ymin) grid (\xmax,\ymax); + \draw[line width=1.5pt,->,gray] (\xmin,0)--(\xmax,0) ; + \draw[line width=1.5pt,->,gray] (0,\ymin)--(0,\ymax) ; + \foreach \x in {0,1,...,10} {\draw[gray,line width=1.5pt] (\x,4pt) -- (\x,-4pt) ;} + \foreach \y in {0,1,...,4} {\draw[gray,line width=1.5pt] (4pt,\y) -- (-4pt,\y) ;} + \draw[darkgray] (1,-4pt) node[below,font=\sffamily] {1} ; + \draw[darkgray] (-4pt,1) node[left,font=\sffamily] {1} ; + %splines + \def\LISTE{0/1/0§4/3.667/-0.333§7.5/1.75/0§9/2/-0.333§10/0/-10} + \splinetikz[liste=\LISTE,affpoints=true] + \end{tikzpicture} +\end{center} + +Avec des explications utiles à la compréhension : + +\begin{center} + \begin{tikzpicture}[x=0.9cm,y=0.9cm,xmin=-1,xmax=11,xgrille=1,xgrilles=0.5,ymin=-1,ymax=7,ygrille=1,ygrilles=0.5] + \genfenetre + \splinetikz[liste=0/1/0§4/3.667/-0.333§7.5/1.75/0§9/2/-0.333§10/0/-10,affpoints=true] + \gennotice + \gentangentes + \listecoeffs{3}{3}{3}{3} + \end{tikzpicture} +\end{center} + +\newpage + +\subsection{Avec une gestion plus fine des \og coefficients \fg} + +Dans la majorité des cas, le \textit{coefficient} \textcircled{3} permet d'obtenir une courbe (ou une portion) très satisfaisante ! + +Dans certains cas, notamment si l'une des pentes est relativement \og forte \fg{} et/ou si l'intervalle horizontal de la portion est relativement \og étroit \fg, il se peut que la portion paraisse un peu trop \og abrupte \fg{}. + +On peut dans ce cas \textit{jouer} sur les coefficients de cette portion pour \textit{arrondir} un peu tout cela ! + +Ces fameux \textit{coefficients} peuvent : +\begin{itemize} + \item être donnés (pour utiliser le même partout) sous la forme \Cle{coeffs=C} ; + \item être donnés portion par portion, sous la forme \Cle{coeffs=C1§C2§...} ; + \item être donné de manière très fine, portion par portion et côté par côté, sous la forme \Cle{coeffs=C1G/C1D§C2G/C2D§...}. +\end{itemize} + +\begin{center} + \begin{tikzpicture}[x=0.9cm,y=0.9cm,xmin=-1,xmax=11,xgrille=1,xgrilles=0.5,ymin=-1,ymax=7,ygrille=1,ygrilles=0.5] + \genfenetre + \draw (1,-4pt) node[below,font=\sffamily] {1} ; + \draw (-4pt,1) node[left,font=\sffamily] {1} ; + \def\LISTE{0/1/0§4/3.667/-0.333§7.5/1.75/0§9/2/-0.333§10/0/-10} + \splinetikz[liste=\LISTE,affpoints=true,coeffs=3§3§3§2/1] + \gennotice + \listecoeffs{3/3}{3/3}{3/3}{2/1} + \end{tikzpicture} +\end{center} + +\begin{minted}[frame=lines,framesep=2mm,bgcolor=LightGray,fontsize=\footnotesize,tabsize=2]{tex} +\begin{center} +... +%splines +\def\LISTE{0/1/0§4/3.667/-0.333§7.5/1.75/0§9/2/-0.333§10/0/-10} +\splinetikz[liste=\LISTE,affpoints=true,coeffs=3§3§3§2/1] +... +\end{center} +\end{minted} + +\begin{center} + \begin{tikzpicture}[x=0.9cm,y=0.9cm,xmin=-1,xmax=11,xgrille=1,xgrilles=0.5,ymin=-1,ymax=5,ygrille=1,ygrilles=0.5] + %axes et grilles + \draw[xstep=\xgrilles,ystep=\ygrilles,line width=0.3pt,lightgray!50] (\xmin,\ymin) grid (\xmax,\ymax); + \draw[xstep=\xgrilles,ystep=\ygrilles,line width=0.6pt,lightgray!50] (\xmin,\ymin) grid (\xmax,\ymax); + \draw[line width=1.5pt,->,gray] (\xmin,0)--(\xmax,0) ; + \draw[line width=1.5pt,->,gray] (0,\ymin)--(0,\ymax) ; + \foreach \x in {0,1,...,10} {\draw[gray,line width=1.5pt] (\x,4pt) -- (\x,-4pt) ;} + \foreach \y in {0,1,...,4} {\draw[gray,line width=1.5pt] (4pt,\y) -- (-4pt,\y) ;} + \draw[darkgray] (1,-4pt) node[below,font=\sffamily] {1} ; + \draw[darkgray] (-4pt,1) node[left,font=\sffamily] {1} ; + \draw (1,-4pt) node[below,font=\sffamily] {1} ; + \draw (-4pt,1) node[left,font=\sffamily] {1} ; + \def\LISTE{0/1/0§4/3.667/-0.333§7.5/1.75/0§9/2/-0.333§10/0/-10} + \splinetikz[liste=\LISTE,affpoints=true,coeffs=3§3§3§2/1] + \end{tikzpicture} +\end{center} + +\subsection{Conclusion} + +Le plus \og simple \fg{} est donc: +% +\begin{itemize} + \item de déclarer la liste des points de contrôle, grâce à \ctex{\textbackslash def\textbackslash LISTE\{x1/y1:d1§x2/y2/d2§...\}} ; + \item de saisir la commande \ctex{\textbackslash splinetikz[liste=\textbackslash LISTE]} ; + \item d'ajuster les options et coefficients en fonction du rendu ! +\end{itemize} + +\medskip + +Si jamais il existe ou ou des points \textit{anguleux}, le plus simple est de créer les splines en plusieurs fois. + +\newpage + +\section{L'outil \og tangentetikz \fg{}} + +\subsection{Définitions} + +En parallèle de l'outil \ctex{\textbackslash splinetikz}, il existe l'outil \ctex{\textbackslash tangentetikz} qui va permettre de tracer des tangentes à l'aide de la liste de points précédemment définie pour l'outil \ctex{\textbackslash splinetikz}. + +\smallskip + +NB : il peut fonctionner indépendamment de l'outil \ctex{\textbackslash splinetikz} puisque la liste des points de travail est gérée de manière autonome ! + +\medskip + +La commande \ctex{\textbackslash tangentetikz} se présente sous la forme : + +\begin{minted}[frame=lines,framesep=2mm,bgcolor=LightGray,fontsize=\footnotesize,tabsize=2]{tex} +\begin{tikzpicture} + ... + \tangentetikz[liste=...,couleur=...,epaisseur=...,xl=...,xr=...,style=...,point=...] + ... +\end{tikzpicture} +\end{minted} + +Cela permet de tracer la tangente : +% +\begin{itemize} + \item au point numéro numéro \Cle{point} de la liste \Cle{liste}, de coordonnées \textsf{xi/yi} avec la pente \textsf{di} ; + \item avec une épaisseur de \Cle{epaisseur}, une couleur \Cle{couleur} et un style additionnel \Cle{style} ; + \item en la traçant à partir de \Cle{xl} avant \textsf{xi} et jusqu'à \Cle{xr} après \textsf{xi}. +\end{itemize} + +\subsection{Exemple et illustration} + +\begin{center} + \begin{tikzpicture}[x=3cm,y=3cm,xmin=0,xmax=2,xgrilles=0.25,ymin=0,ymax=2.25,ygrilles=0.25] + \tikzset{noeudexpl/.style={purple,font=\sffamily\small}} + \tgrilles + \draw[line width=1.5pt,->,darkgray] (\xmin,0)--(\xmax,0) ; + \draw[line width=1.5pt,->,darkgray] (0,\ymin)--(0,\ymax) ; + \draw (0,1.5) node[noeudexpl,below] {point 1} ; + \draw (1,2) node[noeudexpl,below] {point 2} ; + \draw (2,0) node[noeudexpl,above left] {point 3} ; + %spline + \splinetikz[liste=0/1.5/0§1/2/-0.333§2/0/-5,affpoints=true,coeffs=3§2,couleur=red] + %tangente + \tangentetikz[liste=0/1.5/0§1/2/-0.333§2/0/-5,xl=0,xr=0.5,couleur=ForestGreen,style=dashed] + \tangentetikz[liste=0/1.5/0§1/2/-0.333§2/0/-5,xl=0.5,xr=0.75,couleur=orange,style=dotted,point=2] + \tangentetikz[liste=0/1.5/0§1/2/-0.333§2/0/-5,xl=0.33,xr=0,couleur=blue,style=densely dashed,point=3] + %explications + \draw[<->,very thick,darkgray] (0.5,2.2)--(1,2.2) node[midway,above,font=\sffamily] {xl} ; + \draw[<->,very thick,darkgray] (1,2.2)--(1.75,2.2) node[midway,above,font=\sffamily] {xr}; + \end{tikzpicture} +\end{center} + +\begin{minted}[frame=lines,framesep=2mm,bgcolor=LightGray,fontsize=\footnotesize,tabsize=2]{tex} +\begin{tikzpicture} + ... + \def\LISTE{0/1.5/0§1/2/-0.333§2/0/-5} + %spline + \splinetikz[liste=\LISTE,affpoints=true,coeffs=3§2,couleur=red] + %tangente + \tangentetikz[liste=\LISTE,xl=0,xr=0.5,couleur=ForestGreen,style=dashed] + \tangentetikz[liste=\LISTE,xl=0.5,xr=0.75,couleur=orange,style=dotted,point=2] + \tangentetikz[liste=\LISTE,xl=0.33,xr=0,couleur=blue,style=densely dashed,point=3] + ... +\end{tikzpicture} +\end{minted} + +\subsection{Exemple avec les deux outils, et \og personnalisation \fg} + +\begin{center} +\begin{tikzpicture}[x=0.5cm,y=0.5cm,xmin=0,xmax=16,xgrilles=1,ymin=0,ymax=16,ygrilles=1] + \draw[xstep=\xgrilles,ystep=\ygrilles,line width=0.3pt,lightgray] (\xmin,\ymin) grid (\xmax,\ymax) ; + \draw[line width=1.5pt,->,darkgray] (\xmin,0)--(\xmax,0) ; + \draw[line width=1.5pt,->,darkgray] (0,\ymin)--(0,\ymax) ; + \foreach \x in {0,2,...,14} {\draw[gray,line width=1.5pt] (\x,4pt) -- (\x,-4pt) ;} + \foreach \y in {0,2,...,14} {\draw[gray,line width=1.5pt] (4pt,\y) -- (-4pt,\y) ;} + \draw[darkgray] (1,-4pt) node[below,font=\sffamily] {1} ; + \draw[darkgray] (-4pt,1) node[left,font=\sffamily] {1} ; + %la liste pour la courbe d'interpolation + \def\liste{0/6/3§3/11/0§7/3/0§10/0/0§14/14/6} + %les tangentes "stylisées" + \tangentetikz[liste=\liste,xl=0,xr=1,couleur=blue,style=dashed] + \tangentetikz[liste=\liste,xl=2,xr=2,couleur=purple,style=dotted,point=2] + \tangentetikz[liste=\liste,xl=2,xr=2,couleur=orange,style=<->,point=3] + \tangentetikz[liste=\liste,xl=2,xr=0,couleur=ForestGreen,point=5] + %la courbe en elle-même + \splinetikz[liste=\liste,affpoints=true,coeffs=3,couleur=cyan,style=densely dotted] + \end{tikzpicture} +\end{center} + +\begin{minted}[frame=lines,framesep=2mm,bgcolor=LightGray,fontsize=\footnotesize,tabsize=4,breaklines]{tex} +\tikzset{% + xmin/.store in=\xmin,xmin/.default=-5,xmin=-5, + xmax/.store in=\xmax,xmax/.default=5,xmax=5, + ymin/.store in=\ymin,ymin/.default=-5,ymin=-5, + ymax/.store in=\ymax,ymax/.default=5,ymax=5, + xgrille/.store in=\xgrille,xgrille/.default=1,xgrille=1, + xgrilles/.store in=\xgrilles,xgrilles/.default=0.5,xgrilles=0.5, + ygrille/.store in=\ygrille,ygrille/.default=1,ygrille=1, + ygrilles/.store in=\ygrilles,ygrilles/.default=0.5,ygrilles=0.5, + xunit/.store in=\xunit,unit/.default=1,xunit=1, + yunit/.store in=\yunit,unit/.default=1,yunit=1 +} + +\begin{tikzpicture}[x=0.5cm,y=0.5cm,xmin=0,xmax=16,xgrilles=1,ymin=0,ymax=16,ygrilles=1] + \draw[xstep=\xgrilles,ystep=\ygrilles,line width=0.3pt,lightgray] (\xmin,\ymin) grid (\xmax,\ymax) ; + \draw[line width=1.5pt,->,darkgray] (\xmin,0)--(\xmax,0) ; + \draw[line width=1.5pt,->,darkgray] (0,\ymin)--(0,\ymax) ; + \foreach \x in {0,2,...,14} {\draw[gray,line width=1.5pt] (\x,4pt) -- (\x,-4pt) ;} + \foreach \y in {0,2,...,14} {\draw[gray,line width=1.5pt] (4pt,\y) -- (-4pt,\y) ;} + %la liste pour la courbe d'interpolation + \def\liste{0/6/3§3/11/0§7/3/0§10/0/0§14/14/6} + %les tangentes "stylisées" + \tangentetikz[liste=\liste,xl=0,xr=1,couleur=blue,style=dashed] + \tangentetikz[liste=\liste,xl=2,xr=2,couleur=purple,style=dotted,point=2] + \tangentetikz[liste=\liste,xl=2,xr=2,couleur=orange,style=<->,point=3] + \tangentetikz[liste=\liste,xl=2,xr=0,couleur=ForestGreen,point=5] + %la courbe en elle-même + \splinetikz[liste=\liste,affpoints=true,coeffs=3,couleur=cyan,style=densely dotted] +\end{tikzpicture} +\end{minted} + +\newpage + +\section{L'outil \og Calcul Formel \fg} + +\subsection{Introduction} + +L'idée des commandes suivantes est de définir, dans un environnement \TikZ, une présentation proche de celle d'un logiciel de calcul formel comme \textsf{XCas} ou \textsf{Geogebra}. + +\smallskip + +Les sujets d'examens, depuis quelques années, peuvent comporter des \textit{captures d'écran} de logiciel de calcul formel, l'idée est ici de reproduire, de manière autonome, une telle présentation. + +\smallskip + +À la manière du \textsf{package} \ctex{tkz-tab}, l'environnement de référence est un environnement \TikZ, dans lequel les lignes dont créées petit à petit, à l'aide de nœuds qui peuvent être réutilisés à loisir ultérieurement. + +\subsection{La commande \og paramCF \fg} + +La première chose à définir est l'ensemble des paramètres \textit{globaux} de la fenêtre de calcul formel, à l'aide de \Cle{Clés}. + +C'est la commande \ctex{\textbackslash paramCF} qui s'y colle, avec : + +\begin{itemize} + \item \Cle{larg} : largeur de l'environnement ; \hfill{}défaut \Cle{16} + \item \Cle{esplg} : espacement vertical entre les lignes ;\hfill{}défaut \Cle{2pt} + \item \Cle{premcol} : largeur de la case du \textit{petit numéro} ;\hfill{}défaut \Cle{0.3} + \item \Cle{hpremcol} : hauteur de la case du \textit{petit numéro} ;\hfill{}défaut \Cle{0.4} + \item \Cle{taille} : taille du texte ;\hfill{}défaut \Cle{\textbackslash normalsize} + \item \Cle{couleur} : couleur des traits de l'environnement ;\hfill{}défaut \Cle{darkgray} + \item \Cle{titre} : booléen pour l'affichage d'un bandeau de titre ;\hfill{}défaut \Cle{false} + \item \Cle{tailletitre} : taille du titre ;\hfill{}défaut \Cle{\textbackslash normalsize} + \item \Cle{poscmd} : position horizontale de la commande d'entrée ;\hfill{}défaut \Cle{gauche} + \item \Cle{posres} : position horizontale de la commande de sortie ;\hfill{}défaut \Cle{centre} + \item \Cle{couleurcmd} : couleur de la commande d'entrée ;\hfill{}défaut \Cle{ed} + \item \Cle{couleurres} : couleur de la commande de sortie ;\hfill{}défaut \Cle{blue} + \item \Cle{sep} : booléen pour l'affichage du trait de séparation E/S ;\hfill{}défaut \Cle{true} + \item \Cle{menu} : booléen pour l'affichage du \textit{bouton} MENU ;\hfill{}défaut \Cle{true} + \item \Cle{labeltitre} : libellé du titre.\hfill{}défaut \Cle{Résultats obtenus avec un logiciel de Calcul Formel} +\end{itemize} + +\subsection{La commande \og ligneCF \fg} + +Une fois les paramètres déclarés, il faut créer les différentes lignes, grâce à la \ctex{\textbackslash ligneCF} : + +\begin{itemize} + \item \Cle{hc} : hauteur de la ligne de commande d'entrée ;\hfill{}défaut \Cle{0.75} + \item \Cle{hr} : hauteur de la ligne de commande de sortie ;\hfill{}défaut \Cle{0.75} + \item deux \textsf{arguments}, celui de la commande d'entrée et celui de la commande de sortie. +\end{itemize} + +\medskip + +Ainsi, le code : + +\begin{minted}[frame=lines,framesep=2mm,bgcolor=LightGray,fontsize=\footnotesize,tabsize=4,breaklines]{tex} +\begin{tikzpicture}[x=1cm,y=1cm,line width=1pt] + \paramCF[titre=true,couleurcmd=olive,couleurres=orange] + \ligneCF{COMMANDE 1}{RÉSULTAT 1} + \ligneCF{\texttt{(x+1)\chap2}}{$\mathtt{x^2+2x+1}$} + \ligneCF[HC=1,HR=1]{\textsf{Dérivée[(x+5)*exp(-0.1*x)]}}{$\mathsf{\rightarrow (0.5-0.1*x)*exp(-0.1*x)}$} +\end{tikzpicture} +\end{minted} + +produira le résultat suivant : + +\begin{center} + \begin{tikzpicture}[x=1cm,y=1cm,line width=1pt] + \paramCF[titre=true,couleurcmd=olive,couleurres=orange] + \ligneCF{COMMANDE 1}{RÉSULTAT 1} + \ligneCF[hc=1,hr=1.25]{\texttt{(x+1)\CFchap2}}{$\mathtt{x^2+2x+1}$} + \end{tikzpicture} +\end{center} + +\newpage + +\subsection{Visualisation des paramètres} + +Pour \textit{illustrer} un peur les \Cle{clés}, un petit schéma, avec les différents nœuds crées par les \textsf{macros}. + +\medskip + +\begin{center} + \begin{tikzpicture}[x=1cm,y=1cm,line width=1pt] + \paramCF[larg=12cm,couleur=lightgray,esplg=12pt,menu=false] + \ligneCF{}{} + \ligneCF[hc=1,hr=1.25]{}{} + %explications + \foreach \noeud in {01,11,21,31,41,51,02,12,22,32,42,52} + \draw[blue] (A\noeud) node[font=\ttfamily] {A\noeud} ; +\end{tikzpicture} +\end{center} + +\medskip + +\begin{center} + \begin{tikzpicture}[x=1cm,y=1cm,line width=1pt] + \paramCF[titre=true,larg=12cm,esplg=10pt,premcol=0.5,hpremcol=0.7,couleur=lightgray] + \ligneCF{COMMANDE 1}{RÉSULTAT 1} + \ligneCF[hc=1.25,hr=1.5]{COMMANDE 2}{RÉSULTAT 2} + %explications + \draw[CadetBlue,<->] ($(A22) + (0,-12pt)$) -- ($(A52) + (0,-12pt)$) node[midway,below,font=\sffamily] {\Cle{larg}} ; + \draw[CadetBlue,<->] ($(A51) + (12pt,0)$) -- ($(A32) + (12pt,0)$) node[midway,right,font=\sffamily] {\Cle{esplg}} ; + \draw[CadetBlue,<->] ($(A02) + (0,2pt)$) -- ($(A02) + (0,2pt) + ({-\CFpremcol},0) $) node[midway,above,font=\sffamily] {\Cle{premcol}} ; + \draw[CadetBlue,<->] ($(A02) + ({-\CFpremcol},0) + (-2pt,0)$) -- ($(A02) + ({-\CFpremcol},{-\CFhpremcol}) +(-2pt,0)$) node[midway,left,font=\sffamily] {\Cle{hpremcol}} ; + \draw[CadetBlue,<->] ($(A31) + (12pt,0)$) -- ($(A41) + (12pt,0)$) node[midway,right,font=\sffamily] {\Cle{hc}} ; + \draw[CadetBlue,<->] ($(A41) + (12pt,0)$) -- ($(A51) + (12pt,0)$) node[midway,right,font=\sffamily] {\Cle{hr}} ; + \draw[CadetBlue,<->] ($(A32) + (12pt,0)$) -- ($(A42) + (12pt,0)$) node[midway,right,font=\sffamily] {\Cle{hc}} ; + \draw[CadetBlue,<->] ($(A42) + (12pt,0)$) -- ($(A52) + (12pt,0)$) node[midway,right,font=\sffamily] {\Cle{hr}} ; + \draw[CadetBlue,->] ($(A12) + (0,-12pt)$) to[bend left=10] ($(A12) + (0,-12pt) + (-18pt,-12pt)$) node[below left,font=\sffamily] {\Cle{couleur}} ; + \draw[CadetBlue,->] ($(A52) + (-0.65,0.25)$) to[bend left=10] ($(A52) + (-0.65,0.25) + (-18pt,12pt)$) node[inner sep=0pt,above left=1pt,font=\sffamily] {\Cle{menu}} ; + \draw[CadetBlue,->] ($(A12) + (16pt,0)$) to[bend left=10] ($(A12) + (16pt,0) + (18pt,-12pt)$) node[inner sep=0pt,below right=1pt,font=\sffamily] {\Cle{sep}} ; + \draw[CadetBlue,->] ($(A01) + (8pt,2pt) + (0,1em)$) to[bend left=10] ($(A01) + (8pt,2pt) + (0,1em) + (-18pt,12pt)$) node[inner sep=0pt,above=1pt,font=\sffamily] {\Cle{titre} \& \Cle{tailletitre} \& \Cle{labeltitre}} ; +\end{tikzpicture} +\end{center} + +Chaque argument COMMANDE \& RÉSULTAT peut être formaté (niveau police) de manière indépendante. + +\newpage + +\section{Code \& Console Python} + +\subsection{Introduction} + +Le \textsf{package} \ctex{pythontex} permet d'insérer et d'exécuter du code Python. On peut : + +\begin{itemize} + \item présenter du code python ; + \item exécuter du code python dans un environnement type \og console \fg{} ; + \item charger du code python, et éventuellement l'utiliser dans la console. +\end{itemize} + +\subsection{Présentation de code Python} + +L'environnement \ctex{\textbackslash envcodepythontex} (chargé par \ctex{ProfLycee}, avec l'option \textit{autogobble}) permet de présenter du code python, dans une \ctex{colorbox} avec un style particulier. + +\begin{minted}[frame=lines,framesep=2mm,bgcolor=LightGray,fontsize=\footnotesize,tabsize=2]{tex} +\begin{envcodepythontex}[largeur=...,centre=...,lignes=...] +... +\end{envcodepythontex} +\end{minted} + +Comme précédemment, des \Cle{Clés} qui permettent de \textit{légèrement} modifier le style : + +\begin{itemize} + \item \Cle{largeur} : largeur de la \textit{tcbox} ;\hfill{}défaut \Cle{\textbackslash linewidth} + \item \Cle{centre} : booléen pour centrer ou non la \textit{tcbox} ;\hfill{}défaut \Cle{true} + \item \Cle{lignes} : booléen pour afficher ou non les numéros de ligne.\hfill{}défaut \Cle{true} +\end{itemize} + +\medskip + +Ainsi, le code : + +\begin{minted}[frame=lines,framesep=2mm,bgcolor=LightGray,fontsize=\footnotesize,tabsize=4,breaklines]{tex} +\begin{envcodepythontex}[largeur=12cm] + #environnement Python(tex) centré avec numéros de ligne + def f(x) : + return x**2 +\end{envcodepythontex} +\end{minted} + +produira + +\begin{envcodepythontex}[largeur=12cm] + #environnement Python(tex) centré avec numéros de ligne + def f(x) : + return x**2 +\end{envcodepythontex} + +Le code : + +\begin{minted}[frame=lines,framesep=2mm,bgcolor=LightGray,fontsize=\footnotesize,tabsize=4]{tex} +\begin{envcodepythontex}[largeur=12cm,lignes=false,centre=false] + #environnement Python(tex) non centré sans numéro de ligne + def f(x) : + return x**2 +\end{envcodepythontex} +\end{minted} + +produira : + +\begin{envcodepythontex}[largeur=12cm,lignes=false,centre=false] + #environnement Python(tex) non centré sans numéro de ligne + def f(x) : + return x**2 +\end{envcodepythontex} + +\newpage + +\subsection{Console d'exécution Python} + +\ctex{pythontex} permet également de \textit{simuler} (en exécutant également !) du code python dans une \textit{console}. + +C'est l'environnement \ctex{\textbackslash envconsolepythontex} qui permet de le faire. + +\begin{minted}[frame=lines,framesep=2mm,bgcolor=LightGray,fontsize=\footnotesize,tabsize=2]{tex} +\begin{envconsolepythontex}[largeur=...,centre=...,label=...] +... +\end{envconsolepythontex} +\end{minted} + +Les \Cle{Clés} disponibles sont : + +\begin{itemize} + \item \Cle{largeur} : largeur de la \textit{console} ;\hfill{}défaut \Cle{\textbackslash linewidth} + \item \Cle{centre} : booléen pour centrer ou non la \textit{console} ;\hfill{}défaut \Cle{true} + \item \Cle{label} : booléen pour afficher ou non le titre.\hfill{}défaut \Cle{true} +\end{itemize} + +\medskip + +Ainsi, le code : + +\begin{minted}[frame=lines,framesep=2mm,bgcolor=LightGray,fontsize=\footnotesize,tabsize=4,breaklines]{tex} +\begin{envconsolepythontex}[largeur=14cm,centre=false] + #console Python(tex) non centrée avec label + from math import sqrt + 1+1 + sqrt(12) +\end{envconsolepythontex} +\end{minted} + +produira + +\begin{envconsolepythontex}[largeur=14cm,centre=false] + #console Python(tex) non centrée avec label + from math import sqrt + 1+1 + sqrt(12) +\end{envconsolepythontex} + +Le code : + +\begin{minted}[frame=lines,framesep=2mm,bgcolor=lightgray!5,fontsize=\footnotesize,tabsize=4]{tex} +\begin{envconsolepythontex}[largeur=14cm,label=false] + #console Python(tex) centrée sans label + table = [[1,2],[3,4]] + table[0][0] +\end{envconsolepythontex} +\end{minted} + +produira : + +\begin{envconsolepythontex}[largeur=14cm,label=false] + #console Python(tex) centrée sans label + table = [[1,2],[3,4]] + table[0][0] +\end{envconsolepythontex} + +\subsection{Personnalisation} + +\textbf{NB : } compte tenu de la \textit{relative complexité} de gérer les options (par paramètres\ldots) des \textit{tcbox} et des \textit{fancyvrb}, le style est \og fixé \fg{} tel quel, et seules la taille et la position de la \textit{tcbox} sont modifiables. Si toutefois vous souhaitez personnaliser davantage, il faudra prendre le code correspondant et appliquer vos modifications ! + +\medskip + +Cela peut donner -- en tout cas -- des idées de personnalisation en ayant une base \textit{pré}existante ! + +\newpage + +\section{Historique} + +{\small \bverb|v1.0.2| : Ajout des environnements pour Python + +{\small \bverb|v1.0.1| : Modification mineure liée au chargement de \ctex{xcolor} + +{\small \bverb|v1.0 | : Version initiale} + +%\newpage +% +%\section{Codes du package splinetikz.sty} +% +%\begin{minted}[frame=lines,framesep=2mm,bgcolor=LightGray,fontsize=\footnotesize,tabsize=2]{tex} +%\NeedsTeXFormat{LaTeX2e} +%\ProvidesPackage{splinetikz}[2022/02/10 - v1.0 - Splines cubiques, en TikZ] +% +%%------Packages utiles +%\RequirePackage[dvipsnames,table]{xcolor} +%\RequirePackage{tikz} +%\RequirePackage{pgf,pgffor,pgfplots} +%\pgfplotsset{compat=1.18} +%\RequirePackage{ifthen} +%\RequirePackage{xkeyval} +%\RequirePackage{xfp} +%\RequirePackage{xstring} +%\RequirePackage{simplekv} +%\RequirePackage{listofitems} +%\RequirePackage{xintexpr} +%\usetikzlibrary{decorations.pathreplacing} +%\usetikzlibrary{decorations.markings} +%\usetikzlibrary{arrows.meta} +%\end{minted} +% +%\begin{minted}[frame=lines,framesep=2mm,bgcolor=LightGray,fontsize=\footnotesize,tabsize=2]{tex} +%%------commande utile pour extraire des infos d'une liste +%\newcommand\extractcoeff[2]{% #1=liste & #2=numero +% \setsepchar{§}% +% \readlist\lcoeffs{#1} +% \ifnum \lcoeffslen=1 +% \def\COEFFA{#1} +% \def\COEFFB{#1} +% \else +% \itemtomacro\lcoeffs[#2]\COEFF +% \IfSubStr{\COEFF}{/}% +% {\StrCut{\COEFF}{/}{\COEFFA}{\COEFFB}}% +% {\def\COEFFA{\COEFF}\def\COEFFB{\COEFF}} +% \fi +%} +%\end{minted} +% +%\begin{minted}[frame=lines,framesep=2mm,bgcolor=LightGray,fontsize=\footnotesize,tabsize=2]{tex} +%%------tangente(s) en TikZ, avec point/dérivée ou liste points/dérivées +%\defKV[tgte]{% +% liste=\def\TGTliste{#1},% +% width=\def\TGTepaisseur{#1},% +% couleur=\def\TGTcouleur{#1},% +% xl=\def\TGTXL{#1},% +% xr=\def\TGTXR{#1},% +% style=\def\TGTstyle{#1},% +% point=\def\TGTnumpt{#1} +%} +% +%\setKVdefault[tgte]{ +% liste=,% +% width=1.25pt,% +% couleur=red,% +% xl=0.5,xr=0.5,% +% style=,% +% point=1 +%} +% +%\newcommand\tangentetikz[1][]{% +% \useKVdefault[tgte]% +% \setKV[tgte]{#1}% on paramètres les nouvelles clés et on les simplifie +% \setsepchar[.]{§./}% +% \readlist\TGTlistepoints\TGTliste +% \itemtomacro\TGTlistepoints[\TGTnumpt,1]\xa +% \itemtomacro\TGTlistepoints[\TGTnumpt,2]\ya +% \itemtomacro\TGTlistepoints[\TGTnumpt,3]\fprimea +% \def\TGTDEB{\fpeval{\xa-\TGTXL}}\def\TGTFIN{\fpeval{\xa+\TGTXR}}% +% \draw[line width=\TGTepaisseur,\TGTcouleur,domain=\TGTDEB:\TGTFIN,\TGTstyle] plot (\x,{\fprimea*(\x-\xa)+\ya}) ;% +%} +%\end{minted} +% +%\begin{minted}[frame=lines,framesep=2mm,bgcolor=LightGray,fontsize=\footnotesize,tabsize=2,breaklines]{tex} +%%------splines en tikz avec ..controls +%\defKV[spline]{% +% liste=\def\SPLliste{#1},% +% width=\def\SPLepaisseur{#1},% +% couleur=\def\SPLcouleur{#1},% +% coeffs=\def\SPLcoeffs{#1},% +% couleurpoints=\def\SPLcouleurpoints{#1},% +% taillepoints=\def\SPLtaillepoints{#1},% +% style=\def\SPLstyle{#1} +%} +% +%\setKVdefault[spline]{% +% liste=,% +% width=1.25pt,% +% couleur=red,% +% coeffs=3,% +% couleurpoints=black,% +% taillepoints=2pt,% +% affpoints=false,% +% style= +%} +% +%\newcommand\splinetikz[1][]{% +% \useKVdefault[spline] +% \setKV[spline]{#1}% on paramètres les nouvelles clés et on les simplifie +% %on lit la liste des points/nbderivés et on stocke dans \listepoints +% \setsepchar[.]{§./} +% \readlist\SPLlistepoints\SPLliste +% \def\SPLnbsplines{\inteval{\SPLlistepointslen-1}} +% %si uniquement deux points, pas de boucle... +% \ifnum \SPLlistepointslen=2 +% %extraction des coeffs de compensation +% \extractcoeff{\SPLcoeffs}{1} +% %extraction des coordonnées +% \itemtomacro\SPLlistepoints[1,1]\xa +% \itemtomacro\SPLlistepoints[1,2]\ya +% \itemtomacro\SPLlistepoints[1,3]\fprimea +% \itemtomacro\SPLlistepoints[2,1]\xb +% \itemtomacro\SPLlistepoints[2,2]\yb +% \itemtomacro\SPLlistepoints[2,3]\fprimeb +% \draw[line width=\SPLepaisseur,\SPLcouleur,\SPLstyle] (\xa,\ya) ..controls +({atan \fprimea}:{(\xb-\xa)/\COEFFA}) and +({-180 + atan \fprimeb}:{(\xb-\xa)/\COEFFA}).. (\xb,\yb) ;% +% %sinon on construit bout par bout ! +% \else +% \foreach \i in {1,2,...,\SPLnbsplines}{ +% %extraction des coeffs de compensation +% \extractcoeff{\SPLcoeffs}{\i} +% \def\j{\inteval{\i+1}} +% \itemtomacro\SPLlistepoints[\i,1]\xa +% \itemtomacro\SPLlistepoints[\i,2]\ya +% \itemtomacro\SPLlistepoints[\i,3]\fprimea +% \itemtomacro\SPLlistepoints[\j,1]\xb +% \itemtomacro\SPLlistepoints[\j,2]\yb +% \itemtomacro\SPLlistepoints[\j,3]\fprimeb +% \draw[line width=\SPLepaisseur,\SPLcouleur,\SPLstyle] (\xa,\ya) ..controls +({atan \fprimea}:{(\xb-\xa)/\COEFFA}) and +({-180 + atan \fprimeb}:{(\xb-\xa)/\COEFFB}).. (\xb,\yb) ;% +% } +% \fi +% \ifboolKV[spline]{affpoints}%on affiche les points de contrôle +% {% +% \foreach \i in {1,2,...,\SPLlistepointslen}{% +% \itemtomacro\SPLlistepoints[\i,1]\xa +% \itemtomacro\SPLlistepoints[\i,2]\ya +% \filldraw[\SPLcouleurpoints] (\xa,\ya) circle[radius=\SPLtaillepoints] ;% +% } +% } +% {} +%} +%\end{minted} + +\end{document} \ No newline at end of file diff --git a/macros/latex/contrib/proflycee/tex/ProfLycee.sty b/macros/latex/contrib/proflycee/tex/ProfLycee.sty new file mode 100644 index 0000000000..ceaf2ef191 --- /dev/null +++ b/macros/latex/contrib/proflycee/tex/ProfLycee.sty @@ -0,0 +1,361 @@ +% Author : C. Pierquet +% licence : Released under the LaTeX Project Public License v1.3c +% or later, see http://www.latex-project.org/lppl.txtf + +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{ProfLycee}[2022/02/13 - v1.0.2 - Aide pour l'utilisation de LaTeX en lycée] +% 1.0.2 Environnement pour présenter du code python (avec pythontex) +% 1.0.1 Modif mineure du chargement de xcolor (compatibilité avec d'autres packages notamment...) +% 1.0 Version initiale + +%------Packages utiles +\RequirePackage[table,svgnames]{xcolor}%Gestion des couleurs +\RequirePackage{tikz} +\RequirePackage{pgf,pgffor} +\RequirePackage{ifthen} +\RequirePackage{xkeyval} +\RequirePackage{xfp} +\RequirePackage{xstring} +\RequirePackage{simplekv} +\RequirePackage{listofitems} +\RequirePackage{xintexpr} +\RequirePackage{fontawesome5} +%librairies tikz +\usetikzlibrary{calc} +\usetikzlibrary{decorations.pathreplacing} +\usetikzlibrary{decorations.markings} +\usetikzlibrary{arrows.meta} +%tcolorbox +\RequirePackage[most]{tcolorbox} +%divers +\RequirePackage{ifluatex} +%python +\RequirePackage{fancyvrb} +\RequirePackage[gobble=auto]{pythontex} +\setpythontexlistingenv{pythont} + +%---------------SPLINES---------------------- +%------commande utile pour extraire des infos d'une liste +\newcommand\extractcoeff[2]{% #1=liste & #2=numero + \setsepchar{§}% + \readlist\lcoeffs{#1} + \ifnum \lcoeffslen=1 + \def\COEFFA{#1} + \def\COEFFB{#1} + \else + \itemtomacro\lcoeffs[#2]\COEFF + \IfSubStr{\COEFF}{/}% + {\StrCut{\COEFF}{/}{\COEFFA}{\COEFFB}}% + {\def\COEFFA{\COEFF}\def\COEFFB{\COEFF}} + \fi +} + +%------splines en tikz avec ..controls +\defKV[spline]{% + liste=\def\SPLliste{#1},% + width=\def\SPLepaisseur{#1},% + couleur=\def\SPLcouleur{#1},% + coeffs=\def\SPLcoeffs{#1},% + couleurpoints=\def\SPLcouleurpoints{#1},% + taillepoints=\def\SPLtaillepoints{#1},% + style=\def\SPLstyle{#1} +} + +\setKVdefault[spline]{% + liste=,% + width=1.25pt,% + couleur=red,% + coeffs=3,% + couleurpoints=black,% + taillepoints=2pt,% + affpoints=false,% + style= +} + +\newcommand\splinetikz[1][]{% + \useKVdefault[spline] + \setKV[spline]{#1}% on paramètres les nouvelles clés et on les simplifie + %on lit la liste des points/nbderivés et on stocke dans \listepoints + \setsepchar[.]{§./}% + \readlist\SPLlistepoints\SPLliste + \def\SPLnbsplines{\inteval{\SPLlistepointslen-1}} + %si uniquement deux points, pas de boucle... + \ifnum \SPLlistepointslen=2 + %extraction des coeffs de compensation + \extractcoeff{\SPLcoeffs}{1}% + %extraction des coordonnées + \itemtomacro\SPLlistepoints[1,1]\xa + \itemtomacro\SPLlistepoints[1,2]\ya + \itemtomacro\SPLlistepoints[1,3]\fprimea + \itemtomacro\SPLlistepoints[2,1]\xb + \itemtomacro\SPLlistepoints[2,2]\yb + \itemtomacro\SPLlistepoints[2,3]\fprimeb + \draw[line width=\SPLepaisseur,\SPLcouleur,\SPLstyle] (\xa,\ya) ..controls +({atan \fprimea}:{(\xb-\xa)/\COEFFA}) and +({-180 + atan \fprimeb}:{(\xb-\xa)/\COEFFA}).. (\xb,\yb) ;% + %sinon on construit bout par bout ! + \else + \foreach \i in {1,2,...,\SPLnbsplines}{ + %extraction des coeffs de compensation + \extractcoeff{\SPLcoeffs}{\i} + \def\j{\inteval{\i+1}} + \itemtomacro\SPLlistepoints[\i,1]\xa + \itemtomacro\SPLlistepoints[\i,2]\ya + \itemtomacro\SPLlistepoints[\i,3]\fprimea + \itemtomacro\SPLlistepoints[\j,1]\xb + \itemtomacro\SPLlistepoints[\j,2]\yb + \itemtomacro\SPLlistepoints[\j,3]\fprimeb + \draw[line width=\SPLepaisseur,\SPLcouleur,\SPLstyle] (\xa,\ya) ..controls +({atan \fprimea}:{(\xb-\xa)/\COEFFA}) and +({-180 + atan \fprimeb}:{(\xb-\xa)/\COEFFB}).. (\xb,\yb) ;% + } + \fi + \ifboolKV[spline]{affpoints}%on affiche les points de contrôle + {% + \foreach \i in {1,2,...,\SPLlistepointslen}{% + \itemtomacro\SPLlistepoints[\i,1]\xa + \itemtomacro\SPLlistepoints[\i,2]\ya + \filldraw[\SPLcouleurpoints] (\xa,\ya) circle[radius=\SPLtaillepoints] ;% + } + } + {} +} + +%------tangente(s) en TikZ, avec point/dérivée ou liste points/dérivées +\defKV[tgte]{% + liste=\def\TGTliste{#1},% + width=\def\TGTepaisseur{#1},% + couleur=\def\TGTcouleur{#1},% + xl=\def\TGTXL{#1},% + xr=\def\TGTXR{#1},% + style=\def\TGTstyle{#1},% + point=\def\TGTnumpt{#1} +} + +\setKVdefault[tgte]{ + liste=,% + width=1.25pt,% + couleur=red,% + xl=0.5,xr=0.5,% + style=,% + point=1 +} + +\newcommand\tangentetikz[1][]{% + \useKVdefault[tgte]% + \setKV[tgte]{#1}% on paramètres les nouvelles clés et on les simplifie + \setsepchar[.]{§./}% + \readlist\TGTlistepoints\TGTliste + \itemtomacro\TGTlistepoints[\TGTnumpt,1]\xa + \itemtomacro\TGTlistepoints[\TGTnumpt,2]\ya + \itemtomacro\TGTlistepoints[\TGTnumpt,3]\fprimea + \def\TGTDEB{\fpeval{\xa-\TGTXL}}\def\TGTFIN{\fpeval{\xa+\TGTXR}}% + \draw[line width=\TGTepaisseur,\TGTcouleur,domain=\TGTDEB:\TGTFIN,\TGTstyle] plot (\x,{\fprimea*(\x-\xa)+\ya}) ;% +} + +%----------------FENÊTRE CALCUL FORMEL +\newcommand\CFchap{\textasciicircum} +\newcounter{CFnum} +% ========= DEF DES CLES PARAM FENETRES XCAS +\defKV[paramfenxcas]{% + larg=\def\CFlarg{#1},% + esplg=\def\CFesplg{#1},% + premcol=\def\CFpremcol{#1},% + hpremcol=\def\CFhpremcol{#1},% + taille=\def\CFtaille{#1},% + couleur=\def\CFcouleur{#1},% + tailletitre=\def\CFtailletitre{#1},% + couleurcmd=\def\CFcoulcmd{#1},% + couleurres=\def\CFcoulres{#1},% + poscmd=\def\CFposcmd{#1},% + posres=\def\CFposres{#1},% + labeltitre=\def\CFlabeltitre{#1}% +} +\setKVdefault[paramfenxcas]{% + larg=16,esplg=2pt,premcol=0.3,hpremcol=0.4,% + couleur=darkgray,menu=true,titre=false,tailletitre=\normalsize,taille=\normalsize,% + sep=true,posres=centre,poscmd=gauche,% + couleurcmd=red,couleurres=blue,% + labeltitre={Résultats obtenus avec un logiciel de Calcul Formel}} +\newcommand\paramCF[1][]{% + \setcounter{CFnum}{0} + \useKVdefault[paramfenxcas]% + \setKV[paramfenxcas]{#1}% on paramètres les nouvelles clés et on les simplifie +} +% ========= DEF DES CLES PARAM LIGNES XCAS ========= +\defKV[paramlgxcas]{% + hc=\def\CFhle{#1},% + hr=\def\CFhlr{#1} +} +\setKVdefault[paramlgxcas]{hc=0.75,hr=0.75} +\newcommand\ligneCF[3][]{% + \addtocounter{CFnum}{1} + \def\CFL{\theCFnum} + \def\CFLA{\inteval{\CFL-1}}% + \useKVdefault[paramlgxcas]% + \setKV[paramlgxcas]{#1}% on paramètres les nouvelles clés et on les simplifie + \def\CFLA{\inteval{\CFL-1}}% + %DÉCLARATION DES NŒUDS (les "6" coins des lignes commande et résultat) + \xintifboolexpr{\CFL == 1}%si c'est la première ligne + {\coordinate (A0\CFL) at (0,0);} + {\coordinate (A0\CFL) at ($(A2\CFLA) + (0,{-\CFesplg})$);} + \coordinate (A1\CFL) at ($(A0\CFL) + (0,{-\CFhle})$); + \coordinate (A2\CFL) at ($(A1\CFL) + (0,{-\CFhlr})$); + \coordinate (A3\CFL) at ($(A0\CFL) + ({\CFlarg},0)$); + \coordinate (A4\CFL) at ($(A1\CFL) + ({\CFlarg},0)$); + \coordinate (A5\CFL) at ($(A2\CFL) + ({\CFlarg},0)$); + %DÉCLARATION DES NŒUDS INTERMÉDIAIRES (pour les commandes et les résultats) + \coordinate (C1\CFL) at ($(A0\CFL) + (0,{-0.5*\CFhle})$); + \coordinate (C2\CFL) at ($(A0\CFL) + ({0.5*\CFlarg},{-0.5*\CFhle})$); + \coordinate (C3\CFL) at ($(A0\CFL) + ({\CFlarg},{-0.5*\CFhle})$); + \coordinate (R1\CFL) at ($(A1\CFL) + (0,{-0.5*\CFhlr})$); + \coordinate (R2\CFL) at ($(A1\CFL) + ({0.5*\CFlarg},{-0.5*\CFhlr})$); + \coordinate (R3\CFL) at ($(A1\CFL) + ({\CFlarg},{-0.5*\CFhlr})$); + %RECTANGLE DE BASE + \draw[\CFcouleur] (A0\CFL) rectangle (A5\CFL) ; + %LA COMMANDE EN ROUGE + \IfStrEq{\CFposcmd}{centre}%si poscmd=center + {\draw (C2\CFL) node[\CFcoulcmd] {#2} ;} + {} + \IfStrEq{\CFposcmd}{gauche}%si poscmd=left + {\draw (C1\CFL) node[right,\CFcoulcmd] {#2} ;} + {} + \IfStrEq{\CFposcmd}{right}%si poscmd=right + {\draw (C3\CFL) node[left,\CFcoulcmd] {#2} ;} + {} + %LA LIGNE DE SÉPARATION + \ifboolKV[paramfenxcas]{sep}%si sep=true + {\draw[\CFcouleur] (A1\CFL) -- (A4\CFL);} + {} + %LE RÉSULTAT + \IfStrEq{\CFposres}{centre}%si posrep=center + {\draw (R2\CFL) node[\CFcoulres] {#3} ;} + {} + \IfStrEq{\CFposres}{gauche}%si posrep=left + {\draw (R1\CFL) node[right,\CFcoulres] {#3} ;} + {} + \IfStrEq{\CFposres}{right}%si posrep=right + {\draw (R3\CFL) node[left,\CFcoulres] {#3} ;} + {} + \ifboolKV[paramfenxcas]{sep}%si sep=true + {\draw[\CFcouleur] (A1\CFL) -- (A4\CFL);}% + {} + %LE PETIT NUMÉRO + \draw[\CFcouleur] (A0\CFL) rectangle ++ ({-\CFpremcol},{-\CFhpremcol}) node[\CFcouleur,midway,font=\small\sffamily\bfseries] {\CFL} ; + %LE RECTANGLE "MENU" + \ifboolKV[paramfenxcas]{menu}%si menu=true + {\draw[\CFcouleur,fill=\CFcouleur!25] (A5\CFL) rectangle ++ (-0.65,0.25) node[black,midway,font=\tiny\sffamily\bfseries] {MENU} ;}% + {} + %LE BLOC "TITRE" + \ifboolKV[paramfenxcas]{titre}%si titre=true + {\draw[\CFcouleur,fill=lightgray!25,rounded corners] ($(A01) + (0,2pt)$) rectangle ++ ($({\CFlarg},2em)$) node[ForestGreen!50!\CFcouleur,midway,font=\CFtailletitre\ttfamily\bfseries] {\CFlabeltitre};} + {} +} + + +%=========CONSOLEPYTHON=========== OK !! +\defKV[envpythonconsole]{% + largeur=\def\CSPYlargeur{#1},% + centre=\testboolKV{#1} + {\def\hookcenterpre{\begin{center}}\def\hookcenterpost{\end{center}}} + {\def\hookcenterpre{\begin{flushleft}}\def\hookcenterpost{\end{flushleft}}} +} + +\setKVdefault[envpythonconsole]{% + largeur=\linewidth,% + centre=true,% + label=true +} + +\newenvironment{envconsolepythontex}[1][]{% + \useKVdefault[envpythonconsole]% + \setKV[envpythonconsole]{#1}% on paramètres les nouvelles clés et on les simplifie + \VerbatimEnvironment + \hookcenterpre + \begin{minipage}{\CSPYlargeur} + \ifboolKV[envpythonconsole]{label}%si sep=true + {\begin{pyconsole}[][% + framesep=3mm,frame=single,fontsize=\footnotesize,framerule=1pt,rulecolor=\color{ForestGreen},label={[\scriptsize Début de la console python]\scriptsize Fin de la console python}]}% + {\begin{pyconsole}[][% + framesep=3mm,frame=single,fontsize=\footnotesize,framerule=1pt,rulecolor=\color{ForestGreen}]} + } + { + \end{pyconsole} + \end{minipage} + \hookcenterpost +} + +%=========CODEPYTHONTEX=========== OK!! +\defKV[envpythonverb]{% + largeur=\def\CODPYlargeur{#1},% + centre=\testboolKV{#1} + {\def\verbcenterpre{\begin{center}}\def\verbcenterpost{\end{center}}} + {\def\verbcenterpre{}\def\verbcenterpost{}} +} + +\setKVdefault[envpythonverb]{% + largeur=\linewidth,% + centre=true,% + lignes=true +} + +\tcbset{stylepythontex/.style={% + enhanced,boxrule=1.25pt,% + sharp corners=downhill,arc=12pt, + before skip=12pt,after skip=12pt,% + top=10pt,bottom=1mm,rightupper=4pt,%leftupper=25pt, + attach boxed title to top right={yshift=-\tcboxedtitleheight}, + boxed title style={ + size=small,colback=ForestGreen!25,boxrule=1.25pt, + colframe=Green,boxsep=1.25pt, + sharp corners=downhill, + arc=12pt, + top=2pt,bottom=1pt,left=6pt,right=6pt + }, + fonttitle=\color{ForestGreen}\itshape\ttfamily\footnotesize, + title={\scriptsize\faPython}\:Code Python\vphantom{/}, + watermark text={\faPython},watermark opacity=0.175,watermark zoom=0.50, + } +} + +\tcbset{stylepythonnolineos/.style={% + stylepythontex,leftupper=10pt, + colframe=Green,colback=ForestGreen!5,% + fontlower=\small,% + before upper = \renewcommand\theFancyVerbLine{\scriptsize\ttfamily\color{Green}\arabic{FancyVerbLine}} + } +} + +\tcbset{stylepythonlineos/.style={% + stylepythontex,leftupper=25pt, + colframe=Green,colback=ForestGreen!5,% + fontlower=\small,% + before upper = \renewcommand\theFancyVerbLine{\scriptsize\ttfamily\color{Green}\arabic{FancyVerbLine}} + } +} + +\newtcolorbox{tcpythontexcode}[1][\linewidth]{% + width=#1,stylepythonlineos +} + +\newtcolorbox{tcpythontexcodeno}[1][\linewidth]{% + width=#1,stylepythonnolineos +} + +\newenvironment{envcodepythontex}[1][]{% + \useKVdefault[envpythonverb]% + \setKV[envpythonverb]{#1}% on paramètres les nouvelles clés et on les simplifie + \VerbatimEnvironment + \verbcenterpre + \ifboolKV[envpythonverb]{lignes}%si lignes=true + {\begin{tcpythontexcode}[\CODPYlargeur]} + {\begin{tcpythontexcodeno}[\CODPYlargeur]} + \ifboolKV[envpythonverb]{lignes}%si lignes=true + {\begin{pyverbatim}[][fontsize=\footnotesize,numbers=left,numbersep=10pt,commandchars=\\\{\},mathescape]} + {\begin{pyverbatim}[][numbers=none,numbersep=0pt,fontsize=\footnotesize,commandchars=\\\{\},mathescape]} + } + { + \end{pyverbatim} + \ifboolKV[envpythonverb]{lignes}%si lignes=true + {\end{tcpythontexcode}} + {\end{tcpythontexcodeno}} + \verbcenterpost +} + +\endinput \ No newline at end of file -- cgit v1.2.3