summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/mychemistry/bondwidth.tex
blob: ec5a5144af81ad10df6e3e5ddb4c9809ca128446 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% bondwidth.tex
% change the line width of bonds in ChemFig for all formulae
% 2011/04/02 v0.4
% -------------------------------------------------------------------
% Copyright 2011 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.
% -------------------------------------------------------------------
% adds the command \setbondwidth{} to ChemFig
%   changes the line width of the bonds to
%   the specified width. An empty argument will
%   restore the default.
% input in the preamble after loading ChemFig
%   with \input{bondwidth}
% Please be aware: this has only be tested with
%   ChemFig version 0.4; this will NOT work with
%   older versions!
% -------------------------------------------------------------------
% 2011/03/21 - v0.1: initial version
% 2011/03/23 - v0.2: restoring default with empty argument
% 2011/03/24 - v0.3: command setbondwidth rewritten so the
%                    ifthen-package isn't required anymore
% 2011/04/02 - v0.4: \makeatletter/-other stören, wenn bondwidth.tex
%                    via sty-file eingebunden => entfernt
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\@mc@bond@width{0.2pt}% default
\def\setbondwidth#1{% set bond width or restore default
  \ifx\@empty#1\@empty\def\@mc@bond@width{0.2pt}\else\def\@mc@bond@width{#1}\fi
}
\def\CF@chemfig@ii[#1][#2]{% modify ChemFig's internal command
  \edef\CF@tmp@str{[remember picture,every node/.style={anchor=base,inner sep=0pt,outer sep=0pt,minimum size=0pt\ifx\@empty#2\@empty\else,#2\fi},baseline,line width=\@mc@bond@width\ifx\@empty#1\@empty\else,#1\fi]}%
  \expandafter\tikzpicture\CF@tmp@str
  \begingroup
    \let\CF@hook@list\@empty
    \ifx\CF@atom@sep\@empty\def\CF@atom@sep{3em}\fi
    \ifx\CF@cram@basewidth\@empty\def\CF@cram@basewidth{1.5ex}\fi
    \CF@incyclefalse
    \CF@cnt@groupnumber\z@
    \let\CF@last@action\z@%
    \let\CF@start@offset\@empty
    \let\CF@end@offset\@empty
    \let\CF@bond@outcontentsaved\@empty
    \def\CF@cycle@anglecorrection{180/\CF@cycle@num}%
    \everyeof{\@nil}\endlinechar\m@ne
    \CF@sanitize@catcode
    \CF@chemfig@iii
}