Skip to content

Instantly share code, notes, and snippets.

@tmgriffiths
Last active October 5, 2016 07:59
Show Gist options
  • Save tmgriffiths/a3cf00ef36a22b892d5a54a0663d1412 to your computer and use it in GitHub Desktop.
Save tmgriffiths/a3cf00ef36a22b892d5a54a0663d1412 to your computer and use it in GitHub Desktop.
Compound symbol for labeling thermodynamic cycles – a number inside a almost comple circle with an arrow tip. Drawn with tikz.
% Requires tikz
% Requires calc
\usetikzlibrary{matrix,arrows,bending}
% TiKz arrowed circles, need to figure out how to differentiate H+ and e- cycles...
\makeatletter
\tikzset{%
/qrr/circle arrow/.cd,
start angle/.initial={},
delta angle/.initial={},
end angle/.initial={},
arrows/.estore in=\qrr@ca@arrow,
arrows=-
}
\pgfdeclareshape{circle arrow}{%
\inheritsavedanchors[from=circle] \inheritanchorborder[from=circle]
\inheritanchor[from=circle]{north} \inheritanchor[from=circle]{north west}
\inheritanchor[from=circle]{north east} \inheritanchor[from=circle]{center}
\inheritanchor[from=circle]{west} \inheritanchor[from=circle]{east}
\inheritanchor[from=circle]{mid} \inheritanchor[from=circle]{mid west}
\inheritanchor[from=circle]{mid east} \inheritanchor[from=circle]{base}
\inheritanchor[from=circle]{base west} \inheritanchor[from=circle]{base east}
\inheritanchor[from=circle]{south} \inheritanchor[from=circle]{south west}
\inheritanchor[from=circle]{south east}
\backgroundpath{
\pgfkeysgetvalue{/qrr/circle arrow/start angle}\qrr@ca@s
\pgfkeysgetvalue{/qrr/circle arrow/end angle}\qrr@ca@e
\pgfkeysgetvalue{/qrr/circle arrow/delta angle}\qrr@ca@d
\ifx\qrr@ca@s\pgfutil@empty%
\pgfmathsetmacro\qrr@ca@s{\qrr@ca@e-\qrr@ca@d}%
\else
\ifx\qrr@ca@e\pgfutil@empty%
\pgfmathsetmacro\qrr@ca@e{\qrr@ca@s+\qrr@ca@d}%
\fi%
\fi
\pgfpathmoveto{\pgfpointadd{\centerpoint}{\pgfpointpolar{\qrr@ca@s}{\radius}}}%
\pgfpatharc{\qrr@ca@s}{\qrr@ca@e}{\radius}%
\pgfkeys{/tikz/arrows/.expand once=\qrr@ca@arrow}%
}
}
\makeatother
\tikzset{% the first two styles are internal, they do not work alone!
turn left/.style={/tikz/shape=circle arrow,/qrr/circle arrow/arrows=-{LaTeX[length=4pt,bend]},/qrr/circle arrow/delta angle=345},
turn right/.style={/tikz/shape=circle arrow,/qrr/circle arrow/arrows={LaTeX[length=4pt,bend]}-,/qrr/circle arrow/delta angle=345},
turn left north/.style = {/tikz/turn left, /qrr/circle arrow/start angle=100} ,
turn left east/.style = {/tikz/turn left, /qrr/circle arrow/start angle=10},
turn left south/.style = {/tikz/turn left, /qrr/circle arrow/start angle=280},
turn left west/.style = {/tikz/turn left, /qrr/circle arrow/start angle=190},
turn right north/.style = {/tikz/turn right, /qrr/circle arrow/start angle=100} ,
turn right east/.style = {/tikz/turn right, /qrr/circle arrow/start angle=10},
turn right south/.style = {/tikz/turn right, /qrr/circle arrow/start angle=280},
turn right west/.style = {/tikz/turn right, /qrr/circle arrow/start angle=190},
}
\DeclareRobustCommand\circled[1]{\tikz[baseline=(char.base)]{%
\node[turn left north, thick, draw, inner sep=0.1em] (char) {#1};
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment