Skip to content

Instantly share code, notes, and snippets.

@jondoesntgit
Created September 24, 2020 14:22
Show Gist options
  • Save jondoesntgit/6862bc90185cb728c227d03dcad1a8f4 to your computer and use it in GitHub Desktop.
Save jondoesntgit/6862bc90185cb728c227d03dcad1a8f4 to your computer and use it in GitHub Desktop.
wheelertikz.sty
% This is my first package
% jamwheel@stanford.edu
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{wheelertikz}[2020-09-24 Package for drawing Tikz Figures for PhD program]
\usepackage{helvet}
\RequirePackage{helvet}
\RequirePackage{sfmath}
\usetikzlibrary{positioning, calc, shapes}
\RequirePackage{tikz}
%\pgfplotsset{compat=1.16}
\makeatletter
\tikzset{arc style/.initial={}}
\pgfdeclareshape{circulator}{
\inheritsavedanchors[from=circle]
\inheritanchorborder[from=circle]
\inheritanchor[from=circle]{center}
\inheritanchor[from=circle]{south}
\inheritanchor[from=circle]{west}
\inheritanchor[from=circle]{north}
\inheritanchor[from=circle]{east}
% etc.
\inheritbackgroundpath[from=circle]
\beforebackgroundpath{
% get and set options
\pgfkeys{/tikz/arc style/.get=\tmp}
\expandafter\tikzset\expandafter{\tmp}
\tikz@options
% get radius length and center coordinates
%\northeast \pgf@xa=\pgf@x
\pgf@xa = .8cm
%\centerpoint \pgf@xb=\pgf@x \pgf@yb=\pgf@y
\pgf@xb=0
\pgf@yb=0
%\northeast \pgf@xa=\pgf@x \pgf@ya=\pgf@y
% \southwest \pgf@xb=\pgf@x \pgf@yb=\pgf@y
% Draw arc starting from left
%\pgfsetarrowsend{to}
\advance\pgf@xb by -0.65\pgf@xa
\pgfpathmoveto{\pgfpoint{\pgf@xb}{\pgf@yb}}
\pgfpatharc{180}{-90}{.65\pgf@xa}
\pgfusepath{draw}
}
}
\makeatother
\makeatletter
\tikzset{arc style/.initial={}}
\pgfdeclareshape{apcshape}{
\inheritsavedanchors[from=rectangle]
\inheritanchorborder[from=rectangle]
\inheritanchor[from=rectangle]{center}
\inheritanchor[from=rectangle]{south}
\inheritanchor[from=rectangle]{west}
\inheritanchor[from=rectangle]{north}
\inheritanchor[from=rectangle]{east}
% etc.
\inheritbackgroundpath[from=rectangle]
\beforebackgroundpath{
% get radius length and center coordinates
\northeast \pgf@xa=\pgf@x \pgf@ya=\pgf@y
\southwest \pgf@xb=\pgf@x \pgf@yb=\pgf@y
\pgf@xc=\pgf@xa%\pgf@x
\advance \pgf@xc by -\pgf@xb
\advance \pgf@xa by -.4\pgf@xc
\advance \pgf@xb by .4\pgf@xc
\pgfpathmoveto{\pgfpoint{\pgf@xa}{\pgf@yb}}
\pgfpathlineto{\pgfpoint{\pgf@xb}{\pgf@ya}}
%\pgfpathlineto{\northeast}
%\pgfpathmoveto{\pgfpoint{1\wd\pgfnodeparttextbox}{\ht\pgfnodeparttextbox}}
%\pgfpathmoveto{\pgfpoint{-.5\wd\pgfnodeparttextbox}{-\ht\pgfnodeparttextbox}}
% Connector symbol
%\advance\pgf@xb by -0.5\pgf@xa
%\pgfpathmoveto{\pgfpoint{\pgf@xb}{\pgf@yb}}
%\pgfpatharc{180}{-90}{.5\pgf@xa}
\pgfusepath{draw}
}
}
\makeatother
\makeatletter
\tikzset{arc style/.initial={}}
\pgfdeclareshape{coupler-shape}{
\inheritsavedanchors[from=ellipse]
\inheritanchorborder[from=ellipse]
\inheritanchor[from=ellipse]{center}
\foreach\anchor in {center,north,south,west,east,north east, south east, north west, south west}{
\inheritanchor[from=ellipse]{\anchor}
}
\inheritbackgroundpath[from=ellipse]
}
\makeatother
\tikzset{apc/.style={draw, shape=apcshape, minimum height=.20cm, minimum width=.4 cm, line width= 1 pt, inner sep=0}}
\tikzset{coupler/.style={draw, shape=coupler-shape, minimum height=.20cm, minimum width=.4 cm, line width= 1 pt, inner sep=0}}
\tikzset{
optic/.style = {line width = 1pt, red},
electric/.style = {line width=1pt, black},
}
\tikzset{
line width=1pt, font=\sffamily, >=latex, every node/.style = {line width = 1pt}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment