summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/chemfig
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2011-04-25 23:53:11 +0000
committerKarl Berry <karl@freefriends.org>2011-04-25 23:53:11 +0000
commitfa970c2346fbb2a938fc0cbddf2aeec1e111c993 (patch)
treeb3d58fd5e9d7bcf8a66ec61b0e634e3a8a9c1591 /Master/texmf-dist/tex/generic/chemfig
parent634ddfa7204fe5e21548eda9e1e2f7cbd0238fe3 (diff)
chemfig (25apr11)
git-svn-id: svn://tug.org/texlive/trunk@22205 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic/chemfig')
-rw-r--r--Master/texmf-dist/tex/generic/chemfig/chemfig.sty4
-rw-r--r--Master/texmf-dist/tex/generic/chemfig/chemfig.tex158
-rw-r--r--Master/texmf-dist/tex/generic/chemfig/t-chemfig.tex6
3 files changed, 78 insertions, 90 deletions
diff --git a/Master/texmf-dist/tex/generic/chemfig/chemfig.sty b/Master/texmf-dist/tex/generic/chemfig/chemfig.sty
index 5111fdd5966..85c3a9269c0 100644
--- a/Master/texmf-dist/tex/generic/chemfig/chemfig.sty
+++ b/Master/texmf-dist/tex/generic/chemfig/chemfig.sty
@@ -1,9 +1,9 @@
% __________________________________________________________________
% | |
% | |
-% | chemfig v0.4a |
+% | chemfig v0.4b |
% | |
-% | April 10, 2011 |
+% | April 24, 2011 |
% | |
% |__________________________________________________________________|
%
diff --git a/Master/texmf-dist/tex/generic/chemfig/chemfig.tex b/Master/texmf-dist/tex/generic/chemfig/chemfig.tex
index 1ac9f1c5ef3..11a90945caf 100644
--- a/Master/texmf-dist/tex/generic/chemfig/chemfig.tex
+++ b/Master/texmf-dist/tex/generic/chemfig/chemfig.tex
@@ -1,9 +1,9 @@
% __________________________________________________________________
% | |
% | |
-% | chemfig v0.4a |
+% | chemfig v0.4b |
% | |
-% | April 10, 2011 |
+% | April 24, 2011 |
% | |
% |__________________________________________________________________|
%
@@ -39,12 +39,10 @@
%
% The Current Maintainer of this work is Christian Tellechea
% --------------------------------------------------------------------
-%
-% Sauvegarde tous les catcodes des caract\`eres sp\'eciaux sauf #
+% Sauvegarde tous les catcodes des caract\`eres sp\'eciaux sauf #
\begingroup
\def\X#1{\catcode\number`#1=\number\catcode`#1\relax}
-% Sauve tous les catcode sauf #
\expandafter\xdef\csname CF@savedcatcode\endcsname{%
\X\[\X\]\X\:\X\(\X\)\X\,\X\-\X\=\X\~\X\!\X\?\X\<\X\>\X\;\X\*\X\|\X\@%
}
@@ -55,7 +53,7 @@
\catcode`\)12 \catcode`\,12 \catcode`\-12 \catcode`\=12
\catcode`\~12 \catcode`\!12 \catcode`\?12 \catcode`\<12
\catcode`\>12 \catcode`\;12 \catcode`\*12 \catcode`\|12
-\catcode`\@11 \catcode`\#6
+\catcode`\@11 \catcode`\#6 \catcode`\ 10
\def\CF@def#1{%
\ifdefined#1%
@@ -64,10 +62,10 @@
\def#1%
}
-\CF@def\CF@ver {0.4a}
-\CF@def\CF@date {2011/04/10}
-\CF@def\CF@fr@date {10 avril 2011}
-\CF@def\CF@en@date {April 10, 2011}
+\CF@def\CF@ver {0.4b}
+\CF@def\CF@date {2011/04/24}
+\CF@def\CF@fr@date {24 avril 2011}
+\CF@def\CF@en@date {April 24, 2011}
\CF@def\CF@package@name{chemfig}
\expandafter\ifx\csname @latexerr\endcsname\relax% on n'utilise pas LaTeX ?
@@ -128,33 +126,11 @@
\newwrite\CF@unused
-\CF@def\CF@specialchar@list{\[\]\:\(\)\,\-\=\~\!\?\<\>\;\*\|\#\@}
-
\CF@def\CF@sanitize@catcode{%
- \expandafter\CF@sanitize@catcode@i\expandafter{\CF@specialchar@list}%
-}
-
-\CF@def\CF@sanitize@catcode@i#1{%
- \ifx\@empty#1\@empty
- \else
- \expandafter\@makeother\@car#1\@nil
- \CF@swap@fi
- \expandafter\CF@sanitize@catcode@i\expandafter{\@gobble#1}%
- \fi
-}
-
-\CF@def\CF@save@catcode{%
- \let\CF@restore@catcode\@empty
- \expandafter\CF@save@catcode@i\expandafter{\CF@specialchar@list}%
-}
-
-\CF@def\CF@save@catcode@i#1{%
- \ifx\@empty#1\@empty
- \else
- \CF@edefadd@tocs\CF@restore@catcode{\catcode`\expandafter\noexpand\@car#1\@nil=\number\expandafter\catcode\expandafter`\@car#1\@nil\noexpand\space}%
- \CF@swap@fi
- \expandafter\CF@save@catcode@i\expandafter{\@gobble#1}%
- \fi
+ \@makeother\[\@makeother\]\@makeother\:\@makeother\(\@makeother\)%
+ \@makeother\,\@makeother\-\@makeother\=\@makeother\~\@makeother\!%
+ \@makeother\?\@makeother\<\@makeother\>\@makeother\;\@makeother\*%
+ \@makeother\|\@makeother\#\@makeother\@%
}
\CF@def\CF@node@content{\expandafter\printatom\expandafter{\csname atom@\number\CF@cnt@atomnumber\endcsname\CF@node@strut}}
@@ -312,7 +288,7 @@
\expandafter\CF@add@tocs\expandafter#1\expandafter{\CF@tmp@str}%
}
-\CF@def\CF@if@firsttokmatch#1#2{% est ce que #1 et #2 commencent par les mêmes tokens ?
+\CF@def\CF@if@firsttokmatch#1#2{% est ce que #1 et #2 commencent par les m\^emes tokens ?
\futurelet\CF@toks@a\CF@gobble@tonil#1\relax\@nil
\futurelet\CF@toks@b\CF@gobble@tonil#2\relax\@nil
\ifx\CF@toks@a\CF@toks@b\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi
@@ -597,7 +573,8 @@
}
\CF@def\CF@chemfig@iii#1{%
- \CF@chemfig@iv{#1}%
+ \expandafter\assign@tonil\expandafter\CF@remain@molecule\scantokens{#1}%
+ \expandafter\CF@chemfig@iv\expandafter{\CF@remain@molecule}%
\endtikzpicture
\let\CF@split@state\z@
}
@@ -617,8 +594,10 @@
\let\CF@default@stringangle\@empty
\fi
\let\CF@current@angle\CF@default@angle
- \if[\expandafter\noexpand\@car#1\@nil
- \CF@analyse@optarg#1\@nil\CF@remain@molecule
+ \def\CF@remain@molecule{#1}%
+ \CF@seek@submol% alias en premier ?
+ \if[\expandafter\expandafter\expandafter\noexpand\expandafter\@car\CF@remain@molecule\@nil
+ \expandafter\CF@analyse@optarg\CF@remain@molecule\@nil\CF@remain@molecule
\expandafter\CF@set@bondangle\expandafter{\CF@current@stringangle}\CF@current@angle
\let\CF@default@angle\CF@current@angle
\let\CF@previous@angle\CF@current@angle
@@ -627,9 +606,8 @@
\unless\ifx\@empty\CF@current@fromatom\let\CF@default@fromatom\CF@current@fromatom\fi
\unless\ifx\@empty\CF@current@toatom\let\CF@default@toatom\CF@current@toatom\fi
\unless\ifx\@empty\CF@current@tikz\let\CF@default@tikz\CF@current@tikz\fi
- \else
- \def\CF@remain@molecule{#1}% on prend tout puisque pas d'argument optionnel au d\'ebut
- \fi% apr\`es l'argument entre crochet au d\'ebut, on passe \`a la suite
+ \CF@seek@submol
+ \fi
\ifCF@incycle% si on commence un cycle
\let\CF@current@angle\CF@previous@angle
\else
@@ -842,21 +820,17 @@
\pgfmathparse{(\CF@dimbx-\CF@dimax)/\CF@len@vector}\let\CF@norm@y\pgfmathresult
}
+\CF@def\CF@set@offset#1#2{%
+ \ifx#1\@empty
+ \edef#1{\ifx#2\CF@empty@node0pt\else\ifx#2\@empty0pt\else\CF@bond@offset\fi\fi}%
+ \fi
+}
+
\CF@def\CF@draw@bond#1#2#3#4#5{% #1=type de liaison #2 et #3:nom de noeuds de d\'ebut et fin #4 et #5: contenu des atomes de d\'ebut et fin
- \edef\CF@start@offset{%
- \ifx\CF@start@offset\@empty
- \ifx#4\CF@empty@node0pt\else\ifx#4\@empty0pt\else\CF@bond@offset\fi\fi
- \else
- \CF@start@offset
- \fi
- }%
- \edef\CF@end@offset{%
- \ifx\CF@end@offset\@empty
- \ifx#5\CF@empty@node0pt\else\ifx#5\@empty0pt\else\CF@bond@offset\fi\fi
- \else
- \CF@end@offset
- \fi
- }%
+ \CF@set@offset\CF@start@offset#4%
+ \CF@set@offset\CF@end@offset#5%
+ \let\CF@current@bondstyle\CF@bond@style
+ \unless\ifx\CF@current@tikz\@empty\CF@expadd@tocs\CF@current@bondstyle{\expandafter,\CF@current@tikz}\fi
\path(#2)--(#3)coordinate[pos=0](#2@)coordinate[pos=1](#3@);%
\CF@compute@nodevect{#2@}{#3@}%
\pgfmathparse{\CF@start@offset/\CF@len@vector}\let\CF@start@coeff\pgfmathresult
@@ -875,6 +849,9 @@
\ifnum\CF@doublebond@type=\z@
\let\CF@doublebond@type\@ne
\fi
+ \ifnum\CF@split@state>\z@
+ \let\CF@doublebond@type\tw@
+ \fi
\pgfmathparse{\CF@double@sep*tan(180/\CF@cycle@num)}%
\let\CF@doublebond@lengthcorrection\pgfmathresult
\fi
@@ -888,10 +865,10 @@
\begingroup% ajuste \'eventuellement les longueurs des liaisons doubles
\ifCF@incycle
\ifdim\CF@start@offset=\z@
- \CF@add@tocs\CF@current@tikz{,shorten <=\CF@doublebond@lengthcorrection pt}%
+ \CF@edefadd@tocs\CF@current@bondstyle{,shorten <=\CF@doublebond@lengthcorrection pt}%
\fi
\ifdim\CF@end@offset=\z@
- \CF@add@tocs\CF@current@tikz{,shorten >=\CF@doublebond@lengthcorrection pt}%
+ \CF@edefadd@tocs\CF@current@bondstyle{,shorten >=\CF@doublebond@lengthcorrection pt}%
\fi
\fi
\CF@draw@bond@i(#2@@1)--(#3@@1);
@@ -902,10 +879,10 @@
\begingroup% ajuste \'eventuellement les longueurs des liaisons doubles
\ifCF@incycle
\ifdim\CF@start@offset=\z@
- \CF@add@tocs\CF@current@tikz{,shorten <=-\CF@doublebond@lengthcorrection pt}%
+ \CF@edefadd@tocs\CF@current@bondstyle{,shorten \ifnum\CF@split@state=\z@<=-\else>=\fi\CF@doublebond@lengthcorrection pt}%
\fi
\ifdim\CF@end@offset=\z@
- \CF@add@tocs\CF@current@tikz{,shorten >=-\CF@doublebond@lengthcorrection pt}%
+ \CF@edefadd@tocs\CF@current@bondstyle{,shorten \ifnum\CF@split@state=\z@>=-\else<=\fi\CF@doublebond@lengthcorrection pt}%
\fi
\fi
\CF@draw@bond@i(#2@@2)--(#3@@2);
@@ -918,28 +895,28 @@
\CF@draw@bond@i(#2@@2)--(#3@@2);
\or% 4 = liaison Cram pleine de #2 vers #3
\CF@create@normnodes{#2@@}{#3@@}{\CF@cram@basewidth/2}{}%
- \expandafter\filldraw\expandafter[\CF@current@tikz,line join=bevel](#2@@1)--(#2@@2)--(#3@@)--(#2@@1);
+ \expandafter\filldraw\expandafter[\CF@current@bondstyle,line join=bevel](#2@@1)--(#2@@2)--(#3@@)--(#2@@1);
\or% 5 = liaison Cram pleine de #3 vers #2
\CF@create@normnodes{#3@@}{#2@@}{\CF@cram@basewidth/2}{}%
- \expandafter\filldraw\expandafter[\CF@current@tikz,line join=bevel](#3@@1)--(#3@@2)--(#2@@)--(#3@@1);
+ \expandafter\filldraw\expandafter[\CF@current@bondstyle,line join=bevel](#3@@1)--(#3@@2)--(#2@@)--(#3@@1);
\or% 6 = liaison Cram pointill\'ee de #2 vers #3
\scope
\CF@create@normnodes{#2@@}{#3@@}{\CF@cram@basewidth/2}{}%
\clip(#2@@1)--(#2@@2)--(#3@@)--(#2@@1);
- \expandafter\draw\expandafter[\CF@current@tikz,dash pattern=on \CF@cram@dashlength off \CF@cram@dashsep,line width=\CF@cram@basewidth](#2@@)--(#3@@);
+ \expandafter\draw\expandafter[\CF@current@bondstyle,dash pattern=on \CF@cram@dashlength off \CF@cram@dashsep,line width=\CF@cram@basewidth](#2@@)--(#3@@);
\endscope
\or% 7 = liaison Cram pointill\'ee de #3 vers #2
\scope
\CF@create@normnodes{#3@@}{#2@@}{\CF@cram@basewidth/2}{}%
\clip(#3@@1)--(#3@@2)--(#2@@)--(#3@@1);
- \expandafter\draw\expandafter[\CF@current@tikz,dash pattern=on \CF@cram@dashlength off \CF@cram@dashsep,line width=\CF@cram@basewidth](#3@@)--(#2@@);
+ \expandafter\draw\expandafter[\CF@current@bondstyle,dash pattern=on \CF@cram@dashlength off \CF@cram@dashsep,line width=\CF@cram@basewidth](#3@@)--(#2@@);
\endscope
\or% 8 = liaison Cram triangle \'evid\'e de #2 vers #3
\CF@create@normnodes{#2@@}{#3@@}{\CF@cram@basewidth/2}{}%
- \expandafter\draw\expandafter[\CF@current@tikz,line join=bevel](#2@@1)--(#2@@2)--(#3@@)--(#2@@1);
+ \expandafter\draw\expandafter[\CF@current@bondstyle,line join=bevel](#2@@1)--(#2@@2)--(#3@@)--(#2@@1);
\or% 9 = liaison Cram triangle \'evid\'e de #3 vers #1
\CF@create@normnodes{#3@@}{#2@@}{\CF@cram@basewidth/2}{}%
- \expandafter\draw\expandafter[\CF@current@tikz,line join=bevel](#3@@1)--(#3@@2)--(#2@@)--(#3@@1);
+ \expandafter\draw\expandafter[\CF@current@bondstyle,line join=bevel](#3@@1)--(#3@@2)--(#2@@)--(#3@@1);
\else
\errmessage{Package \CF@package@name\space Error: unknown bond type, this error should not occur^^JIf you think it's a bug, send a Minimal Example to the author}%
\fi
@@ -947,7 +924,7 @@
\let\CF@end@offset\@empty
}
-\CF@def\CF@draw@bond@i{\expandafter\draw\expandafter[\CF@current@tikz]}
+\CF@def\CF@draw@bond@i{\expandafter\draw\expandafter[\CF@current@bondstyle]}
\CF@def\CF@hook@drawall{% dessine tous les crochets contenus dansla sc \CF@hook@draw
\unless\ifx\CF@hook@drawlist\@empty
@@ -974,6 +951,9 @@
\CF@def\setnodestyle{\def\CF@node@style}
\setnodestyle{}
+\CF@def\setbondstyle{\def\CF@bond@style}
+\setbondstyle{}
+
\expandafter\CF@def\expandafter\CF@gobble@movearg\string @#1#2\@nil#3%
{%
\expandafter\def\csname atom@\number\CF@cnt@atomnumber\endcsname{#2}%
@@ -1011,7 +991,7 @@
\ifx\@empty#2\@empty%
\else
\ifnum#2<\@ne
- \immediate\write\CF@unused{Package \CF@package@name\space Warning: no atom found at position #2.^^JPershaps you mispelled the optional argument of the bond on input line \the\inputlineno.}%
+ \immediate\write\CF@unused{Package \CF@package@name\space Warning: no atom found at position #2, pershaps you mispelled the optional argument of the bond.}%
\else
\ifnum#2>\CF@cnt@atomingroup
\errmessage{Package \CF@package@name\space Error: no atom found at position #2, pershaps you mispelled the optional argument of the bond.}%
@@ -1019,7 +999,7 @@
\fi
\fi
\edef\CF@hook@atomnumber{%
- \ifx\@empty#2\@empty%\relax
+ \ifx\@empty#2\@empty
\ifdim#1pt>90pt
\ifdim#1pt<270pt \number\CF@cnt@atomingroup\else1\fi
\else1%
@@ -1300,7 +1280,8 @@
\endgroup
}
-\CF@def\chembelow{\CF@save@catcode\CF@sanitize@catcode\@testopt\CF@chembelow{1.5pt}}
+\CF@def\chembelow{%
+ \@testopt\CF@chembelow{1.5pt}}
\CF@def\CF@chembelow[#1]#2#3{%
\setbox\CF@box@boxa\hbox{\printatom{#2}}\setbox\CF@box@boxb\hbox{\printatom{#3}}%
@@ -1314,10 +1295,10 @@
}%
\vskip-\dimexpr\ht\CF@box@boxb+\dp\CF@box@boxb+#1\relax
}%
- \CF@restore@catcode
}
-\CF@def\chemabove{\CF@save@catcode\CF@sanitize@catcode\@testopt\CF@chemabove{1.5pt}}
+\CF@def\chemabove{%
+ \@testopt\CF@chemabove{1.5pt}}
\CF@def\CF@chemabove[#1]#2#3{%
\setbox\CF@box@boxa\hbox{\printatom{#2}}\setbox\CF@box@boxb\hbox{\printatom{#3}}%
@@ -1330,7 +1311,6 @@
\hskip\dimexpr(\wd\CF@box@boxa-\wd\CF@box@boxb)/\tw@
}%
}%
- \CF@restore@catcode
}
%%%%%% les signes et les fl\`eches
@@ -1346,7 +1326,8 @@
\setchemrel{}{}{}
-\CF@def\chemrel{\CF@save@catcode\CF@sanitize@catcode\@testopt\CF@chemchemrel@i{}}
+\CF@def\chemrel{%
+ \@testopt\CF@chemchemrel@i{}}
\CF@def\CF@chemchemrel@i[#1]{\@testopt{\CF@chemchemrel@ii[#1]}{}}
@@ -1375,12 +1356,12 @@
\else\chemabove[\CF@chemrel@vsep]{\chembelow[\CF@chemrel@vsep]\CF@chemrel@stuff{\hbox{#2}}}{\hbox{#1}}%
\fi
\fi
- \CF@restore@catcode
}
\CF@def\CF@remove@equichars#1<>#2\@nil{#1#2}
-\CF@def\chemmove{\CF@save@catcode\CF@sanitize@catcode\@testopt\CF@chemmove{}}
+\CF@def\chemmove{%
+ \@testopt\CF@chemmove{}}
\CF@def\CF@chemmove[#1]#2{%
\ifx\@empty#2\@empty
@@ -1392,14 +1373,11 @@
{\z@[remember picture,overlay]}{\z@[remember picture,overlay,#1]}#2
\endtikzpicture
}%
- \CF@restore@catcode
}
\CF@def\chemnameinit#1{%
- \CF@save@catcode\CF@sanitize@catcode
\setbox\CF@stuff@box\hbox{#1}%
\edef\CF@dp@max{\the\dp\CF@stuff@box}%
- \CF@restore@catcode
}
\chemnameinit{}
@@ -1412,7 +1390,9 @@
\fi
}
-\CF@def\chemname{\CF@save@catcode\CF@sanitize@catcode\@testopt\CF@chemname{1.5ex}}
+\CF@def\chemname{%
+ \@testopt\CF@chemname{1.5ex}%
+}
\CF@def\CF@chemname[#1]#2#3{%
\setbox\CF@stuff@box\hbox{#2}%
@@ -1425,7 +1405,6 @@
\kern\dimexpr#1+\CF@dp@max-\CF@dp@stuffbox\relax
\CF@parse@molname#3\\\@nil
}%
- \CF@restore@catcode
}
\CF@savedcatcode
@@ -1446,7 +1425,7 @@ v0.2 2010/08/31
- Les espaces sont permis dans les mol\'ecules. Ils seront
ignor\'es par d\'efaut puisque les atomes sont compos\'es en
mode math par \printatom
- - Une paire de Lewis peut être repr\'esent\'ee ":".
+ - Une paire de Lewis peut \^etre repr\'esent\'ee ":".
- Dans les cycles, une correction de la longueur du trait
d\'eport\'e des liaisons doubles est fait de telle sorte que si
l'on \'ecrit \chemfig{*5(=====)}, on obtient deux polygones
@@ -1462,7 +1441,7 @@ v0.3 2010/11/21
- Le caract\`ere "|" force la fin d'un atome. Si on \'ecrit
"D|ef" alors, chemfig verra deux atomes "D" et "ef".
- Le caract\`ere "#" est reconnu lorsqu'il suit un caract\`ere de
- liaison. Il doit être suivi d'un argument entre parenth\`eses
+ liaison. Il doit \^etre suivi d'un argument entre parenth\`eses
qui contient l'offset de d\'ebut et de fin qui s'appliqueront
\`a cette liaison.
- La macro \chemfig admet un argument optionnel qui sera pass\'e
@@ -1504,4 +1483,13 @@ v0.4 2011/03/07
----------------------------------------------------------------------
v0.4a 2011/04/10
- Correction d'un bug concernant l'argument optionnel en d\'ebut
- de mol\'ecule. \ No newline at end of file
+ de mol\'ecule.
+----------------------------------------------------------------------
+v0.4b 2011/04/24
+ - l'argument de \chemfig est tok\'enis\'e avec \scantokens ce qui
+ rend caduc tout souci de code de cat\'egorie, \`a part #.
+ - la commande \setbondstyle permet de d\'efinir le style des
+ liaisons.
+ - correction de l'affichage incorrect des doubles liaisons dans
+ les cycles apr\`es les commandes \hflipnext et \vflipnext
+ - correction d'un bug lorsqu'un alias commence une mol\'ecule \ No newline at end of file
diff --git a/Master/texmf-dist/tex/generic/chemfig/t-chemfig.tex b/Master/texmf-dist/tex/generic/chemfig/t-chemfig.tex
index 13de61c03db..8f7d11e5ad7 100644
--- a/Master/texmf-dist/tex/generic/chemfig/t-chemfig.tex
+++ b/Master/texmf-dist/tex/generic/chemfig/t-chemfig.tex
@@ -1,9 +1,9 @@
% __________________________________________________________________
% | |
% | |
-% | chemfig v0.4a |
+% | chemfig v0.4b |
% | |
-% | April 10, 2011 |
+% | April 24, 2011 |
% | |
% |__________________________________________________________________|
%
@@ -39,6 +39,6 @@
%
% The Current Maintainer of this work is Christian Tellechea
% --------------------------------------------------------------------
-\usemodule[tikz]
+\usemodule[tikz]%
\input chemfig.tex
\endinput \ No newline at end of file