From dec6380aa131051a91ef04b6694e8ff660c98f74 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 24 Nov 2019 21:25:54 +0000 Subject: pinoutikz (24nov19) git-svn-id: svn://tug.org/texlive/trunk@52907 c570f23f-e606-0410-a88d-b1316a301751 --- .../texmf-dist/tex/latex/pinoutikz/pinoutikz.sty | 124 +++++++++++++++++++++ 1 file changed, 124 insertions(+) create mode 100644 Master/texmf-dist/tex/latex/pinoutikz/pinoutikz.sty (limited to 'Master/texmf-dist/tex/latex/pinoutikz') diff --git a/Master/texmf-dist/tex/latex/pinoutikz/pinoutikz.sty b/Master/texmf-dist/tex/latex/pinoutikz/pinoutikz.sty new file mode 100644 index 00000000000..4ecbcdcd314 --- /dev/null +++ b/Master/texmf-dist/tex/latex/pinoutikz/pinoutikz.sty @@ -0,0 +1,124 @@ +\NeedsTeXFormat{LaTeX2e}[1994/06/01] +\ProvidesPackage{pinoutikz}[1.0.1 Pinout diagram definitions] + +\RequirePackage{ifthen} +\RequirePackage{lmodern} +\RequirePackage{xstring} +\RequirePackage{upquote} +\RequirePackage{amsmath,amssymb} +\RequirePackage{amsfonts} +\RequirePackage{forarray} +\RequirePackage{arrayjob} +\RequirePackage{tikz} + +%% 'sans serif' option +\DeclareOption{sans}{ + \renewcommand{\familydefault}{\sfdefault} +} + +%% 'roman' option +\DeclareOption{roman}{ + \renewcommand{\familydefault}{\rmdefault} +} + +%% Global indentation option +\newif\if@neverindent\@neverindentfalse +\DeclareOption{neverindent}{ + \@neverindenttrue +} + +\ExecuteOptions{sans} + +\ProcessOptions\relax + +\def\pinoutikzname {pinouTikz} +\def\pinoutikzversion {1.0.1} +\def\pinoutikzdate {2019/11/23} + +%% Formatt a pin name +\def\FormatPinLabel#1{ + \pgfmathparse{0}\let\negstate\pgfmathresult + \pgfmathparse{0}\let\index\pgfmathresult + \ForEach{~}% + {% + \StrLen{\thislevelitem}[\itemlen]% + \ifthenelse{\itemlen>0}{% + \ifthenelse{\equal{\negstate}{1}}{$\overline{\thislevelitem}$}{\thislevelitem}% + \pgfmathparse{\index+1}\let\index\pgfmathresult + }{}% + \pgfmathparse{!\negstate}\let\negstate\pgfmathresult% + }% + {#1} +} + +%% PIN diagram with label decoding +%% @param#1: options +%% @param#2: offset +%% @param#3: pin name +%% @param#4: pin number +\def\PIN[#1](#2)#3#4{ + % decode label + \begin{scope}[shift={(#2)}] + \def\pinlabel{#3} + \ifthenelse{\equal{#1}{right}}{% + \draw (0.12,0) node[label=right:{\footnotesize \pinlabel},label=left:{\small \pgfmathprintnumber{#4}} ]{}; + \draw (0,-.15) rectangle(0.12,0.15); + }% + {% + \draw (0,0) node[label=left:{\footnotesize \pinlabel},label=right:{\small \pgfmathprintnumber{#4}} ]{}; + \draw (0,-.15) rectangle(0.12,0.15); + }% + \end{scope} +} + +%% PDIP package diagram +%% @param#1: offset +%% @param#2: number of pins (divisible by 2) +%% @param#3: comma separated definitions list for every pin - every pin definition must be enclosed in quotation marks ("") +\def\PDIP(#1)#2{% + \begin{tikzpicture} + \begin{scope}[shift={(0,0)}] + \sffamily + \textsf{% + \def\pins{{#2}} + \pgfmathparse{#1/2-1}\let\cntpinsl\pgfmathresult + \pgfmathparse{#1/2}\let\cntstr\pgfmathresult + \pgfmathparse{#1-1}\let\cntpinsr\pgfmathresult + \pgfmathparse{\cntstr*.5}\let\height\pgfmathresult + \draw[line width=1.5pt] (0.12,-0.5) rectangle (1.88,\height); + \draw (0.80,\height) arc (180:360:2mm); + %iterate through pin definitions + \foreach \pinnum/\i in {#2}% + {% + \pgfmathparse{\pinnum-1}\let\pinidx\pgfmathresult + \pgfmathparse{(\pinnum>0 && \pinnum<(\cntstr+1)) ? 0 : 1}\let\pinrange\pgfmathresult + \ifthenelse{\equal{\pinrange}{0} } + {% + \pgfmathparse{(\cntpinsl-\pinidx)*0.5}\let\ypin\pgfmathresult + \PIN[left](0,\ypin){\i}{\pinnum} + }%else + {% + \pgfmathparse{(\pinidx-\cntstr)*0.5}\let\ypin\pgfmathresult + \PIN[right](1.88,\ypin){\i}{\pinnum} + } +% \fi + } + } + \end{scope} + \end{tikzpicture} +} + +%% + +\newlength{\pardefault} +\setlength{\pardefault}{\parindent} +\newcommand{\neverindent}{ \setlength{\parindent}{0pt} } +\newcommand{\autoindent}{ \setlength{\parindent}{\pardefault} } + +\if@neverindent +\neverindent +\fi + +% ... + +\endinput \ No newline at end of file -- cgit v1.2.3