diff options
author | Norbert Preining <norbert@preining.info> | 2020-06-08 03:02:56 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2020-06-08 03:02:56 +0000 |
commit | 7e1a772944cf3d35b15db92cf639c702d1acf053 (patch) | |
tree | ac361cbc01e725ed24086f89015dbcb3190b7f54 /macros | |
parent | 666248863665f4318b13e1c1b7a2b94ef90a8b9a (diff) |
CTAN sync 202006080302
Diffstat (limited to 'macros')
26 files changed, 1064 insertions, 360 deletions
diff --git a/macros/latex/contrib/abnt/abnt-doc.pdf b/macros/latex/contrib/abnt/abnt-doc.pdf Binary files differindex 3b82b51321..ff44543ede 100644 --- a/macros/latex/contrib/abnt/abnt-doc.pdf +++ b/macros/latex/contrib/abnt/abnt-doc.pdf diff --git a/macros/latex/contrib/abnt/abnt-doc.tex b/macros/latex/contrib/abnt/abnt-doc.tex index 389bd6c5ea..ac8cb3461a 100644 --- a/macros/latex/contrib/abnt/abnt-doc.tex +++ b/macros/latex/contrib/abnt/abnt-doc.tex @@ -36,7 +36,7 @@ \begin{center} \tikz\node[diamond,shape aspect=1.2,%draw=green,ultra thick, remember picture,overlay,%minimum size=0.6\textwidth, - left color=SpringGreen,shading angle=45,align=center] at (0,0){\includegraphics[height=3cm,width=0.4\textwidth,keepaspectratio]{icone}\\{\Large O pacote <<\texttt{abnt}>>}\\[10pt]\large Youssef Cherem\\[6pt]2019}; + left color=SpringGreen,shading angle=45,align=center] at (0,0){\includegraphics[height=3cm,width=0.4\textwidth,keepaspectratio]{icone}\\{\Large O pacote <<\texttt{abnt}>>}\\[10pt]\large Youssef Cherem\\[6pt]2020}; \end{center} \vspace{4cm} diff --git a/macros/latex/contrib/abnt/abnt.sty b/macros/latex/contrib/abnt/abnt.sty index a29009e1ad..d2a637d008 100644 --- a/macros/latex/contrib/abnt/abnt.sty +++ b/macros/latex/contrib/abnt/abnt.sty @@ -14,9 +14,10 @@ % The Current Maintainer of this work is Youssef Cherem. \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{abnt}[2020/04/14] +\ProvidesPackage{abnt}[2020/06/06] \RequirePackage[left=3cm,top=3cm,right=2cm,bottom=2cm]{geometry} \RequirePackage{setspace} +\onehalfspacing \RequirePackage[automark,markcase=used]{scrlayer-scrpage} \newcommand{\pretextual}{\clearpairofpagestyles} @@ -256,7 +257,7 @@ tocentrynumsep=0pt% <- added \newenvironment{citacao}{\vskip -4pt \singlespacing\setlength{\parindent}{0pt} - \leftskip=6cm\footnotesize}{\medskip} + \leftskip=6cm\footnotesize}{\par\medskip} \RequirePackage{enumerate} diff --git a/macros/latex/contrib/beamer-contrib/beamerappendixnote/README.md b/macros/latex/contrib/beamer-contrib/beamerappendixnote/README.md index 48321f6dc4..b75eb9c94f 100644 --- a/macros/latex/contrib/beamer-contrib/beamerappendixnote/README.md +++ b/macros/latex/contrib/beamer-contrib/beamerappendixnote/README.md @@ -1,4 +1,4 @@ -Beamer appendix note introduces the `\beamerappxnote` command, which puts the note's content on a separate beamer frame, shown by the command `\printappxnotes`. It also creates interactive buttons to move back and forth between the two frames. +Beamer appendix note introduces the `\appxnote` command, which puts the note's content on a separate beamer frame, shown by the command `\printappxnotes`. It also creates interactive buttons to move back and forth between the two frames. # Licence diff --git a/macros/latex/contrib/beamer-contrib/beamerappendixnote/beamerappendixnote.dtx b/macros/latex/contrib/beamer-contrib/beamerappendixnote/beamerappendixnote.dtx index 05445b6b65..206897ec5d 100644 --- a/macros/latex/contrib/beamer-contrib/beamerappendixnote/beamerappendixnote.dtx +++ b/macros/latex/contrib/beamer-contrib/beamerappendixnote/beamerappendixnote.dtx @@ -23,23 +23,35 @@ %</driver> %<package> \ProvidesPackage{beamerappendixnote} %<*package> - [2020/05/13 v1.0 initial version] + [2020/06/07 v1.0.1 updated documentation] %</package> %<*driver> \documentclass{l3doc} -\usepackage{beamerappendixnote} -\usepackage{listings} +%% Packages +% This package +\usepackage{beamerappendixnote} +% Unicode +\usepackage{fontspec,unicode-math} +% Auxiliary +\usepackage{listings,graphicx} + +%% Layout +% Font +\setmainfont{TeX Gyre Pagella} +% Listings \lstset{ basicstyle=\ttfamily, columns=fullflexible, keepspaces=true, } -\usepackage{graphicx} +% Links +\hypersetup{colorlinks,citecolor=blue,linkcolor=blue,urlcolor=blue} -\begin{document} +%% Definitions +\newcommand\fnurl[2]{\href{#1}{#2}\footnote{\url{#1}}} -\changes{v1.0}{2020/05/13}{Initial version} +\begin{document} \GetFileInfo{beamerappendixnote.dtx} @@ -58,29 +70,33 @@ \begin{documentation} -\noindent Beamer appendix note introduces the \cs{beamerappxnote} command, which puts the note's content on a separate beamer frame, shown by the command \cs{printappxnotes}. It also creates interactive buttons to move back and forth between the two frames: +\noindent Beamer appendix note introduces the \cs{appxnote} command, which puts the note's content on a separate beamer frame, shown by the command \cs{printappxnotes}. It also creates interactive buttons to move back and forth between the two frames: \lstinputlisting{example-basic.tex} \includegraphics[page=1,width=.49\linewidth]{example-basic.pdf} \includegraphics[page=2,width=.49\linewidth]{example-basic.pdf} \clearpage +\section{Installation} + +The \pkg{beamerappendixnote} package is available on \fnurl{https://ctan.org/pkg/beamerappendixnote}{CTAN}. The easiest way to install it is through a package manager. For help, see the \fnurl{https://miktex.org/howto/miktex-console}{MiKTeX} or \fnurl{https://www.tug.org/texlive/doc/texlive-en/texlive-en.html\#x1-430005}{TeX Live} manual. To build \pkg{beamerappendixnote} from the source code, follow the instructions in the \verb|README.md| file. + \section{Usage} \begin{function}{\appxnote} - \begin{syntax} + \begin{syntax} \cs{appxnote}\marg{title}\marg{content} - \end{syntax} - - Create a new appendix note. Inserts a \cs{beamergotobutton} to a frame that contains \marg{content}. The appendix frame is created using \cs{printappxnotes}. The button’s text and the title of the appendix frame are both set to \marg{title}. + \end{syntax} + + Create a new appendix note. Inserts a \cs{beamergotobutton} to a frame that contains \marg{content}. The appendix frame is created using \cs{printappxnotes}. The button’s text and the title of the appendix frame are both set to \marg{title}. \end{function} \begin{function}{\printappxnotes} - \begin{syntax} + \begin{syntax} \cs{printappxnotes} - \end{syntax} - - Prints appendix notes in the order they are created using \cs{appxnote}. Has to be used after the last appendix note. Uses one frame per note. Inserts a \cs{beamerreturnbutton} button to the frame where \cs{appxnote} was called, followed by the content, separated by a \cs{vfill}. + \end{syntax} + + Prints appendix notes in the order they are created using \cs{appxnote}. Has to be used after the last appendix note. Uses one frame per note. Inserts a \cs{beamerreturnbutton} button to the frame where \cs{appxnote} was called, followed by the content, separated by a \cs{vfill}. \end{function} \end{documentation} diff --git a/macros/latex/contrib/beamer-contrib/beamerappendixnote/beamerappendixnote.pdf b/macros/latex/contrib/beamer-contrib/beamerappendixnote/beamerappendixnote.pdf Binary files differindex cc3d4de9e8..c6160f5186 100644 --- a/macros/latex/contrib/beamer-contrib/beamerappendixnote/beamerappendixnote.pdf +++ b/macros/latex/contrib/beamer-contrib/beamerappendixnote/beamerappendixnote.pdf diff --git a/macros/latex/contrib/beamer-contrib/beamerappendixnote/example-basic.pdf b/macros/latex/contrib/beamer-contrib/beamerappendixnote/example-basic.pdf Binary files differindex 1e560098a0..6f96ecb4f2 100644 --- a/macros/latex/contrib/beamer-contrib/beamerappendixnote/example-basic.pdf +++ b/macros/latex/contrib/beamer-contrib/beamerappendixnote/example-basic.pdf diff --git a/macros/latex/contrib/beamer-contrib/beamerappendixnote/example-basic.tex b/macros/latex/contrib/beamer-contrib/beamerappendixnote/example-basic.tex index e0eb2b68b8..e2349546c7 100644 --- a/macros/latex/contrib/beamer-contrib/beamerappendixnote/example-basic.tex +++ b/macros/latex/contrib/beamer-contrib/beamerappendixnote/example-basic.tex @@ -1,9 +1,9 @@ \documentclass[20pt]{beamer} \usepackage{beamerappendixnote} \begin{document} -\begin{frame}{Main frame} +\begin{frame}{Main title} Main content \vfill - \appxnote{Appendix note}{Note content} + \appxnote{Note title}{Note content} \end{frame} \printappxnotes \end{document}
\ No newline at end of file diff --git a/macros/latex/contrib/cellprops/LICENSE b/macros/latex/contrib/cellprops/LICENSE index 82ae7cd1eb..19e0cc42ed 100644 --- a/macros/latex/contrib/cellprops/LICENSE +++ b/macros/latex/contrib/cellprops/LICENSE @@ -632,7 +632,7 @@ state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. cellprops - Copyright (C) 2016-2019 Julien "_FrnchFrgg_" RIVAUD + Copyright (C) 2016-2020 Julien "_FrnchFrgg_" RIVAUD This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -652,7 +652,7 @@ Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: - cellprops Copyright (C) 2016-2019 Julien "_FrnchFrgg_" RIVAUD + cellprops Copyright (C) 2016-2020 Julien "_FrnchFrgg_" RIVAUD This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. diff --git a/macros/latex/contrib/cellprops/README.md b/macros/latex/contrib/cellprops/README.md index 740e9561b3..5378701f8e 100644 --- a/macros/latex/contrib/cellprops/README.md +++ b/macros/latex/contrib/cellprops/README.md @@ -13,7 +13,7 @@ Look at the PDF documentation to see examples and detailed usage. -Copyright (C) 2016-2019 Julien "_FrnchFrgg_" RIVAUD +Copyright (C) 2016-2020 Julien "_FrnchFrgg_" RIVAUD This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/macros/latex/contrib/cellprops/cellprops.dtx b/macros/latex/contrib/cellprops/cellprops.dtx index 67b4dc8cd2..86c1d8ef2c 100644 --- a/macros/latex/contrib/cellprops/cellprops.dtx +++ b/macros/latex/contrib/cellprops/cellprops.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % vim: tw=80 spl=en % -%% File: cellprops.dtx (C) Copyright 2016-2019 RIVAUD Julien +%% File: cellprops.dtx (C) Copyright 2016-2020 RIVAUD Julien %% %% It may be distributed and/or modified under the conditions of the %% General Public License (GPL), either version 3 of this @@ -14,8 +14,8 @@ \RequirePackage{expl3}[2018/06/19] \def\ExplFileName{cellprops} \def\ExplFileDescription{CSS-like cell and table properties} -\def\ExplFileDate{2019/09/29} -\def\ExplFileVersion{1.6} +\def\ExplFileDate{2020/06/07} +\def\ExplFileVersion{1.7a} %</driver|package> %<*driver> \documentclass[full]{l3doc} @@ -159,6 +159,8 @@ % %\cellprops{ % td { border: thin solid black; } +% tr:nth-child(-n+3) { background-color: black!10; } +% tr:nth-child(n+8) { background-color: blue!10; } % tr:nth-child(4n) td:first-child, % tr:nth-child(4n+1) td:nth-child(2), % tr:nth-child(4n+2) td:nth-child(3), @@ -200,6 +202,8 @@ %\begin{verbatim} %\cellprops{ % td { border: thin solid black; } +% tr:nth-child(-n+3) { background-color: black!10; } +% tr:nth-child(n+8) { background-color: blue!10; } % tr:nth-child(4n) td:first-child, % tr:nth-child(4n+1) td:nth-child(2), % tr:nth-child(4n+2) td:nth-child(3), @@ -312,16 +316,13 @@ % "td:nth-child()" to select a column. Currently, cells spanning several % columns actually increase the child count by the number of column they % span, so that nth-child can still be used to select columns. -% This is not consistent with the CSS specification. -% \item Any ":nth-child("$A$"n+"$B$")" or ":nth-child("$A$"n)" -% or ":nth-child("$B$")" is supported, with arbitrary $A$~and~$B$. The -% performance will slowly degrade the more different~$A$ are active -% (but if in a \TeX\ group, they will become inactive again when leaving -% the group). \emph{A big difference} with the CSS specification is that -% currently $n$ is not enforced non-negative. In particular -% ":nth-child(2n+8)" \emph{will} match for the second element. This also -% prevents tricks like ":nth-child(-n+3)". I am investigating how to -% handle those without slowing down the general case. +% This is not consistent with the HTML specification of tables, but acts +% as if a cell spanning multiple columns was implicitly creating +% "display: none" empty cell siblings following it. +% \item Any ":nth-child("$A$"n+"$B$")" or ":nth-child("$A$"n)" or +% ":nth-child("$B$")" is supported, with arbitrary $A$~and~$B$, including +% nothing for~$A$ (standing for~$A = 1$) or just a minus sign (standing +% for~$A = -1$). % \end{itemize} % % \subsection{Compatibility} @@ -338,8 +339,7 @@ % % Add a test suite with compatibility tests. Improve % the documentation, and test more \LaTeX\ table constructs and preamble column -% types. Enforce $n\ge0$ in ":nth-child" selectors to match the CSS -% specification. +% types. % % \end{documentation} % @@ -452,6 +452,12 @@ % % \end{macro} % +% \begin{macro}{\@@_parse_properties:nn} +% Now we can parse the block of properties for a given selector. The first +% argument is the token list variable which will ultimately hold the expanded +% code setting internal variables from the properties. That code will be +% called when recalling the computed values in a specific context. +% % \begin{macrocode} \cs_new_protected:Nn \@@_parse_properties:Nn { \tl_clear:N #1 @@ -477,7 +483,20 @@ } } } - +% \end{macrocode} +% \end{macro} +% +% \subsection{Defining new properties} +% +% \subsubsection{Some helpers} +% +% \begin{macro}{\@@_fourval_setter:nnnnnn} +% \begin{macro}{\@@_define_fourval_properties:nnnnnn} +% We first define helpers to parse and define compound properties like +% "padding" where you can give one to four different values and the missing +% values are copied from the given ones. +% +% \begin{macrocode} \cs_new:Nn \@@_fourval_setter:nnnnnn { \@@_fourval_setter_aux:w {#1}{#2}{#3}{#4}#6~{\q_no_value}~{\q_no_value}~{\q_no_value}~\q_stop @@ -510,7 +529,14 @@ #2 } } - +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\@@_color_setter:nn} +% This macro is used to parse color definitions, either named, rgb, or hsl. +% +% \begin{macrocode} \tl_const:Nn \c_@@_inherit_color_tl { \q_nil } \cs_new_nopar:Nn \@@_color_setter:nn { @@ -533,6 +559,13 @@ } } } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_bgcolor_setter:nn} +% For background colors, we support "transparent" as an alias for "inherit". +% +% \begin{macrocode} \cs_new_nopar:Nn \@@_bgcolor_setter:nn { \str_if_eq:nnTF {#2} {transparent} { \@@_color_setter:nn {#1} {inherit} @@ -540,7 +573,13 @@ \@@_color_setter:nn {#1} {#2} } } - +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_linewidth_setter:nn} +% A setter for line widths that supports common keywords: +% +% \begin{macrocode} \cs_new_nopar:Nn \@@_linewidth_setter:nn { \str_case:nnF {#2} { {thin} { \@@_generic_setter:nnn \exp_not:n {#1} { \fboxrule} } @@ -550,7 +589,16 @@ \@@_generic_setter:nnn \exp_not:n {#1} {#2} } } - +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_border_setter:nn } +% "border" and "border-"<side> are compound properties that can define the +% width, the style and the color. As per the specification, the "border" +% property always sets all four sides at the same time instead of being a +% four-valued property. +% +% \begin{macrocode} \cs_new_nopar:Nn \@@_border_setter:nn { \@@_border_setter_aux:nw {#1}#2~{\q_no_value}~{\q_no_value}~\q_stop @@ -586,13 +634,22 @@ \@@_delegate_setter:nn {#1-color} {#4} } } + \cs_new:Npn \@@_border_setter_isstyle:nTF #1 { \str_case:nnTF {#1} { {none}{} {hidden}{} {dotted}{} {dashed}{} {solid}{} {double}{} {groove}{} {ridge}{} {inset}{} {outset}{} } } - +% \end{macrocode} +% \end{macro} +% +% \subsubsection{Actual definitions of properties} +% +% First some simple-valued properties where we just store the value +% unexpanded. +% +% \begin{macrocode} \@@_define_properties:nn { \@@_generic_setter:nnn \exp_not:n }{ @@ -600,19 +657,32 @@ min-depth, min-width, } - +% \end{macrocode} +% +% "padding" is a compound property for "padding-"<side> which store their +% value unexpanded. +% +% \begin{macrocode} \@@_define_fourval_properties:nnnnnn { \@@_generic_setter:nnn \exp_not:n } {padding} {padding-top}{padding-right}{padding-bottom}{padding-left} - +% \end{macrocode} +% +% Simple-valued properties that store a str value. +% +% \begin{macrocode} \@@_define_properties:nn { \@@_generic_setter:nnn \tl_to_str:n }{ text-align, math-mode, } - +% \end{macrocode} +% +% Some simple-valued color properties, using the dedicated parser. +% +% \begin{macrocode} \@@_define_properties:nn { \@@_color_setter:nn }{ @@ -624,31 +694,54 @@ }{ background-color, } - +% \end{macrocode} +% +% A compound property whose individual sides use the linewidth setter for +% keyword recognition. +% +% \begin{macrocode} \@@_define_fourval_properties:nnnnnn { \@@_linewidth_setter:nn } {border-width} {border-top-width}{border-right-width} {border-bottom-width}{border-left-width} - +% \end{macrocode} +% +% A compound property whose individual sides are str values. They could be +% checked against the list of valid values, but any non-existing one will be +% ignored anyway due to the way they are implemented. +% +% \begin{macrocode} \@@_define_fourval_properties:nnnnnn { \@@_generic_setter:nnn \tl_to_str:n } {border-style} {border-top-style}{border-right-style} {border-bottom-style}{border-left-style} - +% \end{macrocode} +% +% A compound property whose individual sides are colors. +% +% \begin{macrocode} \@@_define_fourval_properties:nnnnnn { \@@_color_setter:nn } {border-color} {border-top-color}{border-right-color} {border-bottom-color}{border-left-color} - +% \end{macrocode} +% +% The five border-specific compound properties are defined here. +% +% \begin{macrocode} \@@_define_properties:nn { \@@_border_setter:nn }{ border, border-top, border-right, border-bottom, border-left } - +% \end{macrocode} +% +% \subsection{Parsing a CSS stylesheet} +% +% \begin{macrocode} \NewDocumentCommand \cellprops { m } { \@@_parse_css:n {#1} } @@ -656,135 +749,235 @@ \cs_new_protected:Nn \@@_parse_css:n { \@@_parse_css:w #1 \q_mark {\q_nil} \q_stop } - -\tl_new:N \l_@@_parse_tmp_tl +% \end{macrocode} +% +% Grab the content up to the first opening brace. That content will be the +% comma-separated selector list, and the braced content is a block of +% properties. We can loop until there is no such block remaining. +% +% \begin{macrocode} +\tl_new:N \l_@@_parse_properties_tl \NewDocumentCommand \@@_parse_css:w { lmu{\q_stop} } { \quark_if_nil:nF {#2} { - \@@_parse_properties:Nn \l_@@_parse_tmp_tl {#2} + \@@_parse_properties:Nn \l_@@_parse_properties_tl {#2} \clist_map_inline:nn {#1} { - \@@_parse_css_addprops:nV {##1} \l_@@_parse_tmp_tl + \@@_parse_css_addprops:n {##1} } \@@_parse_css:w #3 \q_stop } } - - -\seq_new:N \l_@@_parse_selector_seq -\tl_new:N \l_@@_parse_desc_tl - -\str_const:Nn \c_@@_parse_nthchild_str { :nth-child( } -\prop_new:N \c_@@_parse_replace_prop -\prop_put:Nnn \c_@@_parse_replace_prop { :first-child } { :nth-child(1) } - -\cs_new_protected:Nn \@@_parse_selector:Nn { - \str_set:Nx \l_tmpa_str {#2} % \end{macrocode} % -% Replace some aliases with their meaning: +% Some pseudo-classes generate conditional code for the properties to be +% applied. Check if such code exists, and wrap the parsed property setters +% in a \cs{bool_if:nT}. % % \begin{macrocode} - \prop_map_inline:Nn \c_@@_parse_replace_prop { - \use:x { - \exp_not:n { \tl_replace_all:Nnn \l_tmpa_str } - { \tl_to_str:n { ##1 } } { \tl_to_str:n { ##2 } } +\tl_new:N \l_@@_current_selector_tl +\tl_new:N \l_@@_current_selector_check_tl +\cs_new_protected:Nn \@@_parse_css_addprops:n { + \@@_parse_selector:n {#1} + \tl_set:Nx \l_tmpa_tl { l_@@_property_group_\l_@@_current_selector_tl _tl } + \tl_if_exist:cF { \l_tmpa_tl } { \tl_clear:c { \l_tmpa_tl } } + \tl_if_empty:NTF \l_@@_current_selector_check_tl { + \tl_put_right:cV { \l_tmpa_tl } \l_@@_parse_properties_tl + }{ + \tl_put_right:cx { \l_tmpa_tl } { + \exp_not:N \bool_if:nT { + \exp_not:V \l_@@_current_selector_check_tl + }{ + \exp_not:V \l_@@_parse_properties_tl + } } } +} % \end{macrocode} % -% Replace all spaces by \cs{q_stop} to defeat the space removal feature of -% \cs{seq_set_split:Nnn}. +% Here we parse a selector. These are naturally space-separated, but we first +% need to detect and normalize constructs like ":nth-child(argument)". We +% replace them by ":nth-child{argument}" where the braces will procect any +% space that can legitimately occur within "argument". % % \begin{macrocode} - \tl_replace_all:Nnn \l_tmpa_str {~} {\q_stop} - \exp_args:NNVV - \seq_set_split:Nnn \l_tmpa_seq \c_@@_parse_nthchild_str \l_tmpa_str - \seq_pop_left:NN \l_tmpa_seq \l_tmpa_tl +\cs_new_protected:Nn \@@_parse_selector_sanitize:n { + \exp_args:Nx \@@_parse_selector_sanitize_aux:n + { \tl_to_str:n{#1} } +} +\cs_new_protected:Nn \@@_parse_selector_sanitize_aux:n { + \cs_set:Npn \@@_parse_selector_sanitize:w ##1:#1(##2)##3\q_stop + { + \quark_if_nil:nTF {##3} { + ##1 + }{ + ##1:#1{##2}\@@_parse_selector_sanitize:w ##3\q_stop + } + } + \tl_set:Nx \l_@@_current_selector_tl { + \exp_last_unbraced:NV + \@@_parse_selector_sanitize:w + \l_@@_current_selector_tl + :#1()\q_nil\q_stop + } +} % \end{macrocode} % -% And replace them back. +% Now that we can sanitize pseudo-classes, parsing the selector is safe. The +% only construct to protect is currently ":nth-child()". % % \begin{macrocode} - \tl_replace_all:Nnn \l_tmpa_tl {\q_stop} {~} - \seq_clear:N \l_@@_parse_selector_seq - \seq_put_right:NV \l_@@_parse_selector_seq \l_tmpa_tl - \seq_map_inline:Nn \l_tmpa_seq { - \tl_set:Nn \l_tmpa_tl { ##1 } +\seq_new:N \l_@@_current_selector_seq +\seq_new:N \l_@@_pseudoclasses_seq +\tl_new:N \l_@@_current_element_tl +\cs_new_protected:Nn \@@_parse_selector:n { + \tl_set:Nx \l_@@_current_selector_tl { \tl_to_str:n {#1} } % \end{macrocode} % -% And replace them back again. +% The sanitize code is more readable with Expl category colon, so replace it +% now, instead of defining the method with expand or lccode tricks. % % \begin{macrocode} - \tl_replace_all:Nnn \l_tmpa_tl {\q_stop} {~} + \exp_args:NNV \tl_replace_all:Nnn + \l_@@_current_selector_tl \c_colon_str {:} + \@@_parse_selector_sanitize:n {nth-child} + \seq_set_split:NnV \l_@@_current_selector_seq {~} \l_@@_current_selector_tl + \tl_clear:N \l_@@_current_selector_tl + \tl_clear:N \l_@@_current_selector_check_tl + \seq_map_inline:Nn \l_@@_current_selector_seq { % \end{macrocode} % -% Now replace the first closing parenthesis by \cs{q_stop}\cs{prg_do_nothing:} -% to use \cs{q_stop} as a delimiter for \cs{seq_set_split:Nnn} and thus split -% at most once. Note that here the space trimming feature is desired for the -% left part, but not just at the right of the parenthesis, so -% \cs{prg_do_nothing:} will act as a guard and will be removed afterwards. +% Split the current selector item on ":" to get the base element and the +% pseudo-classes. % % \begin{macrocode} - \tl_replace_once:Nnn \l_tmpa_tl { ) } { \q_stop\prg_do_nothing: } - \seq_set_split:NnV \l_tmpa_seq { \q_stop } \l_tmpa_tl - \seq_pop_right:NN \l_tmpa_seq \l_@@_parse_desc_tl - \tl_replace_once:Nnn \l_@@_parse_desc_tl { \prg_do_nothing: } {} - \seq_get_left:NNT \l_tmpa_seq \l_tmpa_tl { - \exp_args:NNV \@@_parse_nth:Nn \l_tmpa_tl \l_tmpa_tl - \tl_put_left:Nn \l_@@_parse_desc_tl { ) } - \tl_put_left:NV \l_@@_parse_desc_tl \l_tmpa_tl + \seq_set_split:Nnn \l_@@_pseudoclasses_seq {:} {##1} + \seq_pop_left:NN \l_@@_pseudoclasses_seq \l_@@_current_element_tl + \tl_put_right:Nn \l_@@_current_selector_tl {~} + \tl_put_right:NV \l_@@_current_selector_tl \l_@@_current_element_tl + \seq_map_inline:Nn \l_@@_pseudoclasses_seq { + \@@_parse_pseudoclass:w ####1{}\q_stop } - \seq_put_right:NV \l_@@_parse_selector_seq \l_@@_parse_desc_tl } - \tl_set:Nx #1 { - \exp_args:NNV \seq_use:Nn - \l_@@_parse_selector_seq \c_@@_parse_nthchild_str +} +% \end{macrocode} +% +% The first argument is the complete pseudo-class up to the opening argument +% brace (if any), and the second argument is the braced content (if any). +% The third argument gobbles any trailing garbage. +% +% \begin{macrocode} +\NewDocumentCommand \@@_parse_pseudoclass:w { lmu{\q_stop} } { + \exp_args:Nx \str_case:nn { #1 } { + {first-child} { \@@_parse_selector_nth:n {1} } + {nth-child} { \@@_parse_selector_nth:n {#2} } } } \str_const:Nn \c_@@_parse_n_str {n} -\seq_new:N \l_@@_used_nth_factors_seq -\cs_new_protected:Nn \@@_parse_nth:Nn { - \str_case:nnF {#2} { +\int_new:N \l_@@_nth_coeff_int +\int_new:N \l_@@_nth_offset_int +\cs_new_protected:Nn \@@_parse_selector_nth:n { +% \end{macrocode} +% +% Put something in the selector token list, for specificity ordering +% of declarations. +% +% \begin{macrocode} + \tl_put_right:Nn \l_@@_current_selector_tl { :nth-child } +% \end{macrocode} +% +% Now parse the nth-child argument: +% +% \begin{macrocode} + \str_case:nnF {#1} { {even} { \str_set:Nn \l_tmpa_str {2n} } {odd} { \str_set:Nn \l_tmpa_str {2n+1} } }{ - \str_set:Nn \l_tmpa_str {#2} + \str_set:Nn \l_tmpa_str {#1} } - \exp_args:NNVV - \seq_set_split:Nnn \l_tmpa_seq \c_@@_parse_n_str \l_tmpa_str + \exp_args:NNV + \seq_set_split:NnV \l_tmpa_seq \c_@@_parse_n_str \l_tmpa_str \seq_pop_right:NN \l_tmpa_seq \l_tmpa_tl - \int_set:Nn \l_tmpb_int { 0\l_tmpa_tl } - \seq_get_left:NNTF \l_tmpa_seq \l_tmpa_tl { - \int_set:Nn \l_tmpa_int { 0\l_tmpa_tl } + \tl_if_empty:NTF \l_tmpa_tl { + \int_zero:N \l_@@_nth_offset_int }{ - \int_zero:N \l_tmpa_int + \int_set:Nn \l_@@_nth_offset_int { \l_tmpa_tl } } - \int_compare:nNnTF \l_tmpa_int = { 0 } { - \tl_set:Nx #1 { \int_use:N \l_tmpb_int } + \seq_get_left:NNTF \l_tmpa_seq \l_tmpa_tl { + \tl_if_empty:NTF \l_tmpa_tl { + \int_set:Nn \l_@@_nth_coeff_int {1} + }{ + \exp_args:NV \tl_if_eq:nnTF \l_tmpa_tl {-} { + \int_set:Nn \l_@@_nth_coeff_int {-1} + }{ + \int_set:Nn \l_@@_nth_coeff_int { \l_tmpa_tl } + } + } }{ - \int_set:Nn \l_tmpb_int { \int_mod:nn {\l_tmpb_int} {\l_tmpa_int} } - \tl_set:Nx #1 { - \int_use:N \l_tmpa_int \exp_not:V \c_@@_parse_n_str - + \int_use:N \l_tmpb_int } - \seq_put_right:Nx - \l_@@_used_nth_factors_seq { \int_use:N \l_tmpa_int } + \int_zero:N \l_@@_nth_coeff_int + } +% \end{macrocode} +% +% At last, generate the condition code. +% +% \begin{macrocode} + \exp_args:NV \str_case:nn \l_@@_current_element_tl { + {tr} { \@@_generate_check_nth:n {\g_@@_row_int} } + {td} { \@@_generate_check_nth:n {\g_@@_col_int} } } } -\cs_new_protected:Npn \@@_parse_css_addprops:nV #1 #2 { - \@@_parse_selector:Nn \l_tmpa_tl {#1} - \tl_set:Nx \l_tmpa_tl { l_@@_property_group_\l_tmpa_tl _tl } - \tl_if_exist:cF { \l_tmpa_tl } { \tl_clear:c { \l_tmpa_tl } } - \tl_put_right:cV { \l_tmpa_tl } #2 +\cs_new_protected_nopar:Nn \@@_generate_check_nth:n { + \int_compare:nNnTF \l_@@_nth_coeff_int = { 0 } { + \tl_set:Nx \l_tmpa_tl { + \exp_not:n { \int_compare_p:nNn #1 = } + \exp_not:V \l_@@_nth_offset_int + } + }{ + \tl_set:Nx \l_tmpb_tl { + { + \exp_not:n { #1 - } + \exp_not:V \l_@@_nth_offset_int + }{ + \exp_not:V \l_@@_nth_coeff_int + } + } + \tl_set:Nx \l_tmpa_tl { + \exp_not:N \bool_lazy_and_p:nn { + \exp_not:n { \int_compare_p:nNn 0 = } + { + \exp_not:N \int_mod:nn + \exp_not:V \l_tmpb_tl + } + }{ + \exp_not:n { \int_compare_p:nNn 0 < } + { + \exp_not:N \int_div_truncate:nn + \exp_not:V \l_tmpb_tl + \exp_not:n { + 1 } + } + } + } + } + \tl_if_empty:NTF \l_@@_current_selector_check_tl { + \tl_set_eq:NN \l_@@_current_selector_check_tl \l_tmpa_tl + }{ + \tl_set:Nx \l_@@_current_selector_check_tl { + \exp_not:N \bool_lazy_and_p:nn { + \exp_not:V \l_@@_current_selector_check_tl + }{ + \exp_not:V \l_tmpa_tl + } + } + } } \cs_set_protected:Nn \@@_recall_properties:n { - \tl_if_exist:cT { l_@@_property_group_#1_tl } { - \tl_use:c { l_@@_property_group_#1_tl } + \tl_if_exist:cT { l_@@_property_group_~#1_tl } { + \tl_use:c { l_@@_property_group_~#1_tl } } \clist_map_inline:nn { \@currenvir } { - \tl_if_exist:cT { l_@@_property_group_##1~#1_tl } { - \tl_use:c { l_@@_property_group_##1~#1_tl } + \tl_if_exist:cT { l_@@_property_group_~##1~#1_tl } { + \tl_use:c { l_@@_property_group_~##1~#1_tl } } } } @@ -897,13 +1090,46 @@ \hlx{s[\l_@@_tablepadding_top_dim]} } +\cs_new_protected_nopar:Nn \@@_maybe_startrow: { + \bool_if:NF \g_@@_inrow_bool { + \bool_gset_true:N \g_@@_inrow_bool + \int_gincr:N \g_@@_row_int + \int_gset_eq:NN \g_@@_col_int \c_one_int + \dim_gzero:N \g_@@_ht_dim + \dim_gzero:N \g_@@_dp_dim + } +} + +\cs_new_protected_nopar:Nn \@@_maybe_endrow: { + \bool_if:NT \g_@@_inrow_bool { + \@@_every_cell_end: + \bool_gset_false:N \g_@@_inrow_bool + } +} + +\cs_new_protected_nopar:Nn \@@_every_cell_end: { + \int_gincr:N \g_@@_col_int +} + \cs_set_protected_nopar:Nn \@@_readpreamble:n { \cs_set_eq:NN \tab@readpreamble \@@_orig_tab@readpreamble:n - \tl_put_left:Nn \tab@multicol {\@@_startrow:} - \tl_put_left:Nn \tab@tabtext {\int_gincr:N \g_@@_col_int} +% \end{macrocode} +% +% \cs{tab@multicol} is inserted at the beginning of a each row, and by +% \cs{multicolumn} after its \cs{omit}. We use it to ensure that the row is +% initialized correctly however it starts (normally or with a +% \cs{multicolumn}). +% +% \cs{tab@tabtext} is inserted at the end of every cell but the last one, so +% we should ensure that its effect is applied at the end of the row; +% \cs{@@_maybe_endrow} will take care of that. +% +% \begin{macrocode} + \tl_put_left:Nn \tab@multicol {\@@_maybe_startrow:} + \tl_put_left:Nn \tab@tabtext {\@@_every_cell_end:} \tab@readpreamble{#1} \exp_args:Nx \tab@preamble - { \exp_not:N\@@_startrow: \the\tab@preamble \exp_not:N\@@_endrow: } + { \the\tab@preamble \exp_not:N\@@_maybe_endrow: } } % \end{macrocode} % @@ -976,24 +1202,8 @@ \@@_end_array:n { \@@_orig_endLT: } } -\cs_new_protected_nopar:Nn \@@_startrow: { - \bool_if:NF \g_@@_inrow_bool { - \bool_gset_true:N \g_@@_inrow_bool - \int_gincr:N \g_@@_row_int - \int_gset_eq:NN \g_@@_col_int \c_one_int - \dim_gzero:N \g_@@_ht_dim - \dim_gzero:N \g_@@_dp_dim - } -} - -\cs_new_protected_nopar:Nn \@@_endrow: { - \bool_if:NT \g_@@_inrow_bool { - \bool_gset_false:N \g_@@_inrow_bool - } -} - \cs_new_protected_nopar:Nn \@@_cr:n { - \@@_endrow: + \@@_maybe_endrow: \tl_if_empty:NF \g_@@_borders_tl { \cr \noalign{\nobreak} @@ -1016,10 +1226,12 @@ \cs_set_eq:NN \@@_orig_multicolumn:w \multicolumn \cs_set:Npn \multicolumn#1#2#3 { - \@@_orig_multicolumn:w {#1}{#2}{ - #3 - \int_gadd:Nn \g_@@_col_int {#1} + \@@_orig_multicolumn:w {#1}{#2}{#3} + \int_gadd:Nn \g_@@_col_int {#1} + \tl_gput_right:Nx \g_@@_borders_tl { + \prg_replicate:nn {#1 - 1} {\span\omit} } + \ignorespaces } } @@ -1110,20 +1322,6 @@ \colpop -% \end{macrocode} -% -% Handle various \verb|:nth-child()| forms. -% -% \begin{macrocode} -\cs_new_protected_nopar:Nn \@@_seq_nthchild:Nn { - \seq_clear:N #1 - \seq_map_inline:Nn \l_@@_used_nth_factors_seq { - \seq_put_right:Nx #1 { - ##1 n + \int_eval:n{\int_mod:nn{#2}{##1}} - } - } - \seq_put_right:Nx #1 { \int_eval:n{#2} } -} \cs_new_protected_nopar:Nn \@@_begincell:n { \@@_begin_raw_cell:n { @@ -1162,25 +1360,13 @@ \global\@minipagefalse \everypar{} } - \@@_seq_nthchild:Nn \l_tmpa_seq { \g_@@_row_int } - \@@_seq_nthchild:Nn \l_tmpb_seq { \g_@@_col_int } \@@_recall_properties:n {td~p} - \seq_map_inline:Nn \l_tmpa_seq { - \@@_recall_properties:n {tr:nth-child(##1)~p} - } - \seq_map_inline:Nn \l_tmpb_seq { - \@@_recall_properties:n {td:nth-child(##1)~p} - } \@@_recall_properties:n {tr~td~p} - \seq_map_inline:Nn \l_tmpa_seq { - \@@_recall_properties:n {tr:nth-child(##1)~td~p} - } - \seq_map_inline:Nn \l_tmpa_seq { - \seq_map_inline:Nn \l_tmpb_seq { - \@@_recall_properties:n {tr:nth-child(##1)~ - td:nth-child(####1)~p} - } - } + \@@_recall_properties:n {tr:nth-child~p} + \@@_recall_properties:n {td:nth-child~p} + \@@_recall_properties:n {tr:nth-child~td~p} + \@@_recall_properties:n {tr~td:nth-child~p} + \@@_recall_properties:n {tr:nth-child~td:nth-child~p} } } \cs_new_protected_nopar:Nn \@@_end_par_cell:n { @@ -1195,26 +1381,14 @@ \cs_new_protected_nopar:Nn \@@_begin_raw_cell:n { \group_begin: - \@@_seq_nthchild:Nn \l_tmpa_seq { \g_@@_row_int } - \@@_seq_nthchild:Nn \l_tmpb_seq { \g_@@_col_int } - \seq_map_inline:Nn \l_tmpa_seq { - \@@_recall_properties:n {tr:nth-child(##1)} - } + \@@_recall_properties:n {tr:nth-child} \@@_update_colors: \@@_recall_properties:n {td} \@@_recall_properties:n {tr~td} - \seq_map_inline:Nn \l_tmpb_seq { - \@@_recall_properties:n {td:nth-child(##1)} - } - \seq_map_inline:Nn \l_tmpa_seq { - \@@_recall_properties:n {tr:nth-child(##1)~td} - } - \seq_map_inline:Nn \l_tmpa_seq { - \seq_map_inline:Nn \l_tmpb_seq { - \@@_recall_properties:n {tr:nth-child(##1)~ - td:nth-child(####1)} - } - } + \@@_recall_properties:n {td:nth-child} + \@@_recall_properties:n {tr:nth-child~td} + \@@_recall_properties:n {tr~td:nth-child} + \@@_recall_properties:n {tr:nth-child~td:nth-child} \@@_update_colors: % Additional init code #1 diff --git a/macros/latex/contrib/cellprops/cellprops.ins b/macros/latex/contrib/cellprops/cellprops.ins index 195394a7e7..3619d87296 100644 --- a/macros/latex/contrib/cellprops/cellprops.ins +++ b/macros/latex/contrib/cellprops/cellprops.ins @@ -1,6 +1,6 @@ \iffalse meta-comment -File cellprops.ins (C) Copyright 2016-2019 RIVAUD Julien +File cellprops.ins (C) Copyright 2016-2020 RIVAUD Julien It may be distributed and/or modified under the conditions of the General Public License (GPL), either version 3 of this diff --git a/macros/latex/contrib/cellprops/cellprops.pdf b/macros/latex/contrib/cellprops/cellprops.pdf Binary files differindex 18aba7b5e7..f315384a17 100644 --- a/macros/latex/contrib/cellprops/cellprops.pdf +++ b/macros/latex/contrib/cellprops/cellprops.pdf diff --git a/macros/latex/contrib/nicematrix/README.md b/macros/latex/contrib/nicematrix/README.md index f3183a5cfc..d55ad61352 100644 --- a/macros/latex/contrib/nicematrix/README.md +++ b/macros/latex/contrib/nicematrix/README.md @@ -10,9 +10,7 @@ The LaTeX extension `nicematrix` is distributed under the LPPL 1.3 license. ## Presentation The LaTeX package `nicematrix` provides new environments similar to the classical environments -`{array}` and `{matrix}` but with some additional features. Among these features are the -possibilities to fix the width of the columns, to draw continuous ellipsis dots between the cells -of the array and to add exterior rows and columns (so called *border matrices*). +`{tabular}`, `{array}` and `{matrix}` but with some additional features. The extension `nicematrix` creates PGF/Tikz nodes corresponding to the cells of the array and uses them to provide new functionalities. ## Installation diff --git a/macros/latex/contrib/nicematrix/nicematrix-french.pdf b/macros/latex/contrib/nicematrix/nicematrix-french.pdf Binary files differindex 6acb7b9f28..c5d481ad72 100644 --- a/macros/latex/contrib/nicematrix/nicematrix-french.pdf +++ b/macros/latex/contrib/nicematrix/nicematrix-french.pdf diff --git a/macros/latex/contrib/nicematrix/nicematrix.dtx b/macros/latex/contrib/nicematrix/nicematrix.dtx index 7e22066769..e957be5dc9 100644 --- a/macros/latex/contrib/nicematrix/nicematrix.dtx +++ b/macros/latex/contrib/nicematrix/nicematrix.dtx @@ -15,8 +15,8 @@ % % \fi % \iffalse -\def\myfileversion{4.1} -\def\myfiledate{2020/05/27} +\def\myfileversion{4.2} +\def\myfiledate{2020/06/07} % % %<*batchfile> @@ -825,7 +825,7 @@ version 2005/12/01 or later. % h & i & j \\ \hline % \end{NiceTabular} % \end{BVerbatim} -% \begin{NiceTabular}{|C|C|C|}[hvlines, code-before = +% \begin{NiceTabular}{|C|C|C|}[code-before = % \cellcolor{red!15}{3-1,2-2,1-3}] % \hline % a & b & c \\ \hline @@ -851,7 +851,7 @@ version 2005/12/01 or later. % h & i & j \\ \hline % \end{NiceTabular} % \end{BVerbatim} -% \begin{NiceTabular}{|C|C|C|}[hvlines, code-before = +% \begin{NiceTabular}{|C|C|C|}[code-before = % \rectanglecolor{blue!15}{2-2}{3-3}] % \hline % a & b & c \\ \hline @@ -2346,7 +2346,7 @@ version 2005/12/01 or later. % % \bigskip % \begin{minipage}[c]{7.6cm} -% Here is a array composed with the following code: +% Here is an array composed with the following code: % % \medskip % \begin{BVerbatim} @@ -3424,23 +3424,6 @@ version 2005/12/01 or later. % \end{macrocode} % % -% \medskip -% The version of 2020/02/08 of \pkg{expl3} has replaced |\l_keys_key_tl| by -% |\l_keys_key_str|. We have immediately changed in this file. Now, you test the -% existence of |\l_keys_key_str| in order to detect whether the version of LaTeX -% used by the final user is up to date. -% \begin{macrocode} -\msg_new:nnn { nicematrix } { expl3~too~old } - { - Your~version~of~LaTeX~(especially~expl3)~is~too~old.~ - You~can~go~on~but~you~will~probably~have~other~errors~ - if~you~use~the~functionalities~of~nicematrix. - } -\cs_if_exist:NF \l_keys_key_str - { \msg_error:nn { nicematrix } { expl3~too~old } } -% \end{macrocode} -% -% % \bigskip % The command for the treatment of the options of |\usepackage| is at the end of % this package for technical reasons. @@ -3571,8 +3554,7 @@ version 2005/12/01 or later. % \begin{macrocode} \cs_set_protected:Npn \pgfutil@check@rerun ##1 ##2 { - \str_set:Nx \l_tmpa_str { \tl_range:nnn { ##1 } 1 3 } - \str_if_eq:VnF \l_tmpa_str { nm- } + \str_if_eq:eeF { nm- } { \tl_range:nnn { ##1 } 1 3 } { \@@_old_pgfutil@check@rerun { ##1 } { ##2 } } } } @@ -3646,9 +3628,9 @@ version 2005/12/01 or later. \cs_set:Npn \@@_cline % \end{macrocode} % We have to act in a fully expandable way since there may be |\noalign| (in the -% |\multispan|) to detect. That's why we use |\exp_arg:Ne| and not |\exp_arg:Nx|. +% |\multispan|) to detect. That's why we use |\@@_cline_i:en|. % \begin{macrocode} - { \exp_args:Ne \@@_cline_i:nn \l_@@_first_col_int } + { \@@_cline_i:en \l_@@_first_col_int } % \end{macrocode} % The command |\cline_i:nn| has two arguments. The first is the number of the % current column (it \emph{must} be used in that column). The second is a @@ -3670,11 +3652,10 @@ version 2005/12/01 or later. % several |\cline|). % \begin{macrocode} \peek_meaning_remove_ignore_spaces:NTF \cline - { & \exp_args:Ne \@@_cline_i:nn { \@@_succ:n { #3 } } } + { & \@@_cline_i:en { \@@_succ:n { #3 } } } { \everycr { } \cr } } - - +\cs_generate_variant:Nn \@@_cline_i:nn { e n } % \end{macrocode} % % \bigskip @@ -5561,6 +5542,12 @@ version 2005/12/01 or later. % \begin{macrocode} \NewDocumentEnvironment { NiceArrayWithDelims } { m m O { } m ! O { } } { +% \end{macrocode} +% The aim of the following |\bgroup| (the corresponding |\egroup| is, of course, +% at the end of the environment) is to be able to put an exposant to a matrix in +% a mathematical formula. +% \begin{macrocode} + \bgroup \tl_set:Nn \l_@@_left_delim_tl { #1 } \tl_set:Nn \l_@@_right_delim_tl { #2 } \bool_gset_false:N \g_@@_row_of_col_done_bool @@ -6111,7 +6098,7 @@ version 2005/12/01 or later. % \begin{macrocode} \bool_if:NTF \l_@@_max_delimiter_width_bool { \@@_put_box_in_flow_bis:nn { #1 } { #2 } } - \@@_put_box_in_flow: + \@@_put_box_in_flow: } % \end{macrocode} % @@ -6125,6 +6112,7 @@ version 2005/12/01 or later. \skip_horizontal:N \arraycolsep } \@@_after_array: + \egroup } % \end{macrocode} % This is the end of the environment |{NiceArrayWithDelims}|. @@ -6142,7 +6130,7 @@ version 2005/12/01 or later. \box_set_ht:Nn \l_tmpa_box { \box_ht:N \l_tmpa_box + \l_tmpa_dim } \box_set_dp:Nn \l_tmpa_box { \box_dp:N \l_tmpa_box + \l_tmpb_dim } \str_if_eq:VnTF \l_@@_baseline_str { c } - { \box_use_drop:N \l_tmpa_box } + { \box_use_drop:N \l_tmpa_box } \@@_put_box_in_flow_i: } % \end{macrocode} @@ -9002,7 +8990,7 @@ version 2005/12/01 or later. % \end{macrocode} % % The command |\CT@arc@| is a command of \pkg{colortbl} which sets the color of -% the rules in the array. The package \pkg{nicematrix} uses it even if +% the rules in the array. The package \pkg{nicematrix} uses it even when % \pkg{colortbl} is not loaded. % \begin{macrocode} \CT@arc@ @@ -9010,48 +8998,23 @@ version 2005/12/01 or later. \pgfrememberpicturepositiononpagetrue \pgf@relevantforpicturesizefalse \pgfsetlinewidth \arrayrulewidth -% \end{macrocode} -% First, we compute in |\l_tmpa_dim| the height of the rules we have to draw. -% \begin{macrocode} + \pgfsetrectcap \@@_qpoint:n { row - 1 } \dim_set_eq:NN \l_tmpa_dim \pgf@y - \@@_qpoint:n { row - \@@_succ:n \c@iRow } - \dim_sub:Nn \l_tmpa_dim \pgf@y -% \end{macrocode} -% We translate vertically to take into account the potential ``last row''. -% \begin{macrocode} - \dim_zero:N \l_tmpb_dim - \int_compare:nNnT \l_@@_last_row_int > { -1 } - { - \dim_set_eq:NN \l_tmpb_dim \g_@@_dp_last_row_dim - \dim_add:Nn \l_tmpb_dim \g_@@_ht_last_row_dim -% \end{macrocode} -% We adjust the value of |\l_tmpa_dim| by the width of the horizontal rule just -% before the ``last row''. -% \begin{macrocode} - \@@_qpoint:n { row - \@@_succ:n \c@iRow } - \dim_add:Nn \l_tmpa_dim \pgf@y - \@@_qpoint:n { row - \@@_succ:n \g_@@_row_total_int } - \dim_sub:Nn \l_tmpa_dim \pgf@y - \dim_sub:Nn \l_tmpa_dim \l_tmpb_dim - } - \dim_add:Nn \l_tmpa_dim \arrayrulewidth + \@@_qpoint:n { row - \@@_succ:n \c@iRow } + \dim_set_eq:NN \l_tmpb_dim \pgf@y % \end{macrocode} % -% % Now, we can draw the vertical rules with a loop. % \begin{macrocode} \int_step_inline:nnn { \bool_if:NTF \l_@@_NiceArray_bool 1 2 } { \bool_if:NTF \l_@@_NiceArray_bool { \@@_succ:n \c@jCol } \c@jCol } { - \pgfpathmoveto { \@@_qpoint:n { col - ##1 } } - \pgfpathlineto - { - \pgfpointadd - { \@@_qpoint:n { col - ##1 } } - { \pgfpoint \c_zero_dim { \l_tmpb_dim + \l_tmpa_dim } } - } + \@@_qpoint:n { col - ##1 } + \dim_set_eq:NN \l_tmpc_dim \pgf@x + \pgfpathmoveto { \pgfpoint \l_tmpc_dim \l_tmpa_dim } + \pgfpathlineto { \pgfpoint \l_tmpc_dim \l_tmpb_dim } } \pgfusepathqstroke \endpgfpicture @@ -9059,7 +9022,7 @@ version 2005/12/01 or later. } % \end{macrocode} % -%% +% % \subsection*{The key hvlines} % % @@ -9149,7 +9112,7 @@ version 2005/12/01 or later. } % \end{macrocode} % -% First, the horizontal rules in the interior of the array. +% Now, the horizontal rules in the interior of the array. % \begin{macrocode} \int_step_variable:nnNn 2 \c@iRow \l_tmpa_tl { @@ -9996,7 +9959,7 @@ version 2005/12/01 or later. % \begin{macrocode} \cs_new_protected:Npn \@@_draw_blocks: { \seq_map_inline:Nn \g_@@_blocks_seq { \@@_Block_iii:nnnnnn ##1 } } -% \end{macrocode} +% \end{macrocode} % % \begin{macrocode} \cs_new_protected:Npn \@@_Block_iii:nnnnnn #1 #2 #3 #4 #5 #6 @@ -10320,8 +10283,7 @@ version 2005/12/01 or later. % If this is really the end of the current environment (of \pkg{nicematrix}), we % put back the command |\end| and its argument in the TeX flow. % \begin{macrocode} - \str_set:NV \l_tmpa_str \@currenvir - \bool_if:NTF { \str_if_eq_p:Vn \l_tmpa_str { #1 } } + \str_if_eq:eeTF \@currenvir { #1 } { \end { #1 } } % \end{macrocode} % It this is not the |\end| we are looking for, we put those tokens in @@ -10520,7 +10482,7 @@ version 2005/12/01 or later. \@@_msg_new:nn { Unknown~option~for~xdots } { As~for~now~there~is~only~three~options~available~here:~'color',~'line-style'~ - and~'shorten'~(and~you~try~to~use~'\l_keys_key_str').~If~you~go~on,~ + and~'shorten'~(and~you~try~to~use~'\l_keys_key_tl').~If~you~go~on,~ this~option~will~be~ignored. } % \end{macrocode} @@ -10641,7 +10603,7 @@ version 2005/12/01 or later. % \begin{macrocode} \@@_msg_new:nn { Bad~value~for~letter~for~dotted~lines } { - The~value~of~key~'\tl_use:N\l_keys_key_str'~must~be~of~length~1.\\ + The~value~of~key~'\tl_use:N\l_keys_key_tl'~must~be~of~length~1.\\ If~you~go~on,~it~will~be~ignored. } % \end{macrocode} @@ -10650,7 +10612,7 @@ version 2005/12/01 or later. % \begin{macrocode} \@@_msg_new:nnn { Unknown~key~for~NiceMatrixOptions } { - The~key~'\tl_use:N\l_keys_key_str'~is~unknown~for~the~command~ + The~key~'\tl_use:N\l_keys_key_tl'~is~unknown~for~the~command~ \token_to_str:N \NiceMatrixOptions. \\ If~you~go~on,~it~will~be~ignored. \\ For~a~list~of~the~*principal*~available~keys,~type~H~<return>. @@ -10693,7 +10655,7 @@ version 2005/12/01 or later. % \begin{macrocode} \@@_msg_new:nnn { Unknown~option~for~NiceArray } { - The~option~'\tl_use:N\l_keys_key_str'~is~unknown~for~the~environment~ + The~option~'\tl_use:N\l_keys_key_tl'~is~unknown~for~the~environment~ \{NiceArray\}. \\ If~you~go~on,~it~will~be~ignored. \\ For~a~list~of~the~*principal*~available~options,~type~H~<return>. @@ -10746,7 +10708,7 @@ version 2005/12/01 or later. % \begin{macrocode} \@@_msg_new:nnn { Unknown~option~for~NiceMatrix } { - The~option~'\tl_use:N\l_keys_key_str'~is~unknown~for~the~ + The~option~'\tl_use:N\l_keys_key_tl'~is~unknown~for~the~ \@@_full_name_env:. \\ If~you~go~on,~it~will~be~ignored. \\ For~a~list~of~the~*principal*~available~options,~type~H~<return>. @@ -10798,7 +10760,7 @@ version 2005/12/01 or later. % \begin{macrocode} \@@_msg_new:nnn { Unknown~option~for~NiceTabular } { - The~option~'\tl_use:N\l_keys_key_str'~is~unknown~for~the~environment~ + The~option~'\tl_use:N\l_keys_key_tl'~is~unknown~for~the~environment~ \{NiceTabular\}. \\ If~you~go~on,~it~will~be~ignored. \\ For~a~list~of~the~*principal*~available~options,~type~H~<return>. @@ -11184,6 +11146,11 @@ version 2005/12/01 or later. % The key |hvline| don't draw rules in the blocks (commands |\Block|) and in the % virtual blocks corresponding to the dotted lines. % +% \subsection*{Changes between versions 4.1 and 4.2} +% +% It's now possible to write |\begin{pNiceMatrix}a&b\\c&d\end{pNiceMatrix}^2| +% with the expected result. +% % \PrintIndex % % \tableofcontents diff --git a/macros/latex/contrib/nicematrix/nicematrix.pdf b/macros/latex/contrib/nicematrix/nicematrix.pdf Binary files differindex 0004ec61cd..184e8e4a59 100644 --- a/macros/latex/contrib/nicematrix/nicematrix.pdf +++ b/macros/latex/contrib/nicematrix/nicematrix.pdf diff --git a/macros/luatex/latex/luamesh/README b/macros/luatex/latex/luamesh/README index be387c79e6..926aaf6afd 100644 --- a/macros/luatex/latex/luamesh/README +++ b/macros/luatex/latex/luamesh/README @@ -1,6 +1,6 @@ -*- coding: utf-8 -*- -luamesh package by Maxime Chupin -Version 0.51 dated 2017/04/15 +luamesh package by Maxime Chupin +Version 0.6 dated 2020/06/06 The LuaLaTeX package luamesh allows to compute and draw 2D Delaunay triangulation. The algorithm is written with lua, and depending on the choice of the “engine”, @@ -26,13 +26,14 @@ dum.bbl dum.tex fond.mp fond.pdf -lltxdoc.cls +luameshdoc.cls luamesh-doc.listing luamesh-doc.pdf luamesh-doc.tex luamesh-title.pdf maillage.geo maillage.msh +maillagev4.msh meshgarde.txt ===== Lua Script File ===== @@ -44,4 +45,4 @@ luamesh-tex.lua luamesh.sty ================== -The archive luamesh-v0-5.zip contains all the files to insert into your texmf. +The archive luamesh-v0-6.zip contains all the files to insert into your texmf. diff --git a/macros/luatex/latex/luamesh/doc/luamesh-doc.pdf b/macros/luatex/latex/luamesh/doc/luamesh-doc.pdf Binary files differindex 92a1162b9e..0d66dbf557 100644 --- a/macros/luatex/latex/luamesh/doc/luamesh-doc.pdf +++ b/macros/luatex/latex/luamesh/doc/luamesh-doc.pdf diff --git a/macros/luatex/latex/luamesh/doc/luamesh-doc.tex b/macros/luatex/latex/luamesh/doc/luamesh-doc.tex index e2e2bdfc43..07b6125f0f 100644 --- a/macros/luatex/latex/luamesh/doc/luamesh-doc.tex +++ b/macros/luatex/latex/luamesh/doc/luamesh-doc.tex @@ -1,13 +1,13 @@ % luamesh: compute and draw meshes with lua, luamplib and tikz % -% Originally written by Maxime Chupin <mc@melusine.eu.org>, -% 2010. +% Originally written by Maxime Chupin <notezik@gmail.com>, +% 2017. % % Distributed under the terms of the GNU free documentation licence: % http://www.gnu.org/licenses/fdl.html % without any invariant section or cover text. -\documentclass{lltxdoc} +\documentclass{luameshdoc} \usepackage{tcolorbox} \usepackage{enumitem} \usepackage[tikz]{bclogo} @@ -15,7 +15,7 @@ \usepackage{animate} \title{\Verb+luamesh+: compute and draw meshes with \lualatex} -\author{Maxime Chupin \email{mc@melusine.eu.org}} +\author{Maxime Chupin \email{notezik@gmail.com}} \date{\today} @@ -167,8 +167,8 @@ } \vfill \begin{center} - Version 0.5, 2017, February, 9th \\ - \url{http://melusine.eu.org/syracuse/G/delaunay/} + Version 0.6, 2020, June, 6th \\ + \url{https://plmlab.math.cnrs.fr/mchupin/luamesh} \end{center} %% == Page de garde ==================================================== \newpage @@ -196,8 +196,15 @@ I would also like to thank the first user, an intensive \tableofcontents + \section{Installation} +\luamesh is on the CTAN and can be installed with the package manager of +your distribution. + +\begin{center} + \url{https://www.ctan.org/pkg/luamesh} +\end{center} Of course, you can just put the two files \Verb+luamesh.lua+ and \Verb+luamesh.sty+ in the working directory but this is not @@ -590,7 +597,6 @@ mesh. The followed method is, given a parameter $h$: \item to mesh the complete set of points (using the Bowyer and Watson algorithm). \end{itemize} - One can use the macro as follows: \begin{Exemple} \meshPolygon[step=polygon,scale=2cm]{(0,0);(1,0);(1,0.5);(0,0.5);(-0.20,0.35);(-0.25,0.25);(-0.20,0.15)} @@ -655,7 +661,7 @@ Here is an example of customizing the drawing. tikz, color = blue!70, meshpoint = \alpha, - colorPolygon=red!120, + colorPolygon=red!100, scale=4cm, step=mesh, print=points, @@ -1006,8 +1012,16 @@ This macro draws the triangulation produced by Gmsh and exported in the \Verb+msh+ format. The argument is the name of the file to be read (e.g.: \Verb+maillage.msh+). +Since the version 0.6, \luamesh support both version 2 and 4 of the \emph{MSH ASCII file format}. + + \begin{Exemple} -\drawGmsh{maillage.msh} +\drawGmsh{maillage.msh} % version 2.2 of MSH ASCII file format +\end{Exemple} + + +\begin{Exemple} + \drawGmsh{maillagev4.msh} % version 4.1 of MSH ASCII file format \end{Exemple} There are several options to customize the drawing. @@ -1089,7 +1103,7 @@ There are several options to customize the drawing. \end{optionsenum} \begin{Exemple} - \gmshVoronoi[tikz,scale=1.5cm, delaunay=show,styleVoronoi=dashed]{maillage.msh} + \gmshVoronoi[tikz,scale=3cm, delaunay=show,styleVoronoi=dashed]{maillagev4.msh} \end{Exemple} @@ -1207,6 +1221,17 @@ using the \Verb+animate+ package. %\animategraphics[controls]{1}{animation-crop}{}{} %\end{Exemple} + +\section{History} + +\begin{itemize} +\item June, 6th, 2020, v 0.6, correction of bug produced by the + deleted \Verb+\mplibcolor+ function of \Verb+luamplib+ package. +\item June, 6th, 2020, v 0.6, add support of version 4 of the + \emph{MSH ASCII file format}. +\end{itemize} + + \input{dum.bbl} \end{document} diff --git a/macros/luatex/latex/luamesh/doc/lltxdoc.cls b/macros/luatex/latex/luamesh/doc/luameshdoc.cls index d0b4d47fde..c8d507d329 100644 --- a/macros/luatex/latex/luamesh/doc/lltxdoc.cls +++ b/macros/luatex/latex/luamesh/doc/luameshdoc.cls @@ -1,8 +1,8 @@ -% private class for lualatex-doc +% copy of the private class for lualatex-doc, lltxdoc.sty. 2017 version. % see lualatex-doc.tex for copying conditions % Manuel Pégourié-Gonnard -\ProvidesClass{lltxdoc} +\ProvidesClass{luameshdoc} \LoadClass[a4paper]{scrartcl} \RequirePackage{luamesh} @@ -102,4 +102,4 @@ \small }{% \endlist -}
\ No newline at end of file +} diff --git a/macros/luatex/latex/luamesh/doc/maillagev4.msh b/macros/luatex/latex/luamesh/doc/maillagev4.msh new file mode 100644 index 0000000000..5f414cae37 --- /dev/null +++ b/macros/luatex/latex/luamesh/doc/maillagev4.msh @@ -0,0 +1,453 @@ +$MeshFormat +4.1 0 8 +$EndMeshFormat +$Entities +9 8 1 0 +1 0 0 0 0 +2 2 0 0 0 +3 2 1 0 0 +4 0 1 0 0 +5 1 0.5 0 0 +6 1.5 0.5 0 0 +7 1 0.75 0 0 +8 0.5 0.5 0 0 +9 1 0.25 0 0 +1 0 0 0 2 0 0 0 2 1 -2 +2 2 0 0 2 1 0 0 2 2 -3 +3 0 1 0 2 1 0 0 2 3 -4 +4 0 0 0 0 1 0 0 2 4 -1 +5 1 0.5 0 1.5 0.75 0 0 2 6 -7 +6 0.5 0.5 0 1 0.75 0 0 2 7 -8 +7 0.5 0.25 0 1 0.5 0 0 2 8 -9 +8 1 0.25 0 1.5 0.5 0 0 2 9 -6 +1 0 0 0 2 1 0 0 8 1 2 3 4 -8 -7 -6 -5 +$EndEntities +$Nodes +18 95 1 95 +0 1 0 1 +1 +0 0 0 +0 2 0 1 +2 +2 0 0 +0 3 0 1 +3 +2 1 0 +0 4 0 1 +4 +0 1 0 +0 5 0 1 +5 +1 0.5 0 +0 6 0 1 +6 +1.5 0.5 0 +0 7 0 1 +7 +1 0.75 0 +0 8 0 1 +8 +0.5 0.5 0 +0 9 0 1 +9 +1 0.25 0 +1 1 0 9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +0.1999999999996293 0 0 +0.3999999999991157 0 0 +0.5999999999985328 0 0 +0.7999999999979498 0 0 +0.9999999999973885 0 0 +1.199999999997894 0 0 +1.39999999999842 0 0 +1.599999999998947 0 0 +1.799999999999474 0 0 +1 2 0 4 +19 +20 +21 +22 +2 0.1999999999995579 0 +2 0.3999999999989749 0 +2 0.5999999999989468 0 +2 0.7999999999994734 0 +1 3 0 9 +23 +24 +25 +26 +27 +28 +29 +30 +31 +1.799999999999167 1 0 +1.6 1 0 +1.400000000001387 1 0 +1.200000000002774 1 0 +1.000000000004117 1 0 +0.8000000000033287 1 0 +0.6000000000024965 1 0 +0.4000000000016644 1 0 +0.200000000000832 1 0 +1 4 0 4 +32 +33 +34 +35 +0 0.7999999999999998 0 +0 0.6000000000013869 0 +0 0.4000000000016644 0 +0 0.2000000000008322 0 +1 5 0 3 +36 +37 +38 +1.429166487020014 0.6282732692525027 0 +1.297235955115133 0.7010290942791583 0 +1.150779560124165 0.7383618699838352 0 +1 6 0 3 +39 +40 +41 +0.8492204391961987 0.7383618698763567 0 +0.7027640436394702 0.701029093818806 0 +0.5708335122175866 0.6282732686148088 0 +1 7 0 3 +42 +43 +44 +0.5708335129870858 0.3717267307415588 0 +0.702764044912523 0.298970905710619 0 +0.8492204398974336 0.261638130012749 0 +1 8 0 3 +45 +46 +47 +1.150779560764304 0.2616381301173972 0 +1.297235956377622 0.2989709061875121 0 +1.429166487836711 0.3717267314306073 0 +2 1 0 48 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +87 +88 +89 +90 +91 +92 +93 +94 +95 +1.575754773693516 0.3727680526541947 0 +0.4242452263117927 0.6272319474069891 0 +1.575754773386917 0.6272319482587808 0 +0.4242452266006865 0.3727680517327859 0 +1.82006075891254 0.5000000002497784 0 +0.1799392410800134 0.4999999997649647 0 +1.506554911128919 0.2581927120523169 0 +1.664526598907325 0.2419484780735156 0 +0.4934450889280959 0.741807287986066 0 +0.335473401080529 0.7580515220625742 0 +1.506554910223461 0.7418072885976703 0 +1.664526598882498 0.7580515234014276 0 +0.4934450897845141 0.2581927113866551 0 +0.3354734011037487 0.2419484765476321 0 +1.840742812866083 0.6870274567184909 0 +0.1592571871277452 0.3129725432767637 0 +0.1592571870957545 0.6870274562353395 0 +1.840742812899947 0.3129725437997585 0 +0.7476263426605293 0.8528501324398146 0 +1.252373657339898 0.1471498675516256 0 +1.252373656782735 0.8528501325612595 0 +0.7476263432310521 0.1471498674360577 0 +0.3500620806703637 0.4999999996661191 0 +1.649937919326001 0.5000000003544357 0 +0.9137187557487293 0.8693222882414073 0 +1.086281244247427 0.1306777117579327 0 +0.9138546712285419 0.1315776182011232 0 +1.086145328777087 0.8684223817977503 0 +1.845840914421956 0.154159085577822 0 +0.1541590855654224 0.8458409144347685 0 +1.845840914596291 0.8458409145963616 0 +0.1541590854015815 0.1541590854018572 0 +1.714028605157862 0.3817276988989023 0 +0.2859713948485624 0.6182723011483432 0 +1.714028604805168 0.6182723020649582 0 +0.2859713951811274 0.3817276979436318 0 +1.387846812549787 0.1971375120799924 0 +0.6121531874993122 0.8028624879094739 0 +1.387846811532008 0.8028624882376136 0 +0.6121531884857123 0.1971375117529554 0 +1.525843663542067 0.1259771457351219 0 +0.4741563365246392 0.8740228542887083 0 +1.525843662648386 0.8740228546085549 0 +0.4741563373640486 0.1259771453787467 0 +1.69999999999921 0.1029091578165097 0 +0.3000000000012482 0.8970908422636076 0 +1.699999999999584 0.8970908430271125 0 +0.2999999999993725 0.1029091569416843 0 +$EndNodes +$Elements +18 197 1 197 +0 1 15 1 +1 1 +0 2 15 1 +2 2 +0 3 15 1 +3 3 +0 4 15 1 +4 4 +0 5 15 1 +5 5 +0 6 15 1 +6 6 +0 7 15 1 +7 7 +0 8 15 1 +8 8 +0 9 15 1 +9 9 +1 1 1 10 +10 1 10 +11 10 11 +12 11 12 +13 12 13 +14 13 14 +15 14 15 +16 15 16 +17 16 17 +18 17 18 +19 18 2 +1 2 1 5 +20 2 19 +21 19 20 +22 20 21 +23 21 22 +24 22 3 +1 3 1 10 +25 3 23 +26 23 24 +27 24 25 +28 25 26 +29 26 27 +30 27 28 +31 28 29 +32 29 30 +33 30 31 +34 31 4 +1 4 1 5 +35 4 32 +36 32 33 +37 33 34 +38 34 35 +39 35 1 +1 5 1 4 +40 6 36 +41 36 37 +42 37 38 +43 38 7 +1 6 1 4 +44 7 39 +45 39 40 +46 40 41 +47 41 8 +1 7 1 4 +48 8 42 +49 42 43 +50 43 44 +51 44 9 +1 8 1 4 +52 9 45 +53 45 46 +54 46 47 +55 47 6 +2 1 2 142 +56 60 61 91 +57 58 59 90 +58 57 56 89 +59 55 54 88 +60 91 61 95 +61 90 59 94 +62 57 89 93 +63 55 88 92 +64 25 68 86 +65 12 69 87 +66 66 29 85 +67 67 16 84 +68 20 21 52 +69 33 34 53 +70 47 46 84 +71 41 40 85 +72 37 36 86 +73 43 42 87 +74 25 26 68 +75 12 13 69 +76 28 29 66 +77 15 16 67 +78 52 21 62 +79 53 34 63 +80 20 52 65 +81 33 53 64 +82 21 22 62 +83 34 35 63 +84 19 20 65 +85 32 33 64 +86 65 55 76 +87 64 57 77 +88 59 62 78 +89 61 63 79 +90 2 19 76 +91 18 2 76 +92 4 32 77 +93 31 4 77 +94 3 23 78 +95 22 3 78 +96 1 10 79 +97 35 1 79 +98 54 47 84 +99 56 41 85 +100 42 60 87 +101 36 58 86 +102 11 91 95 +103 24 90 94 +104 89 30 93 +105 88 17 92 +106 36 6 50 +107 42 8 51 +108 8 41 49 +109 6 47 48 +110 71 52 82 +111 70 53 83 +112 52 71 80 +113 53 70 81 +114 66 39 72 +115 67 45 73 +116 38 68 75 +117 44 69 74 +118 49 41 56 +119 42 51 60 +120 48 47 54 +121 36 50 58 +122 46 45 67 +123 40 39 66 +124 38 37 68 +125 44 43 69 +126 39 7 72 +127 45 9 73 +128 7 38 75 +129 9 44 74 +130 60 51 61 +131 58 50 59 +132 49 56 57 +133 48 54 55 +134 72 7 75 +135 73 9 74 +136 76 55 92 +137 77 57 93 +138 59 78 94 +139 61 79 95 +140 85 29 89 +141 84 16 88 +142 25 86 90 +143 12 87 91 +144 13 14 74 +145 26 27 75 +146 27 28 72 +147 14 15 73 +148 28 66 72 +149 15 67 73 +150 68 26 75 +151 69 13 74 +152 19 65 76 +153 32 64 77 +154 62 22 78 +155 63 35 79 +156 52 62 82 +157 53 63 83 +158 65 52 80 +159 64 53 81 +160 51 8 70 +161 50 6 71 +162 8 49 70 +163 6 48 71 +164 55 65 80 +165 62 59 82 +166 57 64 81 +167 63 61 83 +168 11 12 91 +169 24 25 90 +170 29 30 89 +171 16 17 88 +172 61 51 83 +173 59 50 82 +174 49 57 81 +175 48 55 80 +176 17 18 92 +177 30 31 93 +178 23 24 94 +179 10 11 95 +180 27 72 75 +181 14 73 74 +182 71 48 80 +183 70 49 81 +184 50 71 82 +185 51 70 83 +186 46 67 84 +187 40 66 85 +188 68 37 86 +189 69 43 87 +190 18 76 92 +191 31 77 93 +192 78 23 94 +193 79 10 95 +194 54 84 88 +195 56 85 89 +196 86 58 90 +197 87 60 91 +$EndElements diff --git a/macros/luatex/latex/luamesh/scripts/luamesh-polygon.lua b/macros/luatex/latex/luamesh/scripts/luamesh-polygon.lua index fd8a228aa3..37dc7c0487 100644 --- a/macros/luatex/latex/luamesh/scripts/luamesh-polygon.lua +++ b/macros/luatex/latex/luamesh/scripts/luamesh-polygon.lua @@ -1,3 +1,9 @@ +----------------------------------------------------------------------- +-- FILE: luamesh-polygon.lua +-- DESCRIPTION: functions of luamesh package to mesh a polygon +-- AUTHOR: Maxime Chupin +----------------------------------------------------------------------- + -- Given three colinear points p, q, r, the function checks if -- point q lies on line segment 'pr' function onSegment(p,q,r) diff --git a/macros/luatex/latex/luamesh/scripts/luamesh-tex.lua b/macros/luatex/latex/luamesh/scripts/luamesh-tex.lua index 11e31a4c77..34755092ed 100644 --- a/macros/luatex/latex/luamesh/scripts/luamesh-tex.lua +++ b/macros/luatex/latex/luamesh/scripts/luamesh-tex.lua @@ -1,3 +1,8 @@ +----------------------------------------------------------------------- +-- FILE: luamesh-tex.lua +-- DESCRIPTION: functions of luamesh package to produce LaTeX code +-- AUTHOR: Maxime Chupin +----------------------------------------------------------------------- -- trace Voronoi with MP function traceVoronoiMP(listPoints, triangulation,listVoronoi, points, tri,styleD,styleV) if(styleD == "dashed") then diff --git a/macros/luatex/latex/luamesh/scripts/luamesh.lua b/macros/luatex/latex/luamesh/scripts/luamesh.lua index a1023aace9..e03703c6d7 100644 --- a/macros/luatex/latex/luamesh/scripts/luamesh.lua +++ b/macros/luatex/latex/luamesh/scripts/luamesh.lua @@ -1,3 +1,9 @@ +----------------------------------------------------------------------- +-- FILE: luamesh.lua +-- DESCRIPTION: core functions of luamesh package +-- REQUIREMENTS: local scripts (luamesh-polygon and luamesh-tex) +-- AUTHOR: Maxime Chupin +----------------------------------------------------------------------- require "luamesh-polygon" require "luamesh-tex" @@ -509,36 +515,88 @@ function readGmsh(file) Jnodes = 0 boolElements = false Jelements = 0 + J=0 - for i=1,#lines-J do - if(lines[i+J] == "$EndNodes") then - boolNodes = false - -- go to the next line - end - if(boolNodes) then -- we are in the Nodes environment - xy=split(lines[i+J]," +") - table.insert(listPoints,{x=tonumber(xy[2]),y=tonumber(xy[3])}) - end - if(lines[i+J] == "$Nodes") then - boolNodes = true - -- go to the next line - J=J+1 - end - if(lines[i+J] == "$EndElements") then - boolElements = false - -- go to the next line - end - if(boolElements) then -- we are in the Nodes environment - xy=split(lines[i+J]," +") - if(tonumber(xy[2]) == 2) then -- if the element is a triangle - nbrTags = xy[3]+1 - table.insert(triangulation,{tonumber(xy[2+nbrTags+1]),tonumber(xy[2+nbrTags+2]),tonumber(xy[2+nbrTags+3])}) + format=split(lines[2]," +") + if((tonumber(format[1])>=2.0) and (tonumber(format[1])<3.0)) then -- Format 2 + for i=4,#lines-J do + if(lines[i+J] == "$EndNodes") then + boolNodes = false + -- go to the next line + end + if(boolNodes) then -- we are in the Nodes environment + xy=split(lines[i+J]," +") + table.insert(listPoints,{x=tonumber(xy[2]),y=tonumber(xy[3])}) + end + if(lines[i+J] == "$Nodes") then + boolNodes = true + -- go to the next line + J=J+1 + end + if(lines[i+J] == "$EndElements") then + boolElements = false + -- go to the next line + end + if(boolElements) then -- we are in the Elements environment + xy=split(lines[i+J]," +") + if(tonumber(xy[2]) == 2) then -- if the element is a triangle + nbrTags = xy[3]+1 + table.insert(triangulation,{tonumber(xy[2+nbrTags+1]),tonumber(xy[2+nbrTags+2]),tonumber(xy[2+nbrTags+3])}) + end + end + if(lines[i+J] == "$Elements") then + boolElements = true + -- go to the next line + J=J+1 end end - if(lines[i+J] == "$Elements") then - boolElements = true - -- go to the next line - J=J+1 + end + + + if(tonumber(format[1]) >= 4.0) then -- format 4 + for i=4,#lines-J do + if(lines[i+J] == "$EndNodes") then + boolNodes = false + -- go to the next line + end + if(boolNodes) then -- we are in the Nodes environment + xy=split(lines[i+J]," +") -- bloc 4 number + nbrBloc = tonumber(xy[4]) + for k=1,nbrBloc do + xyz=split(lines[i+J+nbrBloc+k]," +") -- x y z + table.insert(listPoints,{x=tonumber(xyz[1]),y=tonumber(xyz[2])}) + end + J =J+ 2*tonumber(xy[4]) + end + if(lines[i+J] == "$Nodes") then + boolNodes = true + -- go to the next line + J=J+1 + end + if(lines[i+J] == "$EndElements") then + boolElements = false + -- go to the next line + end + if(boolElements) then -- we are in the Elements environment + xy=split(lines[i+J]," +") + if(tonumber(xy[1]) < 2) then -- if the elements block is not a triangle + J = J+tonumber(xy[4]) -- we jump to the new block + end + if(tonumber(xy[1]) == 2) then -- if the elements block is a triangle + nbrElements = tonumber(xy[4]) + for k=1,nbrElements do + xyz=split(lines[i+J+k]," +") -- line tag node1 node2 node3 + table.insert(triangulation,{tonumber(xyz[2]),tonumber(xyz[3]),tonumber(xyz[4])}) + end + J = J+nbrElements + end + end + if(lines[i+J] == "$Elements") then + boolElements = true + -- go to the next line + J=J+1 + end + end end return listPoints, triangulation diff --git a/macros/luatex/latex/luamesh/tex/luamesh.sty b/macros/luatex/latex/luamesh/tex/luamesh.sty index 86f66edf1f..d2024a1da8 100644 --- a/macros/luatex/latex/luamesh/tex/luamesh.sty +++ b/macros/luatex/latex/luamesh/tex/luamesh.sty @@ -1,7 +1,7 @@ \NeedsTeXFormat{LaTeX2e}% \def\PackageName{luamesh}% -\def\fileversion{v0.51}% -\def\filedate{2017/04/15}% +\def\fileversion{v0.6}% +\def\filedate{2020/06/06}% \ProvidesPackage{luamesh}[\filedate\space\fileversion]% % % package to load @@ -89,8 +89,8 @@ buildMeshTikZBWinc("#2","\luaescapestring{\unexpanded{#3}}","\luaescapestring{\unexpanded{#4}}","\luameshval@bmi@mode","\luameshval@bmi@print","\luameshval@bmi@bbox","\luameshval@bmi@scale","\luameshval@bmi@color","\luameshval@bmi@colorbbox")% }% \else % we are using MP - \mplibcolor{\luameshmpcolor}{\luameshval@bmi@color}% - \mplibcolor{\luameshmpcolorBbox}{\luameshval@bmi@colorbbox}% + \def\luameshmpcolor{\mpcolor{\luameshval@bmi@color}}% + \def\luameshmpcolorBbox{\mpcolor{\luameshval@bmi@colorbbox}}% \directlua{% buildMeshMPBWinc("#2","\luaescapestring{\unexpanded{#3}}","\luaescapestring{\unexpanded{#4}}","\luameshval@bmi@mode","\luameshval@bmi@print","\luameshval@bmi@bbox","\luameshval@bmi@scale")% }% @@ -149,8 +149,8 @@ buildMeshTikZBW("#2","\luameshval@bm@mode","\luameshval@bm@print","\luameshval@bm@bbox","\luameshval@bm@scale","\luameshval@bm@color","\luameshval@bm@colorbbox")% }% \else % we are using MP - \mplibcolor{\luameshmpcolor}{\luameshval@bm@color}% - \mplibcolor{\luameshmpcolorBbox}{\luameshval@bm@colorbbox}% + \def\luameshmpcolor{\mpcolor{\luameshval@bm@color}}% + \def\luameshmpcolorBbox{\mpcolor{\luameshval@bm@colorbbox}}% \directlua{% buildMeshMPBW("#2","\luameshval@bm@mode","\luameshval@bm@print","\luameshval@bm@bbox","\luameshval@bm@scale")% }% @@ -238,9 +238,9 @@ buildVoronoiTikZBWinc("#2","\luaescapestring{\unexpanded{#3}}","\luaescapestring{\unexpanded{#4}}","\luameshval@bvi@mode","\luameshval@bvi@print","\luameshval@bvi@bbox","\luameshval@bvi@scale","\luameshval@bvi@delaunay","\luameshval@bvi@color","\luameshval@bvi@colorbbox","\luameshval@bvi@colorvoronoi","\luameshval@bvi@styleDelaunay","\luameshval@bvi@styleVoronoi")% }% \else % we are using MP - \mplibcolor{\luameshmpcolor}{\luameshval@bvi@color}% - \mplibcolor{\luameshmpcolorBbox}{\luameshval@bvi@colorbbox}% - \mplibcolor{\luameshmpcolorVoronoi}{\luameshval@bvi@colorvoronoi}% + \def\luameshmpcolor{\mpcolor{\luameshval@bvi@color}}% + \def\luameshmpcolorBbox{\mpcolor{\luameshval@bvi@colorbbox}}% + \def\luameshmpcolorVoronoi{\mpcolor{\luameshval@bvi@colorvoronoi}}% \directlua{% buildVoronoiMPBWinc("#2","\luaescapestring{\unexpanded{#3}}","\luaescapestring{\unexpanded{#4}}","\luameshval@bvi@mode","\luameshval@bvi@print","\luameshval@bvi@bbox","\luameshval@bvi@scale","\luameshval@bvi@delaunay","\luameshval@bvi@styleDelaunay","\luameshval@bvi@styleVoronoi")% }% @@ -327,9 +327,9 @@ buildVoronoiTikZBW("#2","\luameshval@bv@mode","\luameshval@bv@print","\luameshval@bv@bbox","\luameshval@bv@scale","\luameshval@bv@delaunay","\luameshval@bv@color","\luameshval@bv@colorbbox","\luameshval@bv@colorVoronoi","\luameshval@bv@styleDelaunay","\luameshval@bv@styleVoronoi")% }% \else % we are using MP - \mplibcolor{\luameshmpcolor}{\luameshval@bv@color}% - \mplibcolor{\luameshmpcolorBbox}{\luameshval@bv@colorbbox}% - \mplibcolor{\luameshmpcolorVoronoi}{\luameshval@bv@colorVoronoi}% + \def\luameshmpcolor{\mpcolor{\luameshval@bv@color}}% + \def\luameshmpcolorBbox{\mpcolor{\luameshval@bv@colorbbox}}% + \def\luameshmpcolorVoronoi{\mpcolor{\luameshval@bv@colorVoronoi}}% \directlua{% buildVoronoiMPBW("#2","\luameshval@bv@mode","\luameshval@bv@print","\luameshval@bv@bbox","\luameshval@bv@scale","\luameshval@bv@delaunay","\luameshval@bv@styleDelaunay","\luameshval@bv@styleVoronoi")% }% @@ -388,8 +388,8 @@ printPointsTikZ("#2","\luameshval@tp@mode","\luameshval@tp@print","\luameshval@tp@bbox","\luameshval@tp@scale","\luameshval@tp@color","\luameshval@tp@colorbbox")% }% \else % we are using MP - \mplibcolor{\luameshmpcolor}{\luameshval@tp@color}% - \mplibcolor{\luameshmpcolorBbox}{\luameshval@tp@colorbbox}% + \def\luameshmpcolor{\mpcolor{\luameshval@tp@color}}% + \def\luameshmpcolorBbox{\mpcolor{\luameshval@tp@colorbbox}}% \directlua{% printPointsMP("#2","\luameshval@tp@mode","\luameshval@tp@print","\luameshval@tp@bbox","\luameshval@tp@scale")% }% @@ -452,8 +452,8 @@ printPointsTikZinc("#2","\luaescapestring{\unexpanded{#3}}","\luaescapestring{\unexpanded{#4}}","\luameshval@tpi@mode","\luameshval@tpi@print","\luameshval@tpi@bbox","\luameshval@tpi@scale","\luameshval@tpi@color","\luameshval@tpi@colorbbox")% }% \else % we are using MP - \mplibcolor{\luameshmpcolor}{\luameshval@tpi@color}% - \mplibcolor{\luameshmpcolorBbox}{\luameshval@tpi@colorbbox}% + \def\luameshmpcolor{\mpcolor{\luameshval@tpi@color}}% + \def\luameshmpcolorBbox{\mpcolor{\luameshval@tpi@colorbbox}}% \directlua{% printPointsMPinc("#2","\luaescapestring{\unexpanded{#3}}","\luaescapestring{\unexpanded{#4}}","\luameshval@tpi@mode","\luameshval@tpi@print","\luameshval@tpi@bbox","\luameshval@tpi@scale")% }% @@ -522,11 +522,11 @@ TeXOnePointTikZBW("#2","#3","\luameshval@ap@step","\luameshval@ap@scale","\luameshval@ap@mode","\luameshval@ap@bbox","\luameshval@ap@color","\luameshval@ap@colorback","\luameshval@ap@colornew","\luameshval@ap@colorcircle","\luameshval@ap@colorbbox")% }% \else % we are using MP - \mplibcolor{\luameshmpcolor}{\luameshval@ap@color} - \mplibcolor{\luameshmpcolorBack}{\luameshval@ap@colorback} - \mplibcolor{\luameshmpcolorNew}{\luameshval@ap@colornew} - \mplibcolor{\luameshmpcolorCircle}{\luameshval@ap@colorcircle} - \mplibcolor{\luameshmpcolorBbox}{\luameshval@ap@colorbbox} + \def\luameshmpcolor{\mpcolor{\luameshval@ap@color}} + \def\luameshmpcolorBack{\mpcolor{\luameshval@ap@colorback}} + \def\luameshmpcolorNew{\mpcolor{\luameshval@ap@colornew}} + \def\luameshmpcolorCircle{\mpcolor{\luameshval@ap@colorcircle}} + \def\luameshmpcolorBbox{\mpcolor{\luameshval@ap@colorbbox}} \directlua{% TeXOnePointMPBW("#2","#3","\luameshval@ap@step","\luameshval@ap@scale","\luameshval@ap@mode","\luameshval@ap@bbox")% }% @@ -596,11 +596,11 @@ TeXOnePointTikZBWinc("#2","#3","\luaescapestring{\unexpanded{#4}}","\luaescapestring{\unexpanded{#5}}","\luameshval@ap@step","\luameshval@ap@scale","\luameshval@ap@mode","\luameshval@ap@bbox","\luameshval@ap@color","\luameshval@ap@colorback","\luameshval@ap@colornew","\luameshval@ap@colorcircle","\luameshval@ap@colorbbox")% }% \else % we are using MP - \mplibcolor{\luameshmpcolor}{\luameshval@api@color} - \mplibcolor{\luameshmpcolorBack}{\luameshval@api@colorback} - \mplibcolor{\luameshmpcolorNew}{\luameshval@api@colornew} - \mplibcolor{\luameshmpcolorCircle}{\luameshval@api@colorcircle} - \mplibcolor{\luameshmpcolorBbox}{\luameshval@api@colorbbox} + \def\luameshmpcolor{\mpcolor{\luameshval@api@color}} + \def\luameshmpcolorBack{\mpcolor{\luameshval@api@colorback}} + \def\luameshmpcolorNew{\mpcolor{\luameshval@api@colornew}} + \def\luameshmpcolorCircle{\mpcolor{\luameshval@api@colorcircle}} + \def\luameshmpcolorBbox{\mpcolor{\luameshval@api@colorbbox}} \directlua{% TeXOnePointMPBWinc("#2","#3","\luaescapestring{\unexpanded{#4}}","\luaescapestring{\unexpanded{#5}}","\luameshval@api@step","\luameshval@api@scale","\luameshval@api@mode","\luameshval@api@bbox")% }% @@ -641,7 +641,7 @@ drawGmshTikZinc("#2","\luaescapestring{\unexpanded{#3}}","\luaescapestring{\unexpanded{#4}}","\luameshvaldgi@print","\luameshvaldgi@scale","\luameshvaldgi@color")% }% \else % we are using MP - \mplibcolor{\luameshmpcolor}{\luameshvaldgi@color}% + \def\luameshmpcolor{\mpcolor{\luameshvaldgi@color}}% \directlua{% drawGmshMPinc("#2","\luaescapestring{\unexpanded{#3}}","\luaescapestring{\unexpanded{#4}}","\luameshvaldgi@print","\luameshvaldgi@scale")% }% @@ -679,7 +679,7 @@ drawGmshTikZ("#2","\luameshvaldg@print","\luameshvaldg@scale","\luameshvaldg@color")% }% \else % we are using MP - \mplibcolor{\luameshmpcolor}{\luameshvaldg@color}% + \def\luameshmpcolor{\mpcolor{\luameshvaldg@color}}% \directlua{% drawGmshMP("#2","\luameshvaldg@print","\luameshvaldg@scale")% }% @@ -749,8 +749,8 @@ gmshVoronoiTikZinc("#2","\luaescapestring{\unexpanded{#3}}","\luaescapestring{\unexpanded{#4}}","\luameshval@gvi@print","\luameshval@gvi@scale","\luameshval@gvi@delaunay","\luameshval@gvi@color","\luameshval@gvi@colorvoronoi","\luameshval@gvi@styleDelaunay","\luameshval@gvi@styleVoronoi")% }% \else % we are using MP - \mplibcolor{\luameshmpcolor}{\luameshval@gvi@color}% - \mplibcolor{\luameshmpcolorVoronoi}{\luameshval@gvi@colorvoronoi}% + \def\luameshmpcolor{\mpcolor{\luameshval@gvi@color}}% + \def\luameshmpcolorVoronoi{\mpcolor{\luameshval@gvi@colorvoronoi}}% \directlua{% gmshVoronoiMPinc("#2","\luaescapestring{\unexpanded{#3}}","\luaescapestring{\unexpanded{#4}}","\luameshval@gvi@print","\luameshval@gvi@scale","\luameshval@gvi@delaunay","\luameshval@gvi@styleDelaunay","\luameshval@gvi@styleVoronoi")% }% @@ -817,8 +817,8 @@ gmshVoronoiTikZ("#2","\luameshval@gv@print","\luameshval@gv@scale","\luameshval@gv@delaunay","\luameshval@gv@color","\luameshval@gv@colorVoronoi","\luameshval@gv@styleDelaunay","\luameshval@gv@styleVoronoi")% }% \else % we are using MP - \mplibcolor{\luameshmpcolor}{\luameshval@gv@color}% - \mplibcolor{\luameshmpcolorVoronoi}{\luameshval@gv@colorVoronoi}% + \def\luameshmpcolor{\mpcolor{\luameshval@gv@color}}% + \def\luameshmpcolorVoronoi{\mpcolor{\luameshval@gv@colorVoronoi}}% \directlua{% gmshVoronoiMP("#2","\luameshval@gv@print","\luameshval@gv@scale","\luameshval@gv@delaunay","\luameshval@gv@styleDelaunay","\luameshval@gv@styleVoronoi")% }% @@ -896,8 +896,8 @@ drawMeshPolygonTikZ("#2","\luameshval@mp@mode","\luameshval@mp@h","\luameshval@mp@step","\luameshval@mp@print","\luameshval@mp@scale","\luameshval@mp@color","\luameshval@mp@colorPolygon","\luameshval@mp@gridpoints")% }% \else % we are using MP - \mplibcolor{\luameshmpcolor}{\luameshval@mp@color}% - \mplibcolor{\luameshmpcolorPoly}{\luameshval@mp@colorPolygon}% + \def\luameshmpcolor{\mpcolor{\luameshval@mp@color}}% + \def\luameshmpcolorPoly{\mpcolor{\luameshval@mp@colorPolygon}}% \directlua{% drawMeshPolygonMP("#2","\luameshval@mp@mode","\luameshval@mp@h","\luameshval@mp@step","\luameshval@mp@print","\luameshval@mp@scale","\luameshval@mp@gridpoints")% }% @@ -974,8 +974,8 @@ drawMeshPolygonTikZinc("#2","\luaescapestring{\unexpanded{#3}}","\luaescapestring{\unexpanded{#4}}","\luameshval@mpi@mode","\luameshval@mpi@h","\luameshval@mpi@step","\luameshval@mpi@print","\luameshval@mpi@scale","\luameshval@mpi@color","\luameshval@mpi@colorPolygon","\luameshval@mpi@gridpoints")% }% \else % we are using MP - \mplibcolor{\luameshmpcolor}{\luameshval@mpi@color}% - \mplibcolor{\luameshmpcolorPoly}{\luameshval@mpi@colorPolygon}% + \def\luameshmpcolor{\mpcolor{\luameshval@mpi@color}}% + \def\luameshmpcolorPoly{\mpcolor{\luameshval@mpi@colorPolygon}}% \directlua{% drawMeshPolygonMPinc("#2","\luaescapestring{\unexpanded{#3}}","\luaescapestring{\unexpanded{#4}}","\luameshval@mpi@mode","\luameshval@mpi@h","\luameshval@mpi@step","\luameshval@mpi@print","\luameshval@mpi@scale","\luameshval@mpi@gridpoints")% }% |