texlive[55827] Master: tikzpackets (13jul20)

commits+karl at tug.org commits+karl at tug.org
Mon Jul 13 23:09:51 CEST 2020


Revision: 55827
          http://tug.org/svn/texlive?view=revision&revision=55827
Author:   karl
Date:     2020-07-13 23:09:51 +0200 (Mon, 13 Jul 2020)
Log Message:
-----------
tikzpackets (13jul20)

Modified Paths:
--------------
    trunk/Master/tlpkg/bin/tlpkg-ctan-check
    trunk/Master/tlpkg/tlpsrc/collection-pictures.tlpsrc

Added Paths:
-----------
    trunk/Master/texmf-dist/doc/latex/tikzpackets/
    trunk/Master/texmf-dist/doc/latex/tikzpackets/README
    trunk/Master/texmf-dist/doc/latex/tikzpackets/tikzPackets.pdf
    trunk/Master/texmf-dist/doc/latex/tikzpackets/tikzPackets.tex
    trunk/Master/texmf-dist/tex/latex/tikzpackets/
    trunk/Master/texmf-dist/tex/latex/tikzpackets/tikzPackets.sty
    trunk/Master/tlpkg/tlpsrc/tikzpackets.tlpsrc

Added: trunk/Master/texmf-dist/doc/latex/tikzpackets/README
===================================================================
--- trunk/Master/texmf-dist/doc/latex/tikzpackets/README	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/tikzpackets/README	2020-07-13 21:09:51 UTC (rev 55827)
@@ -0,0 +1,27 @@
+Package tikzPackets provide command for simple build network packets illustration with tikz.
+
+Usage example (UDP):
+
+\begin{tikzpicture}
+	\packetsInit
+	\packetsPrintBitScale{31}
+	
+	\packetsPutField{16}{Source Port}
+	\packetsPutField{16}{Destination Port}
+	\packetsEndLine{0}{}
+	
+	\packetsPutField{16}{Length}
+	\packetsPutField{16}{Checksum}
+	\packetsEndLine{32}{}
+	
+	\packetsPutField[protocolsField, minimum height = 1.5cm]{32}{Data}
+	\packetsEndLine{64}{}
+\end{tikzpicture}
+
+
+Version 1.0 (2020-07-13): first public release
+
+
+Copyright (C) 2020, Robert Ryszard Paciorek <rrp at opcode.eu.org>
+
+This is free software distributed under terms of The MIT License.


Property changes on: trunk/Master/texmf-dist/doc/latex/tikzpackets/README
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/tikzpackets/tikzPackets.pdf
===================================================================
(Binary files differ)

Index: trunk/Master/texmf-dist/doc/latex/tikzpackets/tikzPackets.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/tikzpackets/tikzPackets.pdf	2020-07-13 21:08:24 UTC (rev 55826)
+++ trunk/Master/texmf-dist/doc/latex/tikzpackets/tikzPackets.pdf	2020-07-13 21:09:51 UTC (rev 55827)

