texlive[72985] Master: euclidean-lattice (27nov24)
commits+karl at tug.org
commits+karl at tug.org
Wed Nov 27 21:55:43 CET 2024
Revision: 72985
https://tug.org/svn/texlive?view=revision&revision=72985
Author: karl
Date: 2024-11-27 21:55:43 +0100 (Wed, 27 Nov 2024)
Log Message:
-----------
euclidean-lattice (27nov24)
Modified Paths:
--------------
trunk/Master/tlpkg/bin/tlpkg-ctan-check
trunk/Master/tlpkg/tlpsrc/collection-mathscience.tlpsrc
Added Paths:
-----------
trunk/Master/texmf-dist/doc/latex/euclidean-lattice/
trunk/Master/texmf-dist/doc/latex/euclidean-lattice/README.md
trunk/Master/texmf-dist/doc/latex/euclidean-lattice/euclidean-lattice-doc.pdf
trunk/Master/texmf-dist/source/latex/euclidean-lattice/
trunk/Master/texmf-dist/source/latex/euclidean-lattice/euclidean-lattice.dtx
trunk/Master/texmf-dist/source/latex/euclidean-lattice/euclidean-lattice.ins
trunk/Master/texmf-dist/tex/latex/euclidean-lattice/
trunk/Master/texmf-dist/tex/latex/euclidean-lattice/euclidean-lattice.sty
trunk/Master/tlpkg/tlpsrc/euclidean-lattice.tlpsrc
Added: trunk/Master/texmf-dist/doc/latex/euclidean-lattice/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/euclidean-lattice/README.md (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/euclidean-lattice/README.md 2024-11-27 20:55:43 UTC (rev 72985)
@@ -0,0 +1,8 @@
+This is the `euclidean-lattice` package,
+written by Jérôme Plût <jerome.plut at ssi.gouv.fr>.
+
+This package provides a simple and efficient way
+of drawing TikZ pictures of two-dimensional Euclidean lattices.
+
+This material is distributed according to the LaTeX Project Public
+License version 1.3c (https://www.latex-project.org/lppl.txt).
Property changes on: trunk/Master/texmf-dist/doc/latex/euclidean-lattice/README.md
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/euclidean-lattice/euclidean-lattice-doc.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/latex/euclidean-lattice/euclidean-lattice-doc.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/euclidean-lattice/euclidean-lattice-doc.pdf 2024-11-27 20:55:13 UTC (rev 72984)
+++ trunk/Master/texmf-dist/doc/latex/euclidean-lattice/euclidean-lattice-doc.pdf 2024-11-27 20:55:43 UTC (rev 72985)
Property changes on: trunk/Master/texmf-dist/doc/latex/euclidean-lattice/euclidean-lattice-doc.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/source/latex/euclidean-lattice/euclidean-lattice.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/euclidean-lattice/euclidean-lattice.dtx (rev 0)
+++ trunk/Master/texmf-dist/source/latex/euclidean-lattice/euclidean-lattice.dtx 2024-11-27 20:55:43 UTC (rev 72985)
@@ -0,0 +1,695 @@
+%% \iffalse
+%% Copyright (C) 2024 Jerome Plut
+%%
+%% 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
+%% https://www.latex-project.org/lppl.txt
+%% and version 1.3c or later is part of all distributions of LaTeX
+%% version 2008-05-04 or later.
+%%
+%% This work has the LPPL maintenance status "maintained".
+%%
+%% The Current Maintainer of this work is Jerome Plut.
+%%
+%% This work consists of the files `euclidean-lattice.ins`
+%% and `euclidean-lattice.dtx`,
+%% as well as the derived file `euclidean-lattice.sty`.
+%% \fi
+
+% \iffalse
+%<*driver>
+\ProvidesFile{euclidean-lattice.dtx}
+%</driver>
+%
+%<*driver>
+\documentclass{ltxdoc}
+\usepackage{color}
+\usepackage{euclidean-lattice}
+\usepackage[listings]{tcolorbox}
+\tcbuselibrary{skins}
+\usepackage[margin=25mm]{geometry}
+\usepackage{amsmath,amsfonts,amssymb}
+\usepackage{titling}
+\setlength{\droptitle}{-30mm}
+
+\sloppy
+\definecolor{blue1}{RGB}{0,53,130}
+\definecolor{red1}{RGB}{218,41,28}
+\definecolor{green1}{RGB}{0,150,59}
+\definecolor{purple1}{RGB}{114,36,108}
+\definecolor{cyan1}{RGB}{242,249,245}
+\definecolor{cyan2}{RGB}{28,133,115}
+\parindent 0pt
+\parskip 1ex
+\EnableCrossrefs
+\CodelineIndex
+\RecordChanges
+\newtcblisting{example}{%
+ listing side text,tikz lower={scale=.5},
+ listing options={basicstyle=\ttfamily\fontsize{8pt}{9pt}\selectfont,
+ breaklines=true,language=tex,commentstyle=\color{cyan2}\itshape},
+ sharp corners,boxrule=.4pt,righthand width=55mm,boxsep=0mm,left=2mm,
+ sidebyside gap=2mm,
+ skin=bicolor,colback=cyan1,colframe=black,colbacklower=white,
+}
+\makeatletter
+\def\makecompact#1{\g at addto@macro#1{%
+ \setlength{\itemsep}{\z@}\setlength{\parsep}{\z@}%
+ \setlength{\topsep}{\z@}\setlength{\partopsep}{\z@}%
+}}\makecompact\itemize \makecompact\enumerate
+\makeatother
+\let\labelitemi\textendash
+
+\begin{document}
+ \DocInput{euclidean-lattice.dtx}
+ \PrintChanges
+ \PrintIndex
+\end{document}
+%</driver>
+%<*doc>
+\fi
+
+\GetFileInfo{euclidean-lattice.sty}
+
+\title{The \textsf{euclidean-lattice} package}
+\author{J\'er\^ome Pl\^ut
+ \textlangle\texttt{jerome.plut at cyber.gouv.fr}\textrangle}
+\date{\textsf{euclidean-lattice}~\fileversion, dated~\filedate}
+
+
+\maketitle
+
+This package provides a simple and efficient way
+of drawing \textsf{TikZ} pictures of two-dimensional Euclidean lattices.
+
+\section{Usage}
+
+\subsection{The \texttt{\textbackslash lattice} command}
+
+\DescribeMacro{\lattice}
+{\color{red1}|\lattice|}%
+{\color{green1}|<|\textit{overlay specification}|>|}%
+{\color{blue1}|[|\textit{options...}|]|}%
+|(|$a$|,|$b$|)(|$c$|,|$d$|);|
+This commands draws a part of the two-dimensional lattice
+generated by the vectors $(a,b)$ and $(c,d)$.
+
+The {\color{green1}\textit{overlay specification}} is optional
+and follows~\textsf{beamer} syntax.
+It will only work if the \textsf{beamer} class is loaded.
+
+The {\color{blue1}\textit{options}} enable customizing how the lattice
+is displayed. They follow the standard \textsf{TikZ/PGF} key-value
+interface. The following options are available.
+
+\DescribeMacro{x}
+\DescribeMacro{y}
+{{\color{blue1}\texttt{x=}$x_1$|:|$x_2$}
+and {\color{blue1}\texttt{y=}$y_1$|:|$y_2$}}
+(default value |x=-2:2|,|y=-2:2|).
+
+These two options specify a bounding box which determines
+which part of the lattice is drawn.
+As a shortcut, passing the value |x=|$x_1$
+is equivalent to |x=|$-x_1$|:|$x_1$, and likewise for~|y|.
+\begin{example}
+\draw[help lines,gray!25] (-5,0) grid (5,2);
+\lattice[x=5,y=0:2](3,0)(1,1);
+\node[inner sep=1.5pt,circle,fill=red] at (0,0){};
+\end{example}
+
+\DescribeMacro{grid}
+{{\color{blue1}\texttt{grid=}\textit{options...}}}
+
+This option specifies how to draw
+the grid generated by the two given lattice vectors.
+It may take either a single value (generally a color name),
+or several values grouped in braces.
+Note that this grid depends on the basis vectors and not only on the
+lattice; see the example below.
+\begin{example}
+\lattice[y=0:2,x=0:5,grid=gray](2,-1)(1,1);
+% Same lattice, different basis:
+\lattice[y=0:2,x=6:11,grid={yellow,very thick}]
+ (3,0)(4,1);
+\end{example}
+
+\DescribeMacro{bounding box}
+{{\color{blue1}\texttt{bounding box=}\textit{options...}}}
+
+This option specifies how to draw
+the bounding box given by the |x| and |y| options.
+It may take either a single value (generally a color name),
+or several values grouped in braces.
+\begin{example}
+\lattice[bounding box=green,x=-5:5,y=0:2](3,0)(1,1);
+\end{example}
+
+\DescribeMacro{each point}
+{{\color{blue1}\texttt{each point/.code n args=\{5\}\{}%
+\textit{code...}\texttt{\}}}}
+
+This option contains contains the code to execute for each
+lattice point. This code is called with the five following parameters:
+\begin{itemize}
+\item (|#1|) the parsed lattice node options,
+\item (|#2|,|#3|) the $(x,y)$ coordinates of the current lattice point
+(as \textsf{TikZ} canvas coordinates);
+\item (|#4|,|#5|) the coordinates of the same point
+relative to the provided lattice basis (as integers).
+\end{itemize}
+Note that, due to this parameter being expanded inside a macro, all the
+|#| signs must be doubled in its definition, as in the following example.
+\begin{example}
+\lattice[x=-5:5,y=0:2,each point/.code n args=
+ {5}{\node[##1,fill=cyan!10] at (##2,##3){(##4,##5)};}]
+ (3,0)(1,1);
+\end{example}
+
+
+\textbf{Other options}
+
+Any remaining options are directly passed to
+the |\node| calls for each lattice point.
+\begin{example}
+\lattice[red,rectangle,inner sep=2pt,x=-5:5,y=0:2]
+ (3,0)(1,1);
+\end{example}
+
+
+\subsection{Configuring default behaviour}
+
+\DescribeMacro{x}
+\DescribeMacro{y}
+\DescribeMacro{grid}
+\DescribeMacro{bounding box}
+\DescribeMacro{each point}
+The |/lattice/x|, |/lattice/y|, |/lattice/grid|, |/lattice/bounding box|,
+|/lattice/each point| PGF keys contain
+the default parameters for the correspondingly-named options.
+Note that the |#| signs must \emph{not} be doubled in |/lattice/each point|.
+\begin{example}
+\pgfqkeys{/lattice}{x=-5:5,y=-.1:2.1,
+ grid={blue!10,very thick},
+ bounding box={red,fill=gray!5},
+ each point/.code n args={5}{%
+ \node[#1,fill=cyan!10,rectangle] at (#2,#3)
+ {\tiny (#4,#5)};}}
+\lattice[grid,bounding box](3,0)(1,1);
+\end{example}
+
+\DescribeMacro{node}
+The |/lattice/node| key contains the default parameters for the |\node|
+call for each point.
+Equivalently, these are the default options passed to each |\lattice| call.
+\begin{example}
+\pgfkeys{/lattice/node={fill=yellow!25,draw=red}}
+\lattice[x=-5:5,y=0:2](3,0)(1,1);
+\end{example}
+
+\subsection{Exactness and limitations}
+
+This command only outputs lattices containing the origin.
+An offset lattice may still be obtained by using
+the PGF transformation mechanism
+and correspondingly adjusting the |x|,|y| bounding box parameters:
+\begin{example}
+\begin{scope}\pgftransformshift{\pgfpoint{1cm}{0}}
+\lattice[x=-3:1,red,rectangle](2,0)(1,1);
+\end{scope}
+\lattice(2,0)(1,1);
+\end{example}
+
+
+This command might be executed a large number of times in a single
+document, for example in the case of a \textsf{beamer} presentation
+with a large number of overlays.
+This means that we need to be careful to make it efficient.
+
+Therefore, all computations are performed using \TeX\ registers.
+Since these registers only implement 32-bit integer arithmetic,
+we use fixed-point arithmetic with 16-bit offset for numeric computations
+(which include matrix inversion).
+This implies some precision loss and enforces some numeric limits.
+The use of fixed-point arithmetic means that
+the products appearing in the determinant of the lattice
+must not exceed $2^{15}$.
+In particular, this package should work
+as long as all the coordinates (in absolute value) do not exceed~$128$,
+which should cover most typical scales of \textsf{TikZ} pictures.
+
+We compensate for the precision loss by sampling a bit too many
+lattice points (relative to the required bounding box)
+and then filtering \emph{a posteriori} to ensure that all points
+are in the bounding box.
+This last step should remain exact, at least as soon as
+the coordinates of the lattice vectors are integers
+(or integer multiples of $2^{-8}$).
+
+Therefore, we expect that in most cases, the command will exactly output
+the lattice points inside the bounding box.
+If this were to fail, however, as a last-resort option,
+enlarging the bounding box by a small number in all directions
+should ensure that all lattice points appear.
+
+%\iffalse
+%</doc>
+%\fi
+% \section{Implementation}
+%
+% \paragraph{Initialization.}
+% We obviously depend on~\textsf{tikz}
+% (and more precisely on~\textsf{pgfkeys}).
+% \begin{macrocode}
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{euclidean-lattice}[2024-07-26 Euclidean~lattices 1.0]
+\RequirePackage{tikz}
+% \end{macrocode}
+% We use fixed-point arithmetic in the 31-bit registers supported by
+% \TeX, using 16 bits for offset.
+%
+% TODO: we could slightly enhance the precision of computations by
+% correctly rounding the last bit (instead of truncating).
+% Depending on the value's sign,
+% |\advance XXX by .5\la at unit| should do the trick.
+%
+% This means that we represent a real number~$x$
+% using the integer $f(x) = B x$, where $B = 2^{16}$.
+% To multiply two such integers, we note that
+% $f(xy) = B x y = f(x) f(y)/B$,
+% which we compute as $(f(x)/\beta) \cdot (f(y)/\beta)$,
+% where $\beta = \sqrt{B} = 2^{8}$.
+% We store this value in the register |\la at unit|.
+% \begin{macrocode}
+\newdimen\la at unit \la at unit=256sp
+\def\lattice at mul#1#2{% writes #1*#2 in #1
+ \@tempdimc=#2 \divide\@tempdimc\la at unit
+ \divide #1\la at unit
+ \multiply #1\@tempdimc}%
+% \end{macrocode}
+% We perform division using
+% $f(x/y) = B x/y = B f(x)/f(y)$,
+% which we compute as $\frac{\beta f(x)}{f(y)/\beta}$.
+% \begin{macrocode}
+\def\lattice at div#1#2{%
+ \@tempdimc=#2\divide\@tempdimc\la at unit
+ \multiply #1\la at unit \divide#1\@tempdimc}%
+\def\lattice at invert#1{% writes 1/#1 in #1
+ \@tempdimc=#1 \divide\@tempdimc\la at unit
+ #1=256\p@ \divide #1\@tempdimc}%
+% \end{macrocode}
+% The next macro is our main enumeration routine.
+% It enumerates all the point in the lattice~$\Lambda$ generated
+% by the vectors $(a=|#1|,b=|#2|)$ and $(c=|#3|,d=|#4|)$
+% inside the box~$R$ delimited by the registers
+% $[|\la at Ax|,|\la at Bx|] \times [|\la at Ay|,|\la at By|]$.
+% On each such point, it invokes the macro
+% |\lattice at donode|.
+%
+% Since $\Lambda = B \cdot \mathbb{Z}^2$,
+% instead of enumerating $S = \Lambda \cap R$
+% we enumerate $B^{-1} S = \mathbb{Z}^2 \cap (B^{-1} R)$.
+% We use $(x,y)$ coordinates to describe elements of~$S$
+% and $(w,z)$ coordinates to describes elements of~$B^{-1} S$.
+%
+% We declare several numeric registers, all prefixed with |\la@|:
+% \begin{itemize}
+% \item $(a,b)$ and $(c,d)$ are the vectors of the lattice basis~$B$;
+% \item $R := [Ax, Bx] \times [Ay, By]$ is the bounding box for the drawing;
+% \item $U := (Ux, Uy)$ and $V := (Vx, Vy)$ are the side vectors
+% of the parallelogram $P := B^{-1} \cdot R$,
+% and~$C := (Cx, Cy)$~is its center;
+% \item $sM < sL$ are the slopes of the vectors $U$ and~$V$;
+% \item $wA, wB, wM$ are the horizontal parameters for enumerating
+% the parallelogram;
+% \item $zA, zB, zC$ are the vertical parameters for enumerating the
+% parallelogram;
+% \item $D$ plays a double role, first as the (inverse) determinant of
+% the lattice, and then as a vertical enumeration parameter.
+% \end{itemize}
+% \begin{macrocode}
+\newdimen\la at a \newdimen\la at b \newdimen\la at c \newdimen\la at d
+\newdimen\la at Ax\newdimen\la at Bx\newdimen\la at Ay\newdimen\la at By
+\newdimen\la at D
+\newdimen\la at Ux\newdimen\la at Uy \newdimen\la at Vx\newdimen\la at Vy
+\newdimen\la at Cx\newdimen\la at Cy
+
+\newdimen\la at sL \newdimen\la at sM
+\newdimen\la at zA \newdimen\la at zB \newdimen\la at zC
+\newdimen\la at wA \newdimen\la at wB
+\newcount\la at wM
+% \end{macrocode}
+% \begin{macrocode}
+\def\lattice at enumerate#1#2#3#4{%
+ \la at a=#1\p@ \la at b=#2\p@ \la at c=#3\p@ \la at d=#4\p@
+% \end{macrocode}
+% First we store the \textrm{inverse} of the determinant in |\la at D|.
+% \begin{macrocode}
+ \la at D=\la at a \lattice at mul\la at D\la at d
+ \@tempdima=\la at b \lattice at mul\@tempdima\la at c
+ \advance\la at D -\@tempdima
+ \lattice at invert\la at D
+% \end{macrocode}
+% Compute the inverse image $B^{-1} R = P$.
+% We first compute the sides $U$, $V$ of the parallelogram,
+% multiplying by $-1$ if needed so that both $w$-coordinates are
+% $\geqslant 0$.
+% \begin{macrocode}
+ \la at Ux=\la at Ax \advance\la at Ux-\la at Bx
+ \lattice at mul\la at Ux \la at D
+ \la at Uy=-\la at Ux
+ \lattice at mul\la at Ux \la at d \ifdim\la at Ux <\z@
+ \multiply\la at Ux -1 \multiply\la at Uy -1 \fi
+ \lattice at mul\la at Uy\la at b
+ \la at Vx=\la at By \advance\la at Vx-\la at Ay \lattice at mul\la at Vx\la at D
+ \la at Vy=-\la at Vx
+ \lattice at mul\la at Vx\la at c \ifdim\la at Vx<\z@
+ \multiply\la at Vx -1 \multiply\la at Vy -1\fi
+ \lattice at mul\la at Vy \la at a
+% \end{macrocode}
+% We ensure that $\det(U,V) > 0$, swapping both vectors if needed.
+% Since we only need the sign of this determinant, we scale down the
+% values to help prevent a numeric overflow.
+% \begin{macrocode}
+ \@tempdima \la at Ux
+ \@tempdimb \la at Vx
+ \ifdim\@tempdima<100\p@\else
+ \ifdim\@tempdimb<100\p@\else
+ \divide\@tempdima 1024
+ \divide\@tempdimb 1024\fi\fi
+ \lattice at mul\@tempdima\la at Vy
+ \lattice at mul\@tempdimb\la at Uy
+ \ifdim \@tempdimb>\@tempdima
+ \@tempdimc=\la at Ux \la at Ux=\la at Vx \la at Vx=\@tempdimc
+ \@tempdimc=\la at Uy \la at Uy=\la at Vy \la at Vy=\@tempdimc
+ \fi
+% \end{macrocode}
+% Compute the center of the parallelogram.
+% Note that we also use |\la at sL|, |\la at sM| (not yet needed)
+% as temporaries here.
+% \begin{macrocode}
+ \la at sL=\la at Ax \advance\la at sL\la at Bx \divide\la at sL 2
+ \la at sM=\la at Ay \advance\la at sM\la at By \divide\la at sM 2
+ \la at Cx=\la at sL \lattice at mul\la at Cx\la at d
+ \@tempdima=\la at sM \lattice at mul\@tempdima\la at c
+ \advance\la at Cx -\@tempdima
+ \la at Cy=\la at sM \lattice at mul\la at Cy\la at a
+ \@tempdima=\la at sL \lattice at mul\@tempdima\la at b
+ \advance\la at Cy -\@tempdima
+ \lattice at mul \la at Cx\la at D
+ \lattice at mul \la at Cy\la at D
+% \end{macrocode}
+% Compute the bounding-box in $(w,z)$ space.
+% Note that the |\la at wA|,|\la at wB| values will be re-used below
+% for enumerating all lattice points;
+% on the other hand, |\la at zA| and |\la at zB| are used here
+% as temporary values.
+% \begin{macrocode}
+ \@tempdima\la at Ux \advance\@tempdima\la at Vx
+ \la at wA=\la at Cx \advance\la at wA -.5\@tempdima
+ \la at wB=\la at wA \advance\la at wB \@tempdima
+ \@tempdima\la at Uy \ifdim\@tempdima<\z@ \multiply\@tempdima -1\fi
+ \ifdim\la at Vy<\z@ \advance\@tempdima -\la at Vy
+ \else\advance\@tempdima\la at Vy\fi
+ \la at zA=\la at Cy \advance\la at zA -.5\@tempdima
+ \la at zB=\la at zA \advance\la at zB \@tempdima
+% \end{macrocode}
+% Draw the grid if the options require it.
+% \begin{macrocode}
+ \ifx\lattice at grid\@empty\else \begin{scope}%
+ \clip (\strip at pt\la at Ax,\strip at pt\la at Ay)
+ rectangle (\strip at pt\la at Bx,\strip at pt\la at By);
+ \pgftransformcm{\strip at pt\la at a}{\strip at pt\la at b}%
+ {\strip at pt\la at c}{\strip at pt\la at d}{\pgfpointorigin}%
+ \expandafter\draw\expandafter[\lattice at grid]
+ (\strip at pt\la at wA,\strip at pt\la at zA) grid (\strip at pt\la at wB,\strip at pt\la at zB);
+ \end{scope}\fi
+% \end{macrocode}
+% Compute the last values required to enumerate over $\mathbb{Z}^2 \cap P$.
+% We represent the parallelogram~$P$ as the intersection of four half-planes.
+% Let $A_1=(w_1,z_1)$ and $A_2=(w_2,z_2)$ be
+% the left-most and right-most vertices of~$P$,
+% and $\lambda, \mu$ be the slopes of the sides
+% (the condition $\det(U,V) > 0$ guarantees that $\lambda < \mu$).
+%
+% The two sides originating from~$A_i (i=1,2)$ have equations
+% \[ z=z_i+\lambda(w-w_i), \qquad z=z_i+\mu(w-w_i); \]
+% By defining $z_3 = z_2 - \lambda (w_2 - w_1)$ and $z_4=z_2-\mu(w_2-w_1)$,
+% we may rewrite both equations from~$A_2$ as:
+% \[ z= z_3 + \mu(w-w_1),
+% \qquad z = z_4 + \lambda(w-w_1) \]
+% The parallelogram~$P$ is then defined by the following inequations,
+% where we write $t = w - w_1$:
+% \[ \max(z_3+\mu t, z_1+\lambda t) \;\leqslant\; z \;\leqslant\;
+% \min(z_1+\mu t, z_4+\lambda t). \]
+% For any given value of~$w$ we store the value of these four affine
+% functions in the variables |\la at zB|, |\la at zA|, |\la at D| (not a typo),
+% |\la at zC|, in this order.
+% When increasing the value of~$w$ we only need to increase the values
+% of these four registers respectively by $\mu$, $\lambda$, $\mu$,
+% $\lambda$.
+%
+% First we compute the values $z_2 = z_C + \frac 12(z_U+z_V)$
+% and~$w_2 - w_1 = w_U + w_V$.
+% \begin{macrocode}
+ \@tempdima=\la at Uy \advance\@tempdima\la at Vy
+ \@tempdimb=\la at Cy \advance\@tempdimb .5\@tempdima % z2
+ \@tempdima=\la at Ux \advance\@tempdima\la at Vx % w_2-w_1 = w(U+V)
+% \end{macrocode}
+% Then we compute the slopes $\lambda = |\la at sL|$ and $\mu = |\la at sM|$.
+% A Special case happens when either $w_U$ or $w_V$ is zero.
+% In the first case, $\lambda = -\infty$.
+% This means that the comparisons with |\la at zA| and |\la at zC| must be
+% ignored.
+% \begin{macrocode}
+ \ifdim\la at Ux=\z@
+ \la at sL=\z@ \la at zC=\maxdimen \la at zA=-\maxdimen
+ \else
+ \la at sL=\la at Uy \lattice at div\la at sL\la at Ux
+ \la at zC=-\@tempdima \lattice at mul\la at zC\la at sL \advance\la at zC \@tempdimb
+ \la at zA=\@tempdimb \advance\la at zA -\la at Uy \advance\la at zA -\la at Vy
+ \fi
+% \end{macrocode}
+% Likewise, if $w_V = 0$ then $\mu = +\infty$
+% and the comparisons with |\la at zB| and |\la at D| are ignored.
+% \begin{macrocode}
+ \ifdim\la at Vx=\z@
+ \la at sM=\z@ \la at zB=-\maxdimen \la at D=\maxdimen
+ \else
+ \la at sM=\la at Vy \lattice at div\la at sM\la at Vx
+ \la at zB=-\@tempdima \lattice at mul\la at zB\la at sM \advance\la at zB \@tempdimb
+ \la at D=\@tempdimb \advance\la at D -\la at Uy \advance\la at D -\la at Vy
+ \fi
+% \end{macrocode}
+%
+% At this point the enumerator for $B^{-1} S$ is fully computed;
+% it uses the registers |\la at sL|, |\la at sM| for the slopes,
+% |\la at wA|, |\la at wB| for the boundaries,
+% |\la at zA|, |\la at zB|, |\la at zC|, |\la at D| for the four affine functions,
+% as well as the original matrix~$B$ in |\la at a|, |\la at b|, |\la at c|, |\la at d|
+% (to recompute the points of~$\Lambda$).
+%
+% We re-use the freed registers in the following way:
+% \begin{itemize}
+% \item $(|\la at Vx|,|\la at Vy|)$ hold the $(w,z)$ coordinates
+% of the current lattice point (stored as integers);
+% \item $(|\la at Ux|,|\la at Uy|)$ hold the corresponding point
+% in $(x,y)$ space (stored as \textsf{dimen}s);
+% \item $(|\la at Cx|,|\la at Cy|)$ hold the $(x,y)$ coordinates
+% of the $(w,0)$ point, which is used for each column.
+% \end{itemize}
+%
+% Because the fixed-point arithmetic is imprecise, we might miss some
+% lattice points on the boundaries. We compensate for this by enlarging
+% the bounds ($-1$ for lower bounds, $+1$ for upper bounds)
+% and \emph{a posteriori} checking that all the computed points
+% are in the bounding box.
+%
+% Store in |\la at Vx| our starting $(w,z)$ coordinate,
+% which is the integer $\lceil|\la at wA|\rceil -1$.
+% Since \TeX\ knows only \emph{signed} division (groumpf),
+% computing the ceiling is sign-dependent.
+% \begin{macrocode}
+ \la at Vx=\la at wA \advance\la at Vx\expandafter\ifdim\la at Vx>\z@ -1sp\else-\p@\fi
+ \divide\la at Vx \p@
+% \end{macrocode}
+% Compute the upper boundary $|\la at wB|=\lfloor|\la at wB|\rfloor+1$.
+% \begin{macrocode}
+ \ifdim\la at wB<\z@ \advance\la at wB 1sp\else\advance\la at wB\p@\fi
+ \divide\la at wB\p@
+% \end{macrocode}
+% Compute the difference $t = \lceil w_1\rceil-w_1$
+% and correspondingly advance the four affine functions.
+% \begin{macrocode}
+ \@tempdima=\la at Vx \multiply\@tempdima\p@
+ \advance\@tempdima -\la at wA
+ \@tempdimb=\@tempdima \lattice at mul\@tempdimb\la at sL
+ \advance\la at zA\@tempdimb \advance\la at zC\@tempdimb
+ \@tempdimb=\@tempdima \lattice at mul\@tempdimb\la at sM
+ \advance\la at zB\@tempdimb \advance\la at D\@tempdimb
+% \end{macrocode}
+% Store in |\la at Cx|, |\la at Cy| the $(x,y)$ coordinates of the
+% lattice vector $w \cdot (a,b)$:
+% \begin{macrocode}
+ \la at Cx=\la at a \multiply\la at Cx\la at Vx
+ \la at Cy=\la at b \multiply\la at Cy\la at Vx
+% \end{macrocode}
+% The main $w$-loop starts here.
+% \begin{macrocode}
+ \loop
+% \end{macrocode}
+% Compute the range of $z=|\la at Vy|$ for this value of $w=|\la at Vx|$.
+% The minimum value is $\max(|\la at zA|,|\la at zB|)-1$:
+% \begin{macrocode}
+ \la at Vy=\la at zA \ifdim\la at Vy<\la at zB \la at Vy=\la at zB\fi
+ \advance\la at Vy\expandafter\ifdim\la at Vy>\z@ -1sp\else-\p@\fi
+ \divide\la at Vy\p@
+% \end{macrocode}
+% The maximum value is $|\la at wM|=\min(|\la at zC|,|\la at D|)$:
+% \begin{macrocode}
+ \la at wM=\la at zC \ifnum\la at wM>\la at D \la at wM=\la at D\fi
+ \advance\la at wM\expandafter\ifnum\la at wM<\z@\@ne\else\p@\fi
+ \divide\la at wM\p@
+% \end{macrocode}
+% Compute the $(|\la at Ux|,|\la at Uy|)$ point in $(x,y)$ space:
+% \begin{macrocode}
+ \la at Ux=\la at c \multiply\la at Ux\la at Vy \advance\la at Ux\la at Cx
+ \la at Uy=\la at d \multiply\la at Uy\la at Vy \advance\la at Uy\la at Cy
+% \end{macrocode}
+% Inner ($z$) loop. Nested loops require grouping.
+% \begin{macrocode}
+ {\loop
+% \end{macrocode}
+% If the point is inside the bounding box, we invoke |\lattice at donode|.
+% Note the use of |\expandafter| to ensure that the |\node| call inside
+% the PGF key |/lattice/each node| gets the expanded options list.
+% \begin{macrocode}
+ \ifdim\la at Ux<\la at Ax\else\ifdim\la at Ux>\la at Bx\else
+ \ifdim\la at Uy<\la at Ay\else\ifdim\la at Uy>\la at By\else
+ \expandafter\lattice at donode\expandafter{\lattice at node}%
+ \fi\fi\fi\fi
+% \end{macrocode}
+% End of the $z$ loop. We increase $z$ and correspondingly advance the vector.
+% \begin{macrocode}
+ \ifnum\la at Vy<\la at wM
+ \advance\la at Vy 1sp
+ \advance\la at Ux\la at c \advance\la at Uy\la at d
+ \repeat}
+% \end{macrocode}
+% End of the $w$ loop. We increase $w$ and correspondingly advance
+% the $w\cdot (a,b)$ vector as well as the four affine functions.
+% \begin{macrocode}
+ \ifnum\la at Vx<\la at wB
+ \advance\la at Vx 1sp
+ \advance\la at Cx\la at a \advance\la at Cy\la at b
+ \advance\la at zA \la at sL \advance\la at zC \la at sL
+ \advance\la at zB \la at sM \advance\la at D \la at sM
+ \repeat
+}
+% \end{macrocode}
+% This macro gets called for each found lattice point.
+% Its main job is to ensure that the node options (here |#1|)
+% are correctly expanded.
+% \begin{macrocode}
+\def\lattice at donode#1{%
+ \pgfkeys{/lattice/arg/each point={#1}{\strip at pt\la at Ux}{\strip at pt\la at Uy}%
+ {\number\la at Vx}{\number\la at Vy}}}
+
+% \end{macrocode}
+% The PGF keys used for parsing the arguments of the |\lattice| command;
+% they correspond to the options passed in square brackets.
+% \begin{macrocode}
+\pgfqkeys{/lattice/arg}{
+ x/.store in=\lattice at x,
+ y/.store in=\lattice at y,
+ grid/.store in=\lattice at grid,
+ each point/.code n args={5}{\pgfkeys{/lattice/each point={#1}{#2}{#3}{#4}{#5}}},
+ bounding box/.store in=\lattice at bbox,
+ .unknown/.code={%
+ \expandafter\lattice at setnode\pgfkeyscurrentkey=#1\lattice at eov
+ }}
+% \end{macrocode}
+% The PGF keys used for user configuration of the default values.
+% \begin{macrocode}
+\pgfqkeys{/lattice}{
+ x/.initial=-2:2,y/.initial=-2:2,
+ node/.initial={circle,inner sep=1pt,draw=none,fill=black},
+ grid/.style={/lattice/arg/grid/.default={#1}},
+ grid={gray,very thin},
+ bounding box/.style={/lattice/arg/bounding box/.default={#1}},
+ bounding box={cyan,thin},
+ each point/.code n args={5}{\node[#1] at (#2,#3){};},
+}
+% \end{macrocode}
+% This handles the passing of any unknown |\lattice| keys
+% down to the |\node| calls.
+% \begin{macrocode}
+\def\lattice at setnode/lattice/arg/#1\lattice at eov{%
+ \edef\lattice at node{\expandafter\noexpand\lattice at node,#1}}
+% \end{macrocode}
+% This macro parses the bounding-box |x| and |y| coordinates,
+% replacing |x=10| by |x=-10:10|.
+% The |detokenize| trick was nicely provided by David Carlisle:
+% |https://tex.stackexchange.com/questions/724989/|.
+% \begin{macrocode}
+\def\lattice at getxy#1#2#3{%
+ \def\m at gic##1:##2:##3\end{\ifx ##3: #2=##1\p@ #3=##2\p@\else
+ #2=-##1\p@ #3=##1\p@\fi}%
+ \expandafter\m at gic\detokenize{#1:}:\end
+}
+% \end{macrocode}
+% The following macros parse the possible combinations of overlays
+% and square-bracket options.
+% They are similar to the way |\tikz at command@path| is defined
+% in |tikz.code.tex|.
+% Just as in that case, the overlay is handled by a |\alt| call,
+% which will fail if \textsf{beamer} is not loaded.
+% \begin{macrocode}
+\def\lattice{\@ifnextchar<\lattice at I{\@ifnextchar[\lattice at II{\lattice@@[]}}}
+\def\lattice at I{\ifnum\the\catcode`\;=\active\relax
+ \let\lattice at next\lattice at Iactive\else
+ \let\lattice at next\lattice at Inormal\fi
+ \lattice at next}
+\long\def\lattice at Inormal<#1>#2;{\alt<#1>{\lattice at I@#2;}{}}
+{\catcode`\;=\active
+ \long\gdef\lattice at Iactive<#1>#2;{\alt<#1>{\lattice at I@#2;}{}}
+}
+\def\lattice at I@{\@ifnextchar[\lattice@@{\lattice@@[]}}
+\def\lattice at II[#1]{\@ifnextchar<{\lattice at IIi[#1]}{\lattice@@[#1]}}
+\def\lattice at IIi[#1]<#2>{\lattice at I<#2>[#1]}
+% \end{macrocode}
+% This macros parses the basis vectors and calls the main loop.
+% |#4| and |#7| are dummy parameters swallowing a possible space between
+% the parentheses and the final semicolon.
+% \begin{macrocode}
+\def\lattice@@[#1](#2,#3)#4(#5,#6)#7{
+ \let\lattice at grid\@empty%
+ \let\lattice at bbox\@empty%
+ \edef\lattice at x{\pgfkeysvalueof{/lattice/x}}%
+ \edef\lattice at y{\pgfkeysvalueof{/lattice/y}}%
+ \edef\lattice at node{\pgfkeysvalueof{/lattice/node}}%
+ \pgfqkeys{/lattice/arg}{#1}%
+% \end{macrocode}
+% Read the bounding-box coordinates from the |x| and |y| keys:
+% \begin{macrocode}
+ \expandafter\lattice at getxy\expandafter{\lattice at x}\la at Ax\la at Bx
+ \expandafter\lattice at getxy\expandafter{\lattice at y}\la at Ay\la at By
+% \end{macrocode}
+% Draw the bounding-box if it was required by the options.
+% \begin{macrocode}
+ \ifx\lattice at bbox\@empty\else
+ \expandafter\draw\expandafter[\lattice at bbox]
+ (\strip at pt\la at Ax,\strip at pt\la at Ay)
+ rectangle (\strip at pt\la at Bx,\strip at pt\la at By);
+ \fi
+% \end{macrocode}
+% Call the main loop.
+% \begin{macrocode}
+ \lattice at enumerate{#2}{#3}{#5}{#6}%
+}
+% \end{macrocode}
+%
+% \Finale
+\endinput
Property changes on: trunk/Master/texmf-dist/source/latex/euclidean-lattice/euclidean-lattice.dtx
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/source/latex/euclidean-lattice/euclidean-lattice.ins
===================================================================
--- trunk/Master/texmf-dist/source/latex/euclidean-lattice/euclidean-lattice.ins (rev 0)
+++ trunk/Master/texmf-dist/source/latex/euclidean-lattice/euclidean-lattice.ins 2024-11-27 20:55:43 UTC (rev 72985)
@@ -0,0 +1,23 @@
+%%
+%% Copyright (C) 2024 Jerome Plut
+%%
+%% 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
+%% https://www.latex-project.org/lppl.txt
+%% and version 1.3c or later is part of all distributions of LaTeX
+%% version 2008-05-04 or later.
+%%
+%% This work has the LPPL maintenance status "maintained".
+%%
+%% The Current Maintainer of this work is Jerome Plut.
+%%
+%% This work consists of the files `euclidean-lattice.ins`
+%% and `euclidean-lattice.dtx`,
+%% as well as the derived file `euclidean-lattice.sty`.
+
+\input docstrip.tex
+\keepsilent
+\generate{\file{euclidean-lattice.sty}{\from{euclidean-lattice.dtx}{package}}}
+\endbatchfile
Added: trunk/Master/texmf-dist/tex/latex/euclidean-lattice/euclidean-lattice.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/euclidean-lattice/euclidean-lattice.sty (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/euclidean-lattice/euclidean-lattice.sty 2024-11-27 20:55:43 UTC (rev 72985)
@@ -0,0 +1,235 @@
+%%
+%% This is file `euclidean-lattice.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% euclidean-lattice.dtx (with options: `package')
+%%
+%% IMPORTANT NOTICE:
+%%
+%% For the copyright see the source file.
+%%
+%% Any modified versions of this file must be renamed
+%% with new filenames distinct from euclidean-lattice.sty.
+%%
+%% For distribution of the original source see the terms
+%% for copying and modification in the file euclidean-lattice.dtx.
+%%
+%% This generated file may be distributed as long as the
+%% original source files, as listed above, are part of the
+%% same distribution. (The sources need not necessarily be
+%% in the same archive or directory.)
+%% \iffalse
+%% Copyright (C) 2024 Jerome Plut
+%%
+%% 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
+%% https://www.latex-project.org/lppl.txt
+%% and version 1.3c or later is part of all distributions of LaTeX
+%% version 2008-05-04 or later.
+%%
+%% This work has the LPPL maintenance status "maintained".
+%%
+%% The Current Maintainer of this work is Jerome Plut.
+%%
+%% This work consists of the files `euclidean-lattice.ins`
+%% and `euclidean-lattice.dtx`,
+%% as well as the derived file `euclidean-lattice.sty`.
+%% \fi
+
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{euclidean-lattice}[2024-07-26 Euclidean~lattices 1.0]
+\RequirePackage{tikz}
+\newdimen\la at unit \la at unit=256sp
+\def\lattice at mul#1#2{% writes #1*#2 in #1
+ \@tempdimc=#2 \divide\@tempdimc\la at unit
+ \divide #1\la at unit
+ \multiply #1\@tempdimc}%
+\def\lattice at div#1#2{%
+ \@tempdimc=#2\divide\@tempdimc\la at unit
+ \multiply #1\la at unit \divide#1\@tempdimc}%
+\def\lattice at invert#1{% writes 1/#1 in #1
+ \@tempdimc=#1 \divide\@tempdimc\la at unit
+ #1=256\p@ \divide #1\@tempdimc}%
+\newdimen\la at a \newdimen\la at b \newdimen\la at c \newdimen\la at d
+\newdimen\la at Ax\newdimen\la at Bx\newdimen\la at Ay\newdimen\la at By
+\newdimen\la at D
+\newdimen\la at Ux\newdimen\la at Uy \newdimen\la at Vx\newdimen\la at Vy
+\newdimen\la at Cx\newdimen\la at Cy
+
+\newdimen\la at sL \newdimen\la at sM
+\newdimen\la at zA \newdimen\la at zB \newdimen\la at zC
+\newdimen\la at wA \newdimen\la at wB
+\newcount\la at wM
+\def\lattice at enumerate#1#2#3#4{%
+ \la at a=#1\p@ \la at b=#2\p@ \la at c=#3\p@ \la at d=#4\p@
+ \la at D=\la at a \lattice at mul\la at D\la at d
+ \@tempdima=\la at b \lattice at mul\@tempdima\la at c
+ \advance\la at D -\@tempdima
+ \lattice at invert\la at D
+ \la at Ux=\la at Ax \advance\la at Ux-\la at Bx
+ \lattice at mul\la at Ux \la at D
+ \la at Uy=-\la at Ux
+ \lattice at mul\la at Ux \la at d \ifdim\la at Ux <\z@
+ \multiply\la at Ux -1 \multiply\la at Uy -1 \fi
+ \lattice at mul\la at Uy\la at b
+ \la at Vx=\la at By \advance\la at Vx-\la at Ay \lattice at mul\la at Vx\la at D
+ \la at Vy=-\la at Vx
+ \lattice at mul\la at Vx\la at c \ifdim\la at Vx<\z@
+ \multiply\la at Vx -1 \multiply\la at Vy -1\fi
+ \lattice at mul\la at Vy \la at a
+ \@tempdima \la at Ux
+ \@tempdimb \la at Vx
+ \ifdim\@tempdima<100\p@\else
+ \ifdim\@tempdimb<100\p@\else
+ \divide\@tempdima 1024
+ \divide\@tempdimb 1024\fi\fi
+ \lattice at mul\@tempdima\la at Vy
+ \lattice at mul\@tempdimb\la at Uy
+ \ifdim \@tempdimb>\@tempdima
+ \@tempdimc=\la at Ux \la at Ux=\la at Vx \la at Vx=\@tempdimc
+ \@tempdimc=\la at Uy \la at Uy=\la at Vy \la at Vy=\@tempdimc
+ \fi
+ \la at sL=\la at Ax \advance\la at sL\la at Bx \divide\la at sL 2
+ \la at sM=\la at Ay \advance\la at sM\la at By \divide\la at sM 2
+ \la at Cx=\la at sL \lattice at mul\la at Cx\la at d
+ \@tempdima=\la at sM \lattice at mul\@tempdima\la at c
+ \advance\la at Cx -\@tempdima
+ \la at Cy=\la at sM \lattice at mul\la at Cy\la at a
+ \@tempdima=\la at sL \lattice at mul\@tempdima\la at b
+ \advance\la at Cy -\@tempdima
+ \lattice at mul \la at Cx\la at D
+ \lattice at mul \la at Cy\la at D
+ \@tempdima\la at Ux \advance\@tempdima\la at Vx
+ \la at wA=\la at Cx \advance\la at wA -.5\@tempdima
+ \la at wB=\la at wA \advance\la at wB \@tempdima
+ \@tempdima\la at Uy \ifdim\@tempdima<\z@ \multiply\@tempdima -1\fi
+ \ifdim\la at Vy<\z@ \advance\@tempdima -\la at Vy
+ \else\advance\@tempdima\la at Vy\fi
+ \la at zA=\la at Cy \advance\la at zA -.5\@tempdima
+ \la at zB=\la at zA \advance\la at zB \@tempdima
+ \ifx\lattice at grid\@empty\else \begin{scope}%
+ \clip (\strip at pt\la at Ax,\strip at pt\la at Ay)
+ rectangle (\strip at pt\la at Bx,\strip at pt\la at By);
+ \pgftransformcm{\strip at pt\la at a}{\strip at pt\la at b}%
+ {\strip at pt\la at c}{\strip at pt\la at d}{\pgfpointorigin}%
+ \expandafter\draw\expandafter[\lattice at grid]
+ (\strip at pt\la at wA,\strip at pt\la at zA) grid (\strip at pt\la at wB,\strip at pt\la at zB);
+ \end{scope}\fi
+ \@tempdima=\la at Uy \advance\@tempdima\la at Vy
+ \@tempdimb=\la at Cy \advance\@tempdimb .5\@tempdima % z2
+ \@tempdima=\la at Ux \advance\@tempdima\la at Vx % w_2-w_1 = w(U+V)
+ \ifdim\la at Ux=\z@
+ \la at sL=\z@ \la at zC=\maxdimen \la at zA=-\maxdimen
+ \else
+ \la at sL=\la at Uy \lattice at div\la at sL\la at Ux
+ \la at zC=-\@tempdima \lattice at mul\la at zC\la at sL \advance\la at zC \@tempdimb
+ \la at zA=\@tempdimb \advance\la at zA -\la at Uy \advance\la at zA -\la at Vy
+ \fi
+ \ifdim\la at Vx=\z@
+ \la at sM=\z@ \la at zB=-\maxdimen \la at D=\maxdimen
+ \else
+ \la at sM=\la at Vy \lattice at div\la at sM\la at Vx
+ \la at zB=-\@tempdima \lattice at mul\la at zB\la at sM \advance\la at zB \@tempdimb
+ \la at D=\@tempdimb \advance\la at D -\la at Uy \advance\la at D -\la at Vy
+ \fi
+ \la at Vx=\la at wA \advance\la at Vx\expandafter\ifdim\la at Vx>\z@ -1sp\else-\p@\fi
+ \divide\la at Vx \p@
+ \ifdim\la at wB<\z@ \advance\la at wB 1sp\else\advance\la at wB\p@\fi
+ \divide\la at wB\p@
+ \@tempdima=\la at Vx \multiply\@tempdima\p@
+ \advance\@tempdima -\la at wA
+ \@tempdimb=\@tempdima \lattice at mul\@tempdimb\la at sL
+ \advance\la at zA\@tempdimb \advance\la at zC\@tempdimb
+ \@tempdimb=\@tempdima \lattice at mul\@tempdimb\la at sM
+ \advance\la at zB\@tempdimb \advance\la at D\@tempdimb
+ \la at Cx=\la at a \multiply\la at Cx\la at Vx
+ \la at Cy=\la at b \multiply\la at Cy\la at Vx
+ \loop
+ \la at Vy=\la at zA \ifdim\la at Vy<\la at zB \la at Vy=\la at zB\fi
+ \advance\la at Vy\expandafter\ifdim\la at Vy>\z@ -1sp\else-\p@\fi
+ \divide\la at Vy\p@
+ \la at wM=\la at zC \ifnum\la at wM>\la at D \la at wM=\la at D\fi
+ \advance\la at wM\expandafter\ifnum\la at wM<\z@\@ne\else\p@\fi
+ \divide\la at wM\p@
+ \la at Ux=\la at c \multiply\la at Ux\la at Vy \advance\la at Ux\la at Cx
+ \la at Uy=\la at d \multiply\la at Uy\la at Vy \advance\la at Uy\la at Cy
+ {\loop
+ \ifdim\la at Ux<\la at Ax\else\ifdim\la at Ux>\la at Bx\else
+ \ifdim\la at Uy<\la at Ay\else\ifdim\la at Uy>\la at By\else
+ \expandafter\lattice at donode\expandafter{\lattice at node}%
+ \fi\fi\fi\fi
+ \ifnum\la at Vy<\la at wM
+ \advance\la at Vy 1sp
+ \advance\la at Ux\la at c \advance\la at Uy\la at d
+ \repeat}
+ \ifnum\la at Vx<\la at wB
+ \advance\la at Vx 1sp
+ \advance\la at Cx\la at a \advance\la at Cy\la at b
+ \advance\la at zA \la at sL \advance\la at zC \la at sL
+ \advance\la at zB \la at sM \advance\la at D \la at sM
+ \repeat
+}
+\def\lattice at donode#1{%
+ \pgfkeys{/lattice/arg/each point={#1}{\strip at pt\la at Ux}{\strip at pt\la at Uy}%
+ {\number\la at Vx}{\number\la at Vy}}}
+
+\pgfqkeys{/lattice/arg}{
+ x/.store in=\lattice at x,
+ y/.store in=\lattice at y,
+ grid/.store in=\lattice at grid,
+ each point/.code n args={5}{\pgfkeys{/lattice/each point={#1}{#2}{#3}{#4}{#5}}},
+ bounding box/.store in=\lattice at bbox,
+ .unknown/.code={%
+ \expandafter\lattice at setnode\pgfkeyscurrentkey=#1\lattice at eov
+ }}
+\pgfqkeys{/lattice}{
+ x/.initial=-2:2,y/.initial=-2:2,
+ node/.initial={circle,inner sep=1pt,draw=none,fill=black},
+ grid/.style={/lattice/arg/grid/.default={#1}},
+ grid={gray,very thin},
+ bounding box/.style={/lattice/arg/bounding box/.default={#1}},
+ bounding box={cyan,thin},
+ each point/.code n args={5}{\node[#1] at (#2,#3){};},
+}
+\def\lattice at setnode/lattice/arg/#1\lattice at eov{%
+ \edef\lattice at node{\expandafter\noexpand\lattice at node,#1}}
+\def\lattice at getxy#1#2#3{%
+ \def\m at gic##1:##2:##3\end{\ifx ##3: #2=##1\p@ #3=##2\p@\else
+ #2=-##1\p@ #3=##1\p@\fi}%
+ \expandafter\m at gic\detokenize{#1:}:\end
+}
+\def\lattice{\@ifnextchar<\lattice at I{\@ifnextchar[\lattice at II{\lattice@@[]}}}
+\def\lattice at I{\ifnum\the\catcode`\;=\active\relax
+ \let\lattice at next\lattice at Iactive\else
+ \let\lattice at next\lattice at Inormal\fi
+ \lattice at next}
+\long\def\lattice at Inormal<#1>#2;{\alt<#1>{\lattice at I@#2;}{}}
+{\catcode`\;=\active
+ \long\gdef\lattice at Iactive<#1>#2;{\alt<#1>{\lattice at I@#2;}{}}
+}
+\def\lattice at I@{\@ifnextchar[\lattice@@{\lattice@@[]}}
+\def\lattice at II[#1]{\@ifnextchar<{\lattice at IIi[#1]}{\lattice@@[#1]}}
+\def\lattice at IIi[#1]<#2>{\lattice at I<#2>[#1]}
+\def\lattice@@[#1](#2,#3)#4(#5,#6)#7{
+ \let\lattice at grid\@empty%
+ \let\lattice at bbox\@empty%
+ \edef\lattice at x{\pgfkeysvalueof{/lattice/x}}%
+ \edef\lattice at y{\pgfkeysvalueof{/lattice/y}}%
+ \edef\lattice at node{\pgfkeysvalueof{/lattice/node}}%
+ \pgfqkeys{/lattice/arg}{#1}%
+ \expandafter\lattice at getxy\expandafter{\lattice at x}\la at Ax\la at Bx
+ \expandafter\lattice at getxy\expandafter{\lattice at y}\la at Ay\la at By
+ \ifx\lattice at bbox\@empty\else
+ \expandafter\draw\expandafter[\lattice at bbox]
+ (\strip at pt\la at Ax,\strip at pt\la at Ay)
+ rectangle (\strip at pt\la at Bx,\strip at pt\la at By);
+ \fi
+ \lattice at enumerate{#2}{#3}{#5}{#6}%
+}
+\endinput
+%%
+%% End of file `euclidean-lattice.sty'.
Property changes on: trunk/Master/texmf-dist/tex/latex/euclidean-lattice/euclidean-lattice.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/tlpkg/bin/tlpkg-ctan-check
===================================================================
--- trunk/Master/tlpkg/bin/tlpkg-ctan-check 2024-11-27 20:55:13 UTC (rev 72984)
+++ trunk/Master/tlpkg/bin/tlpkg-ctan-check 2024-11-27 20:55:43 UTC (rev 72985)
@@ -317,7 +317,7 @@
eso-pic esrelation esstix estcpmm esvect
etaremune etbb etdipa etex-pkg etexcmds etextools ethiop ethiop-t1 etl
etoc etoolbox etoolbox-de etoolbox-generic etsvthor
- euclideangeometry euenc euflag eukdate
+ euclidean-lattice euclideangeometry euenc euflag eukdate
euler euler-math eulerpx eulervm
euro euro-ce euromoney europasscv europecv eurosym
evangelion-jfm everyhook everypage everysel everyshi
Modified: trunk/Master/tlpkg/tlpsrc/collection-mathscience.tlpsrc
===================================================================
--- trunk/Master/tlpkg/tlpsrc/collection-mathscience.tlpsrc 2024-11-27 20:55:13 UTC (rev 72984)
+++ trunk/Master/tlpkg/tlpsrc/collection-mathscience.tlpsrc 2024-11-27 20:55:43 UTC (rev 72985)
@@ -96,6 +96,7 @@
depend eqexpl
depend eqnarray
depend eqnnumwarn
+depend euclidean-lattice
depend euclideangeometry
depend extarrows
depend extpfeil
Added: trunk/Master/tlpkg/tlpsrc/euclidean-lattice.tlpsrc
===================================================================
More information about the tex-live-commits
mailing list.