diff options
author | Norbert Preining <norbert@preining.info> | 2023-03-06 03:05:29 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2023-03-06 03:05:29 +0000 |
commit | 75cd005305bd2c2a0ec383f30ee5b1749ed15183 (patch) | |
tree | 65b5e6b912547ab4610badf5a7f61ce70e5aad02 /graphics | |
parent | a2d17a09f7ecd91acd8826216349bb14cc5602cd (diff) |
CTAN sync 202303060305
Diffstat (limited to 'graphics')
-rw-r--r-- | graphics/pgf/contrib/causets/README.md | 4 | ||||
-rw-r--r-- | graphics/pgf/contrib/causets/causet_tikz_example1.pdf | bin | 18369 -> 19196 bytes | |||
-rw-r--r-- | graphics/pgf/contrib/causets/causet_tikz_example1.tex | 6 | ||||
-rw-r--r-- | graphics/pgf/contrib/causets/causets.pdf | bin | 483657 -> 691844 bytes | |||
-rw-r--r-- | graphics/pgf/contrib/causets/causets.sty | 376 | ||||
-rw-r--r-- | graphics/pgf/contrib/causets/causets.tex | 591 | ||||
-rw-r--r-- | graphics/pgf/contrib/outilsgeomtikz/README.md | 7 | ||||
-rw-r--r-- | graphics/pgf/contrib/outilsgeomtikz/doc/OutilsGeomTikz-doc.pdf | bin | 0 -> 383232 bytes | |||
-rw-r--r-- | graphics/pgf/contrib/outilsgeomtikz/doc/OutilsGeomTikz-doc.tex | 792 | ||||
-rw-r--r-- | graphics/pgf/contrib/outilsgeomtikz/tex/OutilsGeomTikz.sty | 620 |
10 files changed, 2006 insertions, 390 deletions
diff --git a/graphics/pgf/contrib/causets/README.md b/graphics/pgf/contrib/causets/README.md index 76e8b4593f..ca22ea3889 100644 --- a/graphics/pgf/contrib/causets/README.md +++ b/graphics/pgf/contrib/causets/README.md @@ -33,7 +33,7 @@ Bug reports can be send to the maintainer: christoph{dot}minz[AT]gmail{dot}com ## License and distribution -Copyright 2020-2022 by C. Minz +Copyright 2020-2023 by C. Minz This work may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.3 of this licence or (at your option) any later version. The latest version of this licence is in @@ -44,7 +44,7 @@ This work has the LPPL maintenance status "maintained". The current maintainer of this work is C. Minz. https://github.com/c-minz -**Current version: v1.3** +**Current package version: v1.4 (2023/03/06)** CTAN location: /graphics/pgf/contrib/causets/ diff --git a/graphics/pgf/contrib/causets/causet_tikz_example1.pdf b/graphics/pgf/contrib/causets/causet_tikz_example1.pdf Binary files differindex 2ebdf2ce48..31e9ed1480 100644 --- a/graphics/pgf/contrib/causets/causet_tikz_example1.pdf +++ b/graphics/pgf/contrib/causets/causet_tikz_example1.pdf diff --git a/graphics/pgf/contrib/causets/causet_tikz_example1.tex b/graphics/pgf/contrib/causets/causet_tikz_example1.tex index dfbe3abf76..b1c1f10ad1 100644 --- a/graphics/pgf/contrib/causets/causet_tikz_example1.tex +++ b/graphics/pgf/contrib/causets/causet_tikz_example1.tex @@ -9,15 +9,15 @@ \drawpcauset{5,2,7,3,6,1,4} \draw[red, double] (0, 0) circle[radius=0.1]; \end{scope} - % Circumscribe the future infinity: + % Mark the maximal elements (future infinity): \node[draw=blue, inner sep=1pt, thick, ellipse, fit=(E2) (E4) (E5)] (Finf) {}; % Add labels on top: - \node[draw=blue, right, align=right] (FinfLabel) at (4.8, -0.5) {future infinity / \\ maximal events}; + \node[draw=blue, right, align=right] (FinfLabel) at (4.8, -0.5) {maximal events / \\ (future infinity)}; \node[draw=red] (centerLabel) at (0.5, -0.5) {centre}; \node[draw=green!50!black] (myEventLabel) at (5.5, -2.5) {event (E0)}; % Draw arrows from the labels to the references: \draw[ultra thick, blue, ->] (FinfLabel) -- (Finf); - \draw[ultra thick, red, ->] (centerLabel) -- (3, -1); + \draw[ultra thick, red, ->] (centerLabel) -- (3, -1); % centre was shifted by the scope \draw[ultra thick, green!50!black, ->] (myEventLabel) -- (E0); \end{tikzpicture} \end{document} diff --git a/graphics/pgf/contrib/causets/causets.pdf b/graphics/pgf/contrib/causets/causets.pdf Binary files differindex b6a2ccd03f..1409edc2c8 100644 --- a/graphics/pgf/contrib/causets/causets.pdf +++ b/graphics/pgf/contrib/causets/causets.pdf diff --git a/graphics/pgf/contrib/causets/causets.sty b/graphics/pgf/contrib/causets/causets.sty index 291537cb9e..0b9912dc80 100644 --- a/graphics/pgf/contrib/causets/causets.sty +++ b/graphics/pgf/contrib/causets/causets.sty @@ -1,6 +1,6 @@ \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{causets}[2022/05/23 v1.3 Package to draw causal set diagrams] -%% Copyright 2020-2022 by C. Minz +\ProvidesPackage{causets}[2023/03/06 v1.4 Package to draw causal set diagrams] +%% Copyright 2020-2023 by C. Minz % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 @@ -10,7 +10,7 @@ % % This work has the LPPL maintenance status "maintained". % -% The current version of this package is 1.3. +% The current version of this package is 1.4. % % The current maintainer of this work is C. Minz. % https://github.com/c-minz @@ -131,9 +131,12 @@ } % Causet modification options: \tikzcausetsset{% + padding/.store in=\causets@Padding, offset/.store in=\causet@Offset, every causet/.value forbidden, - every causet/.style={baseline=(baseline point)} + every causet/.style={baseline=(baseline point)}, + local style/.style={#1}, + set local style/.style={local style/.expand once={#1}} } % Graphic component switches: \newif\ifcausetsDrawPermutation @@ -182,7 +185,6 @@ every label base/.value forbidden, every label base/.style={text opacity=1, scale=\causetTextScale, font=\causetTextFont, inner sep=0pt}, all labels/.style={every label base/.append style={#1}}, - at/.initial=center, every label/.value forbidden, every label/.style={every label base, color=\pgfkeysvalueof{/tikz/causets/label color}, below left, at=south west}, labels/.style={show labels, every label/.append style={#1}}, @@ -194,7 +196,10 @@ vlabels/.style={show vlabels, every vlabel/.append style={#1}}, every replaced label/.value forbidden, every replaced label/.style={every label}, - replaced labels/.style={every replaced label/.append style={#1}} + replaced labels/.style={every replaced label/.append style={#1}}, + at/.initial=center, + label/.store in=\causet@EventLabel, + label/.value required } % Event styles: \tikzcausetsset{% @@ -205,7 +210,9 @@ every replaced event/.value forbidden, every replaced event/.style={every label base, circle, minimum size=\pgfkeysvalueof{/tikz/causets/event size}}, replaced events/.value required, - replaced events/.style={every replaced event/.append style={#1}} + replaced events/.style={every replaced event/.append style={#1}}, + event/.store in=\causet@EventText, + event/.value required } % Link styles: \tikzcausetsset{% @@ -227,18 +234,28 @@ cap links/.value forbidden, cap links/.style={link starts={Triangle Cap[reversed]}, link ends={Triangle Cap[]}}, arrow links/.value forbidden, - arrow links/.style={link ends={Stealth[round, open, length=4*\pgfkeysvalueof{/tikz/causets/link width}, line width=\pgfkeysvalueof{/tikz/causets/link width}/3]}}, + arrow links/.style={link ends={Stealth[round, length=4*\pgfkeysvalueof{/tikz/causets/link width}, line width=\pgfkeysvalueof{/tikz/causets/link width}/3]}}, every spatial link/.value forbidden, every spatial link/.style={every link, color=\pgfkeysvalueof{/tikz/causets/spatial link color}, dashed}, spatial links/.style={show spatial links, every spatial link/.append style={#1}} } +% Causet externalisation: +\newif\ifcausets@External +\newif\ifcausetsNameExternal +\tikzcausetsset{% + name/.store in=\causet@Name, + name prefix/.store in=\causets@NamePrefix, + set prefix/.style={name prefix=#1, /tikz/external/prefix=#1}, + name external/.is if=causetsNameExternal +} %% Package options: -\tikzcausetsset{normal, offset=0} +\tikzcausetsset{normal, offset=0, padding=\thinspace, name prefix={./}} \causetsDrawLinkstrue \causetsBreakLinkstrue \causetsDrawULabelstrue \causetsDrawVLabelstrue +\causets@Externalfalse \DeclareOption{tiny}{\tikzcausetsset{tiny}} \DeclareOption{smaller}{\tikzcausetsset{very small}} \DeclareOption{small}{\tikzcausetsset{small}} @@ -262,15 +279,34 @@ \DeclareOption{uunlabeled}{\causetsDrawULabelsfalse} \DeclareOption{vlabeled}{\causetsDrawVLabelstrue} \DeclareOption{vunlabeled}{\causetsDrawVLabelsfalse} +\DeclareOption{external}{\causets@Externaltrue} \DeclareOption*{\PackageWarning{causets}{The package causets does not support the option: \CurrentOption}} -\ProcessOptions\relax +\ProcessOptions* +\ifcausets@External + \usetikzlibrary{external}% + \tikzcausetsset{name prefix=causets/, name external=true}% + \tikzexternalize[prefix=causets/] +\fi %% Package functions: \newif\ifcauset@ItemFoundInList +\newcommand*{\causets@setCausetName}[1]{% +{% +\def\causet@Name{}% +\tikzcausetsset{#1}% +\ifx\causet@Name\empty% + \relax% +\else% + \expandafter\tikzsetnextfilename\expandafter{\causet@Name}% +\fi% +}% +} + \newcommand*{\causets@prepareCauset}[1]{% -% Count the number of events (\causet@N), find the minimal value in the list argument (\causet@Start), and define baseline point. -\foreach \causet@E@i/\causet@Label/\causet@Text [count=\causet@i] in {#1}{% +% Count the number of events (\causet@N), find the minimal value in the list +% argument (\causet@Start), and define baseline point. +\foreach \causet@E@i/\causet@LocalStyle [count=\causet@i] in {#1}{% \ifnum\causet@i=1 \pgfmathparse{int(\causet@E@i)} \else @@ -284,29 +320,35 @@ } \newcommand*{\causets@drawEvent}[2][every event]{% -% Draws the event node for \causet@E@i. By default the event style (optional argument #1) is that of every event. The text of the node is #2. +% Draws an event tile and the event on top. +\pgfmathsetmacro\causet@E@i{int(\causet@E@i + \causet@Offset)} +\pgfmathsetmacro\causet@u{\causet@E@i - \causet@Start} +\pgfmathsetmacro\causet@v{\causet@i - 1.0} +\ifcausetsDrawPermutation + \path[causets/.cd, every tile] + ( \causet@u * \causetTileSize, \causet@v * \causetTileSize ) + rectangle +( \causetTileSize, \causetTileSize ); +\fi \pgfmathsetmacro\causet@u{\causet@E@i - \causet@Start + 0.5} \pgfmathsetmacro\causet@v{\causet@i - 0.5} \node[causets/.cd, #1] (E\causet@E@i) - at ( \causet@u * \causetTileSize, \causet@v * \causetTileSize ) - {#2}; + at ( \causet@u * \causetTileSize, \causet@v * \causetTileSize ) {#2}; } \newcommand*{\causets@drawEvents}[1]{% -% Draws a permutation tile and defines and draws an event node (E#) on top of the tile, for each event number # in the list argument. -\foreach \causet@E@i/\causet@Label/\causet@Text [count=\causet@i] in {#1}{% - \pgfmathsetmacro\causet@E@i{int(\causet@E@i + \causet@Offset)} - \pgfmathsetmacro\causet@u{\causet@E@i - \causet@Start} - \pgfmathsetmacro\causet@v{\causet@i - 1.0} - \ifcausetsDrawPermutation - \path[causets/.cd, every tile] - ( \causet@u * \causetTileSize, \causet@v * \causetTileSize ) - rectangle +( \causetTileSize, \causetTileSize ); - \fi - \ifx\causet@Text\causet@Label +% Draws a permutation tile and defines and draws an event node (E#) on top of +% the tile, for each event number # in the list argument. +\foreach \causet@E@i/\causet@LocalStyle [count=\causet@i] in {#1}{% + \ifx\causet@E@i\causet@LocalStyle \causets@drawEvent{} \else - \causets@drawEvent[every replaced event]{\causet@Text} + \def\causet@EventText{} + \tikzcausetsset{set local style=\causet@LocalStyle} + \ifx\causet@EventText\empty + \causets@drawEvent[every event, set local style=\causet@LocalStyle]{} + \else + \causets@drawEvent[every replaced event, set local style=\causet@LocalStyle]{\causet@EventText} + \fi \fi } } @@ -318,7 +360,7 @@ grid ( \causet@N * \causetTileSize, \causet@N * \causetTileSize ); \draw[causets/.cd, every region] ( 0, 0 ) rectangle ( \causet@N * \causetTileSize, \causet@N * \causetTileSize ); - \foreach \causet@E@i/\causet@Label/\causet@Text [count=\causet@i] in {#1}{% + \foreach \causet@E@i/\causet@LocalStyle [count=\causet@i] in {#1}{% \pgfmathsetmacro\causet@E@i{int(\causet@E@i + \causet@Offset)} \ifcausetsDrawULabels \pgfmathsetmacro\causet@u{int(\causet@i + \causet@Start - 1)} @@ -336,19 +378,21 @@ } \newcommand*{\causets@drawSpatialLinks}[1]{% -% Draws the spatial links between the events (only for \drawpcauset and \drawrcauset). +% Draws the spatial links between the events (only for \drawpcauset and +% \drawrcauset). \ifcausetsDrawSpatialLinks - \foreach \causet@E@i/\causet@Label/\causet@Text [count=\causet@i] in {#1}{% + \foreach \causet@E@i/\causet@LocalStyle [count=\causet@i] in {#1}{% \pgfmathsetmacro\causet@E@i{int(\causet@E@i + \causet@Offset)} % \causet@Bound stores the lower bound to find spatially linked events. \edef\causet@Bound{\causet@Offset} - \foreach \causet@E@j/\causet@Label/\causet@Text [count=\causet@j] in {#1}{% + \foreach \causet@E@j/\causet@LocalStyle [count=\causet@j] in {#1}{% \ifnum\causet@j>\causet@i \pgfmathsetmacro\causet@E@j{int(\causet@E@j + \causet@Offset)} \ifnum\causet@E@j>\causet@Bound \ifnum\causet@E@i>\causet@E@j % Add spatial link and remember new lower bound: - \draw[causets/.cd, every spatial link] (E\causet@E@j) -- (E\causet@E@i); + \draw[causets/.cd, every spatial link] + (E\causet@E@j) -- (E\causet@E@i); \xdef\causet@Bound{\causet@E@j} \fi \fi @@ -358,30 +402,118 @@ \fi } -\newcommand*{\causets@drawEventLabel}[1][every label]{% -% Draws the event label for \causet@E@i (shifted by \causet@Offset). By default the label style is assumed that of a standard event label. +\newcommand*{\causets@drawEventLabel}[2][every label]{% +% Draws an event label. \pgfmathsetmacro\causet@E@i{int(\causet@E@i + \causet@Offset)} \node[causets/.cd, #1] (EL\causet@E@i) - at (E\causet@E@i.\pgfkeysvalueof{/tikz/causets/at}) {\causet@Label}; + at (E\causet@E@i.\pgfkeysvalueof{/tikz/causets/at}) {#2}; } \newcommand*{\causets@drawEventLabels}[1]{% % Adds event labels to the events. -\foreach \causet@E@i/\causet@Label/\causet@Text in {#1}{% - \ifx\causet@E@i\causet@Label +\foreach \causet@E@i/\causet@LocalStyle in {#1}{% + \ifx\causet@E@i\causet@LocalStyle \ifcausetsDrawLabels - \causets@drawEventLabel + \causets@drawEventLabel{\causet@E@i} \fi \else - \ifx\causet@Label\empty - \relax% Skip empty labels + \def\causet@EventLabel{} + \tikzcausetsset{set local style=\causet@LocalStyle} + \ifx\causet@EventLabel\empty + \ifcausetsDrawLabels + \causets@drawEventLabel{\causet@E@i} + \fi \else - \causets@drawEventLabel[every replaced label] + \causets@drawEventLabel[every replaced label]{\causet@EventLabel} \fi \fi } } +\newcommand*{\causets@drawContinuousLinks}[2][]{% +% Draws the links in full even if they cross over events. +\foreach \causet@From/\causet@To/\causet@LocalLinkStyle in {#2}{% + \ifx\causet@To\causet@LocalLinkStyle + \gdef\causet@LocalLinkStyle{#1} + \fi + \pgfmathsetmacro\causet@From{int(\causet@From + \causet@Offset)} + \pgfmathsetmacro\causet@To{int(\causet@To + \causet@Offset)} + \draw[causets/.cd, every link, set local style=\causet@LocalLinkStyle] + (E\causet@From) -- (E\causet@To); +} +} + +\newcommand*{\causets@drawBrokenLinks}[3][]{% +% Tests every link if it crosses over an unlinked event and breaks the link. +\foreach \causet@From/\causet@To/\causet@LocalLinkStyle in {#3}{% + \ifx\causet@To\causet@LocalLinkStyle + \gdef\causet@LocalLinkStyle{#1} + \fi + % In this function, \causet@u and \causet@v store the link distance in + % the u- and in the v-direction, respectively. Since these are coordinate + % differences, they are computed without adding the offset. + \pgfmathsetmacro\causet@u{int(\causet@To) - int(\causet@From)} + \foreach \causet@E@i/\causet@LocalStyle [count=\causet@i] in {#2}{% + \ifnum\causet@E@i=\causet@From + \xdef\causet@v{\causet@i} + \fi + \ifnum\causet@E@i=\causet@To + \pgfmathparse{int(\causet@i - \causet@v)} + \xdef\causet@v{\pgfmathresult} + \breakforeach + \fi + } + % Now add offset to events: + \pgfmathsetmacro\causet@From{int(\causet@From + \causet@Offset)} + \pgfmathsetmacro\causet@To{int(\causet@To + \causet@Offset)} + % In this function, \causet@E@j stores the last breaking point and + % \causet@j the index of \causet@From. + \pgfmathsetmacro\causet@E@j{int(\causet@From - 1)} + \edef\causet@j{0} + \foreach \causet@E@i/\causet@LocalStyle [count=\causet@i] in {#2}{% + \pgfmathsetmacro\causet@E@i{int(\causet@E@i + \causet@Offset)} + \ifnum\causet@E@i=\causet@To + \edef\causet@j{0} + \breakforeach + \fi + \ifnum\causet@j>0 + % If the u-/v-coordinate ratio is the same, the event \causet@E@i falls + % along the link and the link needs to break. The ratios are compared + % via cross-multiplication, which is faster and does not cause + % rounding errors: + \pgfmathequal{int((\causet@E@i - \causet@From) * \causet@v)}{int(\causet@u * (\causet@i - \causet@j)))} + \ifnum\pgfmathresult=1 + \ifnum\causet@E@j<\causet@From + % Link is crossing over another event, so draw the link up to the + % (first) breaking point: + \draw[causets/.cd, every link, {Link Start}-{Link Pause}, shorten >=\pgfkeysvalueof{/tikz/causets/broken link gap}, set local style=\causet@LocalLinkStyle] + (E\causet@From) -- (E\causet@E@i); + \else + % Link is crossing over yet another event, so continue from last + % breaking point to next breaking point: + \draw[causets/.cd, every link, {Link Resume}-{Link Pause}, shorten <=\pgfkeysvalueof{/tikz/causets/broken link gap}, shorten >=\pgfkeysvalueof{/tikz/causets/broken link gap}, set local style=\causet@LocalLinkStyle] + (E\causet@E@j) -- (E\causet@E@i); + \fi + \xdef\causet@E@j{\causet@E@i} + \fi + \fi + \ifnum\causet@E@i=\causet@From + \xdef\causet@j{\causet@i} + \fi + } + \ifnum\causet@E@j>\causet@From + % Link did cross over another event, so finish the link from last + % breaking point to final event: + \draw[causets/.cd, every link, {Link Resume}-{Link End}, shorten <=\pgfkeysvalueof{/tikz/causets/broken link gap}, set local style=\causet@LocalLinkStyle] + (E\causet@E@j) -- (E\causet@To); + \else + % Link does not cross over another event, so just draw it: + \draw[causets/.cd, every link, set local style=\causet@LocalLinkStyle] + (E\causet@From) -- (E\causet@To); + \fi +} +} + \newcommand*{\drawpcauset}[1]{% % Draws a causet from a permutation. \causets@prepareCauset{#1} @@ -390,18 +522,20 @@ yshift=-\causet@N * \causetTileSize / 2] \causets@drawEvents{#1} \causets@drawPermutation{#1} + \causets@drawSpatialLinks{#1} \ifcausetsDrawLinks - \foreach \causet@E@i/\causet@Label/\causet@Text [count=\causet@i] in {#1}{% + \foreach \causet@E@i/\causet@LocalStyle [count=\causet@i] in {#1}{% \pgfmathsetmacro\causet@E@i{int(\causet@E@i + \causet@Offset)} % \causet@Bound stores the upper bound to find linked events. \pgfmathsetmacro\causet@Bound{int(\causet@N + \causet@Start)} - \foreach \causet@E@j/\causet@Label/\causet@Text [count=\causet@j] in {#1}{% + \foreach \causet@E@j/\causet@LocalStyle [count=\causet@j] in {#1}{% \ifnum\causet@j>\causet@i \pgfmathsetmacro\causet@E@j{int(\causet@E@j + \causet@Offset)} \ifnum\causet@E@j<\causet@Bound \ifnum\causet@E@i<\causet@E@j % Add link and remember new upper bound: - \draw[causets/.cd, every link] (E\causet@E@i) -- (E\causet@E@j); + \draw[causets/.cd, every link] + (E\causet@E@i) -- (E\causet@E@j); \xdef\causet@Bound{\causet@E@j} \fi \fi @@ -409,7 +543,6 @@ } } \fi - \causets@drawSpatialLinks{#1} \causets@drawEventLabels{#1} \end{scope} \end{scope} @@ -425,69 +558,9 @@ \causets@drawPermutation{#1} \ifcausetsDrawLinks \ifcausetsBreakLinks - % Broken links are allowed, so test every link if it crosses over an unlinked event: - \foreach \causet@From/\causet@To in {#2}{% - % In this function, \causet@u and \causet@v store the link distance in the u- and in the v-direction, respectively. Since these are coordinate differences, they are computed without adding the offset. - \pgfmathsetmacro\causet@u{int(\causet@To) - int(\causet@From)} - \foreach \causet@E@i/\causet@Label/\causet@Text [count=\causet@i] in {#1}{% - \ifnum\causet@E@i=\causet@From - \xdef\causet@v{\causet@i} - \fi - \ifnum\causet@E@i=\causet@To - \pgfmathparse{int(\causet@i - \causet@v)} - \xdef\causet@v{\pgfmathresult} - \breakforeach - \fi - } - % Now add offset to events: - \pgfmathsetmacro\causet@From{int(\causet@From + \causet@Offset)} - \pgfmathsetmacro\causet@To{int(\causet@To + \causet@Offset)} - % In this function, \causet@E@j stores the last breaking point and \causet@j the index of \causet@From. - \pgfmathsetmacro\causet@E@j{int(\causet@From - 1)} - \edef\causet@j{0} - \foreach \causet@E@i/\causet@Label/\causet@Text [count=\causet@i] in {#1}{% - \pgfmathsetmacro\causet@E@i{int(\causet@E@i + \causet@Offset)} - \ifnum\causet@E@i=\causet@To - \edef\causet@j{0} - \breakforeach - \fi - \ifnum\causet@j>0 - % If the u-/v-coordinate ratio is the same, the event \causet@E@i falls along the link and the link needs to break. The ratios are compared via cross-multiplication, which is faster and does not cause rounding errors: - \pgfmathequal{int((\causet@E@i - \causet@From) * \causet@v)}{int(\causet@u * (\causet@i - \causet@j)))} - \ifnum\pgfmathresult=1 - \ifnum\causet@E@j<\causet@From - % Link is crossing over another event, so draw the link up to the (first) breaking point: - \draw[causets/.cd, every link, {Link Start}-{Link Pause}, shorten >=\pgfkeysvalueof{/tikz/causets/broken link gap}] - (E\causet@From) -- (E\causet@E@i); - \else - % Link is crossing over yet another event, so continue from last breaking point to next breaking point: - \draw[causets/.cd, every link, {Link Resume}-{Link Pause}, shorten <=\pgfkeysvalueof{/tikz/causets/broken link gap}, shorten >=\pgfkeysvalueof{/tikz/causets/broken link gap}] - (E\causet@E@j) -- (E\causet@E@i); - \fi - \xdef\causet@E@j{\causet@E@i} - \fi - \fi - \ifnum\causet@E@i=\causet@From - \xdef\causet@j{\causet@i} - \fi - } - \ifnum\causet@E@j>\causet@From - % Link did cross over another event, so finish the link from last breaking point to final event: - \draw[causets/.cd, every link, {Link Resume}-{Link End}, shorten <=\pgfkeysvalueof{/tikz/causets/broken link gap}] - (E\causet@E@j) -- (E\causet@To); - \else - % Link does not cross over another event, so just draw it: - \draw[causets/.cd, every link] - (E\causet@From) -- (E\causet@To); - \fi - } + \causets@drawBrokenLinks{#1}{#2} \else - % Broken links are not allowed, so just draw the links: - \foreach \causet@From/\causet@To in {#2}{% - \pgfmathsetmacro\causet@From{int(\causet@From + \causet@Offset)} - \pgfmathsetmacro\causet@To{int(\causet@To + \causet@Offset)} - \draw[causets/.cd, every link] (E\causet@From) -- (E\causet@To); - } + \causets@drawContinuousLinks{#2} \fi \fi \causets@drawEventLabels{#1} @@ -496,26 +569,39 @@ } \newcommand*{\drawrcauset}[2]{% -% Draws a causet from a permutation and ignoring links given in the second list argument (of link-pairs). +% Draws a causet from a permutation and ignoring links given in the second +% list argument (of link-pairs). \causets@prepareCauset{#1} \begin{scope}[rotate=45] \begin{scope}[xshift=-\causet@N * \causetTileSize / 2, yshift=-\causet@N * \causetTileSize / 2] \causets@drawEvents{#1} \causets@drawPermutation{#1} + \causets@drawSpatialLinks{#1} + % Add omitted links as spatial links: + \ifcausetsDrawSpatialLinks + \foreach \causet@From/\causet@To/\causet@LocalLinkStyle in {#2}{% + \ifx\causet@To\causet@LocalLinkStyle + \pgfmathsetmacro\causet@From{int(\causet@From + \causet@Offset)} + \pgfmathsetmacro\causet@To{int(\causet@To + \causet@Offset)} + \draw[causets/.cd, every spatial link] + (E\causet@From) -- (E\causet@To); + \fi + } + \fi \ifcausetsDrawLinks - \foreach \causet@E@i/\causet@Label/\causet@Text [count=\causet@i] in {#1}{% + \foreach \causet@E@i/\causet@LocalStyle [count=\causet@i] in {#1}{% \pgfmathsetmacro\causet@E@i{int(\causet@E@i + \causet@Offset)} % \causet@Bound stores the upper bound to find linked events. \pgfmathsetmacro\causet@Bound{int(\causet@N + \causet@Start)} - \foreach \causet@E@j/\causet@Label/\causet@Text [count=\causet@j] in {#1}{% + \foreach \causet@E@j/\causet@LocalStyle [count=\causet@j] in {#1}{% \ifnum\causet@j>\causet@i \pgfmathsetmacro\causet@E@j{int(\causet@E@j + \causet@Offset)} \ifnum\causet@E@j<\causet@Bound \ifnum\causet@E@i<\causet@E@j % Check second list argument if the link has to be ignored: \global\causet@ItemFoundInListfalse - \foreach \causet@From/\causet@To in {#2}{% + \foreach \causet@From/\causet@To/\causet@LocalLinkStyle in {#2}{% \pgfmathparse{and(int(\causet@From + \causet@Offset) == int(\causet@E@i), int(\causet@To + \causet@Offset) == int(\causet@E@j))} \ifnum\pgfmathresult=1 \global\causet@ItemFoundInListtrue @@ -525,7 +611,8 @@ \relax% Skip link as it is included in the second argument. \else % Draw link as it is not included in the second argument: - \draw[causets/.cd, every link] (E\causet@E@i) -- (E\causet@E@j); + \draw[causets/.cd, every link] + (E\causet@E@i) -- (E\causet@E@j); \fi % Remember new upper bound: \xdef\causet@Bound{\causet@E@j} @@ -534,15 +621,11 @@ \fi } } - \fi - \causets@drawSpatialLinks{#1} - % Add omitted links as spatial links: - \ifcausetsDrawSpatialLinks - \foreach \causet@From/\causet@To in {#2}{% - \pgfmathsetmacro\causet@From{int(\causet@From + \causet@Offset)} - \pgfmathsetmacro\causet@To{int(\causet@To + \causet@Offset)} - \draw[causets/.cd, every spatial link] (E\causet@From) -- (E\causet@To); - } + \ifcausetsBreakLinks + \causets@drawBrokenLinks[draw=none]{#1}{#2} + \else + \causets@drawContinuousLinks[draw=none]{#2} + \fi \fi \causets@drawEventLabels{#1} \end{scope} @@ -551,21 +634,48 @@ \newcommand*{\pcauset}[2][]{% % Inserts a TikZ picture with a causet, created from a permutation. -\begin{tikzpicture}[causets/.cd, every causet, #1]\drawpcauset{#2}\end{tikzpicture}} +\causets@Padding% +\ifcausetsNameExternal% + \causets@setCausetName{#1}% +\fi% +\begin{tikzpicture}[causets/.cd, every causet, #1]% +\drawpcauset{#2}% +\end{tikzpicture}% +\causets@Padding% +} \newcommand*{\causet}[3][]{% -% Inserts a TikZ picture with a causet, created from a permutation and a link-pair list. -\begin{tikzpicture}[causets/.cd, every causet, #1]\drawcauset{#2}{#3}\end{tikzpicture}} +% Inserts a TikZ picture with a causet, created from a permutation and a +% link-pair list. +\causets@Padding% +\ifcausetsNameExternal% + \causets@setCausetName{#1}% +\fi% +\begin{tikzpicture}[causets/.cd, every causet, #1]% +\drawcauset{#2}{#3}% +\end{tikzpicture}% +\causets@Padding% +} \newcommand*{\rcauset}[3][]{% -% Inserts a TikZ picture with a causet, created from a permutation and a link-pair list of links to remove. -\begin{tikzpicture}[causets/.cd, every causet, #1]\drawrcauset{#2}{#3}\end{tikzpicture}} - -%% Short-hand and pre-computed causet functions: -\providecommand{\causetspath}{.} +% Inserts a TikZ picture with a causet, created from a permutation and a +% link-pair list of links to remove. +\causets@Padding% +\ifcausetsNameExternal% + \causets@setCausetName{#1}% +\fi% +\begin{tikzpicture}[causets/.cd, every causet, #1]% +\drawrcauset{#2}{#3}% +\end{tikzpicture}% +\causets@Padding% +} +%% Short-hand functions and external causets: \newcommand*{\causetfile}[2][]{% -\includegraphics[#1]{\causetspath/#2}} +\causets@Padding% +\includegraphics[#1]{\causets@NamePrefix#2}% +\causets@Padding% +} \newcommand*{\pcausetP}[2][]{% {\causetsDrawPermutationtrue\causetsDrawLabelsfalse\pcauset[#1]{#2}}} @@ -619,7 +729,7 @@ \fi% } -\newcommand*{\causetClosedFence}[2][]{% +\newcommand*{\causetCrown}[2][]{% \ifcase#2% \or%=1 \pcauset[#1]{1,2}% @@ -643,7 +753,3 @@ \rcauset[#1]{18,16,20,14,19,12,17,10,15,8,13,6,11,4,9,2,7,1,5,3}{2/5,4/7,6/9,8/11,10/13,12/15,14/17,16/19}% \fi% } - -\newcommand*{\causetCrown}[1][]{% -\causetClosedFence[#1]{3}% -} diff --git a/graphics/pgf/contrib/causets/causets.tex b/graphics/pgf/contrib/causets/causets.tex index dafa688cb8..e3a8803220 100644 --- a/graphics/pgf/contrib/causets/causets.tex +++ b/graphics/pgf/contrib/causets/causets.tex @@ -12,6 +12,9 @@ \renewcommand{\thesubsection}{} \titlespacing*{\subsection}{0pt}{15pt}{5pt} \titleformat{\subsection}{\small\bfseries\sffamily}{\thetitle}{0pt}{}{} +\renewcommand{\thesubsubsection}{} +\titlespacing*{\subsubsection}{0pt}{5pt}{0pt} +\titleformat{\subsubsection}{\small\sffamily\itshape}{\thetitle}{0pt}{}{} \usepackage{fancyhdr} % advanced header and footer \pagestyle{fancy} \fancypagestyle{plain}{\fancyhf{}\renewcommand{\headrulewidth}{0.0pt}} @@ -72,7 +75,7 @@ } \usepackage{amsmath} -\usepackage{causets} +\usepackage[external]{causets} \newcommand*{\PH}[1][value]{{\small\itshape$\langle$#1$\rangle$}} % placeholder @@ -81,25 +84,26 @@ \tikzmark{#2}% \tikz[remember picture, overlay]% \path (pic cs:#2) -- ++(-1cm, 0.5em) -- ++(#1, 0) node {#3};% -}% version causet +}% \versioncauset -\title{{\small package}\\[0.5cm] \huge causets \\[0.2cm]{\small version 1.3\\[0.5cm]}} +\title{{\small package}\\[0.5cm] \huge causets \\[0.2cm]{\small version 1.4\\[0.5cm]}} \author{Christoph Minz} -\date{May 23, 2022} +\date{6 March 2023} \begin{document} {\sffamily\maketitle} \begin{center} +\large $\displaystyle \tikzcausetsset{large} \left\{ - \pcauset{3,2,1}, - \pcauset{3,1,2}, - \pcauset{2,1,3}, - \pcauset{1,3,2}, - \pcauset{1,2,3} + \pcauset[name=3Antichain_large]{3,2,1}, + \pcauset[name=2ChainUnion1Chain_large]{3,1,2}, + \pcauset[name=Wedge_large]{2,1,3}, + \pcauset[name=Vee_large]{1,3,2}, + \pcauset[name=3Chain_large]{1,2,3} \right\} $ \\ @@ -107,11 +111,11 @@ $\displaystyle \tikzcausetsset{large} \causetsDrawLabelstrue \left\{ - \pcauset{3,2,1}, - \pcauset{3,1,2}, - \pcauset{2,1,3}, - \pcauset{1,3,2}, - \pcauset{1,2,3} + \pcauset[name=3Antichain_largelabeled]{3,2,1}, + \pcauset[name=2ChainUnion1Chain_largelabeled]{3,1,2}, + \pcauset[name=Wedge_largelabeled]{2,1,3}, + \pcauset[name=Vee_largelabeled]{1,3,2}, + \pcauset[name=3Chain_largelabeled]{1,2,3} \right\} $ \\ @@ -119,22 +123,21 @@ $\displaystyle \tikzcausetsset{large} \causetsDrawPermutationtrue \left\{ - \pcauset{3,2,1}, - \pcauset{3,1,2}, - \pcauset{2,1,3}, - \pcauset{1,3,2}, - \pcauset{1,2,3} + \pcauset[name=3Antichain_largeperm]{3,2,1}, + \pcauset[name=2ChainUnion1Chain_largeperm]{3,1,2}, + \pcauset[name=Wedge_largeperm]{2,1,3}, + \pcauset[name=Vee_largeperm]{1,3,2}, + \pcauset[name=3Chain_largeperm]{1,2,3} \right\} $ \end{center} - -\vspace{2em} +\vfill \section*{What is the purpose of this package?} \label{sec:Purpose} Causal set theory is a proposed framework for quantum gravity. Causal sets (\textbf{causets} for short) are locally finite, partially ordered sets. -Though one can describe them mathematically as a set with a partial order, it is usually much simpler to just draw (Hasse) diagrams. +They are commonly represent with Hasse diagrams, where the partial order (standing for the direction of time) increases towards to the top of the page. This package implements some simple functionality to produce such diagrams for causets by drawing them as TikZ graphics. The drawing algorithm makes use of the fact that every finite causet that embeds in $\smash{1 + 1}$ dimensional Minkowski spacetime can be represented by a product of two total orders (2D-orders), where one order can be the total order of the integers labelling the causet elements, while the other is a permutation of the labels\footnote{See \url{https://arxiv.org/abs/0706.0375} and \url{https://arxiv.org/abs/2011.02965} for more details on 2D-orders and causal sets.}. @@ -164,11 +167,11 @@ The three main commands of this package are \end{lstlisting} The first command takes a permutation of the integers from an interval $[ a, b ]$ (where $N = b - a + 1 \geq 0$ is the cardinality of the causet). The permutation determines the event positions and causal structure such that events $i$ and $j$ are linked if $i < j$ and there is no $k > j$ between $i$ and $j$ in the permutation. -The second command does the same, but ignores links between event pairs \lstinline§i/j§ as given in the second argument. +The second command does the same, but removes (restyles) links between event pairs \lstinline§i/j§ as given in the second argument. The third command only uses the permutation to position the events, the links have to be explicitly specified by event pairs \lstinline§i/j§ in the second argument. Any causet that can be embedded in $1 + 1$ dimensional Minkowski spacetime can also be described by the product of two total orders (a 2D-order). -Let the causets elements be labeled by an increasing null coordinate $u$. +Let the causet elements be labeled by an increasing null coordinate $u$. In the first diagram of \autoref{tab:MainCommandsExamples}, the $u$-coordinate axis points upwards on the right hand side. The causal relation (partial order) implies a label permutation along the null coordinate $v$ (pointing upwards along the left axis). This permutation is the input of the \lstinline§\pcauset§ command that computes the causal relation from the permutation. @@ -184,18 +187,18 @@ See example 1 in \autoref{tab:MainCommandsExamples}. \\\midrule 1 & \lstinline§\pcauset{4,7,2,6,1,5,3}§ - & \pcauset{4,7,2,6,1,5,3} + & \pcauset[name=pcausetExample_perm]{4,7,2,6,1,5,3} \\\midrule 2 & \lstinline§\rcauset{4,7,2,6,1,5,3}{2/5}§ - & \rcauset{4,7,2,6,1,5,3}{2/5} + & \rcauset[name=rcausetExample_perm]{4,7,2,6,1,5,3}{2/5} \\\midrule 3 & \lstinline§\causet{4,7,2,6,1,5,3}{1/3,1/5,2/3,2/6,4/5,4/6,4/7}§ - & \causet{4,7,2,6,1,5,3}{1/3,1/5,2/3,2/6,4/5,4/6,4/7} + & \causet[name=causetExample_perm]{4,7,2,6,1,5,3}{1/3,1/5,2/3,2/6,4/5,4/6,4/7} \\\bottomrule \end{tabular*} - \caption{\label{tab:MainCommandsExamples} Examples for the three main commands of the package.} + \caption{\label{tab:MainCommandsExamples} Examples of the three main commands.} \end{table} Every causet that does not embed in $1 + 1$ dimensional Minkowski spacetime can be made embeddable by adding links, for which the \lstinline§\rcauset§ command is defined. @@ -214,58 +217,50 @@ You may use any of the three main commands to add a causet diagram in-line with As an example for the use in a mathematical equation, here is the code for the first set of causets on the title page: \begin{lstlisting} \usepackage{causets} - ... - \begin{document} - ... - \begin{align} S &= \left\{ - \pcauset{3,2,1},\, \pcauset{3,1,2},\, \pcauset{2,1,3},\, \pcauset{1,3,2},\, \pcauset{1,2,3} + \pcauset{3,2,1}, \pcauset{3,1,2}, \pcauset{2,1,3}, \pcauset{1,3,2}, \pcauset{1,2,3} \right\}. \end{align} \end{lstlisting} -\vspace{-1.5em} +%\vspace{-1ex} \begin{align} S &= \left\{ - \pcauset{3,2,1},\, - \pcauset{3,1,2},\, - \pcauset{2,1,3},\, - \pcauset{1,3,2},\, - \pcauset{1,2,3} + \pcauset[name=3Antichain]{3,2,1}, + \pcauset[name=2ChainUnion1Chain]{3,1,2}, + \pcauset[name=Wedge]{2,1,3}, + \pcauset[name=Vee]{1,3,2}, + \pcauset[name=3Chain]{1,2,3} \right\} . \end{align} Of course, a given causet might have more than one representing permutation, so that any of those permutations may be used. However, you may consider it a good practice to choose the permutation that starts with the larger integer, so that disjoint elements appear to the right in the graphs. -For example, you may write \lstinline§\pcauset{3,1,2}§, \pcauset{3,1,2}, as opposed to \lstinline§\pcauset{2,3,1}§, \pcauset{2,3,1}. +For example, you may write \lstinline§\pcauset{3,1,2}§, \pcauset[name=2ChainUnion1Chain]{3,1,2}, as opposed to \lstinline§\pcauset{2,3,1}§, \pcauset[name=1ChainUnion2Chain]{2,3,1}. The arguments of the commands are lists that are iterated over by a \lstinline§\foreach§ loop of PGF/TikZ. So you may use dots {...} to complete ranges of integers automatically. -You may use this feature to draw chains like \pcauset{1,...,5} (with \lstinline§\pcauset{1,...,5}§) or antichains like \pcauset{5,...,1} (with \lstinline§\pcauset{5,...,1}§). +You may use this feature to draw chains like \pcauset[name=5Chain]{1,...,5} (with \lstinline§\pcauset{1,...,5}§) or antichains like \pcauset[name=5Antichain]{5,...,1} (with \lstinline§\pcauset{5,...,1}§). As a more complex example for the dots notation, consider \begin{lstlisting} -\pcauset{20,18,...,8, - 1,7,6,...,2, - 9,11,...,19} +\pcauset{20,18,...,8, 1,7,6,...,2, 9,11,...,19} \end{lstlisting} which produces the same diagram as \begin{lstlisting} -\pcauset{20,18,16,14,12,10,8, - 1,7,6,5,4,3,2, - 9,11,13,15,17,19} +\pcauset{20,18,16,14,12,10,8, 1,7,6,5,4,3,2, 9,11,13,15,17,19} \end{lstlisting} \begin{center} - \pcauset[black colors, permutation]{20,18,16,...,8,1,7,6,...,2,9,11,...,19} + \pcauset[black colors, permutation, name=DotsExample_perm]{20,18,16,...,8,1,7,6,...,2,9,11,...,19} \end{center} In an optional argument, the main commands accepts any causets or TikZ keys to change the style of the causet. -For example, the blue causet \pcauset[blue colors]{2,4,5,1,3} is obtained with +For example, the blue causet \pcauset[blue colors, name=NDash_blue]{2,4,5,1,3} is obtained with \begin{lstlisting} \pcauset[blue colors]{2,4,5,1,3} \end{lstlisting} @@ -274,7 +269,7 @@ For example, the blue causet \pcauset[blue colors]{2,4,5,1,3} is obtained with \label{sec:PackageOptions} Each of the package options can either be specified in square brackets when declaring the package (option applies globally) or be changed with a macro at any point in the document (option applies to the local scope). -If no options are used, an output like \rcauset{4,2,7,6,1,5,3}{2/5} is obtained with the commands +If no options are used, an output like \rcauset[name=Options_rcauset]{4,2,7,6,1,5,3}{2/5} is obtained with the code \begin{lstlisting} \usepackage{causets} ... \begin{document} ... @@ -289,7 +284,7 @@ The package options are listed together with example outputs created with the co \end{lstlisting} If not specified otherwise, any package option also works with the command \lstinline§\causet§. -\begin{longtable}{p{0.65\textwidth}p{0.13\textwidth}p{0.13\textwidth}} +\begin{longtable}{p{0.63\textwidth}p{0.14\textwidth}p{0.14\textwidth}} \toprule Package option & \lstinline§\pcauset§ & \lstinline§\rcauset§ \\\midrule @@ -309,19 +304,19 @@ If not specified otherwise, any package option also works with the command \lsti \lstinline§\usepackage[permutation]{causets}§ shows permutations & \multirow{3}{5em}{% - \causetsDrawPermutationtrue \pcauset{4,2,7,6,1,5,3}} + \causetsDrawPermutationtrue \pcauset[name=Options_pcauset_perm]{4,2,7,6,1,5,3}} & \multirow{3}{5em}{% - \causetsDrawPermutationtrue \rcauset{4,2,7,6,1,5,3}{2/5}} + \causetsDrawPermutationtrue \rcauset[name=Options_rcauset_perm]{4,2,7,6,1,5,3}{2/5}} \\ (\lstinline§\causetsDrawPermutationtrue§ activates this option) \\ (\lstinline§\causetsDrawPermutationfalse§ deactivates this option) -\\\midrule +\\\pagebreak%\midrule \lstinline§\usepackage[permutation, uunlabeled]{causets}§ & \multirow{4}{5em}{% - \causetsDrawPermutationtrue \causetsDrawULabelsfalse \pcauset{4,2,7,6,1,5,3}} + \causetsDrawPermutationtrue \causetsDrawULabelsfalse \pcauset[name=Options_pcauset_permv]{4,2,7,6,1,5,3}} & \multirow{4}{5em}{% - \causetsDrawPermutationtrue \causetsDrawULabelsfalse \rcauset{4,2,7,6,1,5,3}{2/5}} + \causetsDrawPermutationtrue \causetsDrawULabelsfalse \rcauset[name=Options_rcauset_permv]{4,2,7,6,1,5,3}{2/5}} \\ shows permutations without u-labels \\ @@ -331,9 +326,9 @@ If not specified otherwise, any package option also works with the command \lsti \\\midrule \lstinline§\usepackage[permutation, vunlabeled]{causets}§ & \multirow{4}{5em}{% - \causetsDrawPermutationtrue \causetsDrawVLabelsfalse \pcauset{4,2,7,6,1,5,3}} + \causetsDrawPermutationtrue \causetsDrawVLabelsfalse \pcauset[name=Options_pcauset_permu]{4,2,7,6,1,5,3}} & \multirow{4}{5em}{% - \causetsDrawPermutationtrue \causetsDrawVLabelsfalse \rcauset{4,2,7,6,1,5,3}{2/5}} + \causetsDrawPermutationtrue \causetsDrawVLabelsfalse \rcauset[name=Options_rcauset_permu]{4,2,7,6,1,5,3}{2/5}} \\ shows permutations without v-labels \\ @@ -343,40 +338,40 @@ If not specified otherwise, any package option also works with the command \lsti \\\midrule\midrule \lstinline§\usepackage[labeled]{causets}§ shows labeled events & \multirow{3}{5em}{% - \causetsDrawLabelstrue \pcauset{4,2,7,6,1,5,3}} + \causetsDrawLabelstrue \pcauset[name=Options_pcauset_labeled]{4,2,7,6,1,5,3}} & \multirow{3}{5em}{% - \causetsDrawLabelstrue \rcauset{4,2,7,6,1,5,3}{2/5}} + \causetsDrawLabelstrue \rcauset[name=Options_rcauset_labeled]{4,2,7,6,1,5,3}{2/5}} \\ (\lstinline§\causetsDrawLabelstrue§ activates labels) \\ (\lstinline§\causetsDrawLabelsfalse§ deactivates labels) \\\midrule\midrule - \lstinline§\usepackage[continuous]{causets}§ allows links to cross over events. Link interruptions (default) only affect the \lstinline§\causet§ command, but not the examples of \lstinline§\pcauset§ and \lstinline§\rcauset§, shown on the right. -& \multirow{5}{5em}{% - \causetsBreakLinkstrue \pcauset{4,2,7,6,1,5,3}} -& \multirow{5}{5em}{% - \causetsBreakLinkstrue \rcauset{4,2,7,6,1,5,3}{2/5}} + \lstinline§\usepackage[continuous]{causets}§ allows links to cross over events. Link interruptions (default) only affect the \lstinline§\causet§ command and ``restyled'' links of \lstinline§\rcauset§, but not the examples of shown on the right. +& \multirow{6}{5em}{% + \causetsBreakLinkstrue \pcauset[name=Options_pcauset_continuous]{4,2,7,6,1,5,3}} +& \multirow{6}{5em}{% + \causetsBreakLinkstrue \rcauset[name=Options_rcauset_continuous]{4,2,7,6,1,5,3}{2/5}} \\ - Details on interrupted (broken) links are given below. + Details on interrupted (broken) links are given below this table. \\\midrule \lstinline§\usepackage[caps]{causets}§ sets caps as link tips & \multirow{2}{5em}{% - \pcauset[cap links]{4,2,7,6,1,5,3}} + \pcauset[name=Options_pcauset_caps, cap links]{4,2,7,6,1,5,3}} & \multirow{2}{5em}{% - \rcauset[cap links]{4,2,7,6,1,5,3}{2/5}} + \rcauset[name=Options_rcauset_caps, cap links]{4,2,7,6,1,5,3}{2/5}} \\ \\\midrule - \lstinline§\usepackage[arrows]{causets}§ sets arrows (rounded, open stealth) as link tips + \lstinline§\usepackage[arrows]{causets}§ sets arrows (rounded stealth) as link tips & \multirow{2}{5em}{% - \pcauset[arrow links]{4,2,7,6,1,5,3}} + \pcauset[name=Options_pcauset_arrows, arrow links]{4,2,7,6,1,5,3}} & \multirow{2}{5em}{% - \rcauset[arrow links]{4,2,7,6,1,5,3}{2/5}} + \rcauset[name=Options_rcauset_arrows, arrow links]{4,2,7,6,1,5,3}{2/5}} \\\midrule \lstinline§\usepackage[unlinked]{causets}§ does not draw links & \multirow{3}{5em}{% - \causetsDrawLinksfalse \pcauset{4,2,7,6,1,5,3}} + \causetsDrawLinksfalse \pcauset[name=Options_pcauset_unlinked]{4,2,7,6,1,5,3}} & \multirow{3}{5em}{% - \causetsDrawLinksfalse \rcauset{4,2,7,6,1,5,3}{2/5}} + \causetsDrawLinksfalse \rcauset[name=Options_rcauset_unlinked]{4,2,7,6,1,5,3}{2/5}} \\ (\lstinline§\causetsDrawLinkstrue§ actives links) \\ @@ -384,55 +379,55 @@ If not specified otherwise, any package option also works with the command \lsti \\\midrule\midrule \lstinline§\usepackage[tiny]{causets}§ for tiny diagrams & \multirow{2}{5em}{% - \pcauset[tiny]{4,2,7,6,1,5,3}} + \pcauset[name=Options_pcauset_tiny, tiny]{4,2,7,6,1,5,3}} & \multirow{2}{5em}{% - \rcauset[tiny]{4,2,7,6,1,5,3}{2/5}} + \rcauset[name=Options_rcauset_tiny, tiny]{4,2,7,6,1,5,3}{2/5}} \\ (\lstinline§\tikzcausetsset{tiny}§ sets tiny sizes) \\\midrule \lstinline§\usepackage[smaller]{causets}§ for very small diagrams & \multirow{2}{5em}{% - \pcauset[very small]{4,2,7,6,1,5,3}} + \pcauset[name=Options_pcauset_verysmall, very small]{4,2,7,6,1,5,3}} & \multirow{2}{5em}{% - \rcauset[very small]{4,2,7,6,1,5,3}{2/5}} + \rcauset[name=Options_rcauset_verysmall, very small]{4,2,7,6,1,5,3}{2/5}} \\ (\lstinline§\tikzcausetsset{very small}§ sets very small sizes) \\\midrule \lstinline§\usepackage[small]{causets}§ for small diagrams & \multirow{2}{5em}{% - \pcauset[small]{4,2,7,6,1,5,3}} + \pcauset[name=Options_pcauset_small, small]{4,2,7,6,1,5,3}} & \multirow{2}{5em}{% - \rcauset[small]{4,2,7,6,1,5,3}{2/5}} + \rcauset[name=Options_rcauset_small, small]{4,2,7,6,1,5,3}{2/5}} \\ (\lstinline§\tikzcausetsset{small}§ sets small sizes) \\\pagebreak%\midrule For comparison, here are the normal sized causets. & \multirow{2}{5em}{% - \pcauset[normal]{4,2,7,6,1,5,3}} + \pcauset[name=Options_pcauset, normal]{4,2,7,6,1,5,3}} & \multirow{2}{5em}{% - \rcauset[normal]{4,2,7,6,1,5,3}{2/5}} + \rcauset[name=Options_rcauset, normal]{4,2,7,6,1,5,3}{2/5}} \\ (\lstinline§\tikzcausetsset{normal}§ sets normal sizes) \\\midrule \lstinline§\usepackage[large]{causets}§ for large diagrams & \multirow{3}{5em}{% - \pcauset[large]{4,2,7,6,1,5,3}} + \pcauset[name=Options_pcauset_large, large]{4,2,7,6,1,5,3}} & \multirow{3}{5em}{% - \rcauset[large]{4,2,7,6,1,5,3}{2/5}} + \rcauset[name=Options_rcauset_large, large]{4,2,7,6,1,5,3}{2/5}} \\ (\lstinline§\tikzcausetsset{large}§ sets large sizes) \\[1.3em]\midrule \lstinline§\usepackage[larger]{causets}§ for very large diagrams & \multirow{3}{5em}{% - \pcauset[very large]{4,2,7,6,1,5,3}} + \pcauset[name=Options_pcauset_verylarge, very large]{4,2,7,6,1,5,3}} & \multirow{3}{5em}{% - \rcauset[very large]{4,2,7,6,1,5,3}{2/5}} + \rcauset[name=Options_rcauset_verylarge, very large]{4,2,7,6,1,5,3}{2/5}} \\ (\lstinline§\tikzcausetsset{very large}§ sets very large sizes) \\[2.1em]\midrule \lstinline§\usepackage[huge]{causets}§ for huge diagrams & \multirow{4}{5em}{% - \pcauset[huge]{4,2,7,6,1,5,3}} + \pcauset[name=Options_pcauset_huge, huge]{4,2,7,6,1,5,3}} \\ (\lstinline§\tikzcausetsset{huge}§ sets huge sizes) \\ @@ -440,70 +435,88 @@ If not specified otherwise, any package option also works with the command \lsti \\[2.5em]\midrule\midrule \lstinline§\usepackage[black]{causets}§ for black and white causets & \multirow{2}{5em}{% - \pcauset[black colors]{4,2,7,6,1,5,3}} + \pcauset[name=Options_pcauset_black, black colors]{4,2,7,6,1,5,3}} & \multirow{2}{5em}{% - \rcauset[black colors]{4,2,7,6,1,5,3}{2/5}} + \rcauset[name=Options_rcauset_black, black colors]{4,2,7,6,1,5,3}{2/5}} \\ (\lstinline§\tikzcausetsset{black colors}§ activates the option) \\\midrule \lstinline§\usepackage[gray]{causets}§ for grey scale causets (default) -& \multirow{2}{5em}{% - \pcauset[gray colors]{4,2,7,6,1,5,3}} -& \multirow{2}{5em}{% - \rcauset[gray colors]{4,2,7,6,1,5,3}{2/5}} +& \multirow{3}{5em}{% + \pcauset[name=Options_pcauset_gray, gray colors]{4,2,7,6,1,5,3}} +& \multirow{3}{5em}{% + \rcauset[name=Options_rcauset_gray, gray colors]{4,2,7,6,1,5,3}{2/5}} \\ (\lstinline§\tikzcausetsset{gray colors}§ activates the option) \\\midrule \lstinline§\usepackage[blue]{causets}§ for blue causets & \multirow{2}{5em}{% - \pcauset[blue colors]{4,2,7,6,1,5,3}} + \pcauset[name=Options_pcauset_blue, blue colors]{4,2,7,6,1,5,3}} & \multirow{2}{5em}{% - \rcauset[blue colors]{4,2,7,6,1,5,3}{2/5}} + \rcauset[name=Options_rcauset_blue, blue colors]{4,2,7,6,1,5,3}{2/5}} \\ (\lstinline§\tikzcausetsset{blue colors}§ activates the option) \\\midrule \lstinline§\usepackage[neon]{causets}§ for brightly coloured causets & \multirow{3}{5em}{% - \pcauset[neon colors]{4,2,7,6,1,5,3}} + \pcauset[name=Options_pcauset_neon, neon colors]{4,2,7,6,1,5,3}} & \multirow{3}{5em}{% - \rcauset[neon colors]{4,2,7,6,1,5,3}{2/5}} + \rcauset[name=Options_rcauset_neon, neon colors]{4,2,7,6,1,5,3}{2/5}} \\ (\lstinline§\tikzcausetsset{neon colors}§ activates the option) \\ Details on colour options are given in \autoref{sec:Colors}. \\\midrule\midrule \lstinline§\usepackage[spatial]{causets}§ shows dashed lines between spatially separated events (which is a secondary partial order for the causets drawn with \lstinline§\pcauset§). This option only affects the \lstinline§\pcauset§ and \lstinline§\rcauset§ commands, but not the \lstinline§\causet§ command. -& \multirow{3}{5em}{% - \pcauset[spatially linked]{4,2,7,6,1,5,3}} -& \multirow{3}{5em}{% - \rcauset[spatially linked]{4,2,7,6,1,5,3}{2/5}} +& \multirow{7}{5em}{% + \pcauset[name=Options_pcauset_spatial, spatially linked]{4,2,7,6,1,5,3}} +& \multirow{7}{5em}{% + \rcauset[name=Options_rcauset_spatial, spatially linked]{4,2,7,6,1,5,3}{2/5}} \\ (\lstinline§\causetsDrawSpatialLinkstrue§ activates the option) \\ (\lstinline§\causetsDrawSpatialLinksfalse§ deactivates the option) +\\\midrule + \lstinline§\usepackage[external]{causets}§ loads the \lstinline§external§ library, sets the external file name prefix to ``\lstinline§causets/§'', and enables the use of causet names for the external file names. (This feature has to be loaded as option in the preamble not later in the document.) +& \multirow{6}{5em}{% + \pcauset[name=Options_pcauset]{4,2,7,6,1,5,3}} +& \multirow{6}{5em}{% + \rcauset[name=Options_rcauset]{4,2,7,6,1,5,3}{2/5}} +\\ + For details on externalization of causets, see \autoref{sec:ExternalCausets}. \\\bottomrule \end{longtable} -By default, the links in a \lstinline§\causet§ diagram are interrupted if they cross over another event (exactly over the event centre). -Any such crossing of links over events can only occur for the links explicitly specified for the \lstinline§\causet§ command, but not for the links drawn by \lstinline§\pcauset§ or \lstinline§\rcauset§. +By default, the links in a diagram are interrupted if they cross over another event (exactly over the event centre). +Any such crossing of links over events can only occur for the links explicitly specified for the \lstinline§\causet§ command or the locally restyled links of the \lstinline§\rcauset§ command, but not for the links drawn by \lstinline§\pcauset§ or automatically drawn links by \lstinline§\rcauset§. This feature is activated by default (\lstinline§\causetsBreakLinkstrue§) and can be deactivated with \lstinline§\causetsBreakLinksfalse§, or with the option \lstinline§continuously linked§. For example, here is a causet that embeds in 3-dimensional but not in 2-dimensional Minkowski spacetime. -This causet has one event (0) in the centre that is linked to events -3 and 3 but not to events -6 and 6, while a link from -6 to 6 crosses over it. +This causet has one event (0) in the centre that is linked to events -3 and 3 but not to events -6 and 6, while a link (blue) from -6 to 6 crosses over it. \begin{lstlisting} \usepackage[larger]{causets} -\tikzcausetsset{labels={right, position=east}, offset=-8} - +\tikzcausetsset{labels={right, position=east}} ... \begin{document} ... - -\causet[brokenly linked]{7,10,3,1,12,5,2,8,14,11,4,15,13,6,9} {1/2,1/12,2/4,2/14,3/4,3/5,4/6,4/15,5/6,5/8,6/9,7/8,7/10,8/9,8/11, 10/11,10/12,11/13,12/13,12/14,14/15} -\causet[continuously linked]{7,10,3,1,12,5,2,8,14,11,4,15,13,6,9} {1/2,1/12,2/4,2/14,3/4,3/5,4/6,4/15,5/6,5/8,6/9,7/8,7/10,8/9,8/11, 10/11,10/12,11/13,12/13,12/14,14/15} +\causet[brokenly linked]{-1,2,-5,-7,4,-3,-6,0,6,3,-4,7,5,-2,1} {-7/-6,-7/4,-6/-4,-6/6/blue!50!cyan,-5/-4,-5/-3,-4/-2,-4/7, -3/-2,-3/0,-2/1,-1/0,-1/2,0/1,0/3,2/3,2/4,3/5,4/5,4/6,6/7} +\causet[continuously linked]{-1,2,-5,-7,4,-3,-6,0,6,3,-4,7,5,-2,1} {-7/-6,-7/4,-6/-4,-6/6/blue!50!cyan,-5/-4,-5/-3,-4/-2,-4/7, -3/-2,-3/0,-2/1,-1/0,-1/2,0/1,0/3,2/3,2/4,3/5,4/5,4/6,6/7} \end{lstlisting} \begin{center} - \causet[very large, labels={right, at=east}, offset=-8]{7,10,3,1,12,5,2,8,14,11,4,15,13,6,9}{1/2,1/12,2/4,2/14,3/4,3/5,4/6,4/15,5/6,5/8,6/9,7/8,7/10,8/9,8/11,10/11,10/12,11/13,12/13,12/14,14/15} - \hspace{1cm} - \causet[very large, labels={right, at=east}, continuously linked, offset=-8]{7,10,3,1,12,5,2,8,14,11,4,15,13,6,9}{1/2,1/12,2/4,2/14,3/4,3/5,4/6,4/15,5/6,5/8,6/9,7/8,7/10,8/9,8/11,10/11,10/12,11/13,12/13,12/14,14/15} + \causet[name=BrokenlyLinkedExample_verylarge, very large, labels={right, at=east}]{-1,2,-5,-7,4,-3,-6,0,6,3,-4,7,5,-2,1}{-7/-6,-7/4,-6/-4,-6/6/blue!50!cyan,-5/-4,-5/-3,-4/-2,-4/7,-3/-2,-3/0,-2/1,-1/0,-1/2,0/1,0/3,2/3,2/4,3/5,4/5,4/6,6/7} + \hspace{1.5cm} + \causet[name=ContinuouslyLinkedExample_verylarge, very large, labels={right, at=east}, continuously linked]{-1,2,-5,-7,4,-3,-6,0,6,3,-4,7,5,-2,1}{-7/-6,-7/4,-6/-4,-6/6/blue!50!cyan,-5/-4,-5/-3,-4/-2,-4/7,-3/-2,-3/0,-2/1,-1/0,-1/2,0/1,0/3,2/3,2/4,3/5,4/5,4/6,6/7} \end{center} +Note that the links are drawn in the order given by the second argument. +Similar results are obtained with the following \lstinline§\rcauset§ commands (since version 1.4) +\begin{lstlisting} +\rcauset[brokenly linked]{-1,2,-5,-7,4,-3,-6,0,6,3,-4,7,5,-2,1} {-7/-3,-6/0,-5/4,-4/5,0/6,3/7,-6/6/blue!50!cyan} +\rcauset[continuously linked]{-1,2,-5,-7,4,-3,-6,0,6,3,-4,7,5,-2,1} {-7/-3,-6/0,-5/4,-4/5,0/6,3/7,-6/6/blue!50!cyan} +\end{lstlisting} +where all pairs of integers in the second argument are links to be removed (by default, get the local style \lstinline§draw=none§). +All links with a local style specified (here the last link only) are drawn in the order they appear after all automatic links have been drawn. +Local styles are explained in \autoref{sec:LocalStyles} in more detail. + +All main commands, the short hand macros (see \autoref{sec:ShortHandMacros}), and the command \lstinline§\causetfile§ (see \autoref{sec:ExternalCausets}) add a small padding to the left and right of the diagram for a better spacing within text and mathematical expressions. +The padding is adjustable with \lstinline§padding=§\PH\ and stored in the macro \lstinline§\causets@Padding§ (by default, it is \lstinline§\thinspace§). \section{Short hand macros} \label{sec:ShortHandMacros} @@ -511,11 +524,11 @@ The permutations and labels for causets can be switched on globally with the pac \lstinline§\causetsDrawPermutationtrue§ (same as the command \lstinline§\tikzcausetsset{show permutation}§) and \lstinline§\causetsDrawLabelstrue§ (or \lstinline§\tikzcausetsset{labeled}§), respectively. To show only single causets with either of these options, there exist short hand macros for all three main commands. -Each main command can be followed by a capital letter \lstinline§P§ (to show the permutation), \lstinline§L§ (to show event labels), or \lstinline§X§ (to show both). +Each main command can be followed by a capital letter \lstinline§P§ (to show the permutation only), \lstinline§L§ (to show event labels only), or \lstinline§X§ (to show both). \begin{lstlisting} Causets with permutations (and labels) \pcausetP{4,1,2,3}, \pcausetX{1,2,3,4}, \pcausetL{1,2,4,3}, and without any \pcauset{2,4,1,3}. \end{lstlisting} -Causets with permutations (and labels) \pcausetP{4,1,2,3}, \pcausetX{1,2,3,4}, \pcausetL{1,2,4,3}, and without any \pcauset{2,4,1,3}. +Causets with permutations (and labels) \pcausetP[name=Macro_P]{4,1,2,3}, \pcausetX[name=Macro_X]{1,2,3,4}, \pcausetL[name=Macro_L]{1,2,4,3}, and without any \pcauset[name=Macro]{2,4,1,3}. These results are also obtained by using the optional parameter, for example: \begin{lstlisting} @@ -525,102 +538,102 @@ Causets with permutations (and labels) \pcauset[permutation]{4,1,2,3}, \pcauset[ There are a few short hand macros for small common causets as shown here. \begin{lstlisting} \causetFence{1}, \causetFence{2}, \ldots, \causetFence{10}, -\causetClosedFence{1}, \causetClosedFence{2}, \ldots, \causetClosedFence{10}, -\causetCrown +\causetCrown{1}, \causetCrown{2}, \ldots, \causetCrown{10} \end{lstlisting} -\causetFence{1}, \causetFence{2}, \ldots, \causetFence{10}, -\causetClosedFence{1}, \causetClosedFence{2}, \ldots, \causetClosedFence{10}, -\causetCrown +\causetFence[name=2Chain]{1}, \causetFence[name=2Fence]{2}, \ldots, \causetFence[name=10Fence]{10}, +\causetCrown[name=2Chain]{1}, \causetCrown[name=2Crown]{2}, \ldots, \causetCrown[name=10Crown]{10} -\section{Labeling and replacing events (for infinite causets)} +\section{Labeling and replacing events (also to represent infinite causets)} \label{sec:LabelingReplacing} -With version v1.3 of the package, it is possible to relabel and replace causet events. +Since version v1.3 of the package, it is possible to relabel and replace causet events. These features are useful for labelling events arbitrarily, and drawing diagrams of infinite causets using ellipsis. By default, all events get named and labeled by the integers given in the arguments of the commands. For example, \lstinline§\pcausetL{0,2,1}§ creates the diagram \pcausetL{0,2,1} where the event notes are named \lstinline§(E0)§, \lstinline§(E2)§, \lstinline§(E1)§, respectively, while the label nodes have the names \lstinline§(EL0)§, \lstinline§(EL2)§, \lstinline§(EL1)§. If the permutation is displayed as well, the $u$- and $v$-coordinate labels are the nodes \lstinline§(EUL§\PH\lstinline§)§ and \lstinline§(EVL§\PH\lstinline§)§, with \PH\ taking on the values $\{0, 2, 1 \}$. -To offset the names of all causet events by the same amount, use the key-value pair \lstinline§offset=§\PH\ to adjust the naming and labelling of events and get distinct event names, while the same integers are used in the command arguments. +To offset the names of all causet events by an integer amount, use the key-value pair \lstinline§offset=§\PH\ to adjust the naming and labelling of events and get distinct event names, while the same integers are used in the command arguments. Consider the following example. \begin{lstlisting} \begin{align*} - \tikzcausetsset{large, labels={below=1pt, at=south}} + \tikzcausetsset{large} \cdots\quad \pcausetP[offset=-12]{0,2,1,3}\quad\cdots\quad \pcausetL{0,2,1,3}\quad\cdots\quad \pcausetL[offset=12]{0,2,1,3}\quad\cdots \end{align*} \end{lstlisting} -\vspace{-1em} +\vspace{-1ex} \begin{align*} - \tikzcausetsset{large, labels={below=1pt, at=south}} + \tikzcausetsset{large} \cdots\quad - \pcausetP[offset=-12]{0,2,1,3}\quad\cdots\quad - \pcausetL{0,2,1,3}\quad\cdots\quad - \pcausetL[offset=12]{0,2,1,3}\quad\cdots + \pcausetP[name=Diamond_permoffset, offset=-12]{0,2,1,3}\quad\cdots\quad + \pcausetL[name=Diamond_labeled]{0,2,1,3}\quad\cdots\quad + \pcausetL[name=Diamond_labeledoffset, offset=12]{0,2,1,3}\quad\cdots \end{align*} Here, the three commands have the same integer argument \lstinline§{0,2,1,3}§, but the events are named with the specified offsets for the sub-causets, and the labels are adjusted accordingly. In this way, it will be possible to address the event (and label) nodes of the sub-causets distinctively within a larger TikZ picture. For more details on how to draw causets within a TikZ picture, see \autoref{sec:TikZ}. -When you (only) want to change the labelling of events, add a slash and the new event label directly after the event integer in the first command argument. +When you (only) want to change the labelling of an event to \PH, add a slash and \lstinline§label=§\PH\ directly after the event integer in the first command argument. For example, the causet \pcauset{2,1,3} has six different labellings by (distinct) integers from the set $\{ 0, 1, 2 \}$, -\pagebreak +%\pagebreak \begin{lstlisting} \begin{align} \text{order-preserving:} && L_{\mathrm{op}} &= \left\{ \pcausetL{1,0,2}, - \pcausetL{1/0,0/1,2} + \pcausetL{1/label=0,0/label=1,2} \right\} , \\ \text{not order-preserving:} && L_{\mathrm{nop}} &= \left\{ - \pcauset{1/2,0/1,2/0}, - \pcausetL{1,0/2,2/0}, - \pcausetL{1/2,0,2/1}, - \pcauset{1/0,0/2,2/1} + \pcauset{1/label=2,0/label=1,2/label=0}, + \pcausetL{1,0/label=2,2/label=0}, + \pcausetL{1/label=2,0,2/label=1}, + \pcauset{1/label=0,0/label=2,2/label=1} \right\} . \end{align} \end{lstlisting} -\vspace{-1em} +\vspace{-1ex} \begin{align} \text{order-preserving:} && L_{\mathrm{op}} &= \left\{ - \pcausetL{1,0,2}, - \pcausetL{1/0,0/1,2} + \pcausetL[name=Wedge_labeled102]{1,0,2}, + \pcausetL[name=Wedge_labeled012]{1/label=0,0/label=1,2} \right\} , \\ \text{not order-preserving:} && L_{\mathrm{nop}} &= \left\{ - \pcauset{1/2,0/1,2/0}, - \pcausetL{1,0/2,2/0}, - \pcausetL{1/2,0,2/1}, - \pcauset{1/0,0/2,2/1} + \pcauset[name=Wedge_labeled210]{1/label=2,0/label=1,2/label=0}, + \pcausetL[name=Wedge_labeled120]{1,0/label=2,2/label=0}, + \pcausetL[name=Wedge_labeled201]{1/label=2,0,2/label=1}, + \pcauset[name=Wedge_labeled021]{1/label=0,0/label=2,2/label=1} \right\} . \end{align} -The replacing labels can be any text. It is recommended to write longer text labels in a \TeX\ group \lstinline§{...}§. Here is an example +The replacing labels can be any text. +Longer text labels should be written in a \TeX\ group \lstinline§{...}§. +Here is an example \begin{lstlisting} -\pcauset[large]{2/$-\infty$,6,5,7,3/{Text and maths},4/-1} +\pcauset[large]{2/label=$-\infty$,6,5,7,3/label={Text and $maths$},4/label=-1} \end{lstlisting} -\vspace{-0.5em} +\vspace{-1ex} \begin{center} - \pcauset[large]{2/$-\infty$,6,5,7,3/{Text and maths},4/-1} + \pcauset[name=RelabeledEventsExample_large, large]{2/label=$-\infty$,6,5,7,3/label={Text and $maths$},4/label=-1} \end{center} Notice that replaced labels will always be visible, even if labels are deactivated (\lstinline§\causetsDrawLabelsfalse§) as in this example. To change the style of the replaced labels, add the key-value pair \lstinline§replaced labels=§\PH, which extends the style of standard labels. -Similarly to the replacement of labels, you can replace event nodes by adding yet another slash and the event node text after the event integer in the permutation of the command. +Similarly to the replacement of labels, you can replace event nodes by using a slash followed by \lstinline§event=§\PH. This feature may have its main application for the representation of infinite causets, for example, the code \begin{lstlisting} % Define ellipsis rotated by #1 degrees: @@ -628,13 +641,13 @@ This feature may have its main application for the representation of infinite ca ... % Draw infinite causet with ellipsis \pcauset[large, replaced labels={below, at=south}, replaced events={text scale=1}] -{-2/{$\downarrow$ continues infinitely $\downarrow$}/\rdots[90], -1,0,1,16,14,15,11,12,13,7,8,9,10, 2//\rdots[10],3,4//~,5,6//\rdots[-10]} + {-2/{label={$\downarrow$ continues infinitely $\downarrow$}, event={\rdots[90]}}, -1,0,1,16,14,15,11,12,13,7,8,9,10, 2/event={\rdots[10]},3,4/event={~},5,6/event={\rdots[-10]}} \end{lstlisting} yields the diagram \begin{center} \newcommand{\rdots}[1][0]{\rotatebox{#1}{...}} - \pcauset[large, replaced labels={below, at=south}, replaced events={text scale=1}] - {-2/{$\downarrow$ continues infinitely $\downarrow$}/\rdots[90], -1,0,1,16,14,15,11,12,13,7,8,9,10, 2//\rdots[10],3,4//~,5,6//\rdots[-10]} + \pcauset[name=ReplacedEventsExample_large, large, replaced labels={below, at=south}, replaced events={text scale=1}] + {-2/{label={$\downarrow$ continues infinitely $\downarrow$}, event={\rdots[90]}}, -1,0,1,16,14,15,11,12,13,7,8,9,10, 2/event={\rdots[10]},3,4/event={~},5,6/event={\rdots[-10]}} \end{center} Here, three events are replaced by ellipsis with different rotations, and one event is replaced by an empty node (\lstinline§~§). The style of the replaced events is specified via the key \lstinline§replaced labels=§\PH\ -- where \PH\ is \lstinline§{text scale=1}§ in this example. @@ -645,16 +658,6 @@ As shown in the previous example, the position of labels is defined with a key w The \lstinline§at§ key holds a coordinate of the event note. The default positioning is \lstinline§below left, at=south west§. -In summary, the three main commands take the form -\\[1ex] -\lstinline§\pcauset{§\PH[index]\lstinline§/§\PH[label]\lstinline§/§\PH[event text]\lstinline§,...}§ -\\[1ex] -\lstinline§\rcauset{§\PH[index]\lstinline§/§\PH[label]\lstinline§/§\PH[event text]\lstinline§,...}{§\PH[unlink from event]\lstinline§/§\PH[unlink to event]\lstinline§,...}§ -\\[1ex] -\lstinline§\causet{§\PH[index]\lstinline§/§\PH[label]\lstinline§/§\PH[event text]\lstinline§,...}{§\PH[link from event]\lstinline§/§\PH[link to event]\lstinline§,...}§ -\\[1ex] -The full notation for the short hand macros (see \autoref{sec:ShortHandMacros}) is similar. - \section{Changing sizes and fonts (for mathematical expressions)} \label{sec:Sizes} The pre-defined size styles have the following scaling with respect to the normal size:\vspace{-1ex} @@ -674,13 +677,7 @@ For a (first level) sub-script in a summation, you may use the small size, \begin{lstlisting} \begin{equation} \sum_{C \in \tikzcausetsset{small} - \left\{ - \pcauset{1,2,3},\; - \pcauset{1,3,2,4},\; - \pcauset{1,4,3,2,5},\; - \pcauset{1,5,4,3,2,6} - \right\}} - | C | + \Bigl\{ \pcauset{1,2,3}, \pcauset{1,3,2,4}, \pcauset{1,4,3,2,5}, \pcauset{1,5,4,3,2,6} \Bigr\}} | C | = \left| \pcauset{1,2,3} \right| + \left| \pcauset{1,3,2,4} \right| + \left| \pcauset{1,4,3,2,5} \right| @@ -689,17 +686,17 @@ For a (first level) sub-script in a summation, you may use the small size, \end{lstlisting} \begin{equation} \sum_{C \in \tikzcausetsset{small} - \left\{ - \pcauset{1,2,3}, - \;\pcauset{1,3,2,4}, - \;\pcauset{1,4,3,2,5}, - \;\pcauset{1,5,4,3,2,6} - \right\}} + \Bigl\{ + \pcauset[name=3Chain_small]{1,2,3}, + \pcauset[name=Diamond_small]{1,3,2,4}, + \pcauset[name=Pure3Diamond_small]{1,4,3,2,5}, + \pcauset[name=Pure4Diamond_small]{1,5,4,3,2,6} + \Bigr\}} | C | - = \left| \pcauset{1,2,3} \right| - + \left| \pcauset{1,3,2,4} \right| - + \left| \pcauset{1,4,3,2,5} \right| - + \left| \pcauset{1,5,4,3,2,6} \right| + = \left| \pcauset[name=3Chain]{1,2,3} \right| + + \left| \pcauset[name=Diamond]{1,3,2,4} \right| + + \left| \pcauset[name=Pure3Diamond]{1,4,3,2,5} \right| + + \left| \pcauset[name=Pure4Diamond]{1,5,4,3,2,6} \right| \end{equation} Like any other options, sizes can also be specified in the optional argument of a single causet diagram or with \lstinline§\tikzcausetsset{...}§ for the current scope. @@ -737,7 +734,7 @@ Below is an example for a diagram drawn with some sizes defined manually: \pcausetL[tile size=2ex, event size=1ex, link width=0.3ex, text scale=1]{13,8,14,9,3,15,12,1,6,16,5,11,7,2,10,4} \end{lstlisting} \begin{center} - \pcausetL[tile size=2ex, event size=1ex, link width=0.3ex, text scale=1]{13,8,14,9,3,15,12,1,6,16,5,11,7,2,10,4} + \pcausetL[name=Example_resized, tile size=2ex, event size=1ex, link width=0.3ex, text scale=1]{13,8,14,9,3,15,12,1,6,16,5,11,7,2,10,4} \end{center} \vspace{1ex} @@ -765,27 +762,91 @@ changes the event colour to purple and the link colour to cyan. For the pre-defined colour schemes, use the keys \lstinline§gray colors§ (or \lstinline§gray colors§, default), \lstinline§black colors§ (or \lstinline§black colors§, only black and white), \lstinline§blue colors§ (or \lstinline§blue colors§, blue colour tones), or \lstinline§neon colors§ (or \lstinline§neon colors§, bright colours). These keys set all the colours listed above to pre-defined values. -\section{Standalone causets} -\label{sec:Standalone} -For any document that contains many (large) causet diagrams or the same causets that are used repeatedly, the compilation time can be reduced by placing the commands in external files using the \lstinline§standalone§ package. +\section{Changing the styles of individual events and links} +\label{sec:LocalStyles} +The full supported formats of the three main commands are +\\[1ex] +\lstinline§\pcauset[§\PH[causet style]\lstinline§]{§\PH[index]\lstinline§/§\PH[event style]\lstinline§,...}§ +\\[1ex] +\lstinline§\rcauset[§\PH[causet style]\lstinline§]{§\PH[index]\lstinline§/§\PH[event style]\lstinline§,...}{§\PH[unlink from]\lstinline§/§\PH[unlink to]\lstinline§,...,§ +\\\PH[link from]\lstinline§/§\PH[link to]\lstinline§/§\PH[link style]\lstinline§,...}§ +\\[1ex] +\lstinline§\causet[§\PH[causet style]\lstinline§]{§\PH[index]\lstinline§/§\PH[event style]\lstinline§,...}{§\PH[link from]\lstinline§/§\PH[link to]\lstinline§/§\PH[link style]\lstinline§,...}§ +\\[1ex] +and similarly for all short hand macros as described in \autoref{sec:ShortHandMacros}. +The style values are all optional, where \PH[causet style] is applied to that causet only, \PH[event style] is applied to a single event, and \PH[link style] is applied to a single link. -For example, create a file named \lstinline§mycauset.tex§ in the same directory as the main file with the following code: +The feature to apply styles only to individual events and links is to highlight or modify subsets of a causet, for example, by using different colours: \begin{lstlisting} -\documentclass[tikz]{standalone} +\rcausetL[large, subset A/.style={red, dotted}, subset B/.style=blue, replaced labels={text scale=1, at=east, right}]{2/{subset A, label=event $a$}, 5/subset B, 1, 3/{subset A, label=$b$, replaced labels=orange}, 4/subset B, 6/subset B}{2/3/subset A, 4/6/subset B, 5/6/subset B} +\end{lstlisting} +\vspace{-1ex} +\begin{center} + \rcausetL[name=Example_locallystyled, large, subset A/.style={red, dotted}, subset B/.style=blue, replaced labels={text scale=1, at=east, right}]{2/{subset A, label=event $a$}, 5/subset B, 1, 3/{subset A, label=$b$, replaced labels=orange}, 4/subset B, 6/subset B}{2/3/subset A, 4/6/subset B, 5/6/subset B} +\end{center} +Note that \lstinline§label=event $a$§ and \lstinline§label=$b$§ adds (replaced) labels $a$ and $b$, respectively, but their style is not affected by \lstinline§subset A§. +To change the style of the labels, we have to use the \lstinline§replaced labels§ key, see also \autoref{sec:LabelingReplacing}. + +\section{Externalisation and standalone causets} +\label{sec:ExternalCausets} +For any document that contains many (large) causet diagrams or the same causets that are used repeatedly, the compilation time can be reduced by moving the graphics to external files using the externalisation library of TikZ or \lstinline§standalone§ files. + +The externalisation feature of TikZ provides the tools to automatically externalise all causet diagrams and only recompile them when they are changed in the document. +To enable this feature, use the \lstinline§external§ option when loading the package and make sure that the document is compiled with the flag +\begin{lstlisting} +--shell-escape +\end{lstlisting} +The \lstinline§external§ option loads the \lstinline§external§ library, sets the \lstinline§prefix§ to add ``\lstinline§causets/§'' before each external file, and calls \lstinline§\causetsNameExternaltrue§ to use the manually specified names for external file names. +Any causet can be manually named by providing the name key-value pair \lstinline§name=§\PH\ in the optional parameter of a causet command. +As an example, the inline code +\begin{lstlisting} +\pcauset[name=Vee]{1,3,2} +\end{lstlisting} +yields the causet \pcauset[name=Vee]{1,3,2} and creates an external pdf file with the name \lstinline§causets/Vee.pdf§ relative to the main tex file. + +I recommend to always name causets, even if externalisation is not used. +In this way, it is easier to read the source code and switch to externalising at a later point more easily. +Note that the name of a causet does not have to be unique (especially if it is used repeatedly throughout the document), but you may give different names to causets with different style options to avoid unwanted overwrites. +For a repeated causet in the document, either the same code is repeated, or the \lstinline§\causetfile§ command may be used, for example, \lstinline§\pcauset[name=N]{2,4,1,3}§ can be repeated with \lstinline§\causetfile{N}§ to print the N causet \pcauset[name=N]{2,4,1,3}. +The macro \lstinline§\causetfile[#1]{#2}§ also accepts one optional argument \lstinline§[#1]§ and expands to +\begin{lstlisting} +\causets@Padding% +\includegraphics[#1]{\causets@NamePrefix#2}% +\causets@Padding +\end{lstlisting} +To redefine the prefix stored in \lstinline§\causets@NamePrefix§ and also set the \lstinline§external§ library prefix to the same value, use \lstinline§\tikzcausetsset{set prefix=causets/}§. +However, to set \lstinline§\causets@NamePrefix§ only for \lstinline§causets§, use \lstinline§name prefix=§\PH. + +If you are already loading the \lstinline§external§ library for other uses, you do not want to use the \lstinline§external§ option, but add the following to the document's preamble: +\begin{lstlisting} +\usetikzlibrary{external} +... \usepackage{causets} -\begin{document} -\pcauset{3,2,4,1} -\end{document} +\tikzcausetsset{set prefix=causets/, name external=true} \end{lstlisting} -The compiled version is then included with the macro \lstinline§\causetfile{mycauset}§. -The macro \lstinline§\causetfile[#1]{#2}§ also accepts one optional argument \lstinline§[#1]§ and redirects to +For externalising only those causets that are named manually, set \begin{lstlisting} -\includegraphics[#1]{\causetspath/#2} +\tikzset{external/only named=true} \end{lstlisting} -The macro \lstinline§\causetspath§ is pre-defined to \lstinline§.§ (the directory of the main \TeX\ file), but may be renewed to any desired directory with +For switching externalisation on/off all together, the library provides the macros \begin{lstlisting} -\renewcommand{\causetspath}{my_causet_directory} +\tikzexternaldisable +\tikzexternalenable +\end{lstlisting} +Please find further information on the \lstinline§external§ library in the TikZ manual. + +Graphics may also be moved to standalone tex files manually and included with \lstinline§\causetfile§ or \lstinline§\includegraphics§. +For example, create a file named \lstinline§M.tex§ in the directory that was set to \lstinline§name prefix§ (by default, this is ``\lstinline§./§'') with the following code: +\begin{lstlisting} +\documentclass[tikz]{standalone} +\usepackage{causets} +\begin{document} +\pcauset{4,2,5,1,3} +\end{document} \end{lstlisting} +The compiled version \pcauset[name=M]{4,2,5,1,3} is then included with the macro \lstinline§\causetfile{M}§. + +More examples on larger standalone graphics are given in \autoref{sec:TikZ}. \section{Style changes in detail} In the optional argument of the causet macros, you may use other TikZ options to change the output of the macros, for example: @@ -794,7 +855,7 @@ In the optional argument of the causet macros, you may use other TikZ options to ... \begin{document} ... A labeled causet with red-framed semi-transparent labels, \pcausetL[labels={draw=red, fill=white, opacity=0.8, inner sep=1pt, scale=1.5}]{2,4,5,1,3}. \end{lstlisting} -A labeled causet with red-framed semi-transparent labels, \pcausetL[labels={draw=red, fill=white, opacity=0.8, inner sep=1pt, scale=1.5}]{2,4,5,1,3}. +A labeled causet with red-framed semi-transparent labels, \pcausetL[name=NDash_redframedlabels, labels={draw=red, fill=white, opacity=0.8, inner sep=1pt, scale=1.5}]{2,4,5,1,3}. In the same way, it is possible to modify the existing styles of all parts of the diagrams, which means that the default drawing styles are extended by the options passed as value to these keys: \vspace{-1ex} \begin{enumerate}\itemsep=-1ex @@ -808,14 +869,14 @@ In the same way, it is possible to modify the existing styles of all parts of th \item \lstinline§link pauses=§\PH\ sets the ending line tip of each link at an interruption, \item \lstinline§link resumes=§\PH\ sets the starting line tip of each link at an interruption, \item \lstinline§cap links§ sets the starting and ending line tip of each link to a (reversed) cap, - \item \lstinline§arrow links§ sets the ending line tip of each link to a rounded, open, stealth arrow, + \item \lstinline§arrow links§ sets the ending line tip of each link to a rounded, stealth arrow, \item \lstinline§spatial links=§\PH\ shows the spatial links (\lstinline§show spatial links§) and appends to the style of the spatial links (secondary graph edges), \item \lstinline§all labels=§\PH\ appends to the general style of all text labels (applies to the following three label types), \item \lstinline§labels=§\PH\ shows the event labels (\lstinline§show labels§) and appends to the style that applies only to the event labels, \item \lstinline§ulabels=§\PH\ shows the $u$ labels (\lstinline§show ulabels§) and appends to the style that applies only to the $u$ labels, and \item \lstinline§vlabels=§\PH\ shows the $v$ labels (\lstinline§show vlabels§) and appends to the style that applies only to the $v$ labels. \end{enumerate} -In order to manually define the full style of the parts in the diagram - not extending, but \emph{overwriting all} drawing options - set the style of the following keys: \vspace{-1ex} +In order to manually define the full style of the parts in the diagram -- not extending, but \emph{overwriting all} drawing options -- set the style of the following keys: \vspace{-1ex} \begin{enumerate}\itemsep=-1ex \item \lstinline§every causet§ for the general style of the causet diagram (like \lstinline§baseline§, see below), \item \lstinline§every tile§ for the occupied permutation tiles, @@ -837,7 +898,7 @@ So, for example, ... \begin{document} ... \pcauset[large]{2,4,5,1,3} \end{lstlisting} -will generate all causets with square nodes as events and triangle caps on the future link ends, like \pcauset[large, events={rectangle}, links={-Triangle Cap[]}]{2,4,5,1,3}. +will generate all causets with square nodes as events and triangle caps on the future (upper) link ends, like \pcauset[name=NDash_rectangleeventslarge, large, events={rectangle}, links={-Triangle Cap[]}]{2,4,5,1,3}. \vspace{1ex} By default, causets are placed such that a pre-defined coordinate point falls on the text baseline, \lstinline§baseline=(baseline point)§. @@ -846,86 +907,129 @@ You may adjust the baseline as for any TikZ graphic, for example, \begin{lstlisting} \pcauset[baseline=2mm]{2,4,5,1,3} \end{lstlisting} -places the diagram centre $2\mathrm{mm}$ below the text base, \pcauset[baseline=2mm]{2,4,5,1,3}. +places the diagram centre $2\mathrm{mm}$ below the text base, \pcauset[name=NDash_baseline, baseline=2mm]{2,4,5,1,3}. \vspace{1ex} \section{Using this package in TikZ pictures} \label{sec:TikZ} Since the package is TikZ based, using a causet within a TikZ picture is simple. Each of the three main commands is based on a draw command in TikZ that has the same name but starts with \lstinline§\draw...§. -The \lstinline§\draw§ macros, however, do not support an optional argument (since this can be specified directly in a TikZ picture) and they also do not have any short hand macros ending in \lstinline§P§, \lstinline§L§ or \lstinline§X§. +The \lstinline§\draw§ macros, however, do not support an optional argument (since this can be specified directly in a TikZ picture) and they also do not have any short hand macros ending in \lstinline§P§, \lstinline§L§ or \lstinline§X§. +The \lstinline§\draw...§ do not add extra padding (\lstinline§\causets@Padding§) on the left and right of the graphic either. -The two following examples are given by external (standalone) TikZ graphics and included with \lstinline§\causetfile{...}§. -More details on using causets in standalone files are given in \autoref{sec:Standalone}. +The two following examples are given by external (standalone) TikZ graphics and included with \lstinline§\includegraphics{...}§. +More details on using causets in standalone files are given in \autoref{sec:ExternalCausets}. Note that the output of the \lstinline§\draw§ macros has the point (0,0) in the centre, so in order to shift it, we may enclose it in a TikZ scope, for example: \lstinputlisting{causet_tikz_example1.tex} \begin{center} - \causetfile{causet_tikz_example1} + \includegraphics{causet_tikz_example1} \end{center} Note that this example also shows how to use the event nodes that are generated by the \lstinline§\drawpcauset§ macro. The green arrow points to the node of the second causet event \lstinline§(E5)§. -The causet events, event labels, $u$-axis labels, and $v$-axis lables are the nodes \lstinline§(Ei)§, \lstinline§(ELi)§, \lstinline§(EULi)§, and \lstinline§(EVLi)§, respectively, where $\smash{i \in [ 1, N ]}$ for a causet with $N$ events. +The causet events, event labels, $u$-axis labels, and $v$-axis lables are the nodes \lstinline§(Ei)§, \lstinline§(ELi)§, \lstinline§(EULi)§, and \lstinline§(EVLi)§, respectively, where $\smash{i \in [ -1, 5 ]}$. It is also possible to use multiple causets in more complicated graphics, like a tree for example, but note that whenever a causet is actually a text of a node within a TikZ picture (like in the following), we need to use the \lstinline§\pcauset§ (\lstinline§\rcauset§ or \lstinline§\causet§) commands without the \lstinline§draw§ prefix again: \lstinputlisting{causet_tikz_example2.tex} -\hspace{-1.5ex}\causetfile{causet_tikz_example2} +\hspace{-1.5ex} +\includegraphics{causet_tikz_example2} \noindent More examples can be found at \\ \url{https://github.com/c-minz/LaTeX-causets/tree/main/examples} -%\clearpage +\clearpage +\tikzexternaldisable \section{Release notes} -\tikzcausetsset{large, events={black!20}, links={black!10}, cap links, label color={black!30}} -\subsection{v1.3, 2022-05-23} +\tikzcausetsset{large, events={black!30}, links={black!30}, label color={black!40}} + +\subsection[v1.4, 2023-03-06 (Vee-Diamond)]{v1.4, 2023-03-06} +\subsubsection{New features} +\begin{itemize}\itemsep=-1ex +\item \versioncauset{v1-4}{\rcauset[release/.style={black!40!cyan!85}]{1,5/release,3,2,4}{1/5/release}}% + Second values in the sequence of the first argument: now modifies the style of individual events, the events are replaced with the key \lstinline§event=§\PH, and the labels are set with \lstinline§label=§\PH. +\item Third values in the sequence of the second argument of \lstinline§\causet§ and \lstinline§\rcauset§: to modify the style of individual links. +\item Broken links for restyled links of \lstinline§\rcauset§: restyled links can also be drawn between events that would have not been automatically linked, hence these links might now be broken up like the links of \lstinline§\causet§. +\item New key \lstinline§name=§\PH: to define a name of a causet for easier readability of the tex source code (and to be used as external file name when the corresponding package option has been activated). +\item New option \lstinline§external§: to load the \lstinline§external§ library of TikZ for automatic externalisation of all diagrams. +\item New key \lstinline§set prefix=§\PH: to pass a file name prefix that is combined with a causet name for the external files when using \lstinline§external§. +\item New key \lstinline§name external=§\PH[bool]: to activate/deactivate using the causet names for external files. +\item Main commands: padded by a thin space (adjustable with \lstinline§padding=§\PH) for a better spacing in text and math mode. +\end{itemize} +\subsubsection{Modifications and fixes} +\begin{itemize}\itemsep=-1ex +\item Third values in the sequence of the first argument: no longer supported. +\item Spatial links: are now drawn before (so on a lower layer than) links. +\item Style \lstinline§arrow links§: the arrow heads are now filled. +\item Macro \lstinline§\causetspath§: has been replaced by \lstinline§name prefix=§\PH. +\item Short-hand macro \lstinline§\causetCrown§: changed to take a single argument (and the optional style argument) and returns the same output as \lstinline§\causetClosedFence§ used to, which has been removed. +\end{itemize} + +\subsection[v1.3.1, 2022-07-27 (Diamond)]{v1.3.1, 2022-07-27} +\subsubsection{Modifications and fixes} +\begin{itemize}\itemsep=-1ex +\item \versioncauset{v1-3-1}{\pcauset[replaced labels={left=0.5ex, at=west}]{1,3,2,4/label=.3}}% + Automatic event labels: now correctly printed when using \lstinline§offset=§\PH. +\end{itemize} + +\subsection[v1.3, 2022-05-23 (Da)]{v1.3, 2022-05-23} +\subsubsection{New features} +\begin{itemize}\itemsep=-1ex +\item %\versioncauset{v1-3}{\pcauset[replaced labels={left=0.5ex, at=west}]{1,4,2,3/label=.3}}% + Integer sequences in the arguments: use a permutation of an interval $[ a, b ]$, where $a$ and $b$ do no longer have to be natural numbers but can be any integers ($a \leq b$) including 0 and negative numbers. + These numbers name and label the events of the causet if the respective options are chosen. +\item Second values in the sequence of the first argument: to change the name and label of events. +\item New key \lstinline§offset=§\PH\ (0 by default): to define an integer shift for all events before they are named and labeled. +\item New style \lstinline§text font=§\PH\ (additionally to \lstinline§text scale=§\PH): to adjust the font style of text (labels), for example, to set the font size to 20pt (and a baseline skip of 24pt), use \lstinline§text font=\fontsize{20}{24}\selectfont§ +\end{itemize} + +\subsubsection{Modifications and fixes} \begin{itemize}\itemsep=-1ex - \item \versioncauset{v1-3}{\pcauset[replaced labels={left=0.5ex, at=west}]{1,4,2,3/.3}}% - The numbers for the arguments of the causet commands may now be chosen from an interval $[ a, b ]$, where $a$ and $b$ do no longer have to be natural numbers but are any integers ($a \leq b$) including 0 and negative numbers to name and label the events of the causet. - \item The integers given in the arguments of the causet commands that name (and auto label) events may now be modified with \lstinline§offset=§\PH\ (0 by default) before the events are named and labeled with the given numbers. - \item All sizes are now scaled with respect to the normal size and the line thickness of the event outline has been corrected. - \item The following size macros are no longer supported: \\ - \lstinline§\causetRegionLine§, \lstinline§\causetGridLine§, \lstinline§\causetEventSize§, \lstinline§\causetLinkWidth§, and \\ \lstinline§\causetBrokenLinkGap§. - The respective values are now stored in PGF keys and are measured with respect to the size unit (stored in \lstinline§\causetTileSize§). - \item For all labels in the diagram, the font size is now adjustable with \lstinline§text font=§\PH\ (additionally to \lstinline§text scale=§\PH), for example to set the font size to 20pt (and a baseline skip of 24pt), use -\begin{lstlisting} -text font=\fontsize{20}{24}\selectfont -\end{lstlisting} - \item Event labels and the event nodes itself may now be replaced by user-defined text in order to label events manually or use symbols like \lstinline§...§ for representations of infinite causets. - \item The package options have been fixed, they are now all single word options. - \item The short hand macros \lstinline§\*causetL...§ now deactivate the permutation and \\ \lstinline§\*causetP...§ now deactivate labels (if activated previously). +\item Size options: all sizes are now scaled with respect to the normal size. +\item Event style: line thickness of the event outline has been corrected. +\item Size macros removed: \lstinline§\causetRegionLine§, \lstinline§\causetGridLine§, \lstinline§\causetEventSize§, \\ \lstinline§\causetLinkWidth§, and \lstinline§\causetBrokenLinkGap§. + The respective values are now stored in PGF keys and are measured with respect to the size unit (stored in \lstinline§\causetTileSize§). +\item All package options: reduced to single words. +\item Permutation for \lstinline§\*causetL...§: now deactivated (if activated previously), by default. +\item Labels for \lstinline§\*causetP...§: now deactivated (if activated previously), by default. \end{itemize} -\subsection{v1.2, 2022-02-07} +\subsection[v1.2, 2022-02-07 (Vee)]{v1.2, 2022-02-07} +\subsubsection{New features} \begin{itemize}\itemsep=-1ex - \item \versioncauset{v1-2}{\pcauset{1,3,2}}% - The colour option \lstinline§blue§ has been modified so that a blue diagram is now only coloured in different shades of blue, gray and black. - \item Every event label is now positioned relative to the centre point of an event, so that the position of event labels can be modified with \lstinline§left=§\PH, \lstinline§right=§\PH, etc. - \item Arrow tips may now be added to the start and end of links via the style settings \lstinline§link starts=§\PH\ and \lstinline§link ends=§\PH, or via the pre-defined styles \lstinline§cap links§ and \lstinline§arrow links§. - \item By default, links drawn by the command \lstinline§\causet§ are now broken if they cross over an event. -The style of the start and end of the link interruption are set with \lstinline§link pauses=§\PH\ and \lstinline§link resumes=§\PH. - \item Links between spacelike separated events are now also supported by the command \lstinline§\rcauset§. +\item \versioncauset{v1-2}{\pcauset[arrow links]{1,3,2}}% + New style \lstinline§at=§\PH: to specify the relative point of events (\lstinline§at=center§\PH, by default) and position relative to this point using TikZ keys \lstinline§left=§\PH, \lstinline§right=§\PH, etc. +\item New styles \lstinline§cap links§ and \lstinline§arrow links§: add different arrow tips to the start and end of links. +\item New styles \lstinline§link starts=§\PH\ and \lstinline§link ends=§\PH: to modify arrow tips to the start and end of links. +\item Broken links for \lstinline§\causet§: links crossing over unlinked events are broken up now. +\item New styles \lstinline§link pauses=§\PH\ and \lstinline§link resumes=§\PH: to set the link ending style (arrows) at breaking points. +\item Spatial links for \lstinline§\rcauset§: spatial links for spacelike separated events are now supported by \lstinline§\rcauset§, too. \end{itemize} -\subsection{v1.1, 2020-12-15} -\tikzcausetsset{link starts={}, link ends={}} +\subsubsection{Modifications and fixes} \begin{itemize}\itemsep=-1ex - \item \versioncauset{v1-1}{\pcauset{1,2}}% - All colours, size and style options have been moved to PGF keys in the path +\item Colour option \lstinline§blue§: blue colours are now different shades of blue, gray and black only. +\end{itemize} + +\subsection[v1.1, 2020-12-15 (2-Chain)]{v1.1, 2020-12-15} +\subsubsection{New features} +\begin{itemize}\itemsep=-1ex +\item \versioncauset{v1-1}{\pcauset{1,2}}% + All colours, size and style options have been moved to PGF keys in the path \begin{lstlisting} /tikz/causets/ \end{lstlisting} \end{itemize} -\subsection{v1.0, 2020-11-08} +\subsection[v1.0, 2020-11-08 (Singleton)]{v1.0, 2020-11-08} \begin{itemize}\itemsep=-1ex - \item \versioncauset{v1-0}{\pcauset{1}}% - First release of the package \lstinline§causets§ on CTAN, \url{https://ctan.org/pkg/causets}, including all the main commands. +\item \versioncauset{v1-0}{\pcauset{1}}% + First release of the package \lstinline§causets§ on CTAN, \url{https://ctan.org/pkg/causets}, including all the main commands. \end{itemize} \noindent -Older versions of the package are at \\ +All previous versions of the package can be downloaded at \\ \url{https://github.com/c-minz/LaTeX-causets/tree/main/previous_versions} \section{Bug reports and package requests} @@ -936,22 +1040,9 @@ If you have a problem when using the package or you would like to have another f christoph(dot)minz(AT)gmail(dot)com\\ For reporting a bug, I much appreciated if you do the following: \begin{itemize}\itemsep=-1ex - \item Check the issues reported previously if your problem is already listed. - \item Describe your problem including the errors and warning messages, information about the drivers and programs versions. - \item Provide a minimal, working test file (only a single \TeX\ file) that demonstrates the problem. +\item Check the issues reported previously if your problem is already listed. +\item Describe your problem including the errors and warning messages, information about the drivers and programs versions. +\item Provide a minimal, working test file (only a single \TeX\ file) that demonstrates the problem. \end{itemize} \end{document} - -%% Size testing: -\documentclass[tikz,10pt]{standalone} -\usepackage[blue]{causets} -\begin{document} -\pcauset[tiny]{1,3,2,4} -\pcauset[very small]{1,3,2,4} -\pcauset[small]{1,3,2,4} -\pcauset{1,3,2,4} -\pcauset[large]{1,3,2,4} -\pcauset[very large]{1,3,2,4} -\pcauset[huge]{1,3,2,4} -\end{document} diff --git a/graphics/pgf/contrib/outilsgeomtikz/README.md b/graphics/pgf/contrib/outilsgeomtikz/README.md new file mode 100644 index 0000000000..bf1842397d --- /dev/null +++ b/graphics/pgf/contrib/outilsgeomtikz/README.md @@ -0,0 +1,7 @@ +OutilsGeomTikz is a package with geometric tools in TikZ. +----------------------------------------------------------- +OutilsGeomTikz est un package avec outils gĂ©omĂ©triques en TikZ. +----------------------------------------------------------- +Author : CĂ©dric Pierquet +email : cpierquet@outlook.fr +Licence : Released under the LaTeX Project Public License v1.3c or later, see http://www.latex-project.org/lppl.txt
\ No newline at end of file diff --git a/graphics/pgf/contrib/outilsgeomtikz/doc/OutilsGeomTikz-doc.pdf b/graphics/pgf/contrib/outilsgeomtikz/doc/OutilsGeomTikz-doc.pdf Binary files differnew file mode 100644 index 0000000000..9a62f0d515 --- /dev/null +++ b/graphics/pgf/contrib/outilsgeomtikz/doc/OutilsGeomTikz-doc.pdf diff --git a/graphics/pgf/contrib/outilsgeomtikz/doc/OutilsGeomTikz-doc.tex b/graphics/pgf/contrib/outilsgeomtikz/doc/OutilsGeomTikz-doc.tex new file mode 100644 index 0000000000..a2e0c58b23 --- /dev/null +++ b/graphics/pgf/contrib/outilsgeomtikz/doc/OutilsGeomTikz-doc.tex @@ -0,0 +1,792 @@ +% !TeX TXS-program:compile = txs:///arara +% arara: lualatex: {shell: yes, synctex: no, interaction: batchmode} +% arara: lualatex: {shell: yes, synctex: no, interaction: batchmode} if found('log', '(undefined references|Please rerun|Rerun to get)') + +\documentclass[french,a4paper,11pt]{article} +\usepackage[margin=2cm,includefoot]{geometry} +\def\TPversion{0.1.0} +\def\TPdate{03 Mars 2023} +\usepackage[table,svgnames]{xcolor} +\usepackage[bold-style=ISO,math-style=french]{concmath-otf} +%\usepackage[bold-style=ISO,math-style=french]{unicode-math} +%\setmainfont{TeX Gyre Schola} +%\setmathfont{TeX Gyre Schola Math} +\usepackage{OutilsGeomTikz} +\usepackage{awesomebox} +\usepackage{fontawesome5} +\usepackage{footnote} +\makesavenoteenv{tabular} +\usepackage{enumitem} +\usepackage{tabularray} +\usepackage{multicol} +\usepackage{fancyvrb} +\usepackage{fancyhdr} +\usepackage{siunitx} +\sisetup{locale=FR,output-decimal-marker={,},group-minimum-digits=4} +\pagestyle{fancy} +\fancyhf{} +\renewcommand{\headrulewidth}{0pt} +\lfoot{\sffamily\small [OutilsGeomTikz]} +\cfoot{\sffamily\small - \thepage{} -} +\rfoot{} +\rfoot{\hyperlink{matoc}{\small\faArrowAltCircleUp[regular]}} + +\usepackage{hologo} +\providecommand\tikzlogo{Ti\textit{k}Z} +\providecommand\TeXLive{\TeX{}Live\xspace} +\providecommand\PSTricks{\textsf{PSTricks}\xspace} +\let\pstricks\PSTricks +\let\TikZ\tikzlogo +\newcommand\TableauDocumentation{% + \begin{tblr}{width=\linewidth,colspec={X[c]X[c]X[c]X[c]X[c]X[c]},cells={font=\sffamily}} + {\LARGE \LaTeX} & & & & &\\ + & {\LARGE \hologo{pdfLaTeX}} & & & & \\ + & & {\LARGE \hologo{LuaLaTeX}} & & & \\ + & & & {\LARGE \TikZ} & & \\ + & & & & {\LARGE \TeXLive} & \\ + & & & & & {\LARGE \hologo{MiKTeX}} \\ + \end{tblr} +} + +\usepackage{hyperref} +\urlstyle{same} +\hypersetup{pdfborder=0 0 0} +\setlength{\parindent}{0pt} +\definecolor{LightGray}{gray}{0.9} + +\usepackage[french]{babel} +\AddThinSpaceBeforeFootnotes +\FrenchFootnotes + +\usepackage[most]{tcolorbox} +\usetikzlibrary{calc} +\tcbuselibrary{minted} +\NewTCBListing{PresentationCode}{ O{blue} m }{% + sharp corners=downhill,enhanced,arc=12pt,skin=bicolor,% + colback=#1!1!white,colframe=#1!75!black,colbacklower=white,% + attach boxed title to top right={yshift=-\tcboxedtitleheight},title=Code \LaTeX,% + boxed title style={% + colframe=#1!75!black,colback=#1!15!white,% + ,sharp corners=downhill,arc=12pt,% + },% + top=\baselineskip,% + fonttitle=\color{#1!90!black}\itshape\ttfamily\footnotesize,% + listing engine=minted,minted style=colorful, + minted language=tex,minted options={tabsize=2,fontsize=\small,autogobble,breaklines=true}, + #2 +} + +\tcbset{vignettes/.style={% + nobeforeafter,box align=base,boxsep=0pt,enhanced,sharp corners=all,rounded corners=southeast,% + boxrule=0.75pt,left=7pt,right=1pt,top=0pt,bottom=0.25pt,% + } +} + +\tcbset{vignetteMaJ/.style={% + fontupper={\vphantom{pf}\footnotesize\ttfamily}, + vignettes,colframe=ForestGreen!50!black,coltitle=white,colback=ForestGreen!25,% + overlay={\begin{tcbclipinterior}% + \fill[fill=ForestGreen!75]($(interior.south west)$) rectangle node[rotate=90]{\tiny \sffamily{\textcolor{Black}{\scalebox{0.85}[0.75]{\textbf{MĂ J}}}}} ($(interior.north west)+(5pt,0pt)$);% + \end{tcbclipinterior}} + } +} + +\newcommand\Cle[1]{{\bfseries\sffamily\textlangle #1\textrangle}} +\newcommand\cmaj[1]{\tcbox[vignetteMaJ]{#1}\xspace} + +\newcommand\affichegrille[4]{% + \draw[xstep=1,ystep=1,lightgray] (#1,#3) grid (#2,#4) ; + \foreach \x in {#1,\inteval{1+#1},...,#2} \draw[lightgray] (\x,#4)--++(0,3pt) node[font=\scriptsize,above] {$\x$} ; + \foreach \y in {#3,\inteval{1+#3},...,#4} \draw[lightgray] (#1,\y)--++(-3pt,0) node[font=\scriptsize,left] {$\y$} ; +} +\newcommand\pointsutiles[1]{% + \foreach \point in {#1} {\draw[thick,fill=red] \point circle[radius=3pt] ;} +} + +\begin{document} + +\setlength{\aweboxleftmargin}{0.07\linewidth} +\setlength{\aweboxcontentwidth}{0.93\linewidth} +\setlength{\aweboxvskip}{8pt} + +\thispagestyle{empty} + +\vspace{2cm} + +\begin{center} + \begin{minipage}{0.75\linewidth} + \begin{tcolorbox}[colframe=yellow,colback=yellow!15] + \begin{center} + \begin{tabular}{c} + {\Huge \texttt{OutilsGeomTikz [fr]}}\\ + \\ + {\LARGE Des outils gĂ©omĂ©triques, } \\ + \\ + {\LARGE en Ti\textit{k}Z}. \\ + \end{tabular} + + \bigskip + + {\small \texttt{Version \TPversion{} -- \TPdate}} + \end{center} + \end{tcolorbox} +\end{minipage} +\end{center} + +\begin{center} + \begin{tabular}{c} + \texttt{CĂ©dric Pierquet}\\ + {\ttfamily c pierquet -- at -- outlook . fr}\\ + \texttt{\url{https://github.com/cpierquet/OutilsGeomTikz}} +\end{tabular} +\end{center} + +\vspace{0.25cm} + +{$\blacktriangleright$~~Des outils gĂ©omĂ©triques, personnalisables, en Ti\textit{k}Z.} + +\smallskip + +{$\blacktriangleright$~~Une rĂšgle, un rapporteur, une Ă©querre, une rĂ©querre, un rappĂ©querre, un crayon, un compas.} + +\vspace{0.5cm} + +\hfill +\begin{tikzpicture} + \tkzRegle[Fond,AfficheValeurs,Longueur=15,Rotation=-20,Echelle=0.5,CouleurFond=blue] + \tkzEquerre + [Fond,AfficheValeurs,Longueur=12,Origine={(-20:4)},Rotation=-20,CouleurFond=red,Echelle=0.5] + \tkzCrayon[Couleur=ForestGreen,Origine={(-20:4)},Rotation=30,Echelle=0.5] + \draw (10,-5)--++(20:5) (10,-5)--++(50:5) ; + \tkzRapporteur[Fond,CouleurFond=purple,Origine={(10,-5)},Echelle=0.5,Rotation=20] + \tkzRappEquerre[Fond,Origine={(8,1)},Rotation=90,CouleurFond=ForestGreen,Echelle=0.5] + \tkzCrayon[Couleur=yellow,Origine={(8,-1)},Rotation=20,Echelle=0.5] + \coordinate (AA) at ($(10,-5)+(50:{0.5*3.75})$) ; + \tkzCrayon[Couleur=orange,Origine={AA},Rotation=-20,Echelle=0.5] + \tkzRequerre[Fond,AfficheValeurs,CouleurFond=yellow,Origine={(3,-3)},Rotation=-30,Echelle=0.5] + \tkzCrayon[Couleur=gray,Origine={(3,-3)},Rotation=-98,Echelle=0.5] + %compas + \coordinate (FG) at (0,1) ; \coordinate (FH) at (2,1.5) ; + \tkzCompas[LongueurBranches=3,EchelleCrayon=0.75]{FG}{FH} + \tkzRapporteur[Complet,Echelle=0.5,Origine={(13,3.25)},Rotation=25,Fond,CouleurFond=orange] +\end{tikzpicture}\hfill~ + +%\vspace{0.5cm} +% +%\hfill{}\textit{Merci Ă Denis BitouzĂ© et Ă Gilles Le Bourhis pour leurs retours et idĂ©es !} + +\smallskip + +\vfill + +\hrule + +\medskip + +\TableauDocumentation + +\medskip + +\hrule + +\medskip + +\newpage + +\phantomsection +\hypertarget{matoc}{} + +\tableofcontents + +\vfill + +\part{Historique} + +\verb|v0.1.0|~:~~~~Version initiale. + +\vspace{1cm} + +\newpage + +\part{Introduction} + +\section{Le package OutilsGeomTikz} + +\subsection{Introduction} + +\begin{noteblock} +Le package \textsf{OutilsGeomTikz} \textit{propose} des Ă©lĂ©ments graphiques, en langage \TikZ, pour prĂ©senter des outils de construction classiques et personnalisables : + +\begin{itemize} + \item un crayon ; + \item une rĂšgle graduĂ©e ; + \item une Ă©querre graduĂ©e (30/60) ; + \item un rapporteur (180 ou 360); + \item une rĂ©querre graduĂ©e ; + \item une \og rappĂ©querre \fg{} graduĂ©e ; + \item un compas. +\end{itemize} +\vspace*{-\baselineskip}\leavevmode +\end{noteblock} + +\begin{cautionblock} +Certaines idĂ©es et \textit{donc} certains \textit{morceaux} de codes proviennent de StĂ©phane Pasquet\footnotemark\footnotetext{\url{https://tex.stackexchange.com/questions/147389/symbols-of-pencil-ruler-and-compass}} sur un fil de discussion en ligne. +\end{cautionblock} + +\subsection{Chargement du package, packages utilisĂ©s} + +\begin{importantblock} +Le package se charge, dans le prĂ©ambule, de maniĂšre classique. + +Pas d'\textit{option} pour le package, qui ne nĂ©cessite que \textit{peu} de dĂ©pendances ! +\end{importantblock} + +\begin{PresentationCode}{listing only} +\usepackage{OutilsGeomTikz} +\end{PresentationCode} + +\begin{noteblock} +\textsf{OutilsGeomTikz} charge les packages et librairies suivants : + +\begin{itemize} + \item \texttt{tikz}, \texttt{pgffor}, \texttt{simplekv}, \texttt{nicefrac} et \texttt{xstring} ; + \item \texttt{\textit{tikz}.calc}, \texttt{\textit{tikz}.positioning}. +\end{itemize} + +Il est compatible avec les compilations usuelles en \textsf{latex}, \textsf{pdflatex}, \textsf{lualatex} ou \textsf{xelatex}. +\end{noteblock} + +\subsection{Autres solutions} + +\begin{noteblock} +D'autres solutions existent pour prĂ©senter des outils gĂ©omĂ©triques, notamment \textsf{pst-geometrictools}\footnotemark\footnotetext{disponible sur le CTAN : \url{https://ctan.org/pkg/pst-geometrictools}.} (avec du code \PSTricks) ou \textsf{tkz-tools}\footnotemark\footnotetext{disponible sur son site : \url{https://www.mathweb.fr/euclide/les-packages-personnels-latex-stephane-pasquet/}.}, dont \textsf{OutilsGeomTikz} reprend quelques Ă©lĂ©ments de base ! + +\smallskip + +L'utilisateur utilisera la solution la mieux adaptĂ©e pour ses besoins ! +\end{noteblock} + +\pagebreak + +\section{Philosophie du package} + +\subsection{Fonctionnement global} + +\begin{tipblock} +Les diffĂ©rents outils disponibles ont \textit{grosso-modo} le mĂȘme mode de fonctionnement : + +\begin{itemize} + \item le \textit{nom} de la commande est sous la forme \texttt{\textbackslash tkz<Outil>} ; + \item les outils ont Ă©tĂ© crĂ©Ă©s, en \TikZ, avec comme unitĂ© de base le centimĂštre ; + \item pour certains outils, des dimensions minimales sont requises pour un aspect conforme et acceptable ; + \item les options personnalisables sont (sauf exceptions) : + \begin{itemize} + \item la \textit{taille} ; + \item l'\textit{Ă©chelle} globale ou l'\textit{Ă©chelle} des Ă©ventuels labels ; + \item les \textit{couleurs} ; + \item le \textit{fond} (couleur et opacitĂ©) ; + \item la position (\textit{placement} et/ou \textit{rotation}). + \end{itemize} +\end{itemize} +\vspace*{-\baselineskip}\leavevmode +\end{tipblock} + +\subsection{Liste des commandes} + +\begin{cautionblock} +Les outils disponibles sont Ă insĂ©rer dans un environnement \TikZ, et pour le moment il existe : +\begin{itemize} + \item \texttt{\textbackslash tkzRegle} ; + \item \texttt{\textbackslash tkzEquerre} ; + \item \texttt{\textbackslash tkzRapporteur} ; + \item \texttt{\textbackslash tkzRequerre} ; + \item \texttt{\textbackslash tkzRappequerre} ; + \item \texttt{\textbackslash tkzCompas} ; + \item \texttt{\textbackslash tkzCrayon}. +\end{itemize} +\vspace*{-\baselineskip}\leavevmode +\end{cautionblock} + +\begin{PresentationCode}{listing only} +\tkzRegle[clĂ©s] +\tkzEquerre[clĂ©s] +\tkzRapporteur[clĂ©s] +\tkzRequerre[clĂ©s] +\tkzRappEquerre[clĂ©s] +\tkzCrayon[clĂ©s] +\tkzCompas[clĂ©s]{pointe}{mine} +\end{PresentationCode} + +\subsection{Utilisation d'unitĂ©s} + +\begin{tipblock} +Les outils ont Ă©tĂ© crĂ©Ă©s avec unitĂ© de base de 1~cm, afin que les graduations soient \textit{en taille rĂ©elle}. + +\smallskip + +Il est toutefois possible de modifier les unitĂ©s de l'environnement \TikZ, dans ce cas les graduations des outils ne seront plus forcĂ©ment en adĂ©quation avec les unitĂ©s choisies. + +\smallskip + +Ce choix est donc Ă \textit{rĂ©server} dans l'optique de faire des petits schĂ©mas pour illustrer des positions d'outils. +\end{tipblock} + +\pagebreak + +\part{Les outils} + +\section{Le crayon} + +\subsection{La commande} + +\begin{cautionblock} +Le package propose l'outil \textsf{Crayon}. + +La forme gĂ©nĂ©rale du crayon est \textit{fixĂ©e}, mais le crayon peut ĂȘtre \textit{personnalisĂ©}. +\end{cautionblock} + +\begin{PresentationCode}{tikz lower} +\tkzCrayon +\end{PresentationCode} + +\subsection{ClĂ©s et options} + +\begin{tipblock} +Quelques \Cle{clĂ©s} de personnalisation sont disponibles : + +\begin{itemize} + \item \Cle{Longueur} pour la taille, en cm, du crayon ;\hfill~(dĂ©faut : \Cle{5} et mini \Cle{2.5}) + \item \Cle{Origine} pour le placer le crayon (au niveau du $0$) ;\hfill~(dĂ©faut : \Cle{\{(0,0)\}}) + \item \Cle{Rotation} pour pivoter le crayon (au niveau de la mine) ;\hfill~(dĂ©faut : \Cle{0}) + \item \Cle{Echelle} pour l'Ă©chelle globale le crayon ;\hfill~(dĂ©faut : \Cle{1}) + \item \Cle{Couleur} pour la couleur du crayon.\hfill~(dĂ©faut : \Cle{red}) +\end{itemize} +\vspace*{-\baselineskip}\leavevmode +\end{tipblock} + +\begin{noteblock} +Pour des exemples de personnalisation, une grille ainsi que les points \textit{support} seront rajoutĂ©s. + +\smallskip + +Toutes les \Cle{clĂ©s} ne seront pas prĂ©sentĂ©es de maniĂšre indĂ©pendante, mais parfois elles seront \textit{cumulĂ©es} pour Ă©viter de surcharger la sortie. +\end{noteblock} + +\begin{PresentationCode}{listing only} +%environnement tikz +\tkzCrayon[Origine={(-3,-2)},Echelle=0.75,Rotation=45,Couleur=DarkBlue] +\tkzCrayon[Origine={(1,-4)},Longueur=10,Rotation=-30,Couleur=Green] +\tkzCrayon[Origine={(-3,3)},Echelle=1.25,Rotation=195,Couleur=orange] +\end{PresentationCode} + +\begin{PresentationCode}{text only} +\begin{tikzpicture} + \affichegrille{-7}{7}{-5}{5} + \pointsutiles{(-3,-2),(1,-4),(-3,3)} + \tkzCrayon[Origine={(-3,-2)},Echelle=0.75,Rotation=45,Couleur=DarkBlue] + \tkzCrayon[Origine={(1,-4)},Longueur=10,Rotation=-30,Couleur=Green] + \tkzCrayon[Origine={(-3,3)},Echelle=1.25,Rotation=195,Couleur=orange] +\end{tikzpicture} +\end{PresentationCode} + +\pagebreak + +\section{La rĂšgle graduĂ©e} + +\subsection{La commande} + +\begin{cautionblock} +Le package propose l'outil \textsf{RĂšgle graduĂ©e}. + +La forme gĂ©nĂ©rale de la rĂšgle est \textit{fixĂ©e}, mais la rĂšgle peut ĂȘtre \textit{personnalisĂ©e}. +\end{cautionblock} + +\begin{PresentationCode}{tikz lower} +\tkzRegle +\end{PresentationCode} + +\subsection{ClĂ©s et options} + +\begin{tipblock} +Quelques \Cle{clĂ©s} de personnalisation sont disponibles : + +\begin{itemize} + \item \Cle{Longueur} pour la taille, en cm, de la rĂšgle ;\hfill~(dĂ©faut : \Cle{12} et mini \Cle{3}) + \item \Cle{Largeur} pour la largeur, en cm, de la rĂšgle ;\hfill~(dĂ©faut : \Cle{1.5} et mini \Cle{1.25}) + \item \Cle{Origine} pour le placer la rĂšgle (au niveau du $0$) ;\hfill~(dĂ©faut : \Cle{\{(0,0)\}}) + \item \Cle{Rotation} pour pivoter la rĂšgle (au niveau du $0$) ;\hfill~(dĂ©faut : \Cle{0}) + \item \Cle{Echelle} pour l'Ă©chelle globale de la rĂšgle ;\hfill~(dĂ©faut : \Cle{1}) + \item \Cle{Couleur} pour la couleur des Ă©lĂ©ments de la rĂšgle ;\hfill~(dĂ©faut : \Cle{black}) + \item le boolĂ©en \Cle{Fond} pour afficher une couleur de fond pour la rĂšgle ;\hfill~(dĂ©faut : \Cle{false}) + \item \Cle{CouleurFond} pour la couleur du fond de la rĂšgle ;\hfill~(dĂ©faut : \Cle{black}) + \item \Cle{Opacite} pour rĂ©gler l'opacitĂ© du fond de la rĂšgle ;\hfill~(dĂ©faut : \Cle{0.5}) + \item le boolĂ©en \Cle{AfficheValeurs} pour afficher les valeurs des graduations ;\hfill~(dĂ©faut : \Cle{true}) + \item \Cle{PosVal} pour spĂ©cifier la position (haut, milieu, etc) des valeurs, parmi \Cle{h/m/b/hb}. + + \hfill~(dĂ©faut : \Cle{m}) +\end{itemize} +\vspace*{-\baselineskip}\leavevmode +\end{tipblock} + +\begin{noteblock} +Pour des exemples de personnalisation, une grille ainsi que les points \textit{support} seront rajoutĂ©s. + +\smallskip + +Toutes les \Cle{clĂ©s} ne seront pas prĂ©sentĂ©es de maniĂšre indĂ©pendante, mais parfois elles seront \textit{cumulĂ©es} pour Ă©viter de surcharger la sortie. +\end{noteblock} + +\begin{PresentationCode}{listing only} +%environnement tikz +\tkzRegle[Fond,CouleurFond=red] +\tkzRegle[Longueur=13,Largeur=2,Rotation=-45,Couleur=ForestGreen, Origine={(1,-3)},Fond,PosVal=hb] +\tkzRegle[Largeur=1.25,Longueur=9,Couleur=blue,Rotation=20,Origine={(0,3)}, AfficheValeurs=false] +\end{PresentationCode} + +\begin{PresentationCode}{text only} +\begin{tikzpicture} + \affichegrille{-1}{13}{-14}{7} + \pointsutiles{(0,0),(1,-3),(0,3)} + \tkzRegle[Fond,CouleurFond=red] + \tkzRegle[Longueur=13,Largeur=2,Rotation=-45,Couleur=ForestGreen,Origine={(1,-3)},Fond,PosVal=hb] + \tkzRegle[Largeur=1.25,Longueur=9,Couleur=blue,Rotation=20,Origine={(0,3)},AfficheValeurs=false] +\end{tikzpicture} +\end{PresentationCode} + +\pagebreak + +\section{L'Ă©querre} + +\subsection{La commande} + +\begin{cautionblock} +Le package propose l'outil \textsf{Ăquerre}. + +La forme gĂ©nĂ©rale de l'Ă©querre (angles 60/30) est \textit{fixĂ©e}, mais l'Ă©querre peut ĂȘtre \textit{personnalisĂ©e}. +\end{cautionblock} + +\begin{PresentationCode}{tikz lower} +\tkzEquerre +\end{PresentationCode} + +\subsection{ClĂ©s et options} + +\begin{tipblock} +Quelques \Cle{clĂ©s} de personnalisation sont disponibles : + +\begin{itemize} + \item \Cle{Longueur} pour la longueur, en cm, de l'Ă©querre ;\hfill~(dĂ©faut : \Cle{10} et mini \Cle{4.5}) + \item \Cle{Origine} pour le placer l'Ă©querre (au niveau du coin) ;\hfill~(dĂ©faut : \Cle{\{(0,0)\}}) + \item \Cle{Rotation} pour pivoter l'Ă©querre (au niveau du coin) ;\hfill~(dĂ©faut : \Cle{0}) + \item \Cle{Echelle} pour l'Ă©chelle globale de l'Ă©querre ;\hfill~(dĂ©faut : \Cle{1}) + \item \Cle{Couleur} pour la couleur des Ă©lĂ©ments de l'Ă©querre ;\hfill~(dĂ©faut : \Cle{black}) + \item le boolĂ©en \Cle{Fond} pour afficher une couleur de fond pour l'Ă©querre ;\hfill~(dĂ©faut : \Cle{false}) + \item \Cle{CouleurFond} pour la couleur du fond de l'Ă©querre ;\hfill~(dĂ©faut : \Cle{black}) + \item \Cle{Opacite} pour rĂ©gler l'opacitĂ© du fond de l'Ă©querre ;\hfill~(dĂ©faut : \Cle{0.5}) + \item le boolĂ©en \Cle{AfficheValeurs} pour afficher les valeurs des graduations.\hfill~(dĂ©faut : \Cle{true}) +\end{itemize} +\vspace*{-\baselineskip}\leavevmode +\end{tipblock} + +\begin{PresentationCode}{listing only} +%environnement tikz +\tkzEquerre[Fond] +\tkzEquerre[Echelle=0.5,Origine={(8,6)},Couleur=DarkBlue,Rotation=-45] +\tkzEquerre[Longueur=10,Origine={(2.5,-1)},Couleur=red,Rotation=-105] +\end{PresentationCode} + +\begin{PresentationCode}{text only} +\begin{tikzpicture} + \affichegrille{-1}{13}{-7}{11} + \pointsutiles{(0,0),(8,6),(2.5,-1)} + \tkzEquerre[Fond] + \tkzEquerre[Echelle=0.5,Origine={(8,6)},Couleur=DarkBlue,Rotation=-45] + \tkzEquerre[Longueur=10,Origine={(2.5,-1)},Couleur=red,Rotation=-105] +\end{tikzpicture} +\end{PresentationCode} + +\pagebreak + +\section{Les rapporteurs (180 \&{} 360)} + +\subsection{La commande} + +\begin{cautionblock} +Le package propose l'outil \textsf{Rapporteur}. + +La forme gĂ©nĂ©rale du rapporteur (largeur $7,5$~cm) est \textit{fixĂ©e}, mais le rapporteur peut ĂȘtre \textit{personnalisĂ©}. +\end{cautionblock} + +\begin{PresentationCode}{tikz lower} +\tkzRapporteur +\end{PresentationCode} + +\begin{PresentationCode}{tikz lower} +\tkzRapporteur[Complet] +\end{PresentationCode} + +\subsection{ClĂ©s et options} + +\begin{tipblock} +Quelques \Cle{clĂ©s} de personnalisation sont disponibles : + +\begin{itemize} + \item le boolĂ©en \Cle{Complet} pour afficher la version \og 360 \fg{};\hfill~(dĂ©faut : \Cle{false}) + \item \Cle{Origine} pour le placer le rapporteur (au niveau du \textit{centre}) ;\hfill~(dĂ©faut : \Cle{\{(0,0)\}}) + \item \Cle{Rotation} pour pivoter le rapporteur (au niveau du \textit{centre}) ;\hfill~(dĂ©faut : \Cle{0}) + \item \Cle{Echelle} pour l'Ă©chelle globale du rapporteur ;\hfill~(dĂ©faut : \Cle{1}) + \item \Cle{Couleur} pour la couleur des Ă©lĂ©ments du rapporteur ;\hfill~(dĂ©faut : \Cle{black}) + \item le boolĂ©en \Cle{Fond} pour afficher une couleur de fond ;\hfill~(dĂ©faut : \Cle{false}) + \item \Cle{CouleurFond} pour la couleur du fond du rapporteur ;\hfill~(dĂ©faut : \Cle{black}) + \item \Cle{Opacite} pour rĂ©gler l'opacitĂ© du fond du rapporteur ;\hfill~(dĂ©faut : \Cle{0.5}) + \item le boolĂ©en \Cle{AfficheAngles} pour afficher les valeurs des angles.\hfill~(dĂ©faut : \Cle{true}) +\end{itemize} +\vspace*{-\baselineskip}\leavevmode +\end{tipblock} + +\begin{PresentationCode}{listing only} +%environnement tikz +\tkzRapporteur[Fond,CouleurFond=purple] +\tkzRapporteur[Origine={(-2,-3)},Rotation=-45,Couleur=ForestGreen,Echelle=0.5] +\tkzRapporteur[Complet,Origine={(8,-3)},Rotation=30,Couleur=DarkBlue, Echelle=0.75] +\tkzRapporteur[Origine={(7,1)},Rotation=15,Couleur=orange, Echelle=0.75,AfficheAngles=false] +\tkzRapporteur[Complet,Origine={(8,-3)},Rotation=30,Couleur=DarkBlue, Echelle=0.75] +\tkzRapporteur[Complet,Origine={(2,-4)},Rotation=-90,Couleur=red, Echelle=0.5,AfficheAngles=false,Fond,CouleurFond=yellow] +\end{PresentationCode} + +\begin{PresentationCode}{text only} +\begin{tikzpicture} + \affichegrille{-4}{11}{-6}{4} + \pointsutiles{(0,0),(-2,-3),(8,-3),(7,1),(2,-4)} + \tkzRapporteur[Fond,CouleurFond=purple] + \tkzRapporteur[Origine={(-2,-3)},Rotation=-45,Couleur=ForestGreen,Echelle=0.5] + \tkzRapporteur[Complet,Origine={(8,-3)},Rotation=30,Couleur=DarkBlue, Echelle=0.75] + \tkzRapporteur[Origine={(7,1)},Rotation=15,Couleur=orange, Echelle=0.75,AfficheAngles=false] + \tkzRapporteur[Complet,Origine={(8,-3)},Rotation=30,Couleur=DarkBlue, Echelle=0.75] + \tkzRapporteur[Complet,Origine={(2,-4)},Rotation=-90,Couleur=red,Echelle=0.5,AfficheAngles=false,Fond,CouleurFond=yellow] +\end{tikzpicture} +\end{PresentationCode} + +\pagebreak + +\section{La rĂ©querre} + +\subsection{La commande} + +\begin{cautionblock} +Le package propose l'outil \textsf{RĂ©querre}. + +La forme gĂ©nĂ©rale de la rĂ©querre est \textit{fixĂ©e}, mais la rĂ©querre peut ĂȘtre \textit{personnalisĂ©e}. +\end{cautionblock} + +\begin{PresentationCode}{tikz lower} +\tkzRequerre +\end{PresentationCode} + +\subsection{ClĂ©s et options} + +\begin{tipblock} +Quelques \Cle{clĂ©s} de personnalisation sont disponibles : + +\begin{itemize} + \item \Cle{Longueur} pour la taille, en cm, de la rĂ©querre ;\hfill~(dĂ©faut : \Cle{12} et mini \Cle{6}) + \item \Cle{Largeur} pour la largeur, en cm, la rĂ©querre ;\hfill~(dĂ©faut : \Cle{3} et mini \Cle{1.5}) + \item \Cle{Origine} pour le placer la rĂ©querre (au niveau du \textit{centre}) ;\hfill~(dĂ©faut : \Cle{\{(0,0)\}}) + \item \Cle{Rotation} pour pivoter la rĂ©querre (au niveau du coin) ;\hfill~(dĂ©faut : \Cle{0}) + \item \Cle{Echelle} pour l'Ă©chelle globale de la rĂ©querre ;\hfill~(dĂ©faut : \Cle{1}) + \item \Cle{Couleur} pour la couleur des Ă©lĂ©ments de la rĂ©querre ;\hfill~(dĂ©faut : \Cle{black}) + \item le boolĂ©en \Cle{Fond} pour afficher une couleur de fond pour la rĂ©querre ;\hfill~(dĂ©faut : \Cle{false}) + \item \Cle{CouleurFond} pour la couleur du fond de la rĂ©querre ;\hfill~(dĂ©faut : \Cle{black}) + \item \Cle{Opacite} pour rĂ©gler l'opacitĂ© du fond de la rĂ©querre ;\hfill~(dĂ©faut : \Cle{0.5}) + \item le boolĂ©en \Cle{AfficheValeurs} pour afficher les valeurs des graduations.\hfill~(dĂ©faut : \Cle{true}) +\end{itemize} +\vspace*{-\baselineskip}\leavevmode +\end{tipblock} + +\begin{PresentationCode}{listing only} +%environnement tikz +\tkzRequerre[Fond,CouleurFond=yellow] +\tkzRequerre[Echelle=0.5,Origine={(-5,-6)},Rotation=-80,Couleur=ForestGreen, Longueur=10,Largeur=3.5,AfficheValeurs=false] +\tkzRequerre[Origine={(1,-5)},Rotation=15,Couleur=DarkBlue, Longueur=9,Largeur=2.75] +\end{PresentationCode} + +\begin{PresentationCode}{text only} +\begin{tikzpicture} + \affichegrille{-8}{7}{-9}{1} + \pointsutiles{(0,0),(-5,-6),(1,-5)} + \tkzRequerre[Fond,CouleurFond=yellow] + \tkzRequerre[Echelle=0.5,Origine={(-5,-6)},Rotation=-80,Couleur=ForestGreen, Longueur=10,Largeur=3.5,AfficheValeurs=false] + \tkzRequerre[Origine={(1,-5)},Rotation=15,Couleur=DarkBlue,Longueur=9,Largeur=2.75] +\end{tikzpicture} +\end{PresentationCode} + +\pagebreak + +\section{La \og rappĂ©querre \fg} + +\subsection{La commande} + +\begin{cautionblock} +Le package propose l'outil \textsf{RappĂquerre}. + +La forme gĂ©nĂ©rale de la rappĂ©querre est \textit{fixĂ©e}, mais la rappĂ©querre peut ĂȘtre \textit{personnalisĂ©e}. +\end{cautionblock} + +\begin{PresentationCode}{tikz lower} +\tkzRappEquerre +\end{PresentationCode} + +\subsection{ClĂ©s et options} + +\begin{tipblock} +Quelques \Cle{clĂ©s} de personnalisation sont disponibles : + +\begin{itemize} + \item \Cle{Largeur} pour la (demie-)largeur, en cm, de la rappĂ©querre ;\hfill~(dĂ©faut : \Cle{6} et mini \Cle{3}) + \item \Cle{Origine} pour le placer la rappĂ©querre (au niveau du coin) ;\hfill~(dĂ©faut : \Cle{\{(0,0)\}}) + \item \Cle{Rotation} pour pivoter la rappĂ©querre (au niveau du coin) ;\hfill~(dĂ©faut : \Cle{0}) + \item \Cle{Echelle} pour l'Ă©chelle globale de la rappĂ©querre ;\hfill~(dĂ©faut : \Cle{1}) + \item \Cle{EchelleValeurs} pour l'Ă©chelle des valeurs ;\hfill~(dĂ©faut : \Cle{1}) + \item \Cle{Couleur} pour la couleur des Ă©lĂ©ments de la rappĂ©querre ;\hfill~(dĂ©faut : \Cle{black}) + \item le boolĂ©en \Cle{Fond} pour afficher une couleur de fond pour la rappĂ©querre ;\hfill~(dĂ©faut : \Cle{false}) + \item \Cle{CouleurFond} pour la couleur du fond de la rappĂ©querre ;\hfill~(dĂ©faut : \Cle{black}) + \item \Cle{Opacite} pour rĂ©gler l'opacitĂ© du fond de la rappĂ©querre ;\hfill~(dĂ©faut : \Cle{0.5}) + \item le boolĂ©en \Cle{AfficheAngles} pour afficher les valeurs des angles ;\hfill~(dĂ©faut : \Cle{true}) + \item le boolĂ©en \Cle{AfficheValeurs} pour afficher les valeurs des graduations.\hfill~(dĂ©faut : \Cle{true}) +\end{itemize} +\vspace*{-\baselineskip}\leavevmode +\end{tipblock} + +\begin{PresentationCode}{listing only} +%environnement tikz +\tkzRappEquerre[Fond,Ombre] +\tkzRappEquerre[Origine={(-5,-9)},Rotation=150,Couleur=ForestGreen,Echelle=0.5,Ombre] +\tkzRappEquerre[Origine={(2,-10)},Rotation=-170,Couleur=DarkBlue, Largeur=4,Fond,AfficheValeurs=false,AfficheAngles=false,CouleurFond=DarkBlue] +\end{PresentationCode} + +\begin{PresentationCode}{text only} +\begin{tikzpicture} + \affichegrille{-8}{7}{-11}{1} + \pointsutiles{(0,0),(-5,-9),(2,-10)} + \tkzRappEquerre[Fond,Ombre] + \tkzRappEquerre[Origine={(-5,-9)},Rotation=150,Couleur=ForestGreen,Echelle=0.5,Ombre] + \tkzRappEquerre[Origine={(2,-10)},Rotation=-170,Couleur=DarkBlue,Largeur=4,Fond,AfficheValeurs=false,AfficheAngles=false,CouleurFond=DarkBlue] +\end{tikzpicture} +\end{PresentationCode} + +\pagebreak + +\section{Le compas} + +\subsection{La commande} + +\begin{cautionblock} +Le package propose l'outil \textsf{Compas}. + +L'aspect gĂ©nĂ©ral du compas est \textit{fixĂ©}, mais le compas peut ĂȘtre \textit{personnalisĂ©}. +\end{cautionblock} + +\begin{PresentationCode}{tikz lower} +\coordinate (A) at (0,0) ; +\coordinate (B) at (2.5,0) ; +\tkzCompas{A}{B} +\end{PresentationCode} + +\subsection{Arguments, clĂ©s et options} + +\begin{tipblock} +Les deux arguments \textit{obligatoires} sont les \textbf{nĆuds} de la pointe et de la mine du compas, donnĂ©s par exemple grĂące aux commandes \texttt{\textbackslash coordinate} ou \texttt{\textbackslash node}. + +\medskip + +Quelques \Cle{clĂ©s} de personnalisation sont disponibles : + +\begin{itemize} + \item le boolĂ©en \Cle{AfficheCrayon} pour afficher le crayon ;\hfill~(dĂ©faut : \Cle{true}) + \item \Cle{EchelleCrayon} pour l'Ă©chelle du crayon ;\hfill~(dĂ©faut : \Cle{1}) + \item \Cle{CouleurCrayon} pour la couleur du crayon ;\hfill~(dĂ©faut : \Cle{red}) + \item \Cle{LongueurCrayon} pour la longueur du crayon ;\hfill~(dĂ©faut : \Cle{5}) + \item \Cle{LongueurBranches} pour la taille des branches du compas ;\hfill~(dĂ©faut : \Cle{6}) + \item le boolĂ©en \Cle{CouleurCompas} pour la couleur du compas ;\hfill~(dĂ©faut : \Cle{gray}) + \item le boolĂ©en \Cle{Retourne} pour forcer le retournement \og horizontal \fg{} du compas ; + + \hfill~(dĂ©faut : \Cle{false}) + \item \Cle{Echelle} pour l'Ă©chelle du compas (Ă utiliser avec prĂ©caution\ldots) ;\hfill~(dĂ©faut : \Cle{1}) + \item \Cle{UniteTikz} (Ă utiliser avec prĂ©caution\ldots) pour spĂ©cifier une unitĂ©, par dĂ©faut elle est calculĂ©e (et stockĂ©e) en interne ; + + \hfill~(dĂ©faut : \Cle{\textbackslash TmpUniteX}) +\end{itemize} +\vspace*{-\baselineskip}\leavevmode +\end{tipblock} + +\begin{PresentationCode}{listing only} +%environnement tikz +\tkzCompas{A}{B} +\tkzCompas[LongueurBranches=4,CouleurCrayon=blue]{C}{D} +\tkzCompas[LongueurBranches=3,CouleurCrayon=orange,Retourne, LongueurCrayon=3,CouleurCompas=black]{F}{E} +\tkzCompas[LongueurBranches=3,CouleurCrayon=Green, LongueurCrayon=3,CouleurCompas=purple]{F}{E} +\tkzCompas[Echelle=0.75,Retourne,CouleurCrayon=cyan,CouleurCompas=pink]{G}{H} +\end{PresentationCode} + +\begin{PresentationCode}{text only} +\begin{tikzpicture} + \affichegrille{-6}{9}{-6}{7} + \pointsutiles{(0,0),(2,1),(-4,-5),(-1,-5),(5,-2),(8,-3),(8.5,6),(8.5,2.5)} + \coordinate (A) at (0,0) ; \draw (A) node[below] {A} ; + \coordinate (B) at (2,1) ; \draw (B) node[below] {B} ; + \coordinate (C) at (-4,-5) ; \draw (C) node[below] {C} ; + \coordinate (D) at (-1,-5) ; \draw (D) node[below] {D} ; + \coordinate (E) at (5,-2) ; \draw (E) node[left] {E} ; + \coordinate (F) at (8,-3) ; \draw (F) node[right] {F} ; + \coordinate (G) at (8.5,6) ; \draw (G) node[right] {G} ; + \coordinate (H) at (8.5,2.5) ; \draw (H) node[right] {H} ; + \tkzCompas{A}{B} + \tkzCompas[LongueurBranches=4,CouleurCrayon=blue]{C}{D} + \tkzCompas[LongueurBranches=3,CouleurCrayon=orange,Retourne, LongueurCrayon=3,CouleurCompas=black]{F}{E} + \tkzCompas[LongueurBranches=3,CouleurCrayon=Green, LongueurCrayon=3,CouleurCompas=purple]{F}{E} + \tkzCompas[Echelle=0.75,Retourne,CouleurCrayon=cyan,CouleurCompas=pink]{G}{H} +\end{tikzpicture} +\end{PresentationCode} + +\pagebreak + +\part{Exemple} + +\begin{PresentationCode}{listing only} +\tkzRegle[Fond,AfficheValeurs,Longueur=15,Rotation=-20,Echelle=0.5,CouleurFond=blue] +\tkzEquerre[Fond,AfficheValeurs,Longueur=12,Origine={(-20:4)}, Rotation=-20,CouleurFond=red,Echelle=0.5] +\tkzCrayon[Couleur=ForestGreen,Origine={(-20:4)},Rotation=30,Echelle=0.5] +\draw (10,-5)--++(20:5) (10,-5)--++(50:5) ; +\tkzRapporteur[Fond,CouleurFond=purple,Origine={(10,-5)},Echelle=0.5,Rotation=20] +\tkzRappEquerre[Fond,Origine={(9,1)},Rotation=90,CouleurFond=ForestGreen,Echelle=0.5] +\tkzCrayon[Couleur=yellow,Origine={(9,-1)},Rotation=20,Echelle=0.5] +\coordinate (AA) at ($(10,-5)+(50:{0.5*3.75})$) ; +\tkzCrayon[Couleur=orange,Origine={AA},Rotation=-20,Echelle=0.5,Longueur=6] +\tkzRequerre[Fond,AfficheValeurs,CouleurFond=yellow,Origine={(3,-3.5)}, Rotation=-30,Echelle=0.5] +\tkzCrayon[Couleur=gray,Origine={(3,-3)},Rotation=-98,Echelle=0.5] +\coordinate (FG) at (-1,1) ; \coordinate (FH) at (1,1.5) ; +\tkzCompas[LongueurBranches=3,LongueurCrayon=2]{FG}{FH} +\end{PresentationCode} + +\begin{PresentationCode}{text only} +\begin{tikzpicture} + \affichegrille{-2}{13}{-8}{5} + %\pointsutiles{(0,0),(2,1),(-4,-5),(-1,-5),(5,-2),(8,-3),(8.5,6),(8.5,2.5)} + \tkzRegle[Fond,Longueur=8,Rotation=-20,CouleurFond=blue] + \tkzEquerre + [Fond,Longueur=7,Origine={(-20:4)},Rotation=-20,CouleurFond=red] + \tkzCrayon[Couleur=ForestGreen,Origine={(-20:4)},Rotation=30,Longueur=3] + \draw (10,-5)--++(20:3) (10,-5)--++(50:3) ; + \tkzRapporteur[Fond,CouleurFond=purple,Origine={(10,-5)},Echelle=0.5,Rotation=20] + \tkzRappEquerre[Fond,Origine={(9,1)},Rotation=90,CouleurFond=ForestGreen,Largeur=4] + \tkzCrayon[Couleur=yellow,Origine={(9,-1)},Rotation=20,Longueur=3] + \coordinate (AA) at ($(10,-5)+(50:{0.5*3.75})$) ; + \tkzCrayon[Couleur=orange,Origine={AA},Rotation=-20,Longueur=6,Echelle=0.5] + \tkzRequerre[Fond,AfficheValeurs,CouleurFond=yellow,Origine={(3,-3.5)},Rotation=-30,Longueur=7,Largeur=2.5] + \tkzCrayon[Couleur=gray,Origine={(3,-3.5)},Rotation=-98,Longueur=3] + %compas + \coordinate (FG) at (-1,1) ; \coordinate (FH) at (1,1.5) ; + \tkzCompas[LongueurBranches=3,LongueurCrayon=2]{FG}{FH} +\end{tikzpicture} +\end{PresentationCode} +\end{document}
\ No newline at end of file diff --git a/graphics/pgf/contrib/outilsgeomtikz/tex/OutilsGeomTikz.sty b/graphics/pgf/contrib/outilsgeomtikz/tex/OutilsGeomTikz.sty new file mode 100644 index 0000000000..7b6784ca45 --- /dev/null +++ b/graphics/pgf/contrib/outilsgeomtikz/tex/OutilsGeomTikz.sty @@ -0,0 +1,620 @@ +% Author.........: C. Pierquet +% licence........: Released under the LaTeX Project Public License v1.3c or later, see http://www.latex-project.org/lppl.txtf + +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{OutilsGeomTikz}[2023/03/03 v0.1.0 Outils gĂ©omĂ©triques en TikZ] +% 0.1.0 Version initiale + +%------Packages utiles +\RequirePackage{tikz,pgffor} +\RequirePackage{simplekv} +\RequirePackage{xstring} +\RequirePackage{nicefrac} +%librairies tikz +\usetikzlibrary{calc,positioning} + +%--------Crayon +% inspiration(s) de https://tex.stackexchange.com/questions/147389/symbols-of-pencil-ruler-and-compass +\defKV[CrayonGeom]{% + Echelle=\def\PENechelle{#1},% + Longueur=\def\PENlongueur{#1},% + Couleur=\def\PENcouleur{#1},% + Origine=\def\PENposOrigin{#1},% + Rotation=\def\PENangle{#1} +} + +\setKVdefault[CrayonGeom]{% + Echelle=1,% + Couleur=red,% + Longueur=5,% + Origine={(0,0)},% + Rotation=0 +} + +\NewDocumentCommand\tkzCrayon{ O{} }{% + \useKVdefault[CrayonGeom]% + \setKV[CrayonGeom]{#1}% + \xdef\PENlongueur{\fpeval{max(2.5,\PENlongueur)}}%valeurs mini + \begin{scope}[shift={(\PENposOrigin)},rotate=\PENangle,scale=\PENechelle] + \fill[\PENcouleur!75] (-0.2,{\PENlongueur-0.3}) -- (0.2,{\PENlongueur-0.3}) -- (0.2,0.8) --(0.1,0.65) -- (0,0.8) -- (-0.1,0.66) -- (-0.2,0.8) -- cycle; + \draw[color=white,line width={\PENechelle*1pt}] (0,{\PENlongueur-0.3}) -- (0,0.6); + \fill[black] (-0.2,{\PENlongueur-0.6}) -- (0,{\PENlongueur-0.65}) -- (0.2,{\PENlongueur-0.6}) -- (0.2,{\PENlongueur-0.12}) arc(30:150:0.23); + \fill[brown!40] (-0.2,0.8) -- (0,0) node[coordinate,pos=0.7] (a) {} -- (0.2,0.8) node[coordinate,pos=0.3] (b) {} -- (0.1,0.65) -- (0,0.8) -- (-0.1,0.66) -- cycle; + \fill[\PENcouleur] (a) -- (0,0) -- (b) -- cycle ; + \end{scope} +} + +%--------RĂšgle (OK) +\defKV[RegleGeom]{% + Echelle=\def\REGLechelle{#1},% + Longueur=\def\REGLlongueur{#1},% + Largeur=\def\REGLlargeur{#1},% + Couleur=\def\REGLcouleur{#1},% + CouleurFond=\def\REGLcouleurfond{#1},% + Origine=\def\REGLposOrigin{#1},% + Rotation=\def\REGLangle{#1},% + Opacite=\def\REGLopac{#1},% + PosVal=\def\REGLposval{#1} +} + +\setKVdefault[RegleGeom]{% + Echelle=1,% + Couleur=black,% + CouleurFond=black,% + Longueur=12,% + Largeur=1.5,% + Origine={(0,0)},% + Rotation=0,% + AfficheValeurs=true,% + Fond=false,% + Opacite=0.5,% + PosVal=m +} + +\NewDocumentCommand{\tkzRegle}{ O{} }{% + \useKVdefault[RegleGeom]% + \setKV[RegleGeom]{#1}% + \xdef\REGLlongueur{\fpeval{max(3,\REGLlongueur)}}%valeurs mini + \xdef\REGLlargeur{\fpeval{max(1.5,\REGLlargeur)}} + \begin{scope}[shift={(\REGLposOrigin)},rotate=\REGLangle,scale=\REGLechelle] + \ifboolKV[RegleGeom]{Fond} + {% + \begin{scope} + \fill[draw=none,fill=\REGLcouleurfond!10!white,fill opacity=\REGLopac,even odd rule] (-0.375,0)--({\REGLlongueur+0.375},0) to[bend left=15] ({\REGLlongueur+0.375},{-\REGLlargeur}) -- (-0.375,{-\REGLlargeur}) to[bend left=15] (-0.375,0) (0.5,{-0.5*\REGLlargeur}) circle[radius={0.125*\REGLlargeur}] ; + \end{scope} + }% + {} + %bord et trou + \draw[semithick,\REGLcouleur] (-0.375,0)--({\REGLlongueur+0.375},0) to[bend left=15] ({\REGLlongueur+0.375},{-\REGLlargeur}) -- (-0.375,{-\REGLlargeur}) to[bend left=15] (-0.375,0) (0.5,{-0.5*\REGLlargeur}) circle[radius={0.125*\REGLlargeur}] ; + \foreach \x in {0,0.1,...,\REGLlongueur} {\draw[\REGLcouleur] (\x,0)--++(0,-0.25) (\x,{-\REGLlargeur})--++(0,0.25) ;} + \foreach \x in {0,0.5,...,\REGLlongueur} {\draw[\REGLcouleur] (\x,0)--++(0,-0.375) (\x,{-\REGLlargeur})--++(0,0.375) ;} + \foreach \x in {0,1,...,\REGLlongueur} {\draw[\REGLcouleur] (\x,0)--++(0,-0.5) (\x,{-\REGLlargeur})--++(0,0.5) ;} + \ifboolKV[RegleGeom]{AfficheValeurs}% + {% + \IfSubStr{\REGLposval}{h} + {\foreach \i in {0,1,...,\REGLlongueur} \draw[\REGLcouleur] (\i,{-0.5}) node[inner sep=1pt,outer sep=1pt,rotate=\REGLangle,scale={0.8*\REGLechelle},font=\small,below] {$\i$} ;} + {} + \IfSubStr{\REGLposval}{m} + {\foreach \i in {0,1,...,\REGLlongueur} \draw[\REGLcouleur] (\i,{-0.5*\REGLlargeur}) node[inner sep=1pt,outer sep=1pt,rotate=\REGLangle,scale={0.8*\REGLechelle},font=\small] {$\i$} ;} + {} + \IfSubStr{\REGLposval}{b} + {\foreach \i in {0,1,...,\REGLlongueur} \draw[\REGLcouleur] (\i,{-\REGLlargeur+0.5}) node[inner sep=1pt,outer sep=1pt,rotate=\REGLangle,scale={0.8*\REGLechelle},font=\small,above] {\rotatebox{180}{$\fpeval{trunc(\REGLlongueur)-\i}$}} ;} + {} + }% + {}% + \end{scope} +} + +%--------RĂ©querre (OK) +\defKV[RequerreGeom]{% + Echelle=\def\REQechelle{#1},% + Longueur=\def\REQlongueur{#1},% + Largeur=\def\REQlargeur{#1},% + Couleur=\def\REQcouleur{#1},% + CouleurFond=\def\REQcouleurfond{#1},% + Origine=\def\REQposOrigin{#1},% + Rotation=\def\REQangle{#1},% + Opacite=\def\REQopac{#1} +} + +\setKVdefault[RequerreGeom]{% + Echelle=1,% + Couleur=black,% + CouleurFond=black,% + Longueur=12,% + Largeur=3,% + Origine={(0,0)},% + Rotation=0,% + AfficheValeurs=true,% + Fond=false,% + Opacite=0.5 +} + +\NewDocumentCommand{\tkzRequerre}{ O{} }{% + \useKVdefault[RequerreGeom]% + \setKV[RequerreGeom]{#1}% + \xdef\REQlongueur{\fpeval{max(6,\REQlongueur)}}%valeurs mini + \xdef\REQlargeur{\fpeval{max(1.5,\REQlargeur)}} + \begin{scope}[shift={(\REQposOrigin)},rotate=\REQangle,scale=\REQechelle] + \ifboolKV[RequerreGeom]{Fond} + { + \fill[draw=none,rounded corners,fill=\REQcouleurfond!10!white,fill opacity=\REQopac] ({-\REQlongueur*0.5},0) rectangle ({\REQlongueur*0.5},{-\REQlargeur}) ; + } + {} + \draw[semithick,\REQcouleur,rounded corners] ({-\REQlongueur*0.5},0) rectangle ({\REQlongueur*0.5},{-\REQlargeur}) ; + \draw[\REQcouleur] (0,-1)--(0,-\REQlargeur) ; + \foreach \x in {0,0.1,...,\fpeval{0.5*\REQlongueur-0.5}} {\draw[\REQcouleur] (\x,0)--(\x,-0.25) (-\x,0)--(-\x,-0.25) ;} + \foreach \x in {0,0.5,...,\fpeval{0.5*\REQlongueur-0.5}} {\draw[\REQcouleur] (\x,0)--(\x,-0.375) (-\x,0)--(-\x,-0.375) ;} + \foreach \x in {0,1,...,\fpeval{0.5*\REQlongueur-0.5}} {\draw[\REQcouleur] (\x,0)--(\x,-0.5) (-\x,0)--(-\x,-0.5) ;} + \foreach \x in {0.7,0.8,...,\REQlargeur} {\draw[\REQcouleur] (-2.65,-\x)--(-2.35,-\x) (2.65,-\x)--(2.35,-\x) ;} + \foreach \x in {1,1.5,...,\REQlargeur} {\draw[\REQcouleur] (-2.8,-\x)--(-2.2,-\x) (2.2,-\x)--(2.8,-\x) ;} + \begin{scope} + \clip ({-\REQlongueur*0.5},0) rectangle ({\REQlongueur*0.5},{-\REQlargeur}) ; + \draw[\REQcouleur] (0,-1) rectangle++ (0.2,-0.2) (0,-2) rectangle++ (-0.2,0.2) ; + \foreach \x in {1,2,...,\fpeval{\REQlargeur-0.25}} {\draw[\REQcouleur] ({-\REQlongueur*0.5},-\x)--({\REQlongueur*0.5},-\x) ;} + \end{scope} + \ifboolKV[RequerreGeom]{AfficheValeurs}% + {% + \draw[\REQcouleur] (0,-0.5) node[inner sep=1pt,outer sep=1pt,rotate=\REQangle,scale={0.8*\REQechelle},font=\small,below] {$0$} ; + \foreach \i in {1,2,...,\fpeval{0.5*\REQlongueur-0.5}}{% + \draw[\REQcouleur] (\i,-0.5) node[inner sep=1pt,outer sep=1pt,rotate=\REQangle,scale={0.8*\REQechelle},font=\small,below] {$\i$} ; + \draw[\REQcouleur] (-\i,-0.5) node[inner sep=1pt,outer sep=1pt,rotate=\REQangle,scale={0.8*\REQechelle},font=\small,below] {$-\i$} ;} + }% + {}% + \end{scope} +} + +%--------Ăquerre (OK) +\defKV[EquerreGeom]{% + Echelle=\def\EQechelle{#1},% + Longueur=\def\EQlongueur{#1},% + Couleur=\def\EQcouleur{#1},% + CouleurFond=\def\EQcouleurfond{#1},% + Origine=\def\EQposOrigin{#1},% + Rotation=\def\EQangle{#1},% + Opacite=\def\EQopac{#1} +} + +\setKVdefault[EquerreGeom]{% + Echelle=1,% + Couleur=black,% + CouleurFond=black,% + Longueur=10,% + Origine={(0,0)},% + Rotation=0,% + AfficheValeurs=true,% + Fond=false,% + Opacite=0.5 +} + +\NewDocumentCommand{\tkzEquerre}{ O{} }{% + \useKVdefault[EquerreGeom]% + \setKV[EquerreGeom]{#1}% + \xdef\EQlongueur{\fpeval{max(4.5,\EQlongueur)}}%valeurs mini + \def\EQlargeur{\fpeval{\EQlongueur*tand(30)}} + \begin{scope}[shift={(\EQposOrigin)},rotate=\EQangle,scale=\EQechelle] + \ifboolKV[EquerreGeom]{Fond} + {% + \begin{scope} %diff extĂ©rieur-intĂ©rieur + \fill[draw=none,fill=\EQcouleurfond!10!white,fill opacity=\EQopac,even odd rule] + (0,0) -- ({\EQlargeur},0) -- (0,{\EQlongueur}) -- cycle + ({1},{1}) -- ({\EQlargeur-sqrt(3)},{1}) -- ({1},{\EQlongueur-(2+sqrt(3))}) -- cycle ; + \end{scope} + }% + {} + \draw[semithick,\EQcouleur] (0,0) -- ({\EQlargeur},0) -- (0,{\EQlongueur}) -- cycle ; %contour extĂ©rieur + \draw[semithick,\EQcouleur] ({1},{1}) -- ({\EQlargeur-sqrt(3)},{1}) -- ({1},{\EQlongueur-(2+sqrt(3))}) -- cycle ; %contour intĂ©rieur + %graduations + \begin{scope} + \clip (0,0) -- ({\EQlargeur},0) -- (0,{\EQlongueur}) -- cycle ; + \draw[\EQcouleur] (0.1,0)--(0.1,0.075) (0.2,0)--(0.2,0.15) ; + \foreach \x in {0.3,0.4,...,\fpeval{0.925*\EQlargeur}} {\draw[\EQcouleur] (\x,0)--(\x,0.2) ;} + \foreach \x in {0.5,1,...,\fpeval{0.925*\EQlargeur}} {\draw[\EQcouleur] (\x,0)--(\x,0.3) ;} + \foreach \x in {0,1,...,\fpeval{0.925*\EQlargeur}} {\draw[\EQcouleur] (\x,0)--(\x,0.4) ;} + \draw[\EQcouleur] (0,0.1)--(0.075,0.1) (0,0.2)--(0.15,0.2) ; + \foreach \y in {0.3,0.4,...,\fpeval{0.925*\EQlongueur}} {\draw[\EQcouleur] (0,\y)--(0.2,\y) ;} + \foreach \y in {0.5,1,...,\fpeval{0.925*\EQlongueur}} {\draw[\EQcouleur] (0,\y)--(0.3,\y) ;} + \foreach \y in {0,1,...,\fpeval{0.925*\EQlongueur}} {\draw[\EQcouleur] (0,\y)--(0.4,\y) ;} + \ifboolKV[EquerreGeom]{AfficheValeurs}% + {% + \foreach \i in {1,2,...,\fpeval{0.9*\EQlongueur-1}} + \draw[\EQcouleur] (0.4,\i) node[inner sep=1pt,outer sep=1pt,rotate=\EQangle,scale={0.8*\EQechelle},font=\small,right] {\rotatebox{90}{$\i$}} ; + \foreach \i in {1,2,...,\fpeval{0.9*\EQlargeur-0.5}} + \draw[\EQcouleur] (\i,0.4) node[inner sep=1pt,outer sep=1pt,rotate=\EQangle,scale={0.8*\EQechelle},font=\small,above] {\rotatebox{180}{$\i$}} ; + }% + {}% + \end{scope} + \end{scope} +} + +%--------Rapporteur (OK) +\defKV[RapporteurGeom]{% + Echelle=\def\RAPPechelle{#1},% + EchelleAngle=\def\RAPPechangle{#1},% + Couleur=\def\RAPPcouleur{#1},% + CouleurFond=\def\RAPPcouleurfond{#1},% + Origine=\def\RAPPposOrigin{#1},% + Rotation=\def\RAPPangle{#1},% + Opacite=\def\RAPPopac{#1} +} + +\setKVdefault[RapporteurGeom]{% + Echelle=1,% + EchelleAngle=1,% + Couleur=black,% + CouleurFond=black,% + Origine={(0,0)},% + Rotation=0,% + AfficheAngles=true,% + Fond=false,% + Opacite=0.5,% + Complet=false +} + +\NewDocumentCommand{\tkzRapporteur}{ O{} }{% + \useKVdefault[RapporteurGeom]% + \setKV[RapporteurGeom]{#1}% + \begin{scope}[shift={(\RAPPposOrigin)},rotate=\RAPPangle,scale=\RAPPechelle,every node/.style={rotate=\RAPPangle}] + \ifboolKV[RapporteurGeom]{Complet} + { + %fond + \ifboolKV[RapporteurGeom]{Fond} + {% + \fill[draw=none,fill=\RAPPcouleurfond!10!white,fill opacity=\RAPPopac] (0,0) circle[radius=3.75] ; + }% + {} + %rectangles + \foreach \i in {30,45,60} + {\draw[densely dotted,\RAPPcouleur] (\i:2.5) rectangle ({180+\i}:2.5) ;} + %extĂ©rieur et intĂ©rieur + \draw[semithick,\RAPPcouleur] (0,0) circle[radius=3.75] ; + \draw[semithick,\RAPPcouleur] (0,0) circle[radius=2.5] ; + \draw[semithick,\RAPPcouleur] (-2.5,0) -- (2.5,0) ; + \draw[semithick,\RAPPcouleur] (0,-2.5) -- (0,2.5) ; + %grad degrĂ©s + \foreach \i in {0,1,...,360} {\draw[\RAPPcouleur] (\i:3.75)--(\i:3.55) ;} + \foreach \i in {0,5,...,360} {\draw[\RAPPcouleur] (\i:3.75)--(\i:3.45) ;} + \foreach \i in {0,10,...,360} {\draw[\RAPPcouleur] (\i:3.75)--(\i:3.35) ;} + %grad radians + \foreach \i in {0,30,45,60,90,120,135,150,180,210,225,240,270,300,315,330} {\draw[\RAPPcouleur] (\i:2.5)--(\i:2.65) (\i:2.9)--(\i:3.1) ;} + %valeurs si boolĂ©en + \ifboolKV[RapporteurGeom]{AfficheAngles} + {% + \draw[\RAPPcouleur] (0:2.75) node[rotate=90,scale=\fpeval{0.8*\RAPPechelle*\RAPPechangle},font=\tiny] {$0$} ; + \draw[\RAPPcouleur] (180:3.25) node[rotate=90,scale=\fpeval{0.8*\RAPPechelle*\RAPPechangle},font=\tiny] {$\pm 180$} ; + \draw[\RAPPcouleur] (180:2.75) node[rotate=90,scale=\fpeval{0.8*\RAPPechelle*\RAPPechangle},font=\tiny] {$\pm \pi$} ; + \foreach \i in {0,10,...,170} + {\draw[\RAPPcouleur] (\i:3.25) node[rotate={\i-90},scale=\fpeval{0.8*\RAPPechelle*\RAPPechangle},font=\tiny] {$\i$} ;} + \draw[\RAPPcouleur] (30:2.75) node[rotate={30-90},scale=\fpeval{0.8*\RAPPechelle*\RAPPechangle},font=\tiny] {$\nicefrac{\pi}{6}$} ; + \draw[\RAPPcouleur] (45:2.75) node[rotate={45-90},scale=\fpeval{0.8*\RAPPechelle*\RAPPechangle},font=\tiny] {$\nicefrac{\pi}{4}$} ; + \draw[\RAPPcouleur] (60:2.75) node[rotate={60-90},scale=\fpeval{0.8*\RAPPechelle*\RAPPechangle},font=\tiny] {$\nicefrac{\pi}{3}$} ; + \draw[\RAPPcouleur] (90:2.75) node[rotate={90-90},scale=\fpeval{0.8*\RAPPechelle*\RAPPechangle},font=\tiny] {$\nicefrac{\pi}{2}$} ; + \draw[\RAPPcouleur] (120:2.75) node[rotate={120-90},scale=\fpeval{0.8*\RAPPechelle*\RAPPechangle},font=\tiny] {$\nicefrac{2\pi}{3}$} ; + \draw[\RAPPcouleur] (135:2.75) node[rotate={135-90},scale=\fpeval{0.8*\RAPPechelle*\RAPPechangle},font=\tiny] {$\nicefrac{3\pi}{4}$} ; + \draw[\RAPPcouleur] (150:2.75) node[rotate={150-90},scale=\fpeval{0.8*\RAPPechelle*\RAPPechangle},font=\tiny] {$\nicefrac{5\pi}{6}$} ; + \foreach \i in {10,20,...,170} + {\draw[\RAPPcouleur] ({-\i}:3.25) node[rotate={270-\i},scale=\fpeval{0.8*\RAPPechelle*\RAPPechangle},font=\tiny] {$-\i$} ;} + \draw[\RAPPcouleur] (-30:2.75) node[rotate={270-30},scale=\fpeval{0.8*\RAPPechelle*\RAPPechangle},font=\tiny] {$\nicefrac{-\pi}{6}$} ; + \draw[\RAPPcouleur] (-45:2.75) node[rotate={270-45},scale=\fpeval{0.8*\RAPPechelle*\RAPPechangle},font=\tiny] {$\nicefrac{-\pi}{4}$} ; + \draw[\RAPPcouleur] (-60:2.75) node[rotate={270-60},scale=\fpeval{0.8*\RAPPechelle*\RAPPechangle},font=\tiny] {$\nicefrac{-\pi}{3}$} ; + \draw[\RAPPcouleur] (-90:2.75) node[rotate={270-90},scale=\fpeval{0.8*\RAPPechelle*\RAPPechangle},font=\tiny] {$\nicefrac{-\pi}{2}$} ; + \draw[\RAPPcouleur] (-120:2.75) node[rotate={270-120},scale=\fpeval{0.8*\RAPPechelle*\RAPPechangle},font=\tiny] {$\nicefrac{-2\pi}{3}$} ; + \draw[\RAPPcouleur] (-135:2.75) node[rotate={270-135},scale=\fpeval{0.8*\RAPPechelle*\RAPPechangle},font=\tiny] {$\nicefrac{-3\pi}{4}$} ; + \draw[\RAPPcouleur] (-150:2.75) node[rotate={270-150},scale=\fpeval{0.8*\RAPPechelle*\RAPPechangle},font=\tiny] {$\nicefrac{-5\pi}{6}$} ; + }{} + } + { + %fond + \ifboolKV[RapporteurGeom]{Fond} + {% + \begin{scope} + \fill[draw=none,fill=\RAPPcouleurfond!10!white,fill opacity=\RAPPopac,even odd rule] + (-3.75,-0.75) -- (3.75,-0.75) -- (3.75,0) arc (0:180:3.75) -- cycle + (0.5,0) arc (0:180:0.5) -- (-2.25,0) arc (180:0:2.25) -- cycle ; + \end{scope} + }% + {} + %extĂ©rieur et intĂ©rieur + \draw[semithick,\RAPPcouleur] (-3.75,-0.75) -- (3.75,-0.75) -- (3.75,0) arc (0:180:3.75) -- cycle ; + \draw[semithick,\RAPPcouleur] (0.5,0) arc (0:180:0.5) -- (-2.25,0) arc (180:0:2.25) -- cycle ; + %croix + \draw[semithick,\RAPPcouleur] (-0.2,0)--(0.2,0) (0,-0.2)--(0,0.2) ; + %grad ext + \foreach \i in {0,1,...,180} {\draw[\RAPPcouleur] (\i:3.75)--(\i:3.55) ;} + \foreach \i in {0,5,...,180} {\draw[\RAPPcouleur] (\i:3.75)--(\i:3.45) ;} + \foreach \i in {0,10,...,180} {\draw[\RAPPcouleur] (\i:3.75)--(\i:3.35) ;} + %grad int + \foreach \i in {0,5,...,180} {\draw[\RAPPcouleur] (\i:2.25)--(\i:2.4) ;} + \foreach \i in {0,10,...,180} {\draw[\RAPPcouleur] (\i:2.25)--(\i:2.55) ;} + %valeurs si boolĂ©en + \ifboolKV[RapporteurGeom]{AfficheAngles} + {% + \foreach \i in {0,10,...,180} + {\draw[\RAPPcouleur] (\i:3.2) node[rotate={\i-90},scale=\fpeval{\RAPPechelle*\RAPPechangle},font=\tiny] {\i} ;} + \foreach \i in {0,10,...,180} + {\draw[\RAPPcouleur] (\i:2.7) node[rotate={\i-90},scale=\fpeval{\RAPPechelle*\RAPPechangle},font=\tiny] {\inteval{180-\i}} ;} + }{} + } + \end{scope} +} + +%--------RappĂquerre (OK) +\defKV[RapporteurEquerreGeom]{% + Echelle=\def\RAPPEQechelle{#1},% + Largeur=\def\RAPPEQlargeur{#1},% + EchelleValeurs=\def\RAPPEQechangle{#1},% + Couleur=\def\RAPPEQcouleur{#1},% + CouleurFond=\def\RAPPEQcouleurfond{#1},% + Origine=\def\RAPPEQposOrigin{#1},% + Rotation=\def\RAPPEQangle{#1},% + Opacite=\def\RAPPEQopac{#1} +} + +\setKVdefault[RapporteurEquerreGeom]{% + Echelle=1,% + Largeur=6,% + EchelleValeurs=1,% + Couleur=black,% + CouleurFond=black,% + Origine={(0,0)},% + Rotation=0,% + AfficheAngles=true,% + AfficheValeurs=true,% + Ombre=false,% + Fond=false,% + Opacite=0.5 +} + +\NewDocumentCommand{\tkzRappEquerre}{ O{} }{% + \useKVdefault[RapporteurEquerreGeom]% + \setKV[RapporteurEquerreGeom]{#1}% + \xdef\RAPPEQlargeur{\fpeval{max(3,\RAPPEQlargeur)}}%valeurs mini + \begin{scope}[shift={(\RAPPEQposOrigin)},rotate=\RAPPEQangle,scale=\RAPPEQechelle,every node/.style={rotate=\RAPPEQangle}] + %fond + \ifboolKV[RapporteurEquerreGeom]{Fond} + {% + \begin{scope} + \fill[draw=none,fill=\RAPPEQcouleurfond!10!white,fill opacity=\RAPPopac,even odd rule] (-\RAPPEQlargeur,0) -- (\RAPPEQlargeur,0) -- (0,-\RAPPEQlargeur) -- cycle ; + \end{scope} + }% + {} + \ifboolKV[RapporteurEquerreGeom]{Ombre}% + {% + \filldraw[draw=none,fill=\RAPPEQcouleur!25,opacity=\RAPPopac] (-175:{0.65*\RAPPEQlargeur}) arc (-175:-5:{0.65*\RAPPEQlargeur}) -- (-5:{0.625*\RAPPEQlargeur}) arc (-5:-175:{0.625*\RAPPEQlargeur}) -- cycle ;% + }{}% + %extĂ©rieur + \draw[semithick,\RAPPEQcouleur] (-\RAPPEQlargeur,0) -- (\RAPPEQlargeur,0) -- (0,-\RAPPEQlargeur) -- cycle ; + \foreach \x in {0,0.1,...,\fpeval{\RAPPEQlargeur-1}} + {\draw[\RAPPEQcouleur] ({\x},0)--({\x},-0.125) ({-\x},0)--({-\x},-0.125) ;} + \foreach \x in {0,0.5,...,\fpeval{\RAPPEQlargeur-1}} + {\draw[\RAPPEQcouleur] ({\x},0)--({\x},-0.1875) ({-\x},0)--({-\x},-0.1875) ;} + \foreach \x in {0,1,...,\fpeval{\RAPPEQlargeur-1}} + {\draw[\RAPPEQcouleur] ({\x},0)--({\x},-0.25) ({-\x},0)--({-\x},-0.25) ;} + %grad ext + \foreach \i in {5,6,...,175} + {\draw[\RAPPEQcouleur] ({-\i}:{0.5625*\RAPPEQlargeur})--++({-\i}:{0.02*\RAPPEQlargeur}) ;} + \foreach \i in {5,10,...,175} + {\draw[\RAPPEQcouleur] ({-\i}:{0.5625*\RAPPEQlargeur})--++({-\i}:{0.035*\RAPPEQlargeur}) ;} + %angles intĂ©rieurs + \ifboolKV[RapporteurEquerreGeom]{AfficheAngles} + {% + \foreach \i in {10,20,...,170} + {\draw[\RAPPEQcouleur] ({-\i}:{0.6125*\RAPPEQlargeur}) node[rotate={90-\i},scale=\fpeval{\RAPPEQlargeur/8*\RAPPEQechelle*\RAPPEQechangle},font=\tiny] {\i} ;} + %angles "extĂ©rieurs" + \foreach \i in {10,20,...,170} + {\draw[\RAPPEQcouleur] ({-\i}:{0.6375*\RAPPEQlargeur}) node[rotate={90-\i},scale=\fpeval{\RAPPEQlargeur/8*\RAPPEQechelle*\RAPPEQechangle},font=\tiny] {\inteval{180-\i}} ;} + }% + {}% + \ifboolKV[RapporteurEquerreGeom]{AfficheValeurs} + {% + \foreach \i in {-1,0,1} + {\draw[\RAPPEQcouleur] ({\i},-0.375) node[scale=\fpeval{\RAPPEQechelle*\RAPPEQechangle},font=\tiny] {$\i$} ;} + }% + {}% + %tracĂ©s intĂ©rieurs + \draw[\RAPPEQcouleur,dash pattern=on 15 off 4] (0,0)--(-135:{0.5625*\RAPPEQlargeur}) ; + \draw[\RAPPEQcouleur,dash pattern=on 15 off 4] (0,0)--(-45:{0.5625*\RAPPEQlargeur}) ; + \draw[\RAPPEQcouleur] (0,-0.5)--(0,{-0.51*\RAPPEQlargeur}) ; + \foreach \i in {0.4,0.5,...,\fpeval{0.51*\RAPPEQlargeur-0.5}} + {\draw[\RAPPEQcouleur] ({0.2625*\RAPPEQlargeur},{-\i})--++(0.2,0) ;} + \foreach \i in {0.4,0.5,...,\fpeval{0.51*\RAPPEQlargeur-0.5}} + {\draw[\RAPPEQcouleur] ({-0.2625*\RAPPEQlargeur},{-\i})--++(-0.2,0) ;} + \begin{scope} + \clip (-180:{0.55*\RAPPEQlargeur}) arc (-180:0:{0.55*\RAPPEQlargeur}) -- cycle ; + \foreach \i in {-0.5,-1,...,\fpeval{-0.55*\RAPPEQlargeur}} + {\draw[\RAPPEQcouleur] (0.2,\i)--({0.2375*\RAPPEQlargeur},\i) ({0.3125*\RAPPEQlargeur},\i)--({0.55*\RAPPEQlargeur},\i) ;} + \foreach \i in {-0.5,-1,...,\fpeval{-0.55*\RAPPEQlargeur}} + {\draw[\RAPPEQcouleur] (-0.2,\i)--({-0.2375*\RAPPEQlargeur},\i) ({-0.3125*\RAPPEQlargeur},\i)--({-0.55*\RAPPEQlargeur},\i) ;} + \end{scope} + %traits obliques extĂ©rieurs + \begin{scope} + \clip (-\RAPPEQlargeur,0) -- (\RAPPEQlargeur,0) -- (0,-\RAPPEQlargeur) -- cycle ; + \foreach \i in {10,20,...,170} + {\draw[\RAPPEQcouleur] ({-\i}:{0.65*\RAPPEQlargeur})--++({-\i}:3) ;} + \foreach \i in {10,20,...,170} + {\draw[\RAPPEQcouleur] ({-\i}:{0.65*\RAPPEQlargeur})--++({-\i}:3) ;} + \end{scope} + \begin{scope} + \clip (-\RAPPEQlargeur,0) -- (\RAPPEQlargeur,0) -- (0,-\RAPPEQlargeur) -- cycle ; + \def\cliptmp{\fpeval{min(0.15,0.0571*\RAPPEQlargeur)}} + \clip (0,-\RAPPEQlargeur)--++(135:\cliptmp)--++(\RAPPEQlargeur,\RAPPEQlargeur)--++(-45:\cliptmp)--cycle ; + \foreach \i in {1,2,...,89} + {\draw[\RAPPEQcouleur] ({\RAPPEQlargeur/(1+tan(\i))},{-\RAPPEQlargeur*tan(\i)/(1+tan(\i))}) --++ ({180-\i}:{abs(-0.3*\i/90+0.15)+0.15}) ;} + \end{scope} + \begin{scope} + \clip (-\RAPPEQlargeur,0) -- (\RAPPEQlargeur,0) -- (0,-\RAPPEQlargeur) -- cycle ; + \def\cliptmp{\fpeval{min(0.25,0.0571*\RAPPEQlargeur)}} + \clip (0,-\RAPPEQlargeur)--++(135:\cliptmp)--++(\RAPPEQlargeur,\RAPPEQlargeur)--++(-45:\cliptmp)--cycle ; + \foreach \i in {5,10,...,85} + {\draw[\RAPPEQcouleur] ({\RAPPEQlargeur/(1+tan(\i))},{-\RAPPEQlargeur*tan(\i)/(1+tan(\i))}) --++ ({180-\i}:{abs(-0.5*\i/90+0.25)+0.25}) ;} + \end{scope} + \begin{scope} + \clip (-\RAPPEQlargeur,0) -- (\RAPPEQlargeur,0) -- (0,-\RAPPEQlargeur) -- cycle ; + \def\cliptmp{\fpeval{min(0.15,0.0571*\RAPPEQlargeur)}} + \clip (0,-\RAPPEQlargeur)--++(45:\cliptmp)--++(-\RAPPEQlargeur,\RAPPEQlargeur)--++(-135:\cliptmp)--cycle ; + \foreach \i in {1,2,...,89} + {\draw[\RAPPEQcouleur] ({-\RAPPEQlargeur/(1+tan(\i))},{-\RAPPEQlargeur*tan(\i)/(1+tan(\i))}) --++ ({\i}:{abs(-0.3*\i/90+0.15)+0.15}) ;} + \end{scope} + \begin{scope} + \clip (-\RAPPEQlargeur,0) -- (\RAPPEQlargeur,0) -- (0,-\RAPPEQlargeur) -- cycle ; + \def\cliptmp{\fpeval{min(0.25,0.0571*\RAPPEQlargeur)}} + \clip (0,-\RAPPEQlargeur)--++(45:\cliptmp)--++(-\RAPPEQlargeur,\RAPPEQlargeur)--++(-135:\cliptmp)--cycle ; + \foreach \i in {5,10,...,85} + {\draw[\RAPPEQcouleur] ({-\RAPPEQlargeur/(1+tan(\i))},{-\RAPPEQlargeur*tan(\i)/(1+tan(\i))}) --++ ({\i}:{abs(-0.5*\i/90+0.25)+0.25}) ;} + \end{scope} + \end{scope} +} + +%--------Compas +% inspiration(s) de https://tex.stackexchange.com/questions/147389/symbols-of-pencil-ruler-and-compass +% Angle entre l'horizontale et 2 noeuds (#1 & #2), rĂ©sultat dans \MonAngleTmp +\newcommand{\NodeTmpAngle}[2]{% + \pgfmathanglebetweenpoints% + {\pgfpointanchor{#1}{center}}% + {\pgfpointanchor{#2}{center}}% + \global\let\MonAngleTmp\pgfmathresult% +} +% Distance entre 2 noeuds (#1 & #2), rĂ©sultat dans \MaLongueurTmp +\makeatletter +\newcommand{\NodeTmpDist}[2]{% + \pgfpointdiff{\pgfpointanchor{#1}{center}}{\pgfpointanchor{#2}{center}}% + \pgf@xa=\pgf@x + \pgf@ya=\pgf@y + % to convert from pt to cm + \pgfmathparse{veclen(\pgf@xa,\pgf@ya)/28.45274}% + \global\let\MaLongueurTmp\pgfmathresult% +} +\makeatother +% RĂ©cupĂ©ration de l'unitĂ© x (cf https://tex.stackexchange.com/questions/424785/tikz-get-current-unit-length-of-x-coordinate) +\def\recupunitexencm{ + \path let \p{x}=(1,0), \n{xlencm}={scalar(veclen(\x{x},\y{x})/1cm)} + in \pgfextra{\xdef\TmpUniteX{\n{xlencm}}}; +} + +\defKV[CompasGeom]{% + Echelle=\def\COMPASechelle{#1},% + EchelleCrayon=\def\COMPASechellecrayon{#1},% + LongueurBranches=\def\COMPASLLB{#1},% + LongueurCrayon=\def\COMPASLLC{#1},% + CouleurCompas=\def\COMPAScouleur{#1},% + CouleurCrayon=\def\COMPAScouleurcrayon{#1},% + UniteTikz=\def\COMPASunittikz{#1} +} + +\setKVdefault[CompasGeom]{% + Echelle=1,% + EchelleCrayon=1,% + LongueurBranches=6,% + LongueurCrayon=5,% + CouleurCrayon=red,% + CouleurCompas=gray,% + UniteTikz=\TmpUniteX,% + AfficheCrayon=true,% + Retourne=false +} + +\NewDocumentCommand{\tkzCompas}{ s O{} m m }{%Ă©toilĂ©e en gardant la distance entre extrĂ©mitĂ©s + \IfBooleanTF{#1}{}{\NodeTmpDist{#3}{#4}}% + \useKVdefault[CompasGeom]% + \setKV[CompasGeom]{#2}% + %calculs intermĂ©diaires + \recupunitexencm + \NodeTmpAngle{#3}{#4}% + \pgfmathsetmacro{\AngleCP}{asin(\MaLongueurTmp/(\COMPASunittikz*\COMPASechelle*2*\COMPASLLB))} + %retour aux affaires + \ifboolKV[CompasGeom]{Retourne} + {\def\CoeffYscale{-1}}{\def\CoeffYscale{1}} + \begin{scope}[shift=(#3),scale=\COMPASechelle] + \begin{scope}[join=round,rotate=\MonAngleTmp,yscale=\CoeffYscale,shift=(270-\AngleCP:-\COMPASLLB)] + % branche pointe sĂšche + \draw[rotate=-\AngleCP,fill=\COMPAScouleur!80] (0,0)--(0,-\COMPASLLB)--(-.2,-\COMPASLLB+.8)--(-.2,0)--cycle ; + \draw[rotate=-\AngleCP,fill=\COMPAScouleur!05] (0,-\COMPASLLB+.8)--(0,-\COMPASLLB)--(-.2,-\COMPASLLB+.8)--cycle ; + % branche crayon + \draw[rotate=\AngleCP,fill=\COMPAScouleur!80] (0,0)--(0,-\COMPASLLB)--(.2,-\COMPASLLB+.8)--(.2,0)--cycle ; + \begin{scope}[rotate=\AngleCP,shift={(0,-\COMPASLLB)}] + \ifboolKV[CompasGeom]{AfficheCrayon} + {\tkzCrayon[Echelle={\COMPASechellecrayon*0.75},Longueur={\COMPASLLC/0.75},Rotation=-15,Couleur=\COMPAScouleurcrayon]}{} + \draw[fill=gray!25] (\COMPASLLB/30,\COMPASLLB/5) circle (\COMPASLLB/36) ; + \fill[\COMPAScouleur!5] (\COMPASLLB/30,\COMPASLLB/5) -- ++(30:\COMPASLLB/36) arc (30:45:\COMPASLLB/36) -- cycle ; + \fill[\COMPAScouleur!5] (\COMPASLLB/30,\COMPASLLB/5) -- ++(210:\COMPASLLB/36) arc (210:225:\COMPASLLB/36) ; + \draw (\COMPASLLB/30,\COMPASLLB/5) circle (\COMPASLLB/36) ; + \filldraw (\COMPASLLB/30,\COMPASLLB/5) circle (.02) ; + \end{scope} + % haut du compas + \draw[fill=\COMPAScouleur!80] (-.1,0) rectangle (.1,.85) ; + \draw[fill=gray!25] (0,0) circle (.25) ; + \fill[gray!5] (0,0) -- (30:.25) arc (30:45:.25) -- cycle ; + \fill[gray!5,rotate=180] (0,0) -- (30:.25) arc (30:45:.25) -- cycle ; + \draw (0,0) circle (.25) ; + \filldraw (0,0) circle (.05) ; + \end{scope} + \end{scope} +} + +%--------MiniĂquerre +\defKV[MiniEquerreGeom]{% + Echelle=\def\MiniEQechelle{#1},% + Couleur=\def\MiniEQcouleur{#1},% + Origine=\def\MiniEQposOrigin{#1},% + Rotation=\def\MiniEQangle{#1} +} + +\setKVdefault[MiniEquerreGeom]{% + Echelle=1,% + Couleur=black,% + Origine={(0,0)},% + Rotation=0,% + Ombre=true +} + +\NewDocumentCommand{\tkzMiniEquerre}{ O{} }{% + \useKVdefault[MiniEquerreGeom]% + \setKV[MiniEquerreGeom]{#1}% + \begin{scope}[shift={(\MiniEQposOrigin)},rotate=\MiniEQangle,scale=\MiniEQechelle] + \ifboolKV[MiniEquerreGeom]{Ombre}% + {% + \begin{scope} + \clip (0,0)--(1,0)--(0,1.8)--cycle; + \filldraw[draw=none,fill=\MiniEQcouleur!10] (0,0) rectangle (1,2.5pt); + \filldraw[draw=none,fill=\MiniEQcouleur!10] (0,0) rectangle (2.5pt,2); + \end{scope} + }{}% + \draw[semithick,\MiniEQcouleur] (0,0)--(1,0)--(0,1.8)--cycle; + \draw[semithick,\MiniEQcouleur] (0.2,0.2)--(0.65,0.2)--(0.2,1)--cycle; + \foreach \x in {0,0.1,...,1} {\draw[\MiniEQcouleur] (\x,0)--++(0,1.5pt) ;} + \foreach \x in {0,0.5} {\draw[\MiniEQcouleur] (\x,0)--++(0,2pt) ;} + \foreach \y in {0,0.1,...,1.7} {\draw[\MiniEQcouleur] (0,\y)--++(1.5pt,0) ;} + \foreach \y in {0,0.5,1,1.5} {\draw[\MiniEQcouleur] (0,\y)--++(2pt,0) ;} + \end{scope} +} + +%--------MiniRĂšgle +\defKV[MiniRegleGeom]{% + Echelle=\def\MiniREGLechelle{#1},% + Couleur=\def\MiniREGLcouleur{#1},% + Origine=\def\MiniREGLposOrigin{#1},% + Rotation=\def\MiniREGLangle{#1} +} + +\setKVdefault[MiniRegleGeom]{% + Echelle=1,% + Couleur=black,% + Origine={(0,0)},% + Rotation=0,% + Ombre=true +} + +\NewDocumentCommand{\tkzMiniRegle}{ O{} }{% + \useKVdefault[MiniRegleGeom]% + \setKV[MiniRegleGeom]{#1}% + \begin{scope}[shift={(\MiniREGLposOrigin)},rotate=\MiniREGLangle,scale=\MiniREGLechelle] + \ifboolKV[MiniRegleGeom]{Ombre}% + {\filldraw[draw=none,fill=\MiniREGLcouleur!10] (0,0) rectangle (2,-2.5pt) ;}{}% + \draw[semithick,\MiniREGLcouleur] (0,0)--(2,0)--(2,-0.3)--(0,-0.3)--cycle ; + \draw[semithick,\MiniREGLcouleur] (0.35,-0.185) circle[radius=0.05] ; + \foreach \y in {0,0.1,...,2} {\draw[\MiniREGLcouleur] (\y,0)--++(0,-1.5pt) ;} + \foreach \y in {0,0.5,...,2} {\draw[\MiniREGLcouleur] (\y,0)--++(0,-2pt) ;} + \end{scope} +} + +\endinput
\ No newline at end of file |