diff options
author | Karl Berry <karl@freefriends.org> | 2015-09-12 21:23:52 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2015-09-12 21:23:52 +0000 |
commit | af6faae1a8553e2c55f7980152d84d8cf4ac5a96 (patch) | |
tree | c0e8e756f5e5118331df38ec867e51d67a8d0f5d /Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.tikz.code.tex | |
parent | b8a8a5629c2e03bdf95ebe04a220c4568a1dad14 (diff) |
chemmacros (12sep15)
git-svn-id: svn://tug.org/texlive/trunk@38359 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.tikz.code.tex')
-rw-r--r-- | Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.tikz.code.tex | 143 |
1 files changed, 143 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.tikz.code.tex b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.tikz.code.tex new file mode 100644 index 00000000000..9524d14d734 --- /dev/null +++ b/Master/texmf-dist/tex/latex/chemmacros/chemmacros.module.tikz.code.tex @@ -0,0 +1,143 @@ +% -------------------------------------------------------------------------- +% +% the CHEMMACROS package -- module: `tikz' +% +% -------------------------------------------------------------------------- +% Clemens Niederberger +% -------------------------------------------------------------------------- +% https://github.org/cgnieder/chemmacros/ +% contact@mychemistry.eu +% -------------------------------------------------------------------------- +% If you have any ideas, questions, suggestions or bugs to report, please +% feel free to contact me. +% -------------------------------------------------------------------------- +% Copyright 2011-2015 Clemens Niederberger +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3 +% of this license or (at your option) any later version. +% The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3 or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this work is Clemens Niederberger. +% -------------------------------------------------------------------------- +\ChemModule*{tikz}{2015/07/24 upright greek symbols} + +\RequirePackage{tikz} +\usetikzlibrary{calc}%,arrows} + +\ExplSyntaxOn + +\tl_const:Nx \c_chemmacros_other_colon_tl { \token_to_str:N : } + +% -------------------------------------------------------------------------- +% TikZ drawings - helper macros +\cs_new_protected:Npn \chemmacros_tikz_picture:nn #1#2 + { \tikzpicture[{#1}] #2 \endtikzpicture } +\cs_new_protected:Npn \chemmacros_tikz:nn #1#2 { \tikz[{#1}] {#2} } +\cs_new_protected:Npn \chemmacros_tikz_draw:n #1 { \draw[{#1}] } +\cs_new_protected:Npn \chemmacros_tikz_node:n #1 { \node[{#1}] } +\cs_new_protected:Npn \chemmacros_tikz_shade:n #1 { \shade[{#1}] } +\cs_new_protected:Npn \chemmacros_tikz_shadedraw:n #1 { \shadedraw[{#1}] } +\cs_new_protected:Npn \chemmacros_tikz_node_in_draw:n #1 { node[{#1}] } + +\cs_generate_variant:Nn \chemmacros_tikz_picture:nn { xn } +\cs_generate_variant:Nn \chemmacros_tikz_draw:n { x } +\cs_generate_variant:Nn \chemmacros_tikz_node:n { x } +\cs_generate_variant:Nn \chemmacros_tikz_shade:n { x } +\cs_generate_variant:Nn \chemmacros_tikz_shadedraw:n { x } +\cs_generate_variant:Nn \chemmacros_tikz_node_in_draw:n { x } + +% -------------------------------------------------------------------------- +% arrow tips for electron movement +\dim_new:N \l__chemmacros_el_length_dim + +% full tip for pairs +\pgfarrowsdeclare { el } { el } + { + \dim_set:Nn \l__chemmacros_el_length_dim + { 2.5pt + 2.5\pgflinewidth } + \pgfarrowsleftextend { -\l__chemmacros_el_length_dim } + \pgfarrowsrightextend { .5\pgflinewidth } + } + { + \dim_set:Nn \l__chemmacros_el_length_dim + { 2.5pt + 2.5\pgflinewidth } + \pgfsetdash {} { 0pt } + \pgfsetroundjoin + \pgfsetroundcap + \pgfpathmoveto { \pgfpoint { 0pt } { 0pt } } + \pgfpathlineto + { + \pgfpoint + { -\l__chemmacros_el_length_dim } + { .3\l__chemmacros_el_length_dim } + } + \pgfpathlineto + { \pgfpoint { -.5\l__chemmacros_el_length_dim } { 0pt } } + \pgfpathlineto + { + \pgfpoint + { -\l__chemmacros_el_length_dim } + { -.3\l__chemmacros_el_length_dim } + } + \pgfpathlineto { \pgfpoint { 0pt } { 0pt } } + \pgfusepathqfillstroke + } + +% half tip on the left +\pgfarrowsdeclare { left~el } { left~el } + { + \dim_set:Nn \l__chemmacros_el_length_dim + { 2.5pt + 2.5\pgflinewidth } + \pgfarrowsleftextend { -\l__chemmacros_el_length_dim } + \pgfarrowsrightextend { .5\pgflinewidth } + } + { + \dim_set:Nn \l__chemmacros_el_length_dim + { 2.5pt + 2.5\pgflinewidth } + \pgfsetdash {} { 0pt } + \pgfsetroundjoin + \pgfsetroundcap + \pgfpathmoveto { \pgfpoint { 0pt } { 0pt } } + \pgfpathlineto + { + \pgfpoint + { -\l__chemmacros_el_length_dim } + { .3\l__chemmacros_el_length_dim } + } + \pgfpathlineto { \pgfpoint { -.5\l__chemmacros_el_length_dim } { 0pt } } + \pgfpathlineto { \pgfpoint { 0pt } { 0pt } } + \pgfusepathqfillstroke + } + +% half tip in the right +\pgfarrowsdeclare { right~el } { right~el } + { + \dim_set:Nn \l__chemmacros_el_length_dim + { 2.5pt + 2.5\pgflinewidth } + \pgfarrowsleftextend { -\l__chemmacros_el_length_dim } + \pgfarrowsrightextend { .5\pgflinewidth } + } + { + \dim_set:Nn \l__chemmacros_el_length_dim + { 2.5pt + 2.5\pgflinewidth } + \pgfsetdash {} { 0pt } + \pgfsetroundjoin + \pgfsetroundcap + \pgfpathmoveto { \pgfpoint { 0pt } { 0pt } } + \pgfpathlineto + { + \pgfpoint + { -\l__chemmacros_el_length_dim } + { -.3\l__chemmacros_el_length_dim } + } + \pgfpathlineto { \pgfpoint { -.5\l__chemmacros_el_length_dim } { 0pt } } + \pgfpathlineto { \pgfpoint { 0pt } { 0pt } } + \pgfusepathqfillstroke + } +% -------------------------------------------------------------------------- |