texlive[72635] Master/texmf-dist: tikzdotncross (23oct24)
commits+karl at tug.org
commits+karl at tug.org
Wed Oct 23 22:23:40 CEST 2024
Revision: 72635
https://tug.org/svn/texlive?view=revision&revision=72635
Author: karl
Date: 2024-10-23 22:23:40 +0200 (Wed, 23 Oct 2024)
Log Message:
-----------
tikzdotncross (23oct24)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/latex/tikzdotncross/README.md
trunk/Master/texmf-dist/doc/latex/tikzdotncross/tikzdotncross.pdf
trunk/Master/texmf-dist/doc/latex/tikzdotncross/tikzdotncross.tex
trunk/Master/texmf-dist/tex/latex/tikzdotncross/tikzdotncross.sty
Modified: trunk/Master/texmf-dist/doc/latex/tikzdotncross/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/tikzdotncross/README.md 2024-10-23 20:23:32 UTC (rev 72634)
+++ trunk/Master/texmf-dist/doc/latex/tikzdotncross/README.md 2024-10-23 20:23:40 UTC (rev 72635)
@@ -70,7 +70,10 @@
- documentation in PDF format
-------------
-* Version 1.1 (this)
+* Version 1.2 (this)
+ - Added some package options, to change pin defaults, see documentation.
+
+* Version 1.1
- Documentation typos and improvement. Code cleanup.
* Version 1.0
Modified: trunk/Master/texmf-dist/doc/latex/tikzdotncross/tikzdotncross.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/latex/tikzdotncross/tikzdotncross.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/tikzdotncross/tikzdotncross.tex 2024-10-23 20:23:32 UTC (rev 72634)
+++ trunk/Master/texmf-dist/doc/latex/tikzdotncross/tikzdotncross.tex 2024-10-23 20:23:40 UTC (rev 72635)
@@ -15,7 +15,7 @@
%%
%% The Current Maintainer of this work is Alceu Frigeri
%%
-%% This is version {1.1} {2024/01/11}
+%% This is version {1.2} {2024/10/22}
%%
%% The list of files that compose this work can be found in the README.md file at
%% https://ctan.org/pkg/tikzdotncross
@@ -47,12 +47,28 @@
%\tableofcontents
\section{Introduction}
-One recurring problem when drawing in general is how to interpret a crossing line. There are many conventions, notably, the old school (like the author of this) a jump denotes ``non touching lines'' while a simple cross is a connection, more recently (like the past 25 years), the winning convention has been that a dot marks a connection, whilst a simple cross denotes ``non touching lines''. Many, for the sake of staying in the safe side of the wall are now marking a connection with dots and non touching lines with a jump, which is a bit overkill, but at least there is no margin for error.
+One recurring problem when drawing circuits in general is how to interpret a crossing line. There are many conventions, notably, for the old school (like the author of this) a jump denotes ``non touching lines'' while a simple cross is a connection, more recently (like the past 25 years), the winning convention has been that a dot marks a connection, whilst a simple cross denotes ``non touching lines''. Many, for the sake of staying in the safe side of the wall, mark a connection with dots and non touching lines with a jump, which is a bit overkill, but at least there is no margin for interpretation errors.
And that's it, this package defines some commands to mark/pin a connection, declaring a coordinate and node at the same spot, for later reference, and a command to draw a line jumping over crossing lines of a pre-existent path.
+\section{Package Options}\label{options}
+\begin{describelist}{option}
+ \describe {pinsize} {pin (circle) size (default: 1.2), in pt.}
+ \describe {pinang} {pin angle (default: 45). }
+ \describe {pincolor} {pin color (default: blue).}
+ \describe {pinlength} {pin length (default: 4), in pt.}
+ \describe {coordcolor} {coordinate color (default: red), used if \tsobj{\showcoordstrue}.}
+\end{describelist}
+
+Those can also be set, middle code, via:
+\begin{codedescribe}[code,new=2024/10/22]{\setpindefaults}
+\begin{codesyntax}%
+\tsmacro{\setpindefaults}{options as above}
+\end{codesyntax}
+\end{codedescribe}
+
\section{Declaring and Marking Coordinates/Nodes}\label{coord}
Those are based on some ideas from Redaelli et al. (\tsobj[pkg]{CircuiTikZ}). Main differences: a variable number of parameters (see below) and it always also adds an empty node n\tsobj[marg]{coord}.
\begin{codedescribe}{\showcoordstrue,\shoocoordsfalse}
@@ -69,13 +85,16 @@
\tsobj{\pincoord}\tsverb{(}\tsobj[oarg,sep={,}]{coord}\tsverb{)}
\tsobj{\pincoord}\tsverb{(}\tsobj[oarg,sep={,}]{coord,color}\tsverb{)}
\tsobj{\pincoord}\tsverb{(}\tsobj[oarg,sep={,}]{coord,color,angle}\tsverb{)}
-\tsobj{\pincoord}\tsverb{(}\tsobj[oarg,sep={,}]{coord,color,angle,distance}\tsverb{)}
+\tsobj{\pincoord}\tsverb{(}\tsobj[oarg,sep={,}]{coord,color,angle,length}\tsverb{)}
\end{codesyntax}
The \tsobj{\ncoord} always expects a single parameter \tsobj[parg]{coord}. A coordinate named \tsobj[marg]{coord} and node named n\tsobj[marg]{coord} (a ``n'' is added as a prefix) will be created for later use/reference. If \tsobj{\showcoordstrue} is en force, it will also add a pin.
-The \tsobj{\pincoord} always draws a pin, besides declaring a coordinate and node as \tsobj{\ncoord}. It expects one to 4 parameters, as listed. If omitted, the default value for distance is 4 (unit: pt), the default value for the angle is -45 (degrees), the default value for color is blue.
-In fact, the \tsobj{\coord(name)} is just a short cut for \tsverb{\pincoord(name,red,45)}, if \tsobj{\showcoordstrue}.
+The \tsobj{\pincoord} always draws a pin, besides declaring a coordinate and node as \tsobj{\ncoord}. It expects one to 4 parameters, as listed. If omitted, the default length is 4 (unit: pt), the default angle is -45 (degrees), the default color is blue.
+Likewise, if \tsobj{\showcoordstrue}, \tsobj{\coord(name)} is just a short cut for \tsverb{\pincoord(name,red,45)}.
\end{codedescribe}
+\begin{tsremark}
+ Those defaults can be changed via package options, see \ref{options}, or \tsobj{\setpindefaults}.
+\end{tsremark}
\begin{codedescribe}{\dotcoord,\dotpincoord}
\begin{codesyntax}%
@@ -83,7 +102,7 @@
\tsobj{\dotpincoord}\tsverb{(}\tsobj[oarg,sep={,}]{coord}\tsverb{)}
\tsobj{\dotpincoord}\tsverb{(}\tsobj[oarg,sep={,}]{coord,color}\tsverb{)}
\tsobj{\dotpincoord}\tsverb{(}\tsobj[oarg,sep={,}]{coord,color,angle}\tsverb{)}
-\tsobj{\dotpincoord}\tsverb{(}\tsobj[oarg,sep={,}]{coord,color,angle,distance}\tsverb{)}
+\tsobj{\dotpincoord}\tsverb{(}\tsobj[oarg,sep={,}]{coord,color,angle,length}\tsverb{)}
\end{codesyntax}
These are the same as \tsobj{\ncoord} and friends, just adding a dot (a filled in, small circle) at the coordinate.
\end{codedescribe}
@@ -94,7 +113,7 @@
\tsobj{\odotpincoord}\tsverb{(}\tsobj[oarg,sep={,}]{coord}\tsverb{)}
\tsobj{\odotpincoord}\tsverb{(}\tsobj[oarg,sep={,}]{coord,color}\tsverb{)}
\tsobj{\odotpincoord}\tsverb{(}\tsobj[oarg,sep={,}]{coord,color,angle}\tsverb{)}
-\tsobj{\odotpincoord}\tsverb{(}\tsobj[oarg,sep={,}]{coord,color,angle,distance}\tsverb{)}
+\tsobj{\odotpincoord}\tsverb{(}\tsobj[oarg,sep={,}]{coord,color,angle,length}\tsverb{)}
\end{codesyntax}
These are the same as \tsobj{\ncoord} and friends, just adding an open dot (a small circle filled with white) at the coordinate.
\end{codedescribe}
@@ -114,7 +133,7 @@
At each intersection a semi-circle will be drawn, and finally a line will be draw connecting \tsobj[marg]{coordA} to \tsobj[marg]{coordB} over all intermediate nodes.
-The star version flips the semi-circles.
+The star version flips the semi-circles orientation.
\begin{tsremark}
The default \tsobj[oarg]{cross-name} is ``cross''. It may contain only characters, as any valid \TeX\ macro name. The default \tsobj[oarg]{width} of the semi-circle is 7pt.
\end{tsremark}
@@ -126,7 +145,7 @@
\end{tsremark}
\end{codedescribe}
-\newpage
+%\newpage
\section{Some Examples}
\textbf{\color{red}Note:} In the examples below, the circuit doesn't make much/any sense, it is just a way to show the commands possibilities.
@@ -175,6 +194,8 @@
\newpage
As said, the main limitation (derived from how \tsobj[pkg]{intersections} works) is that crossings between the line and nodes might not be detected at all. For example, if someone tries to connect the nodes \tsobj[key]{D1,D2}, it will, unfortunately, fail detecting the node (pnp transistor) entirely:
+%\showcoordstrue
+%\setpindefaults{coordcolor=cyan,pincolor=red}
\begin{codestore}[crossdemoC]
\resizebox{0.5\textwidth}{!}{
\begin{tikzpicture}
Modified: trunk/Master/texmf-dist/tex/latex/tikzdotncross/tikzdotncross.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/tikzdotncross/tikzdotncross.sty 2024-10-23 20:23:32 UTC (rev 72634)
+++ trunk/Master/texmf-dist/tex/latex/tikzdotncross/tikzdotncross.sty 2024-10-23 20:23:40 UTC (rev 72635)
@@ -12,7 +12,7 @@
%%
%% The Current Maintainer of this work is Alceu Frigeri
%%
-%% This is version {1.1} {2024/01/11}
+%% This is version {1.2} {2024/10/22}
%%
%% The list of files that compose this work can be found in the README.md file at
%% https://ctan.org/pkg/tikzdotncross
@@ -26,8 +26,8 @@
\ProvidesExplPackage
{tikzdotncross}
- {2024/01/11}
- {1.1}
+ {2024/10/22}
+ {1.2}
{Marking coordinates and crossing paths}
%%%%%%%
@@ -40,8 +40,8 @@
{
name .code:n = {tikzdotncross} ,
prefix .code:n = {tikzdotncross} ,
- date .code:n = {2024/01/11},
- version .code:n = {1.1} ,
+ date .code:n = {2024/10/22},
+ version .code:n = {1.2} ,
description .code:n = {Marking~ coordinates~ and~ crossing~ paths}
}
\cs_if_exist:NF \PkgInfo
@@ -54,9 +54,48 @@
%%% End of cut-n-paste
%%%%%%%
+%%%
+%%% why that here? well, the token list's commands will be used outside expl3 'domain'
+%%%
+\makeatletter
+
+\keys_define:nn { tikzdotncross }
+ {
+ pin size .tl_set:N = \dotncross@@pinsep ,
+ pin size .value_required:n = true ,
+ pin size .initial:n = 1.2 ,
+ pin size .usage:n = general ,
+
+ pin ang .tl_set:N = \dotncross@@pinang ,
+ pin ang .value_required:n = true ,
+ pin ang .initial:n = 45 ,
+ pin ang .usage:n = general ,
+
+ pin color .tl_set:N = \dotncross@@pincolor ,
+ pin color .value_required:n = true ,
+ pin color .initial:n = blue ,
+ pin color .usage:n = general ,
+
+ pin length .tl_set:N = \dotncross@@pindistance ,
+ pin length .value_required:n = true ,
+ pin length .initial:n = 4 ,
+ pin length .usage:n = general ,
+
+ coord color .tl_set:N = \dotncross@@coordcolor ,
+ coord color .value_required:n = true ,
+ coord color .initial:n = red ,
+ coord color .usage:n = general ,
+ }
+
+\ProcessKeyOptions [ tikzdotncross ]
+
+\NewDocumentCommand{\setpindefaults}{m} {
+ \keys_set:nn {tikzdotncross}{#1}
+}
+
\ExplSyntaxOff
-\makeatletter
+%\makeatletter
\usetikzlibrary{intersections}
%%
@@ -84,17 +123,16 @@
\pgfextra{\csxdef{#2T}{\CrossTotal}}
\foreach \aux in {1,...,\csuse{#2T}}{(#2-\aux) node[minimum size=#6-\pgflinewidth,inner sep=0pt](n#2-\aux){}};
\tikzmath{%
- coordinate \Ctmp; real \dx , \dy , \d; int \idx;
+ coordinate \Ctmp; real \dtmp; int \idx;
\Ctmp{from} = (#3);
\Ctmp{to} = (#4);
- \dx{tmp} = \Ctmpx{to} - \Ctmpx{from};
- \dy{tmp} = \Ctmpy{to} - \Ctmpy{from};
- \d{ang} = atan2(\dy{tmp},\dx{tmp});
+ \dtmp{x} = \Ctmpx{to} - \Ctmpx{from};
+ \dtmp{y} = \Ctmpy{to} - \Ctmpy{from};
+ \dtmp{ang} = atan2(\dtmp{y},\dtmp{x});
\Ctmp{1st} = (n#2-1);
\Ctmp{last} = (n#2-\csuse{#2T});
\idx{1st} = 1;
\idx{last} = \csuse{#2T};
- \idx{crossing} = 1;
if \Ctmpx{1st} == \Ctmpx{from} then {
if \Ctmpy{1st} == \Ctmpy{from} then {
\idx{1st} = 2;
@@ -109,9 +147,9 @@
\ifnum\idx{last}<\idx{1st}
\draw (#3) -- (#4);
\else
- \draw[line width=1.8\pgflinewidth,white,rotate=\d{ang}]
+ \draw[line width=1.8\pgflinewidth,white,rotate=\dtmp{ang}]
\foreach \aux in {\idx{1st},...,\idx{last}}{(#2-\aux) +(-#6/2,0) arc[start angle=\dotncross@@sign180,end angle=0,radius=#6/2]};
- \draw[rotate=\d{ang},line cap=round]
+ \draw[rotate=\dtmp{ang},line cap=round]
\foreach \aux in {\idx{1st},...,\idx{last}}{(#2-\aux) +(-#6/2,0) arc[start angle=\dotncross@@sign180,end angle=0,radius=#6/2]};
\gdef\dotncross@@tmpA{#3}
@@ -133,14 +171,14 @@
\newcommand\showcoordsfalse{\let\ncoord=\dotncross@@coordnode \let\dotcoord=\dotncross@@dotcoordnode \let\odotcoord=\dotncross@@odotcoordnode}
\newcommand\showcoordstrue{\let\ncoord=\dotncross@@coordpin \let\dotcoord=\dotncross@@dotcoordpin \let\odotcoord=\dotncross@@odotcoordpin}
-\def\dotncross@@coordpin(#1){\pincoord(#1,red,45)}
-\def\dotncross@@coordnode(#1){coordinate(#1) node[minimum size=1.2pt,inner sep=1.2pt](n#1){}}
+\def\dotncross@@coordpin(#1){\pincoord(#1,\dotncross@@coordcolor,\dotncross@@pinang)}
+\def\dotncross@@coordnode(#1){coordinate(#1) node[minimum size=\dotncross@@pinsep pt,inner sep=\dotncross@@pinsep pt](n#1){}}
-\def\dotncross@@dotcoordpin(#1){\dotpincoord(#1,red,45)}
-\def\dotncross@@dotcoordnode(#1){coordinate(#1) node[circle,minimum size=1.2pt,inner sep=1.2pt,fill](n#1){}}
+\def\dotncross@@dotcoordpin(#1){\dotpincoord(#1,\dotncross@@coordcolor,\dotncross@@pinang)}
+\def\dotncross@@dotcoordnode(#1){coordinate(#1) node[circle,minimum size=\dotncross@@pinsep pt,inner sep=\dotncross@@pinsep pt,fill](n#1){}}
-\def\dotncross@@odotcoordpin(#1){\odotpincoord(#1,red,45)}
-\def\dotncross@@odotcoordnode(#1){coordinate(#1) node[circle,minimum size=1.2pt,inner sep=1.2pt,fill=white,draw](n#1){}}
+\def\dotncross@@odotcoordpin(#1){\odotpincoord(#1,\dotncross@@coordcolor,\dotncross@@pinang)}
+\def\dotncross@@odotcoordnode(#1){coordinate(#1) node[circle,minimum size=\dotncross@@pinsep pt,inner sep=\dotncross@@pinsep pt,fill=white,draw](n#1){}}
%%%%
%%
@@ -155,9 +193,9 @@
\def\dotncross@@pincasew#1#2{\dotncross@@pincase#1,,,,\dotncross@@pincaseA\dotncross@@pincaseB\dotncross@@pincaseC\dotncross@@pincaseD;#2:}
\def\dotncross@@pincase#1,#2,#3,#4,#5#6#7#8#9:{#8:#1:#2:#3:#4:#9:}
\def\dotncross@@pincaseA:#1:#2:#3:#4:#5;#6:{\dotncross@@pincoord{#1}{#2}{#3}{#4}{#6}}
-\def\dotncross@@pincaseB:#1:#2:#3:#4:#5;#6:{\dotncross@@pincoord{#1}{#2}{#3}{4}{#6}}
-\def\dotncross@@pincaseC:#1:#2:#3:#4:#5;#6:{\dotncross@@pincoord{#1}{#2}{-45}{4}{#6}}
-\def\dotncross@@pincaseD:#1:#2:#3:#4:#5;#6:{\dotncross@@pincoord{#1}{blue}{-45}{4}{#6}}
+\def\dotncross@@pincaseB:#1:#2:#3:#4:#5;#6:{\dotncross@@pincoord{#1}{#2}{#3}{\dotncross@@pindistance}{#6}}
+\def\dotncross@@pincaseC:#1:#2:#3:#4:#5;#6:{\dotncross@@pincoord{#1}{#2}{-\dotncross@@pinang}{\dotncross@@pindistance}{#6}}
+\def\dotncross@@pincaseD:#1:#2:#3:#4:#5;#6:{\dotncross@@pincoord{#1}{\dotncross@@pincolor}{-\dotncross@@pinang}{\dotncross@@pindistance}{#6}}
\def\pincoord(#1){\dotncross@@pincasew{#1}{}}
\def\dotpincoord(#1){\dotncross@@pincasew{#1}{circle,fill,}}
@@ -164,8 +202,8 @@
\def\odotpincoord(#1){\dotncross@@pincasew{#1}{circle,fill=white,draw,}}
\newcommand\dotncross@@pincoord[5]{%
- coordinate(#1) node[#5minimum size=1.2pt,inner sep=1.2pt](n#1){}
- node[circle, #2, inner sep=1.2pt, outer sep=0pt, radius=1pt, fill=#2!20!white, fill opacity=0.2, draw opacity=0.4, draw,
+ coordinate(#1) node[#5minimum size=\dotncross@@pinsep pt,inner sep=\dotncross@@pinsep pt](n#1){}
+ node[circle, #2, inner sep=\dotncross@@pinsep pt, outer sep=0pt, radius=1pt, fill=#2!20!white, fill opacity=0.2, draw opacity=0.4, draw,
pin={[#2, overlay, inner sep=0pt, outer sep=1pt, font=\tiny, pin distance=#4pt,
pin edge={#2, overlay}]#3:#1}]{}%
}
More information about the tex-live-commits
mailing list.