Property changes on: trunk/Master/texmf-dist/doc/latex/tikzpackets/tikzPackets.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/tikzpackets/tikzPackets.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/tikzpackets/tikzPackets.tex	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/tikzpackets/tikzPackets.tex	2020-07-13 21:09:51 UTC (rev 55827)
@@ -0,0 +1,170 @@
+% Copyright (c) 2020 Robert Ryszard Paciorek <rrp at opcode.eu.org>
+% 
+% MIT License
+% 
+% Permission is hereby granted, free of charge, to any person obtaining a copy
+% of this software and associated documentation files (the "Software"), to deal
+% in the Software without restriction, including without limitation the rights
+% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+% copies of the Software, and to permit persons to whom the Software is
+% furnished to do so, subject to the following conditions:
+% 
+% The above copyright notice and this permission notice shall be included in all
+% copies or substantial portions of the Software.
+% 
+% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+% SOFTWARE.
+
+\documentclass[a4paper]{article}
+
+\usepackage{tikzPackets}
+\usepackage{adjustbox,hyperref,fancyvrb-ex,fvextra}
+
+\oddsidemargin=0pt
+\textwidth=430pt
+
+\topmargin=-30pt
+\textheight=662pt
+
+\newcommand{\pkgLink}[1]{\texttt{\href{https://ctan.org/pkg/#1}{#1}}}
+
+\fvset{
+	breaklines=true,
+	breakanywhere=true,
+	breakaftersymbolpre={},
+	breakaftersymbolpost={\tiny\ensuremath{\ \lhook\joinrel\rightarrow\ }},
+	breakanywheresymbolpre={},
+	breakanywheresymbolpost={\tiny\ensuremath{\ \lhook\joinrel\rightarrow\ }}
+}
+
+\begin{document}
+
+\title{The \texttt{tikzPackets}  package}
+\author{Robert Ryszard Paciorek <rrp at opcode.eu.org>}
+\date{2020-07-13}
+\maketitle
+
+This package provide command for simple build network packets illustration with \pkgLink{tikz}.
+Similar functionality (with tables instead of tikz) provide package \pkgLink{bytefield}.
+
+\section{Basic Example}
+
+\begin{CenterExample}
+\begin{tikzpicture}
+    \packetsInit
+    \packetsBitWidth=4.5mm
+    \packetsPrintBitScale{31}
+    
+    \packetsPutField{16}{Source Port}
+    \packetsPutField{16}{Destination Port}
+    \packetsEndLine{0}{}
+    
+    \packetsPutField{16}{Length}
+    \packetsPutField{16}{Checksum}
+    \packetsEndLine{32}{}
+    
+    \packetsPutField[protocolsField, minimum height=1.5cm]{32}{Data}
+    \packetsEndLine{64}{}
+\end{tikzpicture}
+\end{CenterExample}
+
+
+\section{Macros description}
+
+\subsection{packetsInit}
+
+\Verb$\packetsInit$ is used to initialise \textit{tikzPackets} variables, counters and tikz styles.
+Must be used in every \Verb$tikzpicture$ that use \textit{tikzPackets} package commands before any other \textit{tikzPackets} command.
+
+\subsection{packetsPrintBitScale}
+
+\Verb$\packetsPrintBitScale$ draw bits scale. It takes one argument: last bit value.
+
+Formatting of bits scale can be adjust by redefine (after \Verb$\packetsInit$) tikz style \Verb$bitScaleInfo$, redefine \Verb$\packetsBitFont$ or \Verb$\packetsPrintBitNumber$ macro.
+
+\subsection{packetsPutField}
+
+\Verb$\packetsPutField$ draw packet field. It takes 4 arguments:
+\begin{enumerate}
+    \item (optional) node style and formatting options
+    \item number of bits (width of field)
+    \item (optional) node name for new created node
+    \item name (text to display)
+\end{enumerate}
+
+\subsection{packetsPrintRangeOnLeft and packetsPrintRangeOnRight}
+
+\Verb$\packetsPrintRangeOnLeft$ and \Verb$\packetsPrintRangeOnRight$ prints info (start bit number or bits range) on left or right side of current line.
+Should be call after call all \Verb$\packetsPutField$ for this line. Both commands takes two arguments: first bit in line and last bit in line,
+but \Verb$\packetsPrintRangeOnLeft$ ignore second argument.
+
+Formatting of printing text can be adjust by redefine \Verb$\packetsBitFont$ macro or redefine \Verb$\packetsPrintRangeOnLeft$ / \Verb$\packetsPrintRangeOnRight$ macros.
+
+\begin{CenterExample}
+\begin{tikzpicture}
+    \packetsInit
+    \renewcommand{\packetsBitFont}{\scriptsize}
+    \packetsPutField{4}{A} \packetsPutField{4}{B} \packetsPutField{4}{C}
+    \packetsPrintRangeOnLeft{a}{b}
+    \packetsPrintRangeOnRight{d}{e}
+\end{tikzpicture}
+\end{CenterExample}
+
+\subsection{packetsNextLine}
+
+\Verb$\packetsNextLine$ end current line of field and prepare to start next line of field. It don't have arguments.
+
+\subsection{packetsEndLine}
+
+\Verb$\packetsEndLine$ call \Verb$\packetsPrintRangeOnLeft$ and \Verb$\packetsNextLine$.
+Arguments are passed to \Verb$\packetsPrintRangeOnLeft$.
+
+\subsection{packetsLastNode and packetsFirstNodeInLastLine}
+
+\Verb$\packetsLastNode$ hold name of last added node by \Verb$\packetsPutField$ or \Verb$\packetsPrintBitScale$ (and is used for node positioning in \Verb$\packetsPutField$ and \Verb$\packetsPrintRangeOnRight$ macros).
+
+\Verb$\packetsFirstNodeInLastLine$ hold name of first node (added by macro \Verb$\packetsPutField$ or \Verb$\packetsPrintBitScale$) in current line (and is used in \Verb$\packetsPutField$ and \Verb$\packetsPrintRangeOnLeft$ for positioning)
+
+Both can be use for external to reference node adding by these macros (can be captured after add node by \Verb$\edef$) or can be used to start adding nodes by \Verb$\packetsPutField$ relative to some manually added node.
+
+\begin{CenterExample}
+\begin{tikzpicture}
+    \packetsInit
+    \packetsPutField{4}{A}
+    \packetsPutField{4}{B}
+    
+    \node[
+        align=left, anchor=north west,
+        text width=7\packetsBitWidth, node font=\footnotesize
+    ] [] at (\packetsFirstNodeInLastLine.south west) {
+        Some extra info about this packet. And more more info \ldots
+    };
+\end{tikzpicture}
+\end{CenterExample}
+
+\section{Styles and dimmensions}
+
+Width of single bit is set by \Verb$\packetsBitWidth$ and default is 5mm. Default style for node created by \Verb$\packetsPutField$ is \Verb$protocolsField$ and it set line height to 1cm.
+Package provide also \Verb$protocolsFieldBase$ style with minimal setting for node style.
+Macro \Verb$\packetsBitFont$ define font settings for bits info.
+All this change should be done after use \Verb$\packetsInit$.
+
+\begin{CenterExample}
+\begin{tikzpicture}
+    \packetsInit
+    \tikzstyle{protocolsField}=[protocolsFieldBase, draw, minimum height = 0.8cm]
+    \packetsBitWidth=10mm
+    \renewcommand{\packetsBitFont}{\scriptsize\it}
+    
+    \packetsPrintBitScale{7}
+    \packetsPutField{4}{Long field names}
+    \packetsPutField{4}{and low rows}
+\end{tikzpicture}
+\end{CenterExample}
+
+\end{document}


Property changes on: trunk/Master/texmf-dist/doc/latex/tikzpackets/tikzPackets.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/tex/latex/tikzpackets/tikzPackets.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/tikzpackets/tikzPackets.sty	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/tikzpackets/tikzPackets.sty	2020-07-13 21:09:51 UTC (rev 55827)
@@ -0,0 +1,138 @@
+% Copyright (c) 2020 Robert Ryszard Paciorek <rrp at opcode.eu.org>
+% 
+% MIT License
+% 
+% Permission is hereby granted, free of charge, to any person obtaining a copy
+% of this software and associated documentation files (the "Software"), to deal
+% in the Software without restriction, including without limitation the rights
+% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+% copies of the Software, and to permit persons to whom the Software is
+% furnished to do so, subject to the following conditions:
+% 
+% The above copyright notice and this permission notice shall be included in all
+% copies or substantial portions of the Software.
+% 
+% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+% SOFTWARE.
+
+% Version 1.0 (2020-07-13): first public release
+
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{tikzPackets}
+
+\RequirePackage{tikz}
+
+\RequirePackage{xparse}
+
+% need by \packetsPrintRangeOnRight:
+\ifdefined\tcbsetmacrotoheightofnode\else\RequirePackage[skins]{tcolorbox}\fi
+\RequirePackage{pbox}
+
+%
+% init counters, etc
+%
+
+\newdimen\packetsBitWidth\packetsBitWidth=5mm
+\newcounter{packets at FieldCounter}
+
+\newcommand{\packetsInit}{
+	\let\packetsFirstNodeInLastLine\undefined
+	\let\packets at ContinueLine\undefined
+	\setcounter{packets at FieldCounter}{0}
+	\newcommand{\packetsBitFont}{\tiny}
+	\packetsBitWidth=5mm
+	\tikzstyle{protocolsFieldBase}=[
+		anchor = north west, outer sep = 0pt % node position <=> position of left upper node corner
+	]
+	\tikzstyle{protocolsField}=[
+		protocolsFieldBase,
+		draw, minimum height = 1cm,
+	]
+	\tikzstyle{bitScaleInfo}=[
+		protocolsFieldBase, inner sep = 0pt,
+		minimum width = \packetsBitWidth, minimum height = 8pt,
+		node font=\packetsBitFont
+	]
+}
+
+%
+% print bits numbering
+%
+
+
+\newcommand{\packetsPrintBitNumber}[1]{
+	\parbox[b][5pt]{\packetsBitWidth}{\hspace{1pt}#1}
+}
+
+\newcommand{\packetsPrintBitScale}[1]{
+	\node [bitScaleInfo] (bitScaleInfo_0)  {\packetsPrintBitNumber{0}};
+	\foreach \n[remember=\n as \lastn (initially 0)] in {1,...,#1} {
+		\node [bitScaleInfo] (bitScaleInfo_\n) [] at (bitScaleInfo_\lastn.north east) {\packetsPrintBitNumber{\n}};
+		\draw[thin] (bitScaleInfo_\n.south west) |- (bitScaleInfo_\n.north west);
+	}
+	\draw (bitScaleInfo_0.south west)  |- (bitScaleInfo_0.north west);
+	\draw (bitScaleInfo_#1.south east) |- (bitScaleInfo_#1.north east);
+	
+	\def\packetsFirstNodeInLastLine{bitScaleInfo_0}
+	\def\packetsLastNode{bitScaleInfo_#1}
+}
+
+\newcommand{\packetsPrintRangeOnRight}[3][\packetsLastNode]{
+	\tcbsetmacrotoheightofnode{\packets at NodeHeight}{#1}
+	\node [anchor = south, outer sep = 2pt, inner sep = 0pt, rotate = -90, align=center, node font=\packetsBitFont] [] at (#1.east) {\pbox{\packets at NodeHeight}{#2-#3}};
+}
+
+\newcommand{\packetsPrintRangeOnLeft}[3][\packetsFirstNodeInLastLine]{
+	\node [anchor = east, outer sep = 2pt, inner sep = 0pt, align=center, node font=\packetsBitFont] [] at (#1.west) {#2};
+}
+
+%
+% add protocol fields
+%
+%\newcommand{\packetsPutField}[3][protocolsField]{
+\NewDocumentCommand{\packetsPutField}{ O{protocolsField} m o m } {
+	% if provide custom node name, use it
+	\IfValueTF {#3} {
+		\edef\packets at NewNodeName{#3}
+	}{
+		% otherwise get new node name and step counter
+		\edef\packets at NewNodeName{packetsFieldNode_\arabic{packets at FieldCounter}}
+		\stepcounter{packets at FieldCounter}
+	}
+	
+	% if continue line
+	\ifdefined\packets at ContinueLine
+		\node[#1, minimum width=#2\packetsBitWidth] (\packets at NewNodeName) [] at (\packetsLastNode.north east) {#4};
+	% if start new line
+	\else
+		% if not first line
+		\ifdefined\packetsFirstNodeInLastLine
+			\node[#1, minimum width=#2\packetsBitWidth] (\packets at NewNodeName) [] at (\packetsFirstNodeInLastLine.south west) {#4};
+		\else
+			\node[#1, minimum width=#2\packetsBitWidth] (\packets at NewNodeName) {#4};
+		\fi
+		\let\packetsFirstNodeInLastLine\packets at NewNodeName
+		\def\packets at ContinueLine{true}
+	\fi
+	
+	% remember new node name as \packetsLastNode
+	\let\packetsLastNode\packets at NewNodeName
+}
+
+%
+% finish line of fields
+%
+
+\newcommand{\packetsNextLine}{
+	\let\packets at ContinueLine\undefined
+}
+
+\newcommand{\packetsEndLine}[2]{
+	\packetsPrintRangeOnLeft{#1}{#2}
+	\packetsNextLine
+}


Property changes on: trunk/Master/texmf-dist/tex/latex/tikzpackets/tikzPackets.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/tlpkg/bin/tlpkg-ctan-check
===================================================================
--- trunk/Master/tlpkg/bin/tlpkg-ctan-check	2020-07-13 21:08:24 UTC (rev 55826)
+++ trunk/Master/tlpkg/bin/tlpkg-ctan-check	2020-07-13 21:09:51 UTC (rev 55827)
@@ -736,7 +736,8 @@
     tikz-relay tikz-sfc tikz-timing tikz-trackschematic tikz-truchet
     tikzcodeblocks tikzducks tikzinclude tikzlings
     tikzmark tikzmarmots tikzorbital
-    tikzpagenodes tikzpeople tikzpfeile tikzposter tikzscale tikzsymbols
+    tikzpackets tikzpagenodes tikzpeople tikzpfeile tikzposter
+    tikzscale tikzsymbols
     tikztosvg tile-graphic
     timbreicmc times timetable timing-diagrams tinos tipa tipa-de tipfr
     titlecaps titlefoot titlepages titlepic titleref titlesec titling

Modified: trunk/Master/tlpkg/tlpsrc/collection-pictures.tlpsrc
===================================================================
--- trunk/Master/tlpkg/tlpsrc/collection-pictures.tlpsrc	2020-07-13 21:08:24 UTC (rev 55826)
+++ trunk/Master/tlpkg/tlpsrc/collection-pictures.tlpsrc	2020-07-13 21:09:51 UTC (rev 55827)
@@ -180,6 +180,7 @@
 depend tikzmarmots
 depend tikzorbital
 depend tikzpagenodes
+depend tikzpackets
 depend tikzpfeile
 depend tikzpeople
 depend tikzposter

Added: trunk/Master/tlpkg/tlpsrc/tikzpackets.tlpsrc
===================================================================


More information about the tex-live-commits mailing list.