summaryrefslogtreecommitdiff
path: root/Master/texmf-dist
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2011-01-09 23:39:20 +0000
committerKarl Berry <karl@freefriends.org>2011-01-09 23:39:20 +0000
commit44fc5185821d64f484a051cbb7a3bc2de7b3c282 (patch)
treee75ad1e1ef937bfa973a63ccbee1662224b4b34b /Master/texmf-dist
parentabf529e246ee5dabd71cb45b0b38fdae95cdfef1 (diff)
chemfig 0.3a (9jan11)
git-svn-id: svn://tug.org/texlive/trunk@20994 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r--Master/texmf-dist/doc/latex/chemfig/README4
-rw-r--r--Master/texmf-dist/doc/latex/chemfig/chemfig_doc_en.pdfbin940038 -> 1169347 bytes
-rw-r--r--Master/texmf-dist/doc/latex/chemfig/chemfig_doc_en.tex691
-rw-r--r--Master/texmf-dist/doc/latex/chemfig/chemfig_doc_fr.pdfbin938923 -> 1186847 bytes
-rw-r--r--Master/texmf-dist/doc/latex/chemfig/chemfig_doc_fr.tex444
-rw-r--r--Master/texmf-dist/tex/latex/chemfig/chemfig.sty90
6 files changed, 744 insertions, 485 deletions
diff --git a/Master/texmf-dist/doc/latex/chemfig/README b/Master/texmf-dist/doc/latex/chemfig/README
index d8e340533a6..9ed2a189937 100644
--- a/Master/texmf-dist/doc/latex/chemfig/README
+++ b/Master/texmf-dist/doc/latex/chemfig/README
@@ -2,9 +2,9 @@ ___________________________________
The
ChemFig package
- v0.3
+ v0.3a
- 2010/11/21
+ 2011/01/08
___________________________________
Maintainer: Christian Tellechea
diff --git a/Master/texmf-dist/doc/latex/chemfig/chemfig_doc_en.pdf b/Master/texmf-dist/doc/latex/chemfig/chemfig_doc_en.pdf
index 9cb9bdd3963..1b61e25e272 100644
--- a/Master/texmf-dist/doc/latex/chemfig/chemfig_doc_en.pdf
+++ b/Master/texmf-dist/doc/latex/chemfig/chemfig_doc_en.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/chemfig/chemfig_doc_en.tex b/Master/texmf-dist/doc/latex/chemfig/chemfig_doc_en.tex
index 3b6b069ee05..e045695e65a 100644
--- a/Master/texmf-dist/doc/latex/chemfig/chemfig_doc_en.tex
+++ b/Master/texmf-dist/doc/latex/chemfig/chemfig_doc_en.tex
@@ -3,7 +3,7 @@
% | |
% | ChemFig Documentation |
% | |
-% | November 21, 2010 |
+% | January 08, 2011 |
% | |
% |_________________________________________________________________|
%
@@ -15,7 +15,7 @@
% Comments, bug reports and suggestions are welcome.
% Licence : Released under the LaTeX Project Public License v1.3c or
% later, see http://www.latex-project.org/lppl.txt
-% Copyright : Christian Tellechea 2010
+% Copyright : Christian Tellechea 2010-2011
%
% The "chemfig" package consists of the 6 following files:
% chemfig.sty
@@ -43,13 +43,16 @@
\usepackage[T1]{fontenc}
\usepackage[a4paper,margin=2.5cm,head=5mm,headsep=5mm,footskip=10mm]{geometry}
\usepackage[bottom]{footmisc}
-\usepackage{lmodern}
+\usepackage{libertine}
+\renewcommand*\oldstylenums[1]{{\fontfamily{fxlj}\selectfont #1}}
+\usepackage[scaled=0.8]{luximono}
\usepackage{amsmath}
\usepackage{array}
+\usepackage{longtable}
\usepackage{xspace}
\usepackage{fancybox}
+\usepackage{boites}
\usepackage{textcomp}
-\usepackage{xstring}
\usepackage{enumitem}
\usepackage{chemfig}
\usetikzlibrary{decorations.pathmorphing}
@@ -65,91 +68,90 @@
\makeatletter
-\newcommand\disable@lig[1]{%
+\long\def\grab@toks#1\relax{\endgroup\def\right@content{#1}}
+
+\newcommand\make@car@active[2]{%
\catcode`#1\active
\begingroup
\lccode`\~`#1\relax
- \lowercase{\endgroup\def~{\leavevmode\kern\z@\string#1}}%
+ \lowercase{\endgroup\def~{#2}}%
}
\newif\if@exstar
-\newcommand\exemple{\@ifstar{\@exstartrue\exemple@}{\@exstarfalse\exemple@}}
+\newcommand\exemple{%
+ \begingroup
+ \parskip\z@
+ \@makeother\;\@makeother\!\@makeother\?\@makeother\:% neutralise frenchb
+ \@ifstar{\@exstartrue\exemple@}{\@exstarfalse\exemple@}}
\newcommand\exemple@[2][65]{%
- \par\nobreak\vskip5pt
- \def\part@coeff{#1}%
- \def\code@name{#2}%
- \relax\leavevmode\null
- \bgroup
- \obeylines\frenchspacing
+ \medbreak\noindent
+ \begingroup
\let\do\@makeother\dospecials
- \@makeother:%
- \@vobeyspaces
- \disable@lig,\disable@lig-%
- \exemple@@
+ \make@car@active\ { {}}%
+ \make@car@active\^^M{\par\leavevmode}%
+ \make@car@active\,{\leavevmode\kern\z@\string,}%
+ \make@car@active\-{\leavevmode\kern\z@\string-}%
+ \exemple@@{#1}{#2}%
}
-\newcommand\exemple@@[1]{%
- \def\@tempa##1#1{%
- \xdef\left@content{##1}%
- \egroup
- \begingroup
- \endlinechar\m@ne\everyeof{\relax}\catcode`\^^M=10
- \@makeother:\@makeother~\@makeother!\@makeother?\@makeother;%
- \expandafter\grab@toks\scantokens{##1}%
- \endgroup
- \exemple@@@
- }%
+\newcommand\exemple@@[3]{%
+ \def\@tempa##1#3{\exemple@@@{#1}{#2}{##1}}%
\@tempa
}
-\begingroup
-\catcode`#=12
-\gdef\exemple@@@%
-{%
- \begingroup
- \StrSubstitute\left@content{##}#[\left@content]%
- \if@exstar
- \edef\part@left{\the\dimexpr\linewidth-2\fboxsep-2\fboxrule}%
- \let\part@right\part@left
- \else
- \edef\part@left{\the\dimexpr0.\part@coeff\linewidth-\fboxsep-\fboxrule}%
- \edef\part@right{\the\dimexpr\linewidth-0.\part@coeff\linewidth-\fboxsep-\fboxrule}%
- \fi
- \edef\saved@boxsep{\the\fboxsep}%
- \fboxsep1pt\relax
- \boxput*(0,1)%
- {\colorbox{black}{{%
- \leavevmode\kern1.5pt\relax
- \color{white}\ECFAugie\footnotesize
- \vphantom{Cp}\code@name
- }\kern1.5pt\relax}}%
- {\fboxsep\saved@boxsep
+\newcommand\exemple@@@[3]{%
+ \xdef\the@code{#3}%
+ \endgroup
+ \if@exstar
+ \begingroup
+ \fboxrule0.4pt
+ \let\breakboxparindent\z@
+ \def\bkvz@bottom{\hrule\@height\fboxrule}%
+ \let\bkvz@before@breakbox\relax
+ \def\bkvz@set@linewidth{\advance\linewidth\dimexpr-2\fboxrule-2\fboxsep}%
+ \def\bkvz@left{\vrule\@width\fboxrule\hskip\fboxsep}%
+ \def\bkvz@right{\hskip\fboxsep\vrule\@width\fboxrule}%
+ \def\bkvz@top{\hbox to \hsize{%
+ \vrule\@width\fboxrule\@height\fboxrule
+ \leaders\bkvz@bottom\hfill
+ \ECFAugie
+ \fboxsep\z@
+ \colorbox{black}{\kern0.25em\color{white}\footnotesize\lower0.5ex\hbox{\strut#2}\kern0.25em}%
+ \leaders\bkvz@bottom\hfill
+ \vrule\@width\fboxrule\@height\fboxrule}}%
+ \breakbox
+ \kern.5ex\relax
+ \ttfamily\footnotesize\the@code\par
+ \normalfont
+ \kern3pt
+ \hrule height0.1pt width\linewidth depth0.1pt
+ \vskip5pt
+ \rightskip0pt plus 1fill
+ \everypar{{\color{lightgray}\rlap{\vrule height0.1pt width\linewidth depth0.1pt}}\hskip0pt plus 1fill}%
+ \newlinechar`\^^M\everyeof{\noexpand}\scantokens{#3}\par
+ \endbreakbox
+ \endgroup
+ \else
+ \vskip0.5ex
+ \boxput*(0,1)
+ {\fboxsep\z@
+ \hbox{\ECFAugie\colorbox{black}{\leavevmode\kern0.25em{\color{white}\footnotesize\strut#2}\kern0.25em}}%
+ }%
+ {\fboxsep5pt
\fbox{%
- \if@exstar
- \parbox[c]\part@left{%
- \vskip5pt\relax\ttfamily\footnotesize\left@content
- \vskip3pt\hrule\vskip3pt
- \everypar{{\color{lightgray}\rlap{\vrule height0.1pt width\part@right depth0.1pt}}}%
- \par\normalfont
- \subst@in\right@content\par\def
- \subst@in\right@content\def{\hfill\null\par\hfill}%
- \hfill\right@content\hfill\null}%
- \else
- \parbox[c]\part@left{\vskip5pt\relax\ttfamily\footnotesize\left@content}%
- \parbox[c]\part@right{%
- \vskip5pt\relax
- \everypar{{\color{lightgray}\rlap{\vrule height0.1pt width\part@right depth0.1pt}}}%
- \normalfont\footnotesize
- \right@content}%
- \fi
+ $\vcenter{\hsize\dimexpr0.#1\linewidth-\fboxsep-\fboxrule\relax
+ \kern5pt\parskip0pt \ttfamily\footnotesize\the@code}%
+ \vcenter{\kern5pt\hsize\dimexpr\linewidth-0.#1\linewidth-\fboxsep-\fboxrule\relax
+ \everypar{{\color{lightgray}\rlap{\vrule height0.1pt width\dimexpr\linewidth-0.#1\linewidth-\fboxsep-\fboxrule depth0.1pt}}}%
+ \footnotesize\newlinechar`\^^M\everyeof{\noexpand}\scantokens{#3}}$%
}%
}%
- \vskip7.5pt\relax
+ \fi
+ \medbreak
\endgroup
}
-\endgroup
\long\def\if@instr#1#2{%
\long\def\if@instr@i##1#2##2\@nil{\ifx\@empty##2\@empty\expandafter\@secondoftwo\else\expandafter\@firstoftwo\fi}%
@@ -164,8 +166,6 @@
}\relax
}
-\long\def\grab@toks#1\relax{\gdef\right@content{#1}}
-
\newcommand\falseverb[1]{{\ttfamily\detokenize{#1}}}
\long\def\centerverb#1{%
@@ -176,6 +176,7 @@
\let\do\@makeother\dospecials
\@vobeyspaces
\centerverb@i}
+
\makeatother
\usepackage[english]{babel}
@@ -187,7 +188,7 @@
\newcommand\boxednode[2]{\fbox{$\mathrm{#1}\vphantom{M_1}$}_{#2}}
\newcommand\boxedfalseverb[1]{{\fboxsep0pt\fbox{\vphantom|\falseverb{#1}}}}
-\usepackage[plainpages=false,pdfpagelabels,bookmarks=true,bookmarksopen=true,colorlinks=true,hyperfootnotes=false,filecolor=black,linkcolor=blue,urlcolor=magenta,pdfauthor={Christian TELLECHEA},pdftitle={ChemFig},pdfsubject={Dessiner des molécules 2D avec LaTeX},pdfkeywords={ChemFig},pdfcreator={LaTeX}]{hyperref}
+\usepackage[plainpages=false,pdfpagelabels,bookmarks=true,bookmarksopen=true,colorlinks=true,hyperfootnotes=false,filecolor=black,linkcolor=blue,urlcolor=magenta,pdfauthor={Christian TELLECHEA},pdftitle={ChemFig},pdfsubject={Draw 2D molecule with LaTeX},pdfkeywords={ChemFig},pdfcreator={LaTeX}]{hyperref}
\csname @addtoreset\endcsname{section}{part}
\usepackage{titlesec}
@@ -265,28 +266,24 @@
\parskip\medskipamount
\vspace{2cm}
-\fbox{\vbox{\hsize\dimexpr\linewidth-2\fboxrule-2\fboxsep\relax\noindent\color{red}\bfseries The translation of the new features is not done yet, but should be available within a few weeks. The corresponding text, still in french, is gray in this manual. I apologize for the inconvenience.}}
-\vspace{2cm}
-
\setitemize{leftmargin=3em,topsep=0pt,parsep=0pt,itemsep=0pt}
\part{Introduction}
-\begingroup\color{gray}% !!! Nouveau
-\section{Nouveautés de la version 0.3}
-\nouveau Suite à des demandes d'utilisateurs et des lacunes qui devaient de toutes façons être comblées, voici les nouveautés de la version 0.3 :
+\section{New in version 0.3}
+\nouveau Here's what's new in version 0.3, in response to requests from users and to gaps that needed filling anyway:
\begin{enumerate}
- \item Amélioration de la commande \verb-\definesubmol- qui accepte les séquences de contrôle comme alias. On peut aussi choisir un alias dont la substitution est différente selon l'orientation de la liaison qui lui arrive dessus. Voir page~\pageref{definesubmol};
- \item Le caractère ``\verb-|-'' force la fin d'un atome. Si on écrit ``D|ef'' alors, \CF verra deux atomes ``D'' et ``ef''. Lire page~\pageref{decoupage.atomes};
- \item Le caractère ``\verb-#-'' est reconnu lorsqu'il suit un caractère de liaison. Il doit être suivi d'un argument entre parenthèses qui contient le retrait de début et de fin qui s'appliqueront à cette liaison. Voir page~\pageref{modif.retrait}.
- \item La macro \verb-\chemfig- admet des arguments optionnels qui seront passés à l'environnement ``tikzpicture'' dans lequel elle est dessinée. Lire page~\pageref{arguments.optionnels};
- \item Mise en place de la représentation des mouvement d'électrons et des mécanismes réactionnels avec la syntaxe ``\verb-@{<nom>}-'' devant un atome ou
- ``\verb-@{<nom>,<coeff>}-'' au tout début de l'argument d'une liaison.\par
- Cette syntaxe permet de placer un nœud (au sens de \TIKZ) qui deviendra l'extrémité des flèches dessinées. Le tracé des flèches est fait par la macro \verb-\chemmove- dont l'argument optionnel devient celui de l'environnement ``tikzpicture'' dans lequel sont faites les flèches. Lire page~\pageref{mecanismes-reactionnels};
- \item Pour le mécanisme d'alignement vertical des atomes sur une même horizontale, la commande \verb-\chemskipalign- permet d'ignorer ce mécanisme pour le groupe d'atomes dans lequel elle est écrite. Voir page~\pageref{chemskipalign};
- \item La commande \verb-\chemname- permet d'afficher un nom sous une molécule. La commande \verb-\chemnameinit- initialise l'alignement des noms. Lire page~\pageref{chemname};
- \item les dessins des décorations qu'effectue la commande \verb-\lewis- ont été améliorés;
- \item Corrections de bugs et optimisation du code.
+ \item Improvements to the command \verb-\definesubmol- which now accepts control sequences as aliases. An alias can also be set up so that the substitution is different depending on the orientation of the bond which arrives at it. See page~\pageref{definesubmol};
+ \item The character ``\verb-|-'' forces the end of an atom. Thus if one writes ``D|ef'', \CF will see two atoms ``D'' and ``ef''. Read page~\pageref{decoupage.atomes};
+ \item The character ``\verb-#-'' is recognized when it follows a bond character. It must be followed by an argument between parentheses which contains the shortening of the start and end which will be applied to this bond. See page~\pageref{modif.retrait};
+ \item The macro \verb-\chemfig- accepts optional arguments which are passed to the ``tikzpicture'' environment in which it is drawn. Read page ~\pageref{arguments.optionnels};
+ \item Addition of representation of electron movement and reaction mechanisms with the syntax ``\verb-@{<name>}-'' before an atom or
+ ``\verb-@{<name>,<coeff>}-'' at the beginning of the argument of a bond.\par
+ This syntax allows placement of a node (in the \TIKZ sense) which will become the tip of any arrows draw. The layout of the arrows is done by the macro \verb-\chemmove- whose optional argument becomes that of the ``tikzpicture'' environment in which the arrows are drawn. Read page~\pageref{mecanismes-reactionnels};
+ \item For the vertical alignment mechanism to get atoms on the same horizontal line, the macro \verb-\chemskipalign- allows this mechanism to be ignored for the group of atoms in which it is written. See page~\pageref{chemskipalign};
+ \item The commands \verb-\chemname- allows a name to be displayed underneath a molecule and \verb-\chemnameinit- sets the alignment of the names. See page~\pageref{chemname};
+ \item The commands \verb-\hflipnext- and \verb-\vflipnext- horizontaly or verticaly flip the next molecule drawn. See page~\pageref{retournement};
+ \item Drawing of the decorations which carry our the command \verb-\lewis- have been improved;
+ \item Bug fixes and code optimization.
\end{enumerate}
-\endgroup% !!! fin
\section{Foreword}
This package has seen the light of day thanks to the assistance of Christophe \textsc{Casseau}, who had the idea after being confronted with the complexity of the syntax of the \href{http://www.ctan.org/tex-archive/help/Catalogue/entries/ppchtex.html}{\texttt{\textbf{ppchtex}}} package.
@@ -373,7 +370,7 @@ There are many ways of specifying the angle of a bond.
\exemple{Predefined angles}|\chemfig{(-[1]1)(-[2]2)(-[3]3)(-[4]4)(-[5]5)(-[6]6)(-[7]7)-0}|
\item[Absolute angle] To give an angle in degrees relative to the horizontal, the optional argument must take this form: \verb-[:<absolute angle>]-. The \verb-<absolute angle>- may be positive or negative, and may have decimal places. It is reduced to the interval $[0,360)$.
-\item[Relative angle] It is often useful to give the bond angle relative to the preceding bond. This syntax is used:\verb-[::<relative angle>]-. The \verb-<relative angle>- may be positive or negative, and may have decimal places.
+\item[Relative angle] It is often useful to give the bond angle relative to the preceding bond. In this case, the following syntax must be used:\verb-[::<relative angle>]-. The \verb-<relative angle>- may be positive or negative, and may have decimal places.
\end{description}
\subsection{Condensed structural diagram}
@@ -536,20 +533,17 @@ As we have already seen (see page~\pageref{types.liaisons}), bonds can be one of
\setbondoffset{5pt}\chemfig{A-B}|
If one bond is followed immediately by another, then \CF inserts an empty group \verb-{}-. Around this empty group the separation $\delta$ is zero:
-\exemple{Empty groups}/\chemfig{A-B=-=C}\par
-\chemfig{A>B><>|<C}/
+\exemple{Empty groups}/\chemfig{A-B=-=C}/
-\begingroup\color{gray}% !!! Nouveau
-\nouveau\label{modif.retrait}On peut spécifier l'espacement $\delta$ pour une seule liaison avec le caractère \verb-#-. Ce caractère doit se situer \emph{immédiatement} après le signe de liaison et dispose d'un argument obligatoire entre parenthèses de la forme ``\verb-#(<dim1>,<dim2>)-'', où \verb-<dim1>- représente l'espacement $\delta$ au début de la liaison et \verb-<dim2>- celui de la fin. Si \verb-<dim2>- est omis, l'espacement en fin de liaison prend la valeur de $\delta$ en vigueur à ce moment. On peut observer sur cet exemple comment le retrait, réglé à 4pt pour être plus visible, est rendu nul pour la liaison arrivant sur ``B'', puis partant de ``B'' et enfin pour les deux à la fois :
+\nouveau\label{modif.retrait} The spacing $\delta$ for just one bond can be specified with the character \verb-#-. This character must be placed \emph{immediately} after the bond symbol and has one required argument between parentheses of the form ``\verb-#(<dim1>,<dim2>)-'', where \verb-<dim1>- is the spacing $\delta$ at the beginning of the bond and \verb-<dim2>- is the that at the end. If \verb-<dim2>- is omitted, the spacing at the end of the bond takes the value of $\delta$ in effect at that time. One can see in the example how the shortening, set to 4pt to be more visible, is nullified for the bond arriving at ``B'', then for the one leaving ``B'', and finally for both:
\begingroup
\catcode`\#12
-\exemple{Réglage fin du retrait des liaisons}/\setbondoffset{4pt}
+\exemple{Fine adjustment of bond shortening}/\setbondoffset{4pt}
\chemfig{A-B-C}\par
\chemfig{A-#(,0pt)B-C}\par
\chemfig{A-B-#(0pt)C}\par
\chemfig{A-#(,0pt)B-#(0pt)C}/
\endgroup
-\endgroup% !!! fin
By default, all atoms within groups of atoms are typeset in math mode (spaces are ignored). They may therefore contain math mode specific commands such as subscripts or superscripts\footnote{There is a problem with the placement of groups of atoms containing exponents or subscripts. See page~\pageref{alignement.vertical}.}:
\exemple{Math mode}|\chemfig{A_1B^2-C _ 3 ^ 4}|
@@ -611,6 +605,14 @@ The second field, if it is not empty, is a coefficient which multiplies the defa
\chemfig{A-B-[,2]C=[,0.5]D}\par
\chemfig{-=[,1.5]-[,0.75]=[:-20,2]}/
+We can change the size of molecules by altering the font size or the argument of \verb-\setatomsep-, possibly on both \footnote{You can also use the second optional argument of \texttt{\string\chemfig}, see page~\pageref{arguments.optionnels}.}, being careful to confine these changes within a group if we want to limit the scope:
+\exemple{How to modify the size of molecule}/\normalsize \chemfig{H-[:30]O-[:-30]H}\par
+\setatomsep{2.5em}\chemfig{H-[:30]O-[:-30]H}\par
+\small \chemfig{H-[:30]O-[:-30]H}\par
+\footnotesize \chemfig{H-[:30]O-[:-30]H}\par
+\scriptsize \chemfig{H-[:30]O-[:-30]H}\par
+\tiny \chemfig{H-[:30]O-[:-30]H}/
+
\section{Departure and arrival atoms}
A group of atoms can contain several atoms. Suppose we want to connect the group ``ABCD'' to the group ``EFG'' with a bond. \CF calculates which atom of the first group and which of the second group are to be connected by looking at the angle of bond relative to the horizontal. If the angle is between (but not including) $-90\degres$ and 90\degres{} (modulo 360\degres) then the bond is made between the last atom of the first group and the first atom of the second group. In all other cases, the bond is made between the first atom of the first group and the last atom of the second group.
@@ -840,91 +842,94 @@ Some care must be taken with rings when one or more vertices are made up of grou
In order for the ring to have a regular shape, it is necessary to override the \CF mechanism which automatically calculates the departure and arrival atoms of bonds. Here, \verb/C-F/ and \verb/F-G/ must be connected by using the optional argument of these bonds:
\exemple{Forced departure and arrival atoms}|\chemfig{AB*5(-CDE-[,,1]F-[,,,1]GH-I-)}|
-\begingroup\color{gray}% !!! Nouveau
-\section{Représentation des déplacements d'électrons}\label{mecanismes-reactionnels}
-\nouveau Depuis la version 0.3 de \CF, on peut représenter les déplacements d'électrons des effets mésomères ou des mécanismes réactionnels. Cela est rendu possible en marquant le point de départ et le point d'arrivée de la flèche que l'on utilise pour indiquer la migration des électrons à l'aide de la syntaxe ``\verb-@{<argument>}-''. Cette syntaxe permet de poser un nœud (au sens de \TIKZ) en rendant ce nœud accessible en dehors de l'argument de la commande \verb-\chemfig- grâce à l'option ``\texttt{remember picture}'' qui est passée à tous les environnements ``tikzpicture''. Cela suppose que le visualiseur prenne en charge le ``picture remembering'' et que la compilation soit lancée deux fois.
+\section{Representing electron movements}\label{mecanismes-reactionnels}
+\nouveau Starting with \CF version 0.3, we can represent the movement of electrons in mesomeric effects or reaction mechanisms. This is done by marking the departure and arrival points of the electron movement arrow using the syntax ``\verb-@{<argument>}-''. This syntax allows a \TIKZ node to be placed and makes this node accessible outside the argument of the \verb-\chemfig- command thanks to the ``\texttt{remember picture}'' option which is passed to all the ``tikzpicture'' environments. It is assumed that the viewer supports ``picture remembering'' and that the compilation is done twice.
-Deux cas de figure peuvent se présenter, on peut poser :
+Two types of diagrams can arise, so we can ask for:
\begin{itemize}
- \item un nœud de dimension nulle sur une liaison en utilisant la syntaxe ``\verb-@{<nom>,<coeff>}-'' placée immédiatement au début de l'argument optionnel de la liaison concernée sans être suivi d'une virgule s'il y a un premier argument optionnel. Dans ce cas, le nœud portera le nom ``\verb-<nom>-'' et le \verb-<coeff>-, compris entre 0 et 1, déterminera où le nœud se situera sur la liaison. Si on utilise ``\verb-@{<nom>}-'', le \verb-<coeff>- prend la valeur de 0.5 par défaut ce qui signifie que le nœud est posé au milieu de la liaison;
- \item un nœud sur un atome en utilisant la syntaxe ``\verb-@{<nom>}-'' immédiatement avant l'atome concerné. Dans ce cas, le nœud a exactement le même encombrement que l'atome, il peut notamment être vide et donc avoir des dimensions nulles.
+ \item a zero size node on a bond using the syntax ``\verb-@{<name>,<coeff>}-'' placed at the beginning of the optional argument of the relevant bond, without being followed by a comma if there is a first optional argument. In this case, the node takes the name ``\verb-<name>-'' and the \verb-<coeff>-, which must be between 0 and 1, determines where the node is located on the bond. If ``\verb-@{<name>}-'' is used, the \verb-<coeff>- is set to 0.5 by default, which means that the node is placed halfway along the bond;
+ \item a node on an atom using the syntax ``\verb-@{<name>}-'' immediately before the relevant atom. In this case, the node has exactly the same footprint as the atom, but may be empty and therefore have zero dimensions.
\end{itemize}
-Une fois que la commande \verb-\chemfig- a dessiné la (ou les) molécule(s) et a posé les nœuds avec la syntaxe décrite ci dessus, on peut relier ces nœuds entre eux avec les instructions de \TIKZ. Ces instructions seront placées dans l'argument de la commande \verb-\chemmove-\footnote{En réalité, la commande \texttt{\string\chemmove} met son argument dans un environnement ``tikzpicture'' avec les options ``\texttt{remember picture,overlay}''.} et auront la syntaxe suivante si par exemple, on doit relier un nœud portant le nom ``\verb-<nom1>-'' au nœud portant le nom ``\verb-<nom2>-'' :
-\centerverb|\chemmove[<opt>]{\draw[<opt tikz>](<nom1>)<link tikz>(<nom2>);}|
+Once the \verb-\chemfig- command has drawn the molecule(s) and has placed the nodes with the syntax described above, we can connect these nodes to each other with \TIKZ instructions. These instructions are placed in the argument of the command \verb-\chemmove-\footnote{Actually, the \texttt{\string\chemmove} command puts its argument in a ``tikzpicture'' environment with the options ``\texttt{remember picture, overlay}''.} and has the following syntax if (for example) we need to connect a node named ``\verb-<name1>-'' to the node named ``\verb-<name2>-'':
+\centerverb|\chemmove[<opt>]{\draw[<tikz opt>](<name1>)<tikz link>(<name2>);}|
\smallskip
-L'argument optionnel \verb-<opt>- de la commande \verb-\chemmove- sera ajouté à l'argument de l'environnement tikzpicture dans lequel seront tracées les liaisons entre les nœuds. Les instructions \verb-<opt tikz>- et \verb-<link tikz>- sont exhaustivement décrites dans la documentation de l'extension \TIKZ.
+The optional argument \verb-<opt>- of the \verb-\chemmove- command will be added to the argument of the tikzpicture environment in which the links between the nodes will be drawn. The \verb-<tikz opt>- and \verb-<tikz link>- instructions are describe in detail in the documentation of the \TIKZ package.
-\subsection{Effets mésomères}
-Pour fixer les idées prenons l'exemple d'un effet mésomère impliquant une double liaison et un doublet non liant conjugués. Commençons par la possible délocalisation des électrons de la double liaison. On va poser un nœud nommé ``db'' (double bond) au milieu de la double liaison et un nœud nommé ``a1'' sur l'extrémité de la double liaison.
+\subsection{Mesomeric effects}
+To make these concepts concrete, let's take the example of a mesomeric effect involving a double bond and non-bonding lone pair conjugate. Let's begin with the possible delocalization of electrons from the double bond. We will place a node named ``db'' (double bond) in the middle of the double bond and a node named ``a1'' on the end of the double bond.
-\exemple{Effet mésomère 1}/\chemfig{@{a1}=_[@{db}::30]-[::-60]\lewis{2,X}}
+\exemple{Mesomeric effect 1}/\chemfig{@{a1}=_[@{db}::30]-[::-60]\lewis{2,X}}
\chemrel{<->}
\chemfig{\chemabove{\vphantom{X}}{\ominus}-[::30]=_[::-60]
\chemabove{X}{\scriptstyle\oplus}}
\chemmove{\draw[->](db).. controls +(80:8mm) and +(145:8mm).. (a1);}/
-Comme on l'a dit, on remarque qu'il n'y pas de virgule derrière le nœud posé dans les arguments optionnels d'une liaison; On écrit ``\verb|=_[@{db}::30]|'' et non pas ``\verb|=_[@{db},::30]|'' comme on serait tenté de le faire.\\
-Pour relier les nœuds ``db'' et ``a1'', nous avons utilisé la syntaxe suivante :
+As noted above, there is no comma after the node placed in the optional arguments of a bond; we write ``\verb|=_[@{db}::30]|'' and not ``\verb|=_[@{db},::30]|'' as one might be tempted to do.
+
+To link the nodes ``db'' and ``a1'' we have used the following syntax:
\centerverb|\chemmove{\draw[->](db)..controls +(80:8mm) and +(145:8mm)..(a1);}|
\medskip
-Dans cet exemple nous demandons une flèche (\verb/[->]/) et nous utilisons 2 points de contrôle\footnote{Pour connaître toutes les façons de relier deux nœuds avec \TIKZ, lire la documentation de ce package.}. Ceux-ci seront situés en coordonnées polaires à 80\degres{} et 8~mm de ``db'' pour le premier et à 145\degres{} et 8~mm de ``a1'' pour le second. Il ne faut pas être effrayé par cette syntaxe qui peut paraître compliquée en première lecture car son utilisation se réduit dans la plupart des cas à un simple copier-coller dans lequel on modifie juste le nom des nœuds et les coordonnées polaires des points de contrôle. Ce que nous allons vérifier tout de suite avec l'ajout d'une flèche partant du doublet non liant (nœud ``dnl'') vers la liaison simple (nœud ``sb'').
-\exemple{Effet mésomère 2}/\chemfig{@{a1}=_[@{db}::30]-[@{sb}::-60]@{dnl}\lewis{2,X}}
+In this example we ask for an arrow (\verb/[->]/) and we use two control points\footnote{To find all the ways of connecting two nodes with \TIKZ, read the documentation for that package.}. These will be located using polar coordinates at 80\degres{} and 8~mm from ``db'' for the first and at 145\degres{} and 8~mm from ``a1'' for the second. Though this syntax may seem complicated at first reading, one need not be alarmed because its use will usually be a matter of copying and pasting. Only the names and coordinates of the control points need be changed, as can be verified from the example below, where an arrow has been added from the lone pair (node ``dnl'' to the single bond (node ``sb'').
+\exemple{Mesomeric effect 2}/\chemfig{@{a1}=_[@{db}::30]-[@{sb}::-60]@{dnl}\lewis{2,X}}
\chemrel{<->}
\chemfig{\chemabove{\vphantom{X}}{\ominus}-[::30]=_[::-60]
\chemabove{X}{\scriptstyle\oplus}}
-\chemmove{\draw[->](db)..controls +(80:8mm) and +(145:8mm)..(a1);}
-\chemmove{\draw[->](dnl)..controls +(90:4mm) and +(45:4mm)..(sb);}/
+\chemmove{
+ \draw[->](db)..controls +(100:5mm) and +(145:5mm)..(a1);
+ \draw[->](dnl)..controls +(90:4mm) and +(45:4mm)..(sb);}/
-Pour notre nouvelle flèche nous avons fixé les points de contrôle comme suit : un angle de 90\degres{} à 4~mm de ``dnl'' et un angle de 45\degres{} à 4~mm de ``sb''. Mais nous ne sommes pas entièrement satisfaits car nous aimerions que la flèche ne touche pas le trait représentant le doublet non liant. Pour cela nous allons ajouter quelques options à notre flèche.
-\exemple{Effet mésomère 3}/\chemfig{@{a1}=_[@{db}::30]-[@{sb}::-60]@{dnl}\lewis{2,X}}
+For our new arrow we have set the control points as follows: 4~mm at an angle of 90\degres{} from ``dnl'' and 4~mm at an angle of 45\degres{} from ``sb''. But we are not completely satisfied, since we would like the arrow not to touch the line segment representing the lone pair. To do this we will add some options to our arrow.
+\exemple{Mesomeric effect 3}/\chemfig{@{a1}=_[@{db}::30]-[@{sb}::-60]@{dnl}\lewis{2,X}}
\chemrel{<->}
\chemfig{\chemabove{\vphantom{X}}{\ominus}-[::30]=_[::-60]
\chemabove{X}{\scriptstyle\oplus}}
-\chemmove{\draw[->](db).. controls +(80:8mm) and +(145:8mm).. (a1);}
-\chemmove{\draw[->, shorten <=3pt, shorten >= 1pt]
- (dnl).. controls +(90:4mm) and +(70:6mm).. (sb);}/
+\chemmove[->]{
+ \draw(db).. controls +(100:5mm) and +(145:5mm).. (a1);
+ \draw[shorten <=3pt,shorten >=1pt](dnl) .. controls +(90:4mm)
+ and +(45:4mm) .. (sb);}/
-L'option ``\verb|shorten <=3pt|'' indique que le point de départ de la flèche doit être raccourci de 3~pt de même ``\verb|shorten >=2pt|'' indique que le point d'arrivé doit être raccourci de 2~pt.
+The option ``\verb|shorten <=3pt|'' indicates that the tail of the arrow is to be shortened by 3~pt just as ``\verb|shorten >=2pt|'' means that the head of the arrow is shortened by 2~pt.
-On peut utiliser toute la puissance des instructions de \TIKZ pour modifier le dessin de la flèche. Ici, nous changeons l'extrémité de la flèche partant de la double liaison, non plus écrite ``\verb|->|'' mais ``\verb|-stealth|'', nous la dessinons en pointillés d'épaisseur fine et rouge. Nous rajoutons également la lettre $\pi$ au dessus de la flèche en son milieu :
-\exemple{Effet mésomère 4}/\chemfig{@{a1}=_[@{db}::30]-[@{sb}::-60]@{dnl}\lewis{2,X}}
+We can use all the power of \TIKZ instructions to modify the style of the arrow. Here we change the head of the arrow leaving the double bound, writing ``\verb|-stealth|'' instead of ``\verb|->|'', and we draw the arrow with a fine dashed red line. We also add the letter $\pi$ above the middle of the arrow:
+\exemple{Mesomeric effect 4}/\chemfig{@{a1}=_[@{db}::30]-[@{sb}::-60]@{dnl}\lewis{2,X}}
\chemrel{<->}
\chemfig{\chemabove{\vphantom{X}}{\ominus}-[::30]=_[::-60]
\chemabove{X}{\scriptstyle\oplus}}
-\chemmove{\draw[-stealth,thin,dash pattern= on 2pt off 2pt,red]
- (db).. controls +(80:8mm) and +(145:8mm)..
- node[sloped,above] {$\pi$} (a1);}
-\chemmove{\draw[->, shorten <=3pt, shorten >= 1pt]
- (dnl).. controls +(90:4mm) and +(70:6mm).. (sb);}/
-
-Dans l'exemple suivant nous allons voir comment indiquer la position de l'ancre de départ ou d'arrivée. Si nous écrivons
-\exemple{Ancre de départ et d'arrivée 1}/\chemfig{@{x1}\lewis{1:,X}}
+\chemmove{
+ \draw[-stealth,thin,dash pattern= on 2pt off 2pt,red]
+ (db).. controls +(100:5mm) and +(145:5mm)..
+ node[sloped,above] {$\pi$} (a1);
+ \draw[->, shorten <=3pt, shorten >= 1pt]
+ (dnl).. controls +(90:4mm) and +(45:4mm).. (sb);}/
+
+In the following example, we'll see how to indicate the position of the departure or arrival anchor points of the arrow. If we write
+\exemple{Departure or arrival anchor point 1}/\chemfig{@{x1}\lewis{1:,X}}
\hspace{2cm}
\chemfig{@{x2}\lewis{2|,X}}
\chemmove{\draw[->,shorten >=4pt]
(x1).. controls +(90:1cm) and +(90:1cm).. (x2);}/
-Nous constatons que l'ancre de départ de notre flèche ne pointe pas correctement sur nos électrons. La flèche part du milieu du bord supérieur du nœud. En effet, nous avons choisi un angle de départ de 90\degres{} et tikz fait donc partir la flèche de l’ancre ``x1.90'' qui correspond à l’intersection de la demi droite partant du centre du nœud ``x1'' et faisant un angle avec l’horizontale de 90\degres{} avec le bord du nœud qui est un rectangle. Pour obtenir le départ de la flèche d’où nous voulons, nous devons spécifier sa position. Après quelques tâtonnements, c’est ``x1.57'' :
-\exemple{Ancres de départ et d'arrivée 2}/\chemfig{@{x1}\lewis{1:,X}}
+Note that the tail of the arrow does not leave correctly from our electrons; it leaves from the middle of the upper edge of the node. Indeed, we chose a departure angle of 90~\degres{} and so \TIKZ makes the arrow leave from the anchor ``x1.90'' which corresponds to the intersection of the ray leaving from the centre of node ``x1'' at a 90\degres{} angle relative to the horizontal and of the edge of the rectangular node. To get the arrow departure angle that we want, we must specify its position. After some trial and error, it is ``x1.57'':
+\exemple{Departure or arrival anchor point 2}/\chemfig{@{x1}\lewis{1:,X}}
\hspace{2cm}
\chemfig{@{x2}\lewis{2|,X}}
\chemmove{\draw[->,shorten <=4pt,shorten >=4pt]
(x1.57).. controls +(60:1cm) and +(120:1cm).. (x2);}/
-Dans certains cas il sera plus facile d'utiliser les coordonnées cartésiennes pour les points de contrôle. Ici, nous n'utilisons qu'un seul point de contrôle situé à 1~cm horizontalement de ``x1'' et 1,5~cm verticalement :
-\exemple{Un seul point de contrôle}/\chemfig{@{x1}\lewis{1:,X}}
+In some cases it will be easier to use Cartesian coordinated for the control points. Here we use just one control point placed 1~cm to the right of and 1.5~cm above ``x1'':
+\exemple{A single control point}/\chemfig{@{x1}\lewis{1:,X}}
\hspace{2cm}
\chemfig{@{x2}\lewis{2|,X}}
\chemmove{\draw[->,shorten <=4pt,shorten >=4pt]
(x1.57).. controls +(1cm,1.5cm).. (x2);}/
-Dans ce cas nous plaçons un point de contrôle à 1~cm horizontalement et 2~cm verticalement de ``x1''. Tous les objets graphiques dessinées par l’intermédiaire de la commande \verb|\chemmove| sont faits en surimpression et ne seront pas comptés dans les boîtes englobantes. On peut le constater sur l’exemple précédent.
+All the graphics drawn by means of the command \verb|\chemmove| are superimposed and will not be included in the bounding boxes. We can see this in the preceding example.
-\subsection{Mécanismes réactionnels}
-Grâce à l'option \verb|remenber picture| qui est passée à tous les environnements ``tikzpicture'' nous pouvons facilement dessiner les flèches indiquant les mécanismes réactionnels. Prenons comme exemple la première étape de la réaction d'estérification.
-\exemple{Estérification: étape 1}/\setatomsep{7mm}
+\subsection{Reaction mechanisms}
+Thanks to the option \verb|remenber picture| which is passed to all the ``tikzpicture'' environments we can easily draw arrows indicating reaction mechanisms. Let's take for example the first step of the esterification reaction.
+\exemple{Esterification: step 1}/\setatomsep{7mm}
\setchemrel{}{}{5mm}
\chemfig{R-@{dnl}\lewis{26,O}-H}
\chemsign{+}
@@ -934,97 +939,91 @@ Grâce à l'option \verb|remenber picture| qui est passée à tous les environne
\draw[shorten >=2pt](dnl).. controls +(90:1cm) and +(north:1cm).. (atoc);
\draw[shorten >=6pt](db).. controls +(north:5mm) and +(100:1cm).. (atoh);}/
-L'utilisation de la commande \verb|\chemabove{<code>}{<materiel>}| ne change pas les dimensions de la boite englobante du \verb|<code>|. Pour cette raison on peut rencontrer certaines difficultés pour pointer sur le matériel indiquant la charge portée ($\oplus$ ou $\ominus$). Dans l'exemple ci-dessus la solution est de créer un point de contrôle avec un angle de 110\degres{} à 1~cm de ``atoh'' et de raccourcir la flèche de 6pt. Dans l'exemple suivant, seconde étape de la réaction d'estérification, on peut voir que la flèche peut prendre des formes plus compliquées sans forcément surcharger le code.
-\exemple{Estérification: étape 2}/\setatomsep{7mm}
+The use of the \verb|\chemabove{<code>}{<materiel>}| command does not change the dimensions of the bounding box of \verb|<code>|. For this reason we can run into some difficulty in pointing to the symbol representing the charge carried ($\oplus$ or $\ominus$). In the example above the solution is to create a control point with an angle of 110\degres{} at 1~cm from ``atoh'' and to shorten the arrow by 6pt. In the following example, the second step of the esterification reaction, we can see that the arrow can take more complicated forms without complicating the code.
+\exemple{Esterification: step 2}/\setatomsep{7mm}
\setchemrel{}{}{5mm}
\chemfig{R-O-C(-[2]R)(-[6]OH)-@{dnl}\lewis{26,O}H}\hspace{1cm}
\chemfig{@{atoh}\chemabove{H}{\scriptstyle\oplus}}
-\chemmove{\draw[->,shorten <=2pt, shorten >=7pt]
- (dnl).. controls +(south:1cm) and +(north:1.5cm).. (atoh);}/
+\chemmove{
+ \draw[->,shorten <=2pt, shorten >=7pt]
+ (dnl).. controls +(south:1cm) and +(north:1.5cm).. (atoh);}/
-Nous laissons le soin au lecteur d'écrire la suite\ldots
+The rest is left as an exercise to the reader\dots.
-\section{Écrire un nom sous une molécule}\label{chemname}
-\nouveau Pour plus de commodité, \CF permet d'écrire le nom d'une molécule sous celle-ci avec la commande
-\centerverb/\chemname[<dim>]{\chemfig{<code de la molécule>}}{<nom>}/
+\section{Writing a name under a molecule}\label{chemname}
+For convenience, \CF can write the name of a molecule underneath it with the command
+\centerverb/\chemname[<dim>]{\chemfig{<code of the molecule>}}{<name>}/
\smallskip
-La \verb-<dimension>-, qui vaut 1.5ex par défaut, sera insérée verticalement entre la ligne de base de la molécule et le haut des lettres du \verb-<nom>-. Le \verb-<nom>- sera centré par rapport à la molécule mais ce \verb-<nom>- ne peut pas contenir plusieurs paragraphes. Comme on le voit sur cet exemple : \chemname{\chemfig{H-O-H}}{\scriptsize\bfseries La molécule d'eau : $\mathrm{\mathbf{H_2O}}$}, le \verb-<nom>- qui est affiché sous la molécule est pris en compte dans la boîte englobante mais uniquement en ce qui concerne sa dimension \emph{verticale}. L'encombrement horizontal du \verb-<nom>- est toujours nul.
+The \verb-<dim>-, which is 1.5ex by default, will be inserted between the baseline of the molecule and the top of the letters of the \verb-<name>-. The \verb-<name>- will be centred relative to the molecule, but the \verb-<name>- may not contain multiple paragraphs. As we see in this example: \chemname{\chemfig{H-O-H}}{\scriptsize\bfseries The water molecule: $\mathrm{\mathbf{H_2O}}$}, the \verb-<name>- which is displayed under the molecule is taken into account only for the vertical size of the bounding box. The horizontal size of \verb-<name>- is always zero.
-Voici une réaction avec les noms sous les molécules :
-\exemple*{Affichage du nom des molécules}/
-\chemname{\chemfig{R-C(-[:-30]OH)=[:30]O}}{Acide carboxylique}
+Here is a reaction with the names under the molecules:
+\exemple*{Displaying names of molecules}/
+\chemname{\chemfig{R-C(-[:-30]OH)=[:30]O}}{Carboxylic acid}
\chemsign{+}
-\chemname{\chemfig{R'OH}}{Alcool}
+\chemname{\chemfig{R'OH}}{Alcohol}
\chemrel{->}
\chemname{\chemfig{R-C(-[:-30]OR')=[:30]O}}{Ester}
\chemsign{+}
-\chemname{\chemfig{H_2O}}{Eau}
-/
+\chemname{\chemfig{H_2O}}{Water}/
-Il y a quelques contraintes avec cette commande. Pour en pendre conscience, mettons que l'on ait inversé l'acide et l'alcool dans le membre de gauche :
-\exemple*{Alignement des noms 1}/
-\chemname{\chemfig{R'OH}}{Alcool}
+There are some limitations to this command. Suppose we switch the acid and the alcohol on the left side:
+\exemple*{Name alignment 1}/
+\chemname{\chemfig{R'OH}}{Alcohol}
\chemsign{+}
-\chemname{\chemfig{R-C(-[:-30]OH)=[:30]O}}{Acide carboxylique}
+\chemname{\chemfig{R-C(-[:-30]OH)=[:30]O}}{Carboxylic acid}
\chemrel{->}
\chemname{\chemfig{R-C(-[:-30]OR')=[:30]O}}{Ester}
\chemsign{+}
-\chemname{\chemfig{H_2O}}{Eau}
-/
+\chemname{\chemfig{H_2O}}{Water}/
-En fait, au dessous de la ligne de base de chaque molécule (en gris clair sur les exemples de ce manuel), pour écrire le \verb-<nom>-, la commande \verb-\chemname- insère 1.5ex${}+{}$\emph{la plus grande des profondeurs\footnote{En langage \TeX{}, la profondeur est la dimension qui s'étend verticalement sous la ligne de base.} des molécules rencontrées}. La macro \verb-\chemnameinit{<argument>}- initialise cette plus grande profondeur avec le contenu de l'\verb-<argument>-. Il convient donc :
+In fact, to draw the \verb-<name>- the command \verb-\chemname- inserts 1.5ex${}+{}$\emph{the largest of the depths\footnote{In \TeX{} terms, the depth is the dimension which extends vertically below the baseline.} of the molecules thus far} below the baseline of each molecule (light grey for the examples in this manual). The macro \verb-\chemnameinit{<stuff>}- initializes this largest depth with the \verb-<stuff>-. Therefore one should:
\begin{itemize}
- \item d'écrire \verb-\chemnameinit{<plus profonde molécule>}- avant d'impliquer cette commande dans une réaction, sauf si cette réaction commence par la plus profonde molécule;
- \item d'écrire \verb-\chemnameinit{}- après avoir écrit tous les noms d'une réaction chimique afin d'éviter que la plus grande profondeur trouvée dans cette réaction n'interfère dans une réaction future.
+ \item write \verb-\chemnameinit{<deepest molecule>}- before using the \verb-\chemname- command in a reaction, unless the reaction begins with the deepest molecule;
+ \item write \verb-\chemnameinit{}- after having written all the names in a chemical reaction lest the greatest depth in this reaction interfere with a future reaction.
\end{itemize}
-Le code correct est donc d'utiliser \verb-\chemnameinit- avant et après la réaction :
-\exemple*{Alignement des noms 2}/
+Thus the correct code uses \verb-\chemnameinit- before and after the reaction:
+\exemple*{Name alignment 2}/
\chemnameinit{\chemfig{R-C(-[:-30]OH)=[:30]O}}
-\chemname{\chemfig{R'OH}}{Alcool}
+\chemname{\chemfig{R'OH}}{Alcohol}
\chemsign{+}
-\chemname{\chemfig{R-C(-[:-30]OH)=[:30]O}}{Acide carboxylique}
+\chemname{\chemfig{R-C(-[:-30]OH)=[:30]O}}{Carboxylic acid}
\chemrel{->}
\chemname{\chemfig{R-C(-[:-30]OR')=[:30]O}}{Ester}
\chemsign{+}
-\chemname{\chemfig{H_2O}}{Eau}
-\chemnameinit{}
-/
+\chemname{\chemfig{H_2O}}{Water}
+\chemnameinit{}/
-Enfin, pour écrire un nom sur plusieurs lignes, la commande \verb-\\- rencontrée dans un \verb-<nom>- effectue un retour à la ligne\footnote{Par contre, la commande \texttt{\textbackslash par} est interdite et provoquera une erreur à la compilation.} :
-\exemple*{Nom sur 2 lignes}/
-\chemname{\chemfig{R-C(-[:-30]OH)=[:30]O}}{Acide\\carboxylique}
+Finally, to write a name on multiple lines, the command \verb-\\- encountered in a \verb-<name>- causes a line break\footnote{Conversely, the command \texttt{\textbackslash par} is forbidden and causes a compilation error.}:
+\exemple*{Name on 2 lines}/
+\chemname{\chemfig{R-C(-[:-30]OH)=[:30]O}}{Carboxylic\\acid}
\chemsign{+}
-\chemname{\chemfig{R'OH}}{Alcool}
+\chemname{\chemfig{R'OH}}{Alcohol}
\chemrel{->}
\chemname{\chemfig{R-C(-[:-30]OR')=[:30]O}}{Ester}
\chemsign{+}
-\chemname{\chemfig{H_2O}}{Eau}
-\chemnameinit{}
-/
-\endgroup% !!!fin
+\chemname{\chemfig{H_2O}}{Water}
+\chemnameinit{}/
\newpage
\part{Advanced usage}\label{utilisation.avancee}
-\begingroup\color{gray}% !!! Nouveau
-\section{Découpage des atomes}\label{decoupage.atomes}
-\nouveau Le mécanisme de découpage des atomes, déjà décrit auparavant, fait s'étendre chaque atome jusqu'à la prochaine lettre majuscule ou l'un des caractères {\ttfamily \boxedfalseverb{-} \boxedfalseverb{=} \boxedfalseverb{~} \boxedfalseverb{(} \boxedfalseverb{!} \boxedfalseverb{*} \boxedfalseverb{<} \boxedfalseverb{>} \boxedfalseverb{@}}
+\section{Separating atoms}\label{decoupage.atomes}
+\nouveau The atom separating mechanism described previously extends each atom until the next capital letter or one of the characters {\ttfamily \boxedfalseverb{-} \boxedfalseverb{=} \boxedfalseverb{~} \boxedfalseverb{(} \boxedfalseverb{!} \boxedfalseverb{*} \boxedfalseverb{<} \boxedfalseverb{>} \boxedfalseverb{@}}
-Dans certains cas, ce découpage automatique produit des atomes incorrects ce qui peut se traduire par un affichage imparfait. Prenons cette molécule par exemple où l'on remarquera que le caractère ``\texttt('' est mis entre accolade de façon à éviter que \CF ne comprenne à tort qu'une ramification est créée :
+In certain cases this automatic separation produces incorrect atoms which can translate into an imperfect diagram. Consider this example molecule, noting that the ``\texttt('' character is placed between braces so that \CF doesn't incorrectly create a branch:
-\exemple*{Alcène}/\chemfig{CH_3CH_2-[:-60,,3]C(-[:-120]H_3C)=C(-[:-60]H)-[:60]C{(}CH_3{)}_3}/
+\exemple*{Alkene}/\chemfig{CH_3CH_2-[:-60,,3]C(-[:-120]H_3C)=C(-[:-60]H)-[:60]C{(}CH_3{)}_3}/
-On constate que la liaison qui arrive sur l'atome de carbone en haut à droite est trop courte. Cela se produit car, si l'on applique les règles de découpage de \CF dans le groupe d'atomes en haut à droite, les atomes sont découpés de cette façon : ``\texttt{\detokenize{C{(}}}'', ``\texttt{\detokenize{C}}'', ``\texttt{\detokenize{H_3{)}_3}}''. On comprend alors qu'en mode math, le premier atome qui contient une parenthèse ait une profondeur trop importante comme on le voit en rendant visibles les boites contenant les atomes :
+We find that the bond which arrives at the carbon atom in the upper right is too short. This happens because, if we apply the \CF rules for separating atoms to the upper right group, the atoms are split in this way: ``\texttt{\detokenize{C{(}}}'', ``\texttt{\detokenize{C}}'', ``\texttt{\detokenize{H_3{)}_3}}''. We now realize that the first atom contains a parenthesis and thus has too great a depth in math mode; we can see this by making the bounding boxes visible:
\begin{center}
\fboxsep=0pt
\renewcommand*\printatom[1]{\fbox{\ensuremath{\mathrm{#1}}}}%
\chemfig{CH_3CH_2-[:-60,,3]C(-[:-120]H_3C)=C(-[:-60]H)-[:60]C{(}CH_3{)}_3}%
\end{center}
-Le caractère ``|'' force la coupure de l'atome en cours lorsqu'il est rencontré. Ainsi, on peut écrire \texttt{C\textcolor{red}{|}\detokenize{{(CH_3)_3}}} pour faire en sorte que \CF ne découpe que 2 atomes ici : ``\texttt{\detokenize{C}}'' et ``\texttt{\detokenize{{(CH_3)_3}}}. Le problème de la liaison trop courte est ainsi résolu :
+The character ``|'' forces splitting of the atom when it is encountered. Thus we can write \texttt{C\textcolor{red}{|}\detokenize{{(CH_3)_3}}} to ensure that \CF separates just two atoms here: ``\texttt{\detokenize{C}}'' and ``\texttt{\detokenize{{(CH_3)_3}}}''. The problem of the too-short bond is thus solved:
-\exemple*{Alcène}/\chemfig{CH_3CH_2-[:-60,,3]C(-[:-120]H_3C)=C(-[:-60]H)-[:60]C|{(CH_3)_3}}/
-\endgroup% !!! fin
+\exemple*{Alkene}/\chemfig{CH_3CH_2-[:-60,,3]C(-[:-120]H_3C)=C(-[:-60]H)-[:60]C|{(CH_3)_3}}/
\section{Displaying atoms}\label{perso.affichage}
Once a molecule has been split into atoms, the macro \verb-\printatom- is called internally by \CF in order to display each atom. Its sole argument is the code of the atom to be displayed (e.g. ``\verb-H_3-''). By default, this macro enters math mode and displays its argument with the math font family ``rm''. It is defined by the following code:
@@ -1033,32 +1032,31 @@ Once a molecule has been split into atoms, the macro \verb-\printatom- is called
One can modify the code of this macro to customize how atoms are displayed. In the following example, we redefine \verb-\printatom- so that each atom will be enclosed in a rectangular box:
\exemple{Redefinition of \string\printatom}/\fboxsep=1pt
-\renewcommand*\printatom[1]{\fbox{\ensuremath{\mathrm{##1}}}}
+\renewcommand*\printatom[1]{\fbox{\ensuremath{\mathrm{#1}}}}
\chemfig{H_3C-C(=[:30]O)(-[:-30]OH)}/
Here is how to redefine it to use the ``sf'' font family of math mode:
-\exemple{Atoms displayed with ``sf'' font family}/\renewcommand*\printatom[1]{\ensuremath{\mathsf{##1}}}
+\exemple{Atoms displayed with ``sf'' font family}/\renewcommand*\printatom[1]{\ensuremath{\mathsf{#1}}}
\chemfig{H_3C-C(=[:30]O)(-[:-30]OH)}/
-\begingroup\color{gray}% !!! Nouveau
-\section{Arguments optionnels}\label{arguments.optionnels}
-\nouveau La commande \verb-\chemfig- admet deux arguments optionnels et sa syntaxe complète est la suivante :
-\centerverb|\chemfig[<opt1>][<opt2>]{<code molécule>}|
+\section{Optional arguments}\label{arguments.optionnels}
+\nouveau The \verb-\chemfig- command takes two optional arguments; their syntax is as follows:
+\centerverb|\chemfig[<opt1>][<opt2>]{<molecule code>}|
\smallskip
-Le premier argument optionnel \verb-<opt1>- contient des instructions \TIKZ qui seront passées à l'environnement tikzpicture dans lequel est dessinée la molécule. Le deuxième argument optionnel \verb-<opt2>- contient des instructions \TIKZ qui seront exécutées lors du dessin de chaque nœud\footnote{Ces instructions sont ajoutées à la fin de l'argument de \texttt{every node/.style\{<argument>\}}. Cet argument contient par défaut les instructions suivantes : ``{\ttfamily anchor=base,inner sep=0pt,outer sep=0pt,minimum size=0pt}''.}.
+The first optional argument \verb-<opt1>- contains \TIKZ instructions which will be passed to the tikzpicture environment in which the molecule is drawn. The second optional argument \verb-<opt2>- contains \TIKZ instructions which will be executed when each node\footnote{These instructions are added to the end of the argument of \texttt{every node/.style\{<argument>\}}. This argument contains by default the following instructions: ``{\ttfamily anchor=base,inner sep=0pt,outer sep=0pt,minimum size=0pt}''.} is drawn.
-Par l'intermédiaire du premier argument optionnel, on peut choisir par exemple la couleur générale ou l'épaisseur des lignes :
-\exemple{Choix du style}/\chemfig{A-B-[2]C}\par\medskip
+With the use of the first optional argument one can, for example, choose the global colour or thickness of lines:
+\exemple{Style choice}/\chemfig{A-B-[2]C}\par\medskip
\chemfig[line width=1.5pt]{A-B-[2]C}\par\medskip
\chemfig[red]{A-B-[2]C}/
-Avec le second argument optionnel, on peut choisir la couleur des nœud dessinés par \TIKZ, et même modifier l'inclinaison du dessin :
-\exemple{Choix des styles}/\chemfig{A-B-[2]C}\par\medskip
+With the second optional argument, one can choose the colour of nodes drawn by \TIKZ, change the angle of the drawing or its scale:
+\exemple{Style choices}/\chemfig{A-B-[2]C}\par\medskip
\chemfig[][red]{A-B-[2]C}\par\medskip
\chemfig[dash pattern=on 1pt off 2pt][red]{A-B-[2]C}\par\medskip
-\chemfig[][rotate=20]{A-B-[2]C}/
-\endgroup% !!! fin
+\chemfig[][rotate=20]{A-B-[2]C}\par\medskip
+\chemfig[][scale=0.5]{A-B-[2]C}/
\section{Vertical alignment}\label{alignement.vertical}
In some cases with condensed structural diagram of molecules having horizontal bonds, the placement of groups of atoms is incorrect.
@@ -1070,17 +1068,14 @@ Careful study of the following example shows that the groups of atoms are not co
Surprisingly, the second atom is correctly aligned while the last two undergo a vertical shift which seems to be the results of the different height of the bounding box of the atoms ``\verb-A^1-'' and ``\verb-E_1''-.
-In order to understand this phenomenon, we need to consider how \CF places groups of atoms relative to each other. Let us limit ourselves to the case of horizontal bonds in order to simplify terminology, although the algorithm is the same for other bonds. A horizontal bond leaves from the middle of the right side of the bounding box of the departure atom of this bond. The arrival atom is positioned in such a way that the middle of the left side of its bounding box is at the end of the bond. It follows that the vertical placement of the arrival atom depends on the height of the departure atom. To limit this phenomenon, \CF adds to each arrival atom the \verb-\vphantom- of the departure atom, but does not include it in the contents of the arrival atom; this \verb-\vphantom- is not intended to affect the following atoms.
-\begingroup\color{gray}% !!! nouveau
-Les atomes qui restent dans chaque groupe sont alignés de telle sorte que leur ligne de base coïncide avec la ligne de base de l'atome précédent.
-\endgroup%!!! fin
+In order to understand this phenomenon, we need to consider how \CF places groups of atoms relative to each other. Let us limit ourselves to the case of horizontal bonds in order to simplify terminology, although the algorithm is the same for other bonds. A horizontal bond leaves from the middle of the right side of the bounding box of the departure atom of this bond. The arrival atom is positioned in such a way that the middle of the left side of its bounding box is at the end of the bond. It follows that the vertical placement of the arrival atom depends on the height of the departure atom. To limit this phenomenon, \CF adds to each arrival atom the \verb-\vphantom- of the departure atom, but does not include it in the contents of the arrival atom; this \verb-\vphantom- is not intended to affect the following atoms. The atoms remaining in each group are aligned so that their baseline coincides with the baseline of the preceding atom.
The defective alignment can thus be explained. The atoms ``\verb-B-'' and ``\verb-F-'' are aligned correctly as they reflect the height of the atoms before them because of their \verb-\vphantom-. For the atoms ``\verb-C-'' and ``\verb-F-'', the heights of the immediately preceding atoms are taken into account, but those of the atoms ``\verb-A^1-'' and ``\verb-E_1-'' are ignored! It follows that these atoms are a little too high or too low, depending on the height of these bonds.
We can show this by making visible the bounding boxes of the atoms; one sees clearly that the atoms ``\verb-B-'' and ``\verb-F-'' have bounding boxes that reflect the heights of the immediately preceding atoms:
\exemple*{Vertical placement and bounding boxes}/\Huge\setatomsep{2em}
\fboxsep=0pt
-\renewcommand\printatom[1]{\fbox{\ensuremath{\mathrm##1}}}
+\renewcommand\printatom[1]{\fbox{\ensuremath{\mathrm#1}}}
\chemfig{A^1-B-C-D}\qquad
\chemfig{E_1-F-G-H}/
@@ -1089,40 +1084,38 @@ Since there is no satisfactory manual solution, this problem can be worked aroun
\chemfig{A^1-B-{\vphantom{A^1}C}-D}\qquad
\chemfig{E_1-F-{\vphantom{E_1}G}-H}/
-\begingroup\color{gray}% !!! Nouveau
-\nouveau \label{chemskipalign}Il est possible pour n'importe quel groupe d'atomes de désactiver momentanément le mécanisme d'ajustement d'alignement et neutraliser le \verb-\vphantom-. Il suffit pour cela de placer dans le groupe d'atomes la commande \verb-\chemskipalign- : l'alignement reprendra au groupe d'atomes suivant comme si le groupe d'atome contenant \verb-\chemskipalign- n'avait pas existé. On peut se rendre compte sur l'exemple suivant de l'effet de cette instruction qui a pour effet de placer le point de référence de la boîte contenant le premier atome au niveau de la liaison qui arrive de gauche. Les boîtes englobant les atomes ont été dessinées à la seconde ligne :
+\nouveau \label{chemskipalign}For any group of atoms it is possible to temporarily deactivate the alignment adjustment mechanism and thus neutralize the \verb-\vphantom-. Simply place the \verb-\chemskipalign- command in the group of atoms; the alignment will resume in the following group of atoms as if the group of atoms containing \verb-\chemskipalign- had never existed. The following example shows the effects of this instruction: the reference point of the box containing the first atom is placed at the level of the bond which arrives from the left. The bounding boxes of the atoms are drawn in the second line.
-\exemple[60]{Désactivation du mécanisme d'alignement}/\large
+\exemple[60]{Deactivation of the alignment mechanism}/\large
\chemfig{A-.-B}\quad
\chemfig{A-\chemskipalign.-B}\par\bigskip
\fboxsep=0pt
-\renewcommand\printatom[1]{\fbox{\ensuremath{\mathrm{##1}}}}
+\renewcommand\printatom[1]{\fbox{\ensuremath{\mathrm{#1}}}}
\chemfig{A-.-B}\quad
\chemfig{A-\chemskipalign.-B}/
-Cette commande est à utiliser avec précaution car l'alignement des atomes dans le groupe d'atomes à venir peut être perturbé. En règle générale, tout se passera bien si le groupe d'atomes dans lequel figure \verb-\chemskipalign- contient \emph{un seul atome} dont la hauteur et la profondeur sont \emph{inférieures} à celles de l'atome qui précède et qui suit, et si les atomes qui précèdent et suivent ont leur profondeur et hauteur égales. Voici par exemple la mésaventure qui arrive lorsque le groupe d'atomes contient 2 atomes, ici ``\verb-\chemskipalign.-'' et ``\verb-B-'' :
-\exemple{Conséquence de la commande \string\chemskipalign}/\large
+This command is to be used with caution lest the alignment of atoms in the next group be disrupted. In general, all will be well if the group of atoms featuring \verb-\chemskipalign- contains \emph{a single atom} whose height and depth are \emph{less} than those of the preceding and following atoms, and if the preceding and following atoms have identical heights and depths. Here is an example of the mess that results when the group of atoms contains two atoms, here ``\verb-\chemskipalign.-'' and ``\verb-B-'':
+\exemple{Consequence of the \string\chemskipalign command}/\large
\fboxsep=0pt
-\renewcommand\printatom[1]{\fbox{\ensuremath{\mathrm{##1}}}}
+\renewcommand\printatom[1]{\fbox{\ensuremath{\mathrm{#1}}}}
\chemfig{A-\chemskipalign.B-C}/
-Cette fonctionnalité peut parfois s'avérer utile. Mettons que l'on veuille dessiner la molécule
+This feature can sometimes be useful. Suppose we want to draw the following molecule
\begin{center}
\catcode`;12
\def\emptydisk{\chemskipalign\tikz\draw(0,0)circle(2pt);}%
\def\fulldisk{\chemskipalign\tikz\fill(0,0)circle(2pt);}%
\chemfig{A-#(,0pt)\emptydisk-#(0pt,0pt)\fulldisk-#(0pt)B}%
\end{center}
-On peut définir les commandes qui vont dessiner les disques vides et pleins avec \TIKZ. Afin que ces disques soit à la bonne hauteur, c'est-à-dire à la hauteur de la liaison qui leur arrive dessus, on se servira de la commande \verb-\chemskipalign-. Pour que, à la deuxième ligne de l'exemple ci dessous, les liaisons ``collent'' aux disques, nous utiliserons la possibilité de modifier le retrait d'une liaison avec le caractère ``\verb-#-'', fonctionnalité qui a été vue à la page~\pageref{modif.retrait}.% ########## Ne pas traduire ce passage, merci ########## Pour les utilisateurs ayant chargé le package babel avec l'option ``frenchb'', il est nécessaire de désactiver le caractère actif ``\verb-;-'' qui marque la fin d'une instruction \TIKZ et qui sinon ne serait pas reconnu en tant que tel. C'est pourquoi on se place dans un groupe où l'on écrit l'instruction \verb-\shorthandoff{;}- :
+We can define commands which will draw the empty and full disks with \TIKZ. To ensure that these disks are at the right height, namely the height of the bond arriving at them, we will use the command \verb-\chemskipalign-. In the second line below the bonds are ``stuck'' to the disks by using the ability to change the bond shortening with the ``\verb-#-'' character, a feature seen on page~\pageref{modif.retrait}.
\begingroup\catcode`;12 \catcode`#12
-\exemple{Utilisation de \string\chemskipalign\ et #}/
+\exemple{Use of \string\chemskipalign\ and #}/
\begingroup
\def\emptydisk{\chemskipalign\tikz\draw(0,0)circle(2pt);}
\def\fulldisk{\chemskipalign\tikz\fill(0,0)circle(2pt);}
\chemfig{A-\emptydisk-\fulldisk-B}\par
\chemfig{A-#(,0pt)\emptydisk-#(0pt,0pt)\fulldisk-#(0pt)B}
\endgroup/\endgroup
-\endgroup% !!! fin
\section{Shifted double bonds}
All double bonds are made up of two line segments, and these segments are drawn on either side of the imaginary line along which a single bond would be drawn. It is possible to shift a double bond so that one of the line segments lies on the imaginary line. The other segment is then shifted above or below the bond. Actually, it is more correct to say ``left'' or ``right'' of the imaginary line, as the bond is traversed in the direction of drawing.
@@ -1142,7 +1135,7 @@ Shifted bonds are particularly useful in drawing skeleton diagrams of molecules
\chemfig{-[:30]=_[:-30]-[:30]=_[:-30]-[:30]}/
\section{Delocalized double bonds}
-It is sometimes necessary to draw a double bond so that one line segment is dashed while the other is solid\footnote{Thanks to Andreas \textsc{Bröermann} who suggested this feature and who gave me the solution to this problem.}. This feature is not hardcoded into \CF; instead \TIKZ, its ``decorations'' library and its programmable styles make it possible.
+It is sometimes necessary to draw a double bond so that one line segment is dashed while the other is solid\footnote{Thanks to Andreas \textsc{Bröermann} who suggested this feature and who gave me the solution to this problem.}. This feature is not hard-coded into \CF; instead \TIKZ, its ``decorations'' library and its programmable styles make it possible.
First of all, after having loaded the ``decorations'' library by putting \verb-\usetikzlibrary{decorations}- in the preamble, a decoration named ``ddbond'' (for Dashed Double Bond) is defined (lines 1 to 14) and then two \TIKZ styles called ``lddbond'' and ``rddbond'' (lines 15 and 16). For the former, the dashed line segment is on the left of the solid middle segment; for the latter it is on the right. These styles can be called with the fifth optional argument of bonds:
\exemple*{Custom decorations}|\pgfdeclaredecoration{ddbond}{initial}
@@ -1171,16 +1164,13 @@ To do this, one gives the command
\centerverb|\definesubmol{<name>}{<code>}|
\smallskip
-which saves the \verb/<code>/ for recall in the code of the molecule via the shortcut ``\verb/!{name}/''.
-\begingroup\color{gray}% !!! Nouveau
-Ce \verb-<nom>- peut être :
+which saves the \verb/<code>/ for recall in the code of the molecule via the shortcut ``\verb/!{name}/''. This \verb-<name>- can be:
\begin{itemize}
- \item une suite de caractères : tous les caractères alphanumériques pouvant se trouver entre \texttt{\string\csname} et \texttt{\string\endcsname} sont acceptés;
- \item \nouveau[30pt] une séquence de contrôle.
+ \item a sequence of characters: all the alphanumeric characters able to be between \texttt{\string\csname} and \texttt{\string\endcsname} are accepted;
+ \item \nouveau[30pt] a control sequence.
\end{itemize}
-Dans tous les cas, si l'alias est déjà défini il est déconseillé de l'écraser avec une nouvelle définition faite avec \verb-\definesubmol-, d'ailleurs, un ``warning'' sera émis avertissant l'utilisateur que cet alias sera écrasé par le nouveau. Pour écraser la définition d'un alias faite au préalable, il faut utiliser :\label{redefinesubmol}
-\endgroup% !!! fin
+In all cases, if the alias is already defined you should not overwrite it with a new definition using \verb-\definesubmol-. A warning will be issued to the user that the old alias will be overwritten by the new one. To override the definition of an alias made previously, use:\label{redefinesubmol}
\centerverb|\redefinesubmol{<name>}{<code>}|
\smallskip
@@ -1194,17 +1184,15 @@ But in certain cases, this feature saves a lot of space in the code of the molec
\exemple{Butane}|\definesubmol\xx{C(-[::+90]H)(-[::-90]H)}
\chemfig{[:15]H-!\xx-!\xx-!\xx-!\xx-H}|
-\begingroup\color{gray}% !!! Nouveau
-\nouveau La commande \verb-\definesubmol- admet un argument optionnel et sa syntaxe complète est la suivante :
-\centerverb/\definesubmol{<nom>}[<code1>]{code2}/
+\nouveau The \verb-\definesubmol- command takes an optional argument; its syntax is as follows:
+\centerverb/\definesubmol{<name>}[<code1>]{code2}/
\medskip
-Dans la cas où l'argument optionnel est présent, l'alias ``\verb-!<nom>-'' sera remplacé par \verb'<code1>' si la liaison qui arrive sur l'alias vient de droite, c'est à dire si l'angle que fait la liaison arrivant est compris entre 90\degres{} et 270\degres{}, ces valeurs étant non comprises. Pour tous les autres cas où la liaison arrive de gauche ou verticalement, l'alias sera remplacé par \verb-<code2>-.
+When the optional argument is present, the alias ``\verb-!<name>-'' will be replaced by \verb'<code1>' if the bond which arrives at the alias comes from the right, i.e., if the angle which the arriving bond makes is between but is not equal to 90\degres{} and 270\degres{}. For all the other cases where the bond arrives from the left of vertically, the alias will be replaced by \verb-<code2>-.
-On va définir une séquence de contrôle \verb-\Me- pour ``méthyl'' de telle sorte que l'alias ``\verb-!\Me-'' soit remplacé par ``\verb-H_3C-'' lorsque la liaison arrive de droite et par ``\verb-CH_3-'' lorsqu'elle arrive de droite. Avec cet alias, on peut observer sur l'exemple que l'on n'a plus à s'occuper de l'angle (que dans certaines molécules complexes on ne connait même pas) :
-\exemple{Alias dual}/\definesubmol\Me[H_3C]{CH_3}
+We will define a control sequence \verb-\Me- pour ``methyl'' so that the alias ``\verb-!\Me-'' will be replaced by ``\verb-H_3C-'' when the bond arrives from the right and by ``\verb-CH_3-'' when it arrives from the left. We can observe in the example that with this alias we need no longer worry about the angle:
+\exemple{Dual alias}/\definesubmol\Me[H_3C]{CH_3}
\chemfig{*6((-!\Me)=(-!\Me)-(-!\Me)=(-!\Me)-(-!\Me)=(-!\Me)-)}/
-\endgroup% !!! fin
\section{Decorations}
\subsection{Lewis diagrams}\label{lewis}
@@ -1234,13 +1222,14 @@ This can be seen more clearly by drawing an \verb-\fbox- around decorated atoms:
\fbox{\lewis{13,B}}*
\label{setlewis}Several parameters can be set with the help of the macro
-\centerverb|\setlewis{<dim1>}{<dim2>}{<tikz code>}|
+\centerverb|\setlewis[dim1]{<dim2>}{<dim3>}{<tikz code>}|
\smallskip
If an argument is empty, it takes its default value.
\begin{itemize}
- \item \verb-<dim1>- is the distance between the bounding box and the decoration. It is 0.2ex by default;
- \item \verb-<dim2>- is the length of the line segment representing a pair of electrons. It is 1.5ex by default;
+ \item \verb-<dim1>- is the width of the rectangle which represents the empty slot obtained whith the character ``|'';
+ \item \verb-<dim2>- is the distance between the bounding box and the decoration. It is 0.2ex by default;
+ \item \verb-<dim3>- is the length of the line segment representing a pair of electrons. It is 1.5ex by default;
\item \verb-<code tikz>- is code which is passed directly to \TIKZ. This code is empty by default.
\end{itemize}
@@ -1318,14 +1307,14 @@ In this example we specify only ``draw,inner sep=2pt'', which has the effect of
\exemple*{An organization chart}/\setnodestyle{draw,inner sep=2pt}
\setbondoffset{0pt}
\setatomsep{75pt}
-\renewcommand\printatom[1]{##1}
+\renewcommand\printatom[1]{#1}
\chemfig{The boss-[6]Me(-[4]Them(-[6]The others)(-[7,2]Group 1))-You(-[:-120,0.5]Him)(-[:-60,0.5]Her)}/
Here is another organization chart where the nodes are circular and coloured cyan:
\exemple*{Family diagram}/\setnodestyle{draw,circle,fill=cyan,minimum size=30pt}
\setbondoffset{0pt}
\setatomsep{80pt}
-\renewcommand\printatom[1]{\textsf{##1}}
+\renewcommand\printatom[1]{\textsf{#1}}
\chemfig{Me(-[:-50,1.2]Brother)(-[:-10]Brother(-[:15]Niece)(-[:-35]Niece))
(-[:-155,0.8]Sister-[:-80]Nephew)(-[:95,1.25]Father(-[:-25,0.8]Uncle)(-[:-65,0.8]Aunt))
(-[:135]Mother-[:-95,0.5]Uncle)}/
@@ -1415,7 +1404,7 @@ To do this, we will first of all draw five sides of the chair and link the first
\exemple{Structure}|
\chemfig{?-[:-50]-[:10]-[:-10]-[:130]O-[:190]?}|
-Now we simply add the branches inside parentheses. The angles are chosen to give the best impression of presentive, and some bonds are shortened by a factor of 0.7:
+Now we simply add the branches inside parentheses. The angles are chosen to give the best impression of perspective, and some bonds are shortened by a factor of 0.7:
\exemple{Chair representation}|\chemfig{?(-[:190]OH)-[:-50](-[:170]OH)-[:10](-[:-55,0.7]OH)
-[:-10](-[6,0.7]OH)-[:130]O-[:190]?(-[:150,0.7]-[2,0.7]OH)}|
@@ -1431,8 +1420,8 @@ Next, to give the impression of perspective to the ring, the diagonal bonds will
\chemfig{HO-[2,0.5,2]?<[7,0.7]-[,,,,
line width=2pt]>[1,0.7]-[3,0.7]O-[4]?}|
-All that needs to be done now is to add the branches at the correct places, giving the right absolute angles and sometimes reducing the length to better give the illusion of prespective:
-\exemple{Projection de Haworth}|\setcrambond{2pt}{}{}
+All that needs to be done now is to add the branches at the correct places, giving the right absolute angles and sometimes reducing the length to better give the illusion of perspective:
+\exemple{Haworth projection}|\setcrambond{2pt}{}{}
\chemfig{HO-[2,0.5,2]?<[7,0.7](-[2,0.5]OH)-[,,,,
line width=2pt](-[6,0.5]OH)>[1,0.7](-[6,0.5]OH)-[3,0.7]
O-[4]?(-[2,0.3]-[3,0.5]OH)}|
@@ -1484,7 +1473,7 @@ First of all, let's begin by drawing the nested rings, putting just the nitrogen
Then we can draw the horizontal bond in the right ring with a hook. We will also place a hydrogen atom under the nitrogen atom of the 5-ring with the command \verb-\chembelow{N}{H}-. We also need to write ``\verb-HN-'' instead of ``\verb-N-'' at the vertex at the upper left of the molecule:
\exemple{Guanine, step two}|\chemfig{*6(=N-*6(-\chembelow{N}{H}-=N?)=?--HN-)}|
-We note that one bond leaves from the wrong atom\footnote{This seems illogical because the angle of the bond from the \texttt{HN} group toward the first vertes lies between $-90\degres$ and $90\degres$; \CF should therefore leave from the second atom. To explain this contradiction, one must know that in rings, the last bond always links the last vertex to the first, ignoring the \emph{calculated theoretical} angle of this bond (which here is $-90\degres$). \CF uses this theoretical angle to determine the departure and arrival atoms, but does not use it to draw the bond because the two ends are already defined. The departure atom for the last bond is thus the first atom.}! The automatic calculation mechanism must be corrected so that the bond leaves from the second atom ``\verb-N-'' instead of the first. To do this we give an optional argument for the last bond of the first 6-ring ``\verb-[,,2]-'':
+We note that one bond leaves from the wrong atom\footnote{This seems illogical because the angle of the bond from the \texttt{HN} group toward the first vertex lies between $-90\degres$ and $90\degres$; \CF should therefore leave from the second atom. To explain this contradiction, one must know that in rings, the last bond always links the last vertex to the first, ignoring the \emph{calculated theoretical} angle of this bond (which here is $-90\degres$). \CF uses this theoretical angle to determine the departure and arrival atoms, but does not use it to draw the bond because the two ends are already defined. The departure atom for the last bond is thus the first atom.}! The automatic calculation mechanism must be corrected so that the bond leaves from the second atom ``\verb-N-'' instead of the first. To do this we give an optional argument for the last bond of the first 6-ring ``\verb-[,,2]-'':
\exemple{Guanine, step three}|\chemfig{*6(=N-*6(-\chembelow{N}{H}-=N?)=?--HN-[,,2])}|
Simply add the branches to the right vertices. Note especially the branch leaving the first vertex of the first 6-ring ``\verb/(-N_2N)/'':
@@ -1493,17 +1482,136 @@ Simply add the branches to the right vertices. Note especially the branch leavin
We could also draw the same molecule with a regular 5-ring, as is sometimes done:
\exemple{Guanine with 5-ring}|\chemfig{*6((-H_2N)=N-*5(-\chembelow{N}{H}-=N-)=-(=O)-HN-[,,2])}|
+\section{How to\ldots}
+\subsection{Write a colored atom}
+As the package \verb-xcolor- is loaded by \TIKZ, itself loaded by \CF, we can write color commands in the code of a molecule, mainly \verb-\color- et \verb-\textcolor-. The atoms are displayed in \TIKZ nodes which behaves like boxes of \TeX{} and it is as if these atoms were put in a group. Therefore, the color change remains local to the atom.
+
+\exemple{Colors}/\chemfig{C\color{blue}H_3-C(=[1]O)-[7]O\color{red}H}/
+
+This code does not work, because of the rule used to separate atoms: here, the first atom sarts at ``\verb-C-'' and spreads to the next uppercase letter. Therefore, this atom is ``\verb-C\color{blue}-'' and the color change occurs at the end of atom and has no effect. We need to force \CF to cut the first atom just after ``\verb-C-'' with the character ``\verb-|-'' and then include \verb-\color{blue}H_3- between braces so that \CF does not stop the atom 2 before the uppercase ``\verb-H-'' which would leave the color change alone and therefore ineffective in an atom:
+
+\exemple{Colors}/\chemfig{C|{\color{blue}H_3}-C(=[1]O)-[7]O|{\color{red}H}}/
+
+The same effect can be obtained with \verb-\textcolor-:
+
+\exemple{Colors}/\chemfig{C|\textcolor{blue}{H_3}-C(=[1]O)-[7]O|\textcolor{red}{H}}/
+
+The main disadvantage is that we have to do the same for every atom that need to be colored, even if they are contiguous.
+
+\subsection{Draw a curve bond}
+We have already seen that with the \TIKZ library ``\verb-decorations.pathmorphing-'', we can draw a wavy bond:
+
+\exemple{Wavy bond}|\chemfig{A-[,3,,,decorate,decoration=snake]B}
+
+\chemfig{A-[,3,,,decorate,decoration={snake,amplitude=1.5mm,
+ segment length=2.5mm}]B}|
+
+For more flexibility, you can also define nodes using the character ``\verb-@-'' and reuse these nodes after the molecule has been drawn to connect them with a curved line using \verb-\chemmove-:
+
+\exemple{Curved bonds}/\chemfig{@{a}A-[,,,,draw=none]@{b}B}
+\chemmove{\draw[-](a)..controls +(45:7mm) and +(225:7mm)..(b);}
+\bigskip
+
+\chemfig{*6(@{a}---@{b}---)}
+\chemmove{\draw[-](a)..controls +(60:3em) and +(240:3em)..(b);}
+\quad
+\chemfig{*6(@{a}---@{b}---)}
+\chemmove{\draw[-](a)..controls +(60:3em) and +(30:1em)..
+ ++(20:2em) ..controls +(210:3em) and +(-120:4em) ..(b);}/
+
+\subsection{Modify the size of a molecule}
+Two parameters determine the default size of a molecule: the font size and the parameter of \verb-\setatomsep- which is 3em the default. We can modify independently these two parameters to change the size of a molecule:
+
+\exemple{Change the size}/\definesubmol\hho{H-[:30]O-[:-30]H}
+\chemfig{!\hho}
+
+\setatomsep{2.5em}\chemfig{!\hho}
+
+\scriptsize\chemfig{!\hho}
+
+\tiny\chemfig{!\hho}\setatomsep{5em}\chemfig{!\hho}/
+
+You can use the optional second argument of \verb-\chemfig- to \emph{globally} enlarge or reduce a molecule, i.e. the text and links will be reduced by the same ratio:
+
+\exemple{Global change of the size}/\definesubmol\hho{H-[:30]O-[:-30]H}
+\chemfig{!\hho}
+
+\chemfig[][scale=0.75]{!\hho}
+
+\chemfig[][scale=0.5]{!\hho}
+
+\chemfig[][scale=0.33]{!\hho}/
+
+\subsection{Draw a ploymer element}
+The difficulty lies in the display of delimiters (parentheses or brackets) on bond. For this, we will again use the character ``\verb-@-'' to define global nodes that will be used later as anchors for delimiters. We will assume that the node for the location of the opening delimiter is called ``opbr'' and the one of the closing delimiter ``clbr''.
+
+We will write a simple macro \verb-\setpolymerbracket-, followed by two characters which define the opening delimiter and closing delimiter.
+
+Then, the macro \verb-\makebraces- has an optional argument of the form ``\verb-<dim up>,<dim down>-''. These two dimensions are the height and depth of the delimiters from the baseline. The mandatory argument of \verb-\makebraces- is the subscript located at the right bottom of the closing delimiter.
+
+\exemple*{Polymers}|\newcommand\setpolymerdelim[2]{%
+ \def\delimleft{#1}\def\delimright{#2}}
+
+\def\definedelimdim#1,#2\enddefinedelim{\def\delimht{#1}\def\delimdp{#2}}
+
+\newcommand\makebraces[2][0pt,0pt]{%
+ \definedelimdim#1\enddefinedelim
+ \chemmove{%
+ \node[at=(opbr),yshift=(\delimht-\delimdp)/2]
+ {\llap{$\left\delimleft\strut\vrule height\delimht depth\delimdp width0pt \right.$}};%
+ \node[at=(clbr),yshift=(\delimht-\delimdp)/2]
+ {\rlap{$\left.\strut\vrule height\delimht depth\delimdp width0pt \right\delimright_{#2}$}};%
+ }%
+}
+\setpolymerdelim()
+Polyethylen:
+\chemfig{\vphantom{CH_2}-[@{opbr,1}]CH_2-CH_2-[@{clbr,0}]}\makebraces{n}
+\bigskip
+
+Polyvinyl chloride:
+\chemfig{\vphantom{CH_2}-[@{opbr,1}]CH_2-CH(-[6]Cl)-[@{clbr,0}]}
+\makebraces[0pt,15pt]{\!\!\!n}
+\bigskip
+
+Nylon 6:
+\chemfig{\phantom{N}-[@{opbr,1}]{N}(-[2]H)-C(=[2]O)-{(}CH_2{)_5}-[@{clbr,0}]}
+\makebraces[20pt,0pt]{}
+\bigskip
+
+Polycaprolactame:\setatomsep{2em}
+\chemfig{[:-30]-[@{opbr,1}]N(-[6]H)-[:30](=[2]O)--[:30]--[:30]--[@{clbr,0}:30]}
+\makebraces[5pt,5pt]{n}
+
+\setpolymerdelim[]
+Polyphenylen sulfide:
+\chemfig{\vphantom{S}-[@{opbr,1}]S-(**6(---(-[@{clbr,0}])---))}
+\makebraces[15pt,15pt]{}|
+
+\subsection{Draw the symmetrical of a molecule}\label{retournement}
+The two commands \verb-\hflipnext- and \verb-\vflipnext- allow to draw the symmetrical of the next molecule about a horizontal or vertical axis. If we want to draw more symmetrical molecules, we need to write these commands before each molecule involved.
+
+\exemple{Symmetry}/\chemfig{H_3C-C(=[:30]O)-[:-30]OH}% original
+
+\vflipnext
+\chemfig{H_3C-C(=[:30]O)-[:-30]OH}\medskip
+
+\chemfig{H_3C-C(=[:30]O)-[:-30]OH}% original
+\hflipnext
+\chemfig{H_3C-C(=[:30]O)-[:-30]OH}/
+
\section{List of commands}
The commands created by \CF are:
\begin{center}
-\begin{tabular}{>\footnotesize l>\footnotesize p{9cm}}\\\hline
+\begin{longtable}{>\footnotesize l>\footnotesize p{9cm}}\\\hline
\hfill\normalsize Commands\hfill\null &\hfill\normalsize Description\hfill\null\\\hline
\verb-\chemfig<code>-& draws the molecule whose design is described by the \verb-<code>-\\
-\verb-\printatom- & displays the atoms within the molecules. It can be redefined to customize the ouput. See page~\pageref{perso.affichage}\\
+\verb-\printatom- & displays the atoms within the molecules. It can be redefined to customize the output. See page~\pageref{perso.affichage}\\
\verb-\setnodestyle{<style tikz>}-& using \TIKZ syntax, this macro defines the style of nodes containing the atoms. See page~\pageref{style.noeuds}\\
-\verb-\definesubmol{<nom>}[code1]{<code2>}- & créé un alias \verb-!<nom>- que l'on peut placer dans le code des molécules à dessiner qui remplace le \verb-<code1>- ou le \verb-<code2>- selon l'inclinaison de la dernière liaison. Voir page~\pageref{definesubmol}\\
-\verb-\chemskipalign- & Ignore le groupe d'atomes en cours pour le mécanisme d'alignement vertical. Voir page~\pageref{chemskipalign}.\\
-\verb-\redefinesubmol{<name>}{<code>}- & replaces a pre-existing alias \verb-!<name>- with the new \verb-<code>-. See page~\pageref{redefinesubmol}\\[2ex]\hline
+\verb-\hflipnext-&the next molecule will be horizontally flipped\\
+\verb-\vflipnext-&the next molecule will be vertically flipped\\
+\verb-\definesubmol{<name>}[code1]{<code2>}- & creates an alias \verb-!<nom>- which can be put in the code of molecules to be drawn, and which will be replaced with \verb-<code1>- or \verb-<code2>- depending on the angle of the last bond. See page~\pageref{definesubmol}\\
+\verb-\chemskipalign- & tells the vertical alignment mechanism to ignore the current group of atoms. See page~\pageref{chemskipalign}.\\
+\verb-\redefinesubmol{<name>}{<code>}- & replaces a preexisting alias \verb-!<name>- with the new \verb-<code>-. See page~\pageref{redefinesubmol}\\[2ex]\hline
&\\
\verb-\setcrambond{<dim1>}{<dim2>}{<dim3>}- & sets the dimensions of the triangles representing Cram bonds: \verb-<dim1>- is the size of the base, \verb-<dim2>- is the spacing between the dashes and \verb-<dim3>- is the side of the dashes. See page~\pageref{setcrambond}\\
\verb-\setatomsep{<dim>}>- & sets the interatomic distance. See page~\pageref{setatomsep}\\
@@ -1513,23 +1621,23 @@ The commands created by \CF are:
\verb-\lewis{<codes>,<atom>}- & displays the \verb-<atom>- and places Lewis dot decorations as specified in the \verb-<code>-. The dots drawn do not change the bounding box. See page~\pageref{lewis}\\
\verb-\setlewis{<dim1>}{<dim2>}{<tikz code>}- & sets the Lewis dot parameters; \verb-<dim1>- is the distance between the atoms and the decoration, \verb-<dim2>- is the length of the line representing the pair of electrons and \verb-<tikz code>- is code which is passed directly to \TIKZ. See page~\pageref{setlewis}\\[2ex]\hline
&\\
-\verb-\chemmove[<options tikz>]<code tikz>- & Ouvre un environnement \verb-tikzpicture- en y ajoutant à celles qui existent déjà les \verb-<options tikz>-, et relie avec le \verb-<code tikz>- les nœuds posés dans les molécules à l'aide du caractère ``\verb-@-''. Voir page~\pageref{mecanismes-reactionnels}.\\
+\verb-\chemmove[<tikz options>]<tikz code>- & Makes a \verb-tikzpicture- environment, adding to it the \verb-<tikz options>-. Uses the \verb-<tikz code>- to join the nodes specified in the molecules with the help pf the ``\verb-@-'' character. See page~\pageref{mecanismes-reactionnels}.\\
\verb-\chemsign[<dim>]<sign>- & draws the \verb-<sign>-, placing before and after it an unbreakable space of length \verb-<dim>-. See page~\pageref{chemsign}\\
\verb-\chemrel[<txt1>][<txt2>]{<arrow code>}- & draws an arrow described by its \verb-<arrow code>- and places the optional text \verb-<txt1>- and \verb-<txt2>- above and below the arrow respectively. See page~\pageref{chemrel}\\
\verb-\setchemrel{<dim1>}{<dim2>}{<dim3>}- & sets the dimensions of the arrow drawn with the command \verb-\chemrel-: \verb-<dim1>- is the vertical space between the arrow and the optional text, \verb-<dim2>- is the unbreakable horizontal space inserted before and after the arrow and \verb-<dim3>- is the length of the arrow. See page~\pageref{setchemrel}\\[2ex]\hline
&\\
\verb-\chemabove[<dim>]{<txt1>}{txt2}- & writes \verb-<txt1>- and places \verb-<txt2>- above, leaving \verb-<dim>- of vertical space. This command does not change the bounding box of \verb-<txt1>-. See page~\pageref{chemabove}\\
\verb-\chembelow[<dim>]{<txt1>}{txt2}- & writes \verb-{txt1}- and places \verb-<txt2>- below, leaving \verb-<dim>- of vertical space. This command does not change the bounding box of \verb-<txt1>-. See page~\pageref{chemabove}\\
-\verb-\chemname[<dim>]{<molécule>}{<nom>}- & Affiche le \verb-<nom>- sous la \verb-<molécule>-\\
-\verb-\chemnameinit- & Initialise la plus grande profondeur des molécules rencontrées pour avoir un alignement correct de leurs noms\\\hline
-\end{tabular}
+\verb-\chemname[<dim>]{<molecule>}{<name>}- & Places \verb-<name>- under the \verb-<molecule>-\\
+\verb-\chemnameinit- & Initializes the greatest molecule depth to ensure correct alignment of the names of the following molecules.\\\hline
+\end{longtable}
\end{center}
\newpage
\part{Gallery}
This manual concludes with drawings of molecules of varying complexity.
-The curious user can look at the \verb-<code>- of each molecule, though it does become less attractive the more complex the molecule gets. Indeed, beyond a certain level of complexity, though it it is fairly easy to write \verb-<code>-, it becomes much harder to read the \verb-<code>- to analyse it afterwards. We quickly reached the limits of immediate readability of the code of a complex drawing.
+The curious user can look at the \verb-<code>- of each molecule, though it does become less attractive the more complex the molecule gets. Indeed, beyond a certain level of complexity, though it it is fairly easy to write \verb-<code>-, it becomes much harder to read the \verb-<code>- to analyze it afterwards. We quickly reached the limits of immediate readability of the code of a complex drawing.
Anyway, I hope that this package will help all \LaTeX{} users wishing to draw molecules. Given the newness of this package, I hope that you will be forgiving with bugs you encounter and send me an \href{mailto:unbonpetit@gmail.com}{\texttt{\textbf{email}}} to let me know of any malfunctions or suggestions for improvement.\nobreak
@@ -1566,13 +1674,13 @@ $\star\quad\star$
\exemple*{Phthalic anhydride}/\chemfig{*6(=*5(-(=O)-O-(=O)-)-=-=-)}/
\exemple*{Camphor}/\chemfig{*6(-(<:[::120](-[::-100,0.7])(-[::100,0.7]))--(=O)-(-)(<:[::120])--)}
-\quad ou \quad
+\quad or \quad
\setcrambond{3pt}{}{}
\chemfig{<[:10](>[:85,1.8]?(-[:160,0.6])-[:20,0.6])
>[:-10]-[:60](=[:30,0.6]O)-[:170]?(-[:30,0.6])-[:190]-[:240]}/
\exemple*{Triphenylmethane}/\chemfig{*6(-=-*6(-(-*6(=-=-=-))-*6(=-=-=-))=-=)}
-\quad ou \quad
+\quad or \quad
\definesubmol{@}{*6(=-=-=-)}
\chemfig{(-[:-30]!@)(-[:90]!@)(-[:210]!@)}/
@@ -1624,14 +1732,14 @@ $\star\quad\star$
\chemrel[$\mathrm{H^+}$]{-stealth}
\chemfig{*6(-=*5(-\chembelow{N}{H}-(-R_2)=(-R_1)-)-=-=)}/
-\exemple*{Mécanisme réactionnel : groupement carbonyle}/
+\exemple*{Reaction mechanisms: carbonyl group}/
\chemfig{C([3]-)([5]-)=[@{db,.5}]@{atoo}\lewis{06,O}}
\chemrel{<>}
\chemfig{\chemabove{C}{\scriptstyle\oplus}([3]-)([5]-)-\chemabove
{\lewis{026,O}}{\hspace{5mm}\scriptstyle\ominus}}
\chemmove{\draw[->,shorten <=2pt, shorten >=2pt](db) ..controls +(up:5mm) and +(up:5mm)..(atoo);}/
-\exemple*{Mécanismes réactionnels : dérivés nitrés}/
+\exemple*{Reaction mechanisms: nitro group}/
\chemfig{R-\chembelow{N}{\hspace{-5mm}\scriptstyle\oplus}([1]=[@{db}]@{atoo1}O)([7]-[@{sb}]@{atoo2}
\chemabove{\lewis{157,O}}{\hspace{7mm}\scriptstyle\ominus})}
\chemrel{<->}
@@ -1641,7 +1749,7 @@ $\star\quad\star$
\draw[->,shorten <=3pt, shorten >=2pt](atoo2) ..controls +(225:10mm) and +(225:10mm)..(sb);
}/
-\exemple*{Addition nucléophile. Amines primaires}/\chemfig{R-@{aton}\lewis{2,N}H_2}
+\exemple*{Nucleophilic addition. Primary amines}/\chemfig{R-@{aton}\lewis{2,N}H_2}
\chemsign{+}
\chemfig{@{atoc}C([3]-CH_3)([5]-CH_3)=[@{atoo1}]O}
\hspace{1cm}
@@ -1662,32 +1770,23 @@ $\star\quad\star$
\draw(aton) ..controls +(up:5mm) and +(up:5mm)..(sb);
\draw(sbh) ..controls +(left:5mm) and +(south west:5mm)..(aton);
\draw(sbo) ..controls +(up:5mm) and +(north west:5mm)..(atoo);}
-\chemrel[\tiny élimination]{<>}
+\chemrel[\tiny elimination]{<>}
\chemfig{R-N=C(-[1]CH_3)(-[7]CH_3)}
\chemsign{+}
\chemfig{H_3\chemabove{O}{\scriptstyle\oplus}}/
-\exemple*{Mécanismes réactionnels de la chloration}/\scriptsize
+\exemple*{Reaction mechanism of chlorination}/\scriptsize
\setbondoffset{1pt}\setatomsep{2em}
-\chemfig{Cl-[4]@{a0}(=[@{a1}:120]@{a2}O)-[:-120](=[:-60]O)-[4]Cl}
-\chemsign{+}
-\chemfig{*6(-=-=(-@{oh1}OH)-=)}
-\chemrel{-stealth}
+\chemfig{Cl-[4]@{a0}(=[@{a1}:120]@{a2}O)-[:-120](=[:-60]O)-[4]Cl}\chemsign{+}
+\chemfig{*6(-=-=(-@{oh1}OH)-=)}\chemrel{-stealth}
\chemfig{*6((-O-[:150](-[@{o0}:150]@{o1}\lewis{6.,O})(-[@{cl0}:60]@{cl1}Cl)-[:240](-[4]Cl)=[6]O)=-=-=-)}
-\chemrel{-stealth}
-\chemfig{*6((-O-[:150](=[2]O)-[:-150](=[6]O)-[:150]Cl)=-=-=-)}
-\chemsign{+}
-\chemfig{HCl}
-\par
-\chemfig{*6(-=*6(-O-*6(-@{o2}(=[@{o3}]@{o4}O)-Cl)=)-=-=)}
-\chemsign{+}
-\chemfig{*6(-=-=(-@{oh2}OH)-=)}
-\chemrel{-stealth}
+\chemrel{-stealth}\chemfig{*6((-O-[:150](=[2]O)-[:-150](=[6]O)-[:150]Cl)=-=-=-)}\chemsign{+}
+\chemfig{HCl}\par
+\chemfig{*6(-=*6(-O-*6(-@{o2}(=[@{o3}]@{o4}O)-Cl)=)-=-=)}\chemsign{+}
+\chemfig{*6(-=-=(-@{oh2}OH)-=)}\chemrel{-stealth}
\chemfig{*6(-=*6(-O-(-(-[@{cl2}:60]@{cl3}Cl)(-[@{o5}:-120]@{o6}\lewis{6.,O})-O-[::-40]*6(=-=-=-))=)-=-=)}
-\kern-3em \chemrel{-stealth}
-\chemfig{[:30]*6(=-(-O-[:-60](=O)-[:-120](=[4]O)-[:-60]O-*6(=-=-=-))=-=-)}
-\kern-3em \chemsign{+}
-\chemfig{HCl}
+\kern-3em \chemrel{-stealth}\chemfig{[:30]*6(=-(-O-[:-60](=O)-[:-120](=[4]O)-[:-60]O-*6(=-=-=-))=-=-)}
+\kern-3em \chemsign{+}\chemfig{HCl}
\chemmove[line width=0.2pt,-stealth,dash pattern = on 2pt off 1pt]{
\draw[shorten <=2pt](a1)..controls+(200:5mm)and+(200:5mm)..(a2);
\draw[shorten >=2pt](oh1.west)..controls+(180:15mm)and+(60:5mm)..(a0);
@@ -1698,7 +1797,7 @@ $\star\quad\star$
\draw[shorten >=2pt,shorten <=5pt]([xshift=-1.5mm]o6.315)..controls +(315:5mm) and +(315:5mm)..(o5);
\draw[shorten <=2pt](cl2)..controls +(135:5mm) and +(135:5mm)..(cl3.north west);}/
-\exemple*{Cannizzaro}/\chemfig{[:-30]*6(=-=(-@{atoc}C([6]=[@{db}]@{atoo1}O)-H)-=-)}
+\exemple*{Cannizzaro reaction}/\chemfig{[:-30]*6(=-=(-@{atoc}C([6]=[@{db}]@{atoo1}O)-H)-=-)}
\chemrel[\chemfig{@{atoo2}\chemabove{O}{\scriptstyle\ominus}}H]{-stealth}
\chemmove[-stealth,shorten >=2pt,dash pattern=on 1pt off 1pt,thin]{
\draw[shorten <=8pt](atoo2) ..controls +(up:10mm) and +(up:10mm)..(atoc);
@@ -1721,7 +1820,7 @@ $\star\quad\star$
\begingroup
\catcode`;=12
-\exemple*{Réarrangement de Beckmann}/
+\exemple*{Beckmann rearrangement}/
\setbondoffset{1pt}
\setatomsep{2.5em}
\chemfig{(-[:-150]R')(-[:-30]R)=[2]N-[:30]OH}
@@ -1752,49 +1851,49 @@ $\left[\begin{tabular}{c}
/
\endgroup
-\exemple*{Sulfonation de la naphtalène}/\newcommand\putchemnode[1]{\begin{tikzpicture}[remember picture]\node(##1){};\end{tikzpicture}}
+\exemple*{Sulfonation of naphthalene}/\newcommand\putchemnode[1]{\begin{tikzpicture}[remember picture]\node(#1){};\end{tikzpicture}}
\definesubmol\cycleoplus{-[,0.25,,,draw=none]\oplus}
\definesubmol{so2oh}{S(=[::90]O)(=[::-90]O)-OH}
\footnotesize
\setatomsep{2.5em}
\begin{tabular}{ll}
-&\putchemnode{l1}\chemname{\chemfig{*6(=-*6(-=-(!\cycleoplus)-(-SO_3H)-)=-=-)}}{Ion 1-arenium}
+&\putchemnode{l1}\chemname{\chemfig{*6(=-*6(-=-(!\cycleoplus)-(-SO_3H)-)=-=-)}}{1-arenium ion}
\chemrel{-stealth}
-\chemname{\chemfig{*6(=-*6(-=-=(-!{so2oh})-)=-=-)}}{Acide 1-naphthalenesulfonique}\\
-\chemname{\chemfig{*6(=-*6(-=-=-)=-=-)}}{Naphtalène}
+\chemname{\chemfig{*6(=-*6(-=-=(-!{so2oh})-)=-=-)}}{1-naphthalenesulfonic acid}\\
+\chemname{\chemfig{*6(=-*6(-=-=-)=-=-)}}{Naphthalene}
\chemsign{+}
\chemfig{H_2SO_4}\putchemnode{a}\kern1cm&\\[-5ex]
-&\putchemnode{l2}\chemname{\chemfig{*6(=-*6(-=-(-SO_3H)-(!\cycleoplus)-)=-=-)}}{Ion 2-arenium}\kern-3em
+&\putchemnode{l2}\chemname{\chemfig{*6(=-*6(-=-(-SO_3H)-(!\cycleoplus)-)=-=-)}}{2-arenium ion}\kern-3em
\chemrel{-stealth}
-\chemname{\chemfig{*6(=-*6(-=-(-!{so2oh})=-)=-=-)}}{Acide 2-naphthalenesulfonique}
+\chemname{\chemfig{*6(=-*6(-=-(-!{so2oh})=-)=-=-)}}{2-naphthalenesulfonic acid}
\end{tabular}
\chemmove[-stealth,yshift=1cm]{
\draw(a)--node[sloped,above]{80\degres C}(l1);\draw(a)--node[sloped,above]{160\degres C}(l2);}/
\begingroup\catcode`;12
-\exemple*{Schéma explicatif}/\parbox{0.8\linewidth}{
+\exemple*{Explanatory diagram}/\parbox{0.8\linewidth}{
\hspace{10em}
-\tikz[remember picture]\node(n0){\chemname{}{Attaques\\nucléophiles}};\par
+\tikz[remember picture]\node(n0){\chemname{}{Attacks\\nucleophiles}};\par
\vspace{2ex}\hspace{15em}
-\chemfig{R^2-(-[:-60]@{m3}H)-[:60]@{m0}(-[:120]R^1)(-[1,0.25,,,draw=none]\scriptstyle\color{red}\delta+)
- =[@{m1}]@{m2}\lewis{1:7:,O}-[1,0.5,,,draw=none]\scriptstyle\color{red}\delta{-}}
+\chemfig{R^2-(-[:-60]@{a0}H)-[:60]@{a1}(-[:120]R^1)(-[1,0.25,,,draw=none]\scriptstyle\color{red}\delta+)
+ =[@{a2}]@{a3}\lewis{1:7:,O}-[1,0.5,,,draw=none]\scriptstyle\color{red}\delta{-}}
\hspace{5em}
-\chemname[-15ex]{}{\tikz[remember picture]\node(n1){};Réactions d'addition}\kern1em
-\chemname{}{\tikz[remember picture]\node(n2){};Propriétés basiques}\par
+\chemname[-15ex]{}{\tikz[remember picture]\node(n1){};Addition reactions}\kern1em
+\chemname{}{\tikz[remember picture]\node(n2){};Basic properties}\par
\vspace{6ex}\hspace{8em}
-\chemname{}{Propriétés acides des atomes\tikz[remember picture]\node(n3){};
- \\d'hydrogène en position $\alpha$}
+\chemname{}{Acidic properties of hydrogen\tikz[remember picture]\node(n3){};
+ \\atom in $\alpha$ position}
\chemmove[-stealth,line width=0.8pt,green!60!black!70]{
- \draw[shorten >=2pt](n0)..controls+(270:4em)and+(180:2em)..(m0);
- \draw[shorten >=8pt](n1)..controls+(180:2em)and+(60:2em)..(m1);
- \draw[shorten >=5pt](n2)..controls+(180:2em)and+(270:2em)..([xshift=3pt]m2.315);
- \draw[shorten >=2pt](n3)..controls+(0:2em)and+(270:2em)..(m3);
+ \draw[shorten >=2pt](n0)..controls+(270:4em)and+(180:2em)..(a1);
+ \draw[shorten >=8pt](n1)..controls+(180:2em)and+(60:2em)..(a2);
+ \draw[shorten >=5pt](n2)..controls+(180:2em)and+(270:2em)..([xshift=3pt]a3.315);
+ \draw[shorten >=2pt](n3)..controls+(0:2em)and+(270:2em)..(a0);
}}/
\endgroup
-\exemple*{Cristallography}/\newcommand\disk{\tikz\draw[fill=black,overlay](0,0)circle(2pt);}
+\exemple*{Crystallography}/\newcommand\disk{\tikz\draw[fill=black,overlay](0,0)circle(2pt);}
\setatomsep{20pt}
-\renewcommand\printatom[1]{##1}
+\renewcommand\printatom[1]{#1}
\setbondoffset{2pt}
\definesubmol{hat}{-[:40,1.5]\disk-[::-30,2]\disk-[::-30,2]\disk-[::-120,2]\disk-[::-30,2]\disk}
\definesubmol{motif}{-[:40,1.5]\disk(-[2,3])-[::-30,2]\disk
diff --git a/Master/texmf-dist/doc/latex/chemfig/chemfig_doc_fr.pdf b/Master/texmf-dist/doc/latex/chemfig/chemfig_doc_fr.pdf
index d25e5daace7..404e00e7a92 100644
--- a/Master/texmf-dist/doc/latex/chemfig/chemfig_doc_fr.pdf
+++ b/Master/texmf-dist/doc/latex/chemfig/chemfig_doc_fr.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/chemfig/chemfig_doc_fr.tex b/Master/texmf-dist/doc/latex/chemfig/chemfig_doc_fr.tex
index 3e389018e96..7916a9bd907 100644
--- a/Master/texmf-dist/doc/latex/chemfig/chemfig_doc_fr.tex
+++ b/Master/texmf-dist/doc/latex/chemfig/chemfig_doc_fr.tex
@@ -3,7 +3,7 @@
% | |
% | Documentation de ChemFig |
% | |
-% | 21 novembre 2010 |
+% | 8 janvier 2011 |
% | |
% |_________________________________________________________________|
%
@@ -15,7 +15,7 @@
% Comments, bug reports and suggestions are welcome.
% Licence : Released under the LaTeX Project Public License v1.3c or
% later, see http://www.latex-project.org/lppl.txt
-% Copyright : Christian Tellechea 2010
+% Copyright : Christian Tellechea 2010-2011
%
% L'extension "chemfig" est constituée de ces 6 fichiers :
% chemfig.sty
@@ -43,14 +43,17 @@
\usepackage[T1]{fontenc}
\usepackage[a4paper,margin=2.5cm,head=5mm,headsep=5mm,footskip=10mm]{geometry}
\usepackage[bottom]{footmisc}
-\usepackage{lmodern}
+\usepackage{libertine}
+\renewcommand*\oldstylenums[1]{{\fontfamily{fxlj}\selectfont #1}}
+\usepackage[scaled=0.8]{luximono}
\usepackage{amsmath}
\usepackage{array}
+\usepackage{longtable}
\usepackage{xspace}
\usepackage{fancybox}
+\usepackage{boites}
\usepackage{textcomp}
\usepackage{enumitem}
-\usepackage{xstring}
\usepackage{chemfig}
\usetikzlibrary{decorations.pathmorphing}
\usepackage{emerald}
@@ -65,91 +68,90 @@
\makeatletter
-\newcommand\disable@lig[1]{%
+\long\def\grab@toks#1\relax{\endgroup\def\right@content{#1}}
+
+\newcommand\make@car@active[2]{%
\catcode`#1\active
\begingroup
\lccode`\~`#1\relax
- \lowercase{\endgroup\def~{\leavevmode\kern\z@\string#1}}%
+ \lowercase{\endgroup\def~{#2}}%
}
\newif\if@exstar
-\newcommand\exemple{\@ifstar{\@exstartrue\exemple@}{\@exstarfalse\exemple@}}
+\newcommand\exemple{%
+ \begingroup
+ \parskip\z@
+ \@makeother\;\@makeother\!\@makeother\?\@makeother\:% neutralise frenchb
+ \@ifstar{\@exstartrue\exemple@}{\@exstarfalse\exemple@}}
\newcommand\exemple@[2][65]{%
- \par\nobreak\vskip5pt
- \def\part@coeff{#1}%
- \def\code@name{#2}%
- \relax\leavevmode\null
- \bgroup
- \obeylines\frenchspacing
+ \medbreak\noindent
+ \begingroup
\let\do\@makeother\dospecials
- \@makeother:%
- \@vobeyspaces
- \disable@lig,\disable@lig-%
- \exemple@@
+ \make@car@active\ { {}}%
+ \make@car@active\^^M{\par\leavevmode}%
+ \make@car@active\,{\leavevmode\kern\z@\string,}%
+ \make@car@active\-{\leavevmode\kern\z@\string-}%
+ \exemple@@{#1}{#2}%
}
-\newcommand\exemple@@[1]{%
- \def\@tempa##1#1{%
- \xdef\left@content{##1}%
- \egroup
- \begingroup
- \endlinechar\m@ne\everyeof{\relax}\catcode`\^^M=10
- \@makeother:\@makeother~\@makeother!\@makeother?\@makeother;%
- \expandafter\grab@toks\scantokens{##1}%
- \endgroup
- \exemple@@@
- }%
+\newcommand\exemple@@[3]{%
+ \def\@tempa##1#3{\exemple@@@{#1}{#2}{##1}}%
\@tempa
}
-\begingroup
-\catcode`#=12
-\gdef\exemple@@@%
-{%
- \begingroup
- \StrSubstitute\left@content{##}#[\left@content]%
- \if@exstar
- \edef\part@left{\the\dimexpr\linewidth-2\fboxsep-2\fboxrule}%
- \let\part@right\part@left
- \else
- \edef\part@left{\the\dimexpr0.\part@coeff\linewidth-\fboxsep-\fboxrule}%
- \edef\part@right{\the\dimexpr\linewidth-0.\part@coeff\linewidth-\fboxsep-\fboxrule}%
- \fi
- \edef\saved@boxsep{\the\fboxsep}%
- \fboxsep1pt\relax
- \boxput*(0,1)%
- {\colorbox{black}{{%
- \leavevmode\kern1.5pt\relax
- \color{white}\ECFAugie\footnotesize
- \vphantom{Cp}\code@name
- }\kern1.5pt\relax}}%
- {\fboxsep\saved@boxsep
+\newcommand\exemple@@@[3]{%
+ \xdef\the@code{#3}%
+ \endgroup
+ \if@exstar
+ \begingroup
+ \fboxrule0.4pt
+ \let\breakboxparindent\z@
+ \def\bkvz@bottom{\hrule\@height\fboxrule}%
+ \let\bkvz@before@breakbox\relax
+ \def\bkvz@set@linewidth{\advance\linewidth\dimexpr-2\fboxrule-2\fboxsep}%
+ \def\bkvz@left{\vrule\@width\fboxrule\hskip\fboxsep}%
+ \def\bkvz@right{\hskip\fboxsep\vrule\@width\fboxrule}%
+ \def\bkvz@top{\hbox to \hsize{%
+ \vrule\@width\fboxrule\@height\fboxrule
+ \leaders\bkvz@bottom\hfill
+ \ECFAugie
+ \fboxsep\z@
+ \colorbox{black}{\kern0.25em\color{white}\footnotesize\lower0.5ex\hbox{\strut#2}\kern0.25em}%
+ \leaders\bkvz@bottom\hfill
+ \vrule\@width\fboxrule\@height\fboxrule}}%
+ \breakbox
+ \kern.5ex\relax
+ \ttfamily\footnotesize\the@code\par
+ \normalfont
+ \kern3pt
+ \hrule height0.1pt width\linewidth depth0.1pt
+ \vskip5pt
+ \rightskip0pt plus 1fill
+ \everypar{{\color{lightgray}\rlap{\vrule height0.1pt width\linewidth depth0.1pt}}\hskip0pt plus 1fill}%
+ \newlinechar`\^^M\everyeof{\noexpand}\scantokens{#3}\par
+ \endbreakbox
+ \endgroup
+ \else
+ \vskip0.5ex
+ \boxput*(0,1)
+ {\fboxsep\z@
+ \hbox{\ECFAugie\colorbox{black}{\leavevmode\kern0.25em{\color{white}\footnotesize\strut#2}\kern0.25em}}%
+ }%
+ {\fboxsep5pt
\fbox{%
- \if@exstar
- \parbox[c]\part@left{%
- \vskip5pt\relax\ttfamily\footnotesize\left@content
- \vskip3pt\hrule\vskip3pt
- \everypar{{\color{lightgray}\rlap{\vrule height0.1pt width\part@right depth0.1pt}}}%
- \par\normalfont
- \subst@in\right@content\par\def
- \subst@in\right@content\def{\hfill\null\par\hfill}%
- \hfill\right@content\hfill\null}%
- \else
- \parbox[c]\part@left{\vskip5pt\relax\ttfamily\footnotesize\left@content}%
- \parbox[c]\part@right{%
- \vskip5pt\relax
- \everypar{{\color{lightgray}\rlap{\vrule height0.1pt width\part@right depth0.1pt}}}%
- \normalfont\footnotesize
- \right@content}%
- \fi
+ $\vcenter{\hsize\dimexpr0.#1\linewidth-\fboxsep-\fboxrule\relax
+ \kern5pt\parskip0pt \ttfamily\footnotesize\the@code}%
+ \vcenter{\kern5pt\hsize\dimexpr\linewidth-0.#1\linewidth-\fboxsep-\fboxrule\relax
+ \everypar{{\color{lightgray}\rlap{\vrule height0.1pt width\dimexpr\linewidth-0.#1\linewidth-\fboxsep-\fboxrule depth0.1pt}}}%
+ \footnotesize\newlinechar`\^^M\everyeof{\noexpand}\scantokens{#3}}$%
}%
}%
- \vskip7.5pt\relax
+ \fi
+ \medbreak
\endgroup
}
-\endgroup
\long\def\if@instr#1#2{%
\long\def\if@instr@i##1#2##2\@nil{\ifx\@empty##2\@empty\expandafter\@secondoftwo\else\expandafter\@firstoftwo\fi}%
@@ -164,8 +166,6 @@
}\relax
}
-\long\def\grab@toks#1\relax{\gdef\right@content{#1}}
-
\newcommand\falseverb[1]{{\ttfamily\detokenize{#1}}}
\long\def\centerverb#1{%
@@ -176,6 +176,7 @@
\let\do\@makeother\dospecials
\@vobeyspaces
\centerverb@i}
+
\makeatother
\usepackage[frenchb]{babel}
@@ -277,9 +278,10 @@
\item Mise en place de la représentation des mouvement d'électrons et des mécanismes réactionnels avec la syntaxe ``\verb-@{<nom>}-'' devant un atome ou
``\verb-@{<nom>,<coeff>}-'' au tout début de l'argument d'une liaison.\par
Cette syntaxe permet de placer un nœud (au sens de \TIKZ) qui deviendra l'extrémité des flèches dessinées. Le tracé des flèches est fait par la macro \verb-\chemmove- dont l'argument optionnel devient celui de l'environnement ``tikzpicture'' dans lequel sont faites les flèches. Lire page~\pageref{mecanismes-reactionnels};
- \item Pour le mécanisme d'alignement vertical des atomes sur une même horizontale, la commande \verb-\chemskipalign- permet d'ignorer ce mécanisme pour le groupe d'atomes dans lequel elle est écrite. Voir page~\pageref{chemskipalign};
+ \item Concernant le mécanisme d'alignement vertical des atomes sur une même horizontale, l'utilisation de la commande \verb-\chemskipalign- permet d'ignorer ce mécanisme pour le groupe d'atomes dans lequel elle est écrite. Voir page~\pageref{chemskipalign};
\item La commande \verb-\chemname- permet d'afficher un nom sous une molécule. La commande \verb-\chemnameinit- initialise l'alignement des noms. Lire page~\pageref{chemname};
- \item les dessins des décorations qu'effectue la commande \verb-\lewis- ont été améliorés;
+ \item Les commandes \verb-\hflipnext- et \verb-\vflipnext- provoquent un retournement horizontal ou vertical de la prochaine molécule. Voir page~\pageref{retournement};
+ \item Les dessins des décorations qu'effectue la commande \verb-\lewis- ont été améliorés;
\item Corrections de bugs et optimisation du code.
\end{enumerate}
@@ -443,7 +445,7 @@ Remarque : un cycle ne pas commencer ou finir par l'atome ou le groupe d'atomes
\exemple{Le bon codage}|\chemfig{A*4(-B-C-D-)}|
\exemple{Les mauvais codages}|\chemfig{*4(A-B-C-D-)}\hspace{1cm}
- \chemfig{*4(-B-C-D-A)}|
+\chemfig{*4(-B-C-D-A)}|
\section{Ions}
La commande \verb|\chemfig| vous place directement dans l'environnement mathématique\footnote{Il existe un problème de placement des groupes d'atomes contenant des exposants ou des indices. Voir page~\pageref{alignement.vertical}.} de \TeX, il est donc très simple d'écrire un ion. Il faut toutefois placer le signe $-$ entre accolades pour éviter à \CF qu'il le confonde avec le symbole d'une liaison covalente.
@@ -488,7 +490,6 @@ Intrinsèquement, le dessin d'une molécule chimique consiste à relier par des
{\fboxsep1pt
Mais dans cette molécule
\molht{H_3C-C(-[:-30]OH)=[:30]O}
-
on compte 4 groupes d'atomes : ``$\mathrm{H_3C}$'', ``C'', ``O'' et ``OH''. Pour des raisons que nous verrons plus tard, \CF examine chaque groupe d'atomes et le découpe en atomes. Chaque atome s'étend jusqu'à rencontrer une lettre majuscule ou un de ces caractères spéciaux : {\ttfamily \boxedfalseverb{-} \boxedfalseverb{=} \boxedfalseverb{~} \boxedfalseverb{(} \boxedfalseverb{!} \boxedfalseverb{*} \boxedfalseverb{<} \boxedfalseverb{>} \boxedfalseverb{@}}. Pour \CF, tous les caractères entre accolades sont ignorés pour le découpage en atomes.
Par conséquent, le premier groupe d'atomes ``$\mathrm{H_3C}$'' est découpé en 2 atomes : $\boxednode{H_3}{}$ et $\boxednode C{}$. Chimiquement, il arrive que ce ne soient pas de vrais atomes puisque $\mathrm{H_3}$ par exemple, est constitué de 3 atomes d'hydrogène. Par abus de langage, on parlera d'atomes par la suite. Par conséquent, \CF voit la molécule précédente ainsi :
@@ -561,7 +562,7 @@ Si l'un des argument est vide, il prend sa valeur par défaut. Les 3 arguments s
Voici un exemple où les 3 dimensions sont modifiées :
\exemple{Liaison de Cram modifiée}-\setcrambond{10pt}{0.4pt}{1pt}
- \chemfig{A>B>:C>|D}-
+\chemfig{A>B>:C>|D}-
\section{Angle d'une liaison}
Chaque liaison admet un argument optionnel qui se met entre crochet. Le contenu de cet argument optionnel permet de régler tout ce dont on a besoin pour la liaison. Cet argument optionnel est constitué de 5 champs séparés par des virgules qui sont autant d'arguments optionnels pour la liaison. Le premier de ces arguments définit l'angle optionnel de la liaison. Les angles vont croissant dans le sens trigonométrique et sont définis par rapport à l'horizontale. Si l'argument optionnel est vide, alors l'angle par défaut vaut 0\degres. Nous verrons plus loin comment modifier cet angle par défaut.
@@ -604,18 +605,26 @@ Le deuxième champ, s'il est non vide, est un coefficient qui multipliera la dis
\chemfig{A-B-[,2]C=[,0.5]D}\par
\chemfig{-=[,1.5]-[,0.75]=[:-20,2]}/
+On peut modifier la taille des molécules en jouant sur la taille de la police ou sur \verb-\setatomsep-, éventuellement sur les deux\footnote{On peut aussi utiliser le deuxième argument optionnel de la commande \texttt{\string\chemfig}, voir page~\pageref{arguments.optionnels}.}, en prenant soin de confiner ces changements à l'intérieur d'un groupe si on veut en limiter la portée :
+\exemple{Modifier la taille des molécules}/\normalsize \chemfig{H-[:30]O-[:-30]H}\par
+\setatomsep{2.5em}\chemfig{H-[:30]O-[:-30]H}\par
+\small \chemfig{H-[:30]O-[:-30]H}\par
+\footnotesize \chemfig{H-[:30]O-[:-30]H}\par
+\scriptsize \chemfig{H-[:30]O-[:-30]H}\par
+\tiny \chemfig{H-[:30]O-[:-30]H}/
+
\section{Atome de départ et d'arrivée}
Un groupe d'atomes peut contenir plusieurs atomes. Mettons que l'on veuille relier le groupe ``ABCD'' au groupe ``EFG'' avec une liaison. \CF calcule quel atome du premier groupe et quel atome de second groupe il faut relier en fonction de l'angle que fait la liaison avec l'horizontale. Si l'angle est compris entre $-90\degres$ et 90\degres{} (modulo 360\degres) ces valeurs étant \emph{non comprises}, alors, la liaison se fait entre le dernier atome du premier groupe et de premier atome du second groupe. Dans tous les autres cas, la liaison se fait par défaut entre le premier atome du premier groupe et le dernier atome du second groupe.
Voici des exemples où les angles sont dans l'intervalle $]-90\;;90[$, et où la liaison se fait donc entre D et E :
\exemple{Atomes liés par défaut}|\chemfig{ABCD-[:75]EFG}\quad
- \chemfig{ABCD-[:-85]EFG}\quad
- \chemfig{ABCD-[1]EFG}|
+\chemfig{ABCD-[:-85]EFG}\quad
+\chemfig{ABCD-[1]EFG}|
Dans les exemples suivants, les angles appartiennent à $[90\;;270]$ et donc la liaison se fait entre A et G :
\exemple[60]{Atomes liés par défaut}|\chemfig{ABCD-[:100]EFG}\quad
- \chemfig{ABCD-[:-110]EFG}\quad
- \chemfig{ABCD-[5]EFG}|
+\chemfig{ABCD-[:-110]EFG}\quad
+\chemfig{ABCD-[5]EFG}|
Dans certains cas, on peut désirer qu'une liaison parte d'autres atomes que ceux calculés par \CF On peut forcer un atome de départ ou un atome d'arrivée avec l'argument optionnel de la liaison. Il faut écrire :
\centerverb/[,,<entier 1>,<entier 2>]/
@@ -623,8 +632,8 @@ Dans certains cas, on peut désirer qu'une liaison parte d'autres atomes que ceu
où \verb-<entier 1>- et \verb-<entier 2>- sont les numéros des atomes de départ et d'arrivée souhaités. Il faut que ces atomes existent, sinon, un message d'erreur sera émis.
\exemple{Atomes liés forcés}|\chemfig{ABCD-[:75,,2,3]EFG}\qquad
- \chemfig{ABCD-[:75,,,2]EFG}\qquad
- \chemfig{ABCD-[:75,,3,2]EFG}|
+\chemfig{ABCD-[:75,,,2]EFG}\qquad
+\chemfig{ABCD-[:75,,3,2]EFG}|
\section{Personnalisation des liaisons}
Il existe un 5\ieme{} et dernier argument optionnel pour les liaisons qui se trouve à droite de la 4\ieme{} virgule :
@@ -633,9 +642,9 @@ Il existe un 5\ieme{} et dernier argument optionnel pour les liaisons qui se tro
Ce \verb-<code tikz>- est passé directement à \TIKZ lorsque la liaison est tracée. On peut y mettre des attributs de couleur comme ``\verb-red-'', de pointillés comme ``\verb-dash pattern=on 2pt off 2pt-'', d'épaisseur comme ``\verb-line width=2pt-'' ou même de décoration si on a chargé une librairie de décoration de \TIKZ. On peut aussi rendre une liaison invisible en écrivant ``\verb-draw=none-''. Si on veut spécifier plusieurs attributs, on utilise la syntaxe de \TIKZ en les séparant par une virgule :
\exemple{Passage de code tikz}|\chemfig{A-[,,,,red]B}\par
- \chemfig{A-[,,,,dash pattern=on 2pt off 2pt]B}\par
- \chemfig{A-[,,,,line width=2pt]B}\par
- \chemfig{A-[,,,,red,line width=2pt]B}|
+\chemfig{A-[,,,,dash pattern=on 2pt off 2pt]B}\par
+\chemfig{A-[,,,,line width=2pt]B}\par
+\chemfig{A-[,,,,red,line width=2pt]B}|
On peut ainsi avoir accès aux nombreuses librairies de décoration de \TIKZ. On peut par exemple utiliser la librairie ``\verb-pathmorphing-'' en écrivant \verb-\usetikzlibrary{decorations.pathmorphing}- dans le préambule pour tracer des liaisons ondulées :
\exemple{Liaison ondulée}|\chemfig{A-[,3,,,decorate,decoration=snake]B}|
@@ -764,8 +773,8 @@ où chaque champ de l'argument optionnel prend sa valeur par défaut s'il est vi
\end{itemize}
\exemple{Cycles et arcs de cercle}|\chemfig{**6(------)}\quad
- \chemfig{**[30,330]5(-----)}\quad
- \chemfig{**[0,270,dash pattern=on 2pt off 2pt]4(----)}|
+\chemfig{**[30,330]5(-----)}\quad
+\chemfig{**[0,270,dash pattern=on 2pt off 2pt]4(----)}|
\subsection{Position angulaire}
\subsubsection{Au départ}
@@ -774,8 +783,8 @@ Comme on le voit dans les exemples ci-dessous, la règle est que l'atome d'attac
Si cette position angulaire ne convient pas, il est possible de spécifier via l'argument optionnel du début de la molécule un autre angle par défaut. Voici un 6-cycle qui a été pivoté de $+30\degres$, de $-30\degres$ puis de $+60\degres$ :
\exemple[55]{Rotation des cycles}|\chemfig{[:30]A*6(------)}\qquad
- \chemfig{[:-30]A*6(------)}\qquad
- \chemfig{[:60]A*6(------)}|
+\chemfig{[:-30]A*6(------)}\qquad
+\chemfig{[:60]A*6(------)}|
\subsubsection{Après une liaison}
Lorsqu'un cycle ne commence pas une molécule et qu'une (ou plusieurs) liaisons ont été auparavant tracées, la position angulaire par défaut change : le cycle est tracé de telle sorte que la liaison qui arrive sur l'atome de rattachement soit la bissectrice du premier et du dernier côté du cycle.
@@ -785,7 +794,7 @@ Voici un cas simple :
La règle reste valable, quelque soit l'angle de la liaison précédente :
\exemple{Liaisons arrivant sur un cycle}|\chemfig{A-[:25]B*4(----)}\vskip5pt
- \chemfig{A=[:-30]*6(=-=-=-)}|
+\chemfig{A=[:-30]*6(=-=-=-)}|
\subsection{Ramifications partant d'un cycle}
Pour faire partir une ramification d'un des sommets du cycle, on emploie la syntaxe déjà vue :
@@ -800,8 +809,8 @@ On peut faire partir une sous molécule du premier sommet du cycle, ainsi que de
Si on souhaite que la liaison partant d'un sommet ne soit pas la bissectrice de ses côtés, on peut jouer sur le paramètre optionnel global ou le paramètre optionnel de la liaison :
\exemple[50]{Ramifications et angles spécifiés}|\chemfig{*5(---([:90]-A-B)--)}\qquad
- \chemfig{*5(---(-[:90]A-B)--)}\qquad
- \chemfig{*5(---([::+0]-A-B)--)}|
+\chemfig{*5(---(-[:90]A-B)--)}\qquad
+\chemfig{*5(---([::+0]-A-B)--)}|
Il est intéressant de constater au troisième exemple que si on spécifie un angle relatif de 0\degres, la liaison se fait dans le prolongement de la liaison qui précédait dans le cycle. C'est la règle de la page \pageref{angle.relatif} qui spécifiait que l'angle de référence était celui de la dernière liaison tracée.
@@ -841,7 +850,7 @@ Deux cas de figure peuvent se présenter, on peut poser :
\item un nœud de dimension nulle sur une liaison en utilisant la syntaxe ``\verb-@{<nom>,<coeff>}-'' placée immédiatement au début de l'argument optionnel de la liaison concernée sans être suivi d'une virgule s'il y a un premier argument optionnel. Dans ce cas, le nœud portera le nom ``\verb-<nom>-'' et le \verb-<coeff>-, compris entre 0 et 1, déterminera où le nœud se situera sur la liaison. Si on utilise ``\verb-@{<nom>}-'', le \verb-<coeff>- prend la valeur de 0.5 par défaut ce qui signifie que le nœud est posé au milieu de la liaison;
\item un nœud sur un atome en utilisant la syntaxe ``\verb-@{<nom>}-'' immédiatement avant l'atome concerné. Dans ce cas, le nœud a exactement le même encombrement que l'atome, il peut notamment être vide et donc avoir des dimensions nulles.
\end{itemize}
-Une fois que la commande \verb-\chemfig- a dessiné la (ou les) molécule(s) et a posé les nœuds avec la syntaxe décrite ci dessus, on peut relier ces nœuds entre eux avec les instructions de \TIKZ. Ces instructions seront placées dans l'argument de la commande \verb-\chemmove-\footnote{En réalité, la commande \texttt{\string\chemmove} met son argument dans un environnement ``tikzpicture'' avec les options ``\texttt{remember picture,overlay}''.} et auront la syntaxe suivante si par exemple, on doit relier un nœud portant le nom ``\verb-<nom1>-'' au nœud portant le nom ``\verb-<nom2>-'' :
+Une fois que la commande \verb-\chemfig- a dessiné la (ou les) molécule(s) et a posé les nœuds avec la syntaxe décrite ci dessus, on peut relier ces nœuds entre eux avec les instructions de \TIKZ. Ces instructions seront placées dans l'argument de la commande \verb-\chemmove-\footnote{En réalité, la commande \texttt{\string\chemmove} place son argument dans un environnement ``tikzpicture'' dans lequel les options sont ``\texttt{remember picture,overlay}''.} et auront la syntaxe suivante si par exemple, on doit relier un nœud portant le nom ``\verb-<nom1>-'' au nœud portant le nom ``\verb-<nom2>-'' :
\centerverb|\chemmove[<opt>]{\draw[<opt tikz>](<nom1>)<link tikz>(<nom2>);}|
\smallskip
@@ -878,7 +887,8 @@ Pour notre nouvelle flèche nous avons fixé les points de contrôle comme suit
\chemabove{X}{\scriptstyle\oplus}}
\chemmove[->]{
\draw(db).. controls +(100:5mm) and +(145:5mm).. (a1);
- \draw[shorten <=3pt,shorten >=1pt](dnl) .. controls +(90:4mm) and +(45:4mm).. (sb);}/
+ \draw[shorten <=3pt,shorten >=1pt](dnl) .. controls +(90:4mm)
+ and +(45:4mm) .. (sb);}/
L'option ``\verb|shorten <=3pt|'' indique que le point de départ de la flèche doit être raccourci de 3~pt de même ``\verb|shorten >=2pt|'' indique que le point d'arrivé doit être raccourci de 2~pt.
@@ -887,11 +897,12 @@ On peut utiliser toute la puissance des instructions de \TIKZ pour modifier le d
\chemrel{<->}
\chemfig{\chemabove{\vphantom{X}}{\ominus}-[::30]=_[::-60]
\chemabove{X}{\scriptstyle\oplus}}
-\chemmove{\draw[-stealth,thin,dash pattern= on 2pt off 2pt,red]
- (db).. controls +(100:5mm) and +(145:5mm)..
- node[sloped,above] {$\pi$} (a1);
+\chemmove{
+ \draw[-stealth,thin,dash pattern= on 2pt off 2pt,red]
+ (db).. controls +(100:5mm) and +(145:5mm)..
+ node[sloped,above] {$\pi$} (a1);
\draw[->, shorten <=3pt, shorten >= 1pt]
- (dnl).. controls +(90:4mm) and +(45:4mm).. (sb);}/
+ (dnl).. controls +(90:4mm) and +(45:4mm).. (sb);}/
Dans l'exemple suivant nous allons voir comment indiquer la position de l'ancre de départ ou d'arrivée. Si nous écrivons
\exemple{Ancre de départ et d'arrivée 1}/\chemfig{@{x1}\lewis{1:,X}}
@@ -925,16 +936,17 @@ Grâce à l'option \verb|remenber picture| qui est passée à tous les environne
\chemfig{R-@{atoc}C([6]-OH)=[@{db}]O}
\chemrel[\chemfig{@{atoh}\chemabove{H}{\scriptstyle\oplus}}]{<>}
\chemmove[->,shorten <=2pt]{
- \draw[shorten >=2pt](dnl).. controls +(90:1cm) and +(north:1cm).. (atoc);
- \draw[shorten >=6pt](db).. controls +(north:5mm) and +(100:1cm).. (atoh);}/
+ \draw[shorten >=2pt](dnl)..controls +(90:1cm)and+(north:1cm)..(atoc);
+ \draw[shorten >=6pt](db)..controls +(north:5mm)and+(100:1cm)..(atoh);}/
L'utilisation de la commande \verb|\chemabove{<code>}{<materiel>}| ne change pas les dimensions de la boite englobante du \verb|<code>|. Pour cette raison on peut rencontrer certaines difficultés pour pointer sur le matériel indiquant la charge portée ($\oplus$ ou $\ominus$). Dans l'exemple ci-dessus la solution est de créer un point de contrôle avec un angle de 110\degres{} à 1~cm de ``atoh'' et de raccourcir la flèche de 6pt. Dans l'exemple suivant, seconde étape de la réaction d'estérification, on peut voir que la flèche peut prendre des formes plus compliquées sans forcément surcharger le code.
\exemple{Estérification: étape 2}/\setatomsep{7mm}
\setchemrel{}{}{5mm}
\chemfig{R-O-C(-[2]R)(-[6]OH)-@{dnl}\lewis{26,O}H}\hspace{1cm}
\chemfig{@{atoh}\chemabove{H}{\scriptstyle\oplus}}
-\chemmove{\draw[->,shorten <=2pt, shorten >=7pt]
- (dnl).. controls +(south:1cm) and +(north:1.5cm).. (atoh);}/
+\chemmove{
+ \draw[->,shorten <=2pt, shorten >=7pt]
+ (dnl).. controls +(south:1cm) and +(north:1.5cm).. (atoh);}/
Nous laissons le soin au lecteur d'écrire la suite\ldots
@@ -953,8 +965,7 @@ Voici une réaction avec les noms sous les molécules :
\chemrel{->}
\chemname{\chemfig{R-C(-[:-30]OR')=[:30]O}}{Ester}
\chemsign{+}
-\chemname{\chemfig{H_2O}}{Eau}
-/
+\chemname{\chemfig{H_2O}}{Eau}/
Il y a quelques contraintes avec cette commande. Pour en pendre conscience, mettons que l'on ait inversé l'acide et l'alcool dans le membre de gauche :
\exemple*{Alignement des noms 1}/
@@ -964,8 +975,7 @@ Il y a quelques contraintes avec cette commande. Pour en pendre conscience, mett
\chemrel{->}
\chemname{\chemfig{R-C(-[:-30]OR')=[:30]O}}{Ester}
\chemsign{+}
-\chemname{\chemfig{H_2O}}{Eau}
-/
+\chemname{\chemfig{H_2O}}{Eau}/
En fait, au dessous de la ligne de base de chaque molécule (en gris clair sur les exemples de ce manuel), pour écrire le \verb-<nom>-, la commande \verb-\chemname- insère 1.5ex${}+{}$\emph{la plus grande des profondeurs\footnote{En langage \TeX{}, la profondeur est la dimension qui s'étend verticalement sous la ligne de base.} des molécules rencontrées}. La macro \verb-\chemnameinit{<argument>}- initialise cette plus grande profondeur avec le contenu de l'\verb-<argument>-. Il convient donc :
\begin{itemize}
@@ -983,8 +993,7 @@ Le code correct est donc d'utiliser \verb-\chemnameinit- avant et après la réa
\chemname{\chemfig{R-C(-[:-30]OR')=[:30]O}}{Ester}
\chemsign{+}
\chemname{\chemfig{H_2O}}{Eau}
-\chemnameinit{}
-/
+\chemnameinit{}/
Enfin, pour écrire un nom sur plusieurs lignes, la commande \verb-\\- rencontrée dans un \verb-<nom>- effectue un retour à la ligne\footnote{Par contre, la commande \texttt{\textbackslash par} est interdite et provoquera une erreur à la compilation.} :
\exemple*{Nom sur 2 lignes}/
@@ -995,8 +1004,7 @@ Enfin, pour écrire un nom sur plusieurs lignes, la commande \verb-\\- rencontrÃ
\chemname{\chemfig{R-C(-[:-30]OR')=[:30]O}}{Ester}
\chemsign{+}
\chemname{\chemfig{H_2O}}{Eau}
-\chemnameinit{}
-/
+\chemnameinit{}/
\newpage
\part{Utilisation avancée}\label{utilisation.avancee}
@@ -1024,11 +1032,11 @@ Une fois le découpage en atomes effectué, la macro \verb-\printatom- est appel
On peut modifier le code de cette macro pour personnaliser l'affichage de atomes. Dans l'exemple ci-dessous, on redéfinit \verb-\printatom- de façon à ce que chaque atome soit contenu dans une boîte rectangulaire :
\exemple{Redéfinition de \string\printatom}/\fboxsep=1pt
-\renewcommand*\printatom[1]{\fbox{\ensuremath{\mathrm{##1}}}}
+\renewcommand*\printatom[1]{\fbox{\ensuremath{\mathrm{#1}}}}
\chemfig{H_3C-C(=[:30]O)(-[:-30]OH)}/
Voici comment la redéfinir pour utiliser de la police ``sf'' du mode math :
-\exemple{Atomes affichés en police ``sf''}/\renewcommand*\printatom[1]{\ensuremath{\mathsf{##1}}}
+\exemple{Atomes affichés en police ``sf''}/\renewcommand*\printatom[1]{\ensuremath{\mathsf{#1}}}
\chemfig{H_3C-C(=[:30]O)(-[:-30]OH)}/
\section{Arguments optionnels}\label{arguments.optionnels}
@@ -1043,11 +1051,12 @@ Par l'intermédiaire du premier argument optionnel, on peut choisir par exemple
\chemfig[line width=1.5pt]{A-B-[2]C}\par\medskip
\chemfig[red]{A-B-[2]C}/
-Avec le second argument optionnel, on peut choisir la couleur des nœud dessinés par \TIKZ, et même modifier l'inclinaison du dessin :
+Avec le second argument optionnel, on peut choisir la couleur des nœud dessinés par \TIKZ, modifier l'inclinaison du dessin ou changer l'échelle :
\exemple{Choix des styles}/\chemfig{A-B-[2]C}\par\medskip
\chemfig[][red]{A-B-[2]C}\par\medskip
\chemfig[dash pattern=on 1pt off 2pt][red]{A-B-[2]C}\par\medskip
-\chemfig[][rotate=20]{A-B-[2]C}/
+\chemfig[][rotate=20]{A-B-[2]C}\par\medskip
+\chemfig[][scale=0.5]{A-B-[2]C}/
\section{Alignement vertical}\label{alignement.vertical}
Dans certains cas de molécules semi développées dont les liaisons sont horizontales, le placement des groupes d'atomes est incorrect.
@@ -1066,7 +1075,7 @@ On peut donc mieux expliquer l'alignement défectueux constaté. Les atomes ``\v
On peut mettre en évidence ce phénomène en rendant visible les boîtes englobantes des atomes où l'on voit clairement que les atomes ``\verb-B-'' et ``\verb-F-'' ont des boîtes englobantes dont la hauteur qui tient compte des hauteurs des atomes précédents :
\exemple*{Placement horizontal et boîtes englobantes}/\Huge\setatomsep{2em}
\fboxsep=0pt
-\renewcommand\printatom[1]{\fbox{\ensuremath{\mathrm##1}}}
+\renewcommand\printatom[1]{\fbox{\ensuremath{\mathrm#1}}}
\chemfig{A^1-B-C-D}\qquad
\chemfig{E_1-F-G-H}/
@@ -1081,14 +1090,14 @@ Aucune solution automatique n'étant satisfaisante, on peut contourner manuellem
\chemfig{A-.-B}\quad
\chemfig{A-\chemskipalign.-B}\par\bigskip
\fboxsep=0pt
-\renewcommand\printatom[1]{\fbox{\ensuremath{\mathrm{##1}}}}
+\renewcommand\printatom[1]{\fbox{\ensuremath{\mathrm{#1}}}}
\chemfig{A-.-B}\quad
\chemfig{A-\chemskipalign.-B}/
Cette commande est à utiliser avec précaution car l'alignement des atomes dans le groupe d'atomes à venir peut être perturbé. En règle générale, tout se passera bien si le groupe d'atomes dans lequel figure \verb-\chemskipalign- contient \emph{un seul atome} dont la hauteur et la profondeur sont \emph{inférieures} à celles de l'atome qui précède et qui suit, et si les atomes qui précèdent et suivent ont leur profondeur et hauteur égales. Voici par exemple la mésaventure qui arrive lorsque le groupe d'atomes contient 2 atomes, ici ``\verb-\chemskipalign.-'' et ``\verb-B-'' :
\exemple{Conséquence de la commande \string\chemskipalign}/\large
\fboxsep=0pt
-\renewcommand\printatom[1]{\fbox{\ensuremath{\mathrm{##1}}}}
+\renewcommand\printatom[1]{\fbox{\ensuremath{\mathrm{#1}}}}
\chemfig{A-\chemskipalign.B-C}/
Cette fonctionnalité peut parfois s'avérer utile. Mettons que l'on veuille dessiner la molécule
@@ -1167,7 +1176,7 @@ Dans tous les cas, si l'alias est déjà défini il est déconseillé de l'écra
Voici un code qui dessine la molécule de pentane. On a pris soin auparavant de définir un alias ``\verb/xy/'' pour le code \verb/CH_2/ :
\exemple{Pentane}|\definesubmol{xy}{CH_2}
- \chemfig{H_3C-!{xy}-!{xy}-!{xy}-CH_3}|
+\chemfig{H_3C-!{xy}-!{xy}-!{xy}-CH_3}|
Ici, la manœuvre n'est pas très intéressante puisque ``\verb/!{xy}/'' est aussi long à taper que le code qu'il remplace.
@@ -1181,7 +1190,7 @@ Mais dans certains cas, cette fonctionnalité fait gagner beaucoup de place dans
Dans la cas où l'argument optionnel est présent, l'alias ``\verb-!<nom>-'' sera remplacé par \verb'<code1>' si la liaison qui arrive sur l'alias vient de droite, c'est à dire si l'angle que fait la liaison entrante est compris entre $-90$\degres{} et 90\degres{}, ces valeurs étant non comprises. Pour tous les autres cas où la liaison arrive de gauche ou verticalement, l'alias sera remplacé par \verb-<code2>-.
-On va définir une séquence de contrôle \verb-\Me- pour ``méthyl'' de telle sorte que l'alias ``\verb-!\Me-'' soit remplacé par ``\verb-H_3C-'' lorsque la liaison arrive de droite et par ``\verb-CH_3-'' lorsqu'elle arrive de gauche. Avec cet alias, on peut observer sur l'exemple que l'on n'a plus à s'occuper de l'angle (que dans certaines molécules plus complexes on ne connait même pas) :
+On va définir une séquence de contrôle \verb-\Me- pour ``méthyl'' de telle sorte que l'alias ``\verb-!\Me-'' soit remplacé par ``\verb-H_3C-'' lorsque la liaison arrive de droite et par ``\verb-CH_3-'' lorsqu'elle arrive de gauche. Avec cet alias, on peut observer sur l'exemple que l'on n'a plus à s'occuper de l'angle (que dans certaines molécules plus complexes on ne connaît même pas) :
\exemple{Alias dual}/\definesubmol\Me[H_3C]{CH_3}
\chemfig{*6((-!\Me)=(-!\Me)-(-!\Me)=(-!\Me)-(-!\Me)=(-!\Me)-)}/
@@ -1195,38 +1204,39 @@ où les \verb-<n1>-\ldots\verb-<ni>- représentent les positions (en multiples d
Cette commande peut également être utilisée en dehors de l'argument de \verb-\chemfig- :
\exemple{La macro \string\lewis}|\lewis{0246,A}\par\medskip
- \lewis{1357,B}\par\medskip
- \chemfig{H-\lewis{26,O}-S(=[2]\lewis{13,O})
- (=[6]\lewis{57,O})-\lewis{26,O}-H}|
+\lewis{1357,B}\par\medskip
+\chemfig{H-\lewis{26,O}-S(=[2]\lewis{13,O})
+(=[6]\lewis{57,O})-\lewis{26,O}-H}|
Si au lieu d'une paire représentée par une ligne, on souhaite deux points, on fait suivre l'entier par ``\verb-:-''. Si on veut dessiner un électron, il suffit de le faire suivre par un ``\verb-.-''. Pour dessiner une lacune, on le fait suivre d'un ``\verb-|-'' :
\exemple{Décorations de Lewis}*\lewis{0:2:4:6:,C}\qquad\lewis{1:3:5:7:,C}\par\bigskip
- \lewis{0.2.4.6.,C}\qquad\lewis{1.3.5.7.,C}\par\bigskip
- \lewis{0:2.4|,X}\par\bigskip
- Ion oxonuim : \chemfig{H-\lewis{5|7,O^+}(-[2]H)-H}*
+\lewis{0.2.4.6.,C}\qquad\lewis{1.3.5.7.,C}\par\bigskip
+\lewis{0:2.4|,X}\par\bigskip
+Ion oxonuim : \chemfig{H-\lewis{5|7,O^+}(-[2]H)-H}*
Toutes les décorations dessinées par l'intermédiaire de \verb-\lewis- ne sont pas comptabilisées dans la boîte englobante de l'atome. Les décorations sont faites en surimpression. On en voit une conséquence dans les deux exemples ci-dessus où les cadre ne semblent ne plus être correctement ajustés au dessin de la molécule qui dépasse légèrement vers le bas. Ceci sera parfois observable dans ce chapitre ``Décorations'' où l'on présente des commandes qui ne modifient pas la boîte englobante.
On peut le constater de façon plus évidente en traçant une \verb-\fbox- autour des atomes décorés :
\exemple{Boîte englobante et macro \string\lewis}*\fboxsep0pt
- \fbox{\lewis{0.2.4.6.,A}}\par\medskip
- \fbox{\lewis{13,B}}*
+\fbox{\lewis{0.2.4.6.,A}}\par\medskip
+\fbox{\lewis{13,B}}*
\label{setlewis}On peut régler plusieurs paramètres à l'aide la macro
-\centerverb|\setlewis{<dim1>}{<dim2>}{<code tikz>}|
+\centerverb|\setlewis[<dim1>]{<dim2>}{<dim3>}{<code tikz>}|
\smallskip
Si un argument est vide, il prend sa valeur par défaut.
\begin{itemize}
- \item \verb-<dim1>- est la distance entre la boîte englobant l'atome et la décoration. Elle vaut 0.4ex par défaut;
- \item \verb-<dim2>- est la longueur du trait représentant la paire d'électrons. Elle vaut 1.5ex par défaut;
+ \item \verb-<dim1>- est la largeur du rectangle représentant une lacune obtenue avec le caractère ``|''. Elle vaut 0.3ex par défaut;
+ \item \verb-<dim2>- est la distance entre la boîte englobant l'atome et la décoration. Elle vaut 0.4ex par défaut;
+ \item \verb-<dim3>- est la longueur du trait représentant la paire d'électrons. Elle vaut 1.5ex par défaut;
\item \verb-<code tikz>- est le code qui sera passé directement à \TIKZ. Ce code est vide par défaut.
\end{itemize}
\exemple{Les paramètres de la macro \string\lewis}*\setlewis{4pt}{1.5em}{red}
- \chemfig{A-\lewis{26,B}-C}\par\bigskip
- \setlewis{}{}{line width=0.4pt}
- \chemfig{A-\lewis{2|,B}-C}*
+\chemfig{A-\lewis{26,B}-C}\par\bigskip
+\setlewis[0.8ex]{}{}{line width=1pt}
+\chemfig{A-\lewis{2|,B}-C}*
\subsection{Empilement de caractères}
Les macros\label{chemabove}
@@ -1281,12 +1291,12 @@ Et en voici une autre :
\section{Utilisation de {\ttfamily\textbackslash chemfig} dans l'environnement \ttfamily tikzpicture}
Il est possible d'appeler la commande \verb-\chemfig- à l'intérieur d'un environnement \verb-tikzpicture- :
\exemple{\textbackslash chemfig dans tikzpicture}|\begin{tikzpicture}[help lines/.style={thin,draw=black!50}]
- \draw[help lines] (0,0) grid (4,4);
- \draw(0,0) -- (2,1);
- \draw(2,2) circle (0.5);
- \node at (1,3) {\chemfig{A=B-[:30]C}};
- \node[draw,red,anchor=base] at(3,2){\chemfig{X>[2,,,,blue]Y}};
- \end{tikzpicture}|
+\draw[help lines] (0,0) grid (4,4);
+\draw(0,0) -- (2,1);
+\draw(2,2) circle (0.5);
+\node at (1,3) {\chemfig{A=B-[:30]C}};
+\node[draw,red,anchor=base] at(3,2){\chemfig{X>[2,,,,blue]Y}};
+\end{tikzpicture}|
\section{Au delà de la chimie}\label{style.noeuds}
Intrinsèquement, \CF est un outil pour tracer des graphes, et cet outil a été programmé pour qu'il soit adapté à la chimie. Dans une certaine mesure, il est possible de détourner \CF de son usage premier pour tracer des organigrammes ou autres schémas se ramenant à des graphes.
@@ -1297,14 +1307,14 @@ Dans cet exemple, on spécifie simplement ``draw,inner sep=2pt'' ce qui a pour e
\exemple*{Un organigramme}/\setnodestyle{draw,inner sep=2pt}
\setbondoffset{0pt}
\setatomsep{75pt}
-\renewcommand\printatom[1]{##1}
+\renewcommand\printatom[1]{#1}
\chemfig{Le chef-[6]Moi(-[4]Eux(-[6]Les autres)(-[7,2]Groupe 1))-Toi(-[:-120,0.5]Lui)(-[:-60,0.5]Elle)}/
Voici un autre organigramme où les nœuds sont circulaires et colorés en bleu cyan :
\exemple*{Schéma de famille}/\setnodestyle{draw,circle,fill=cyan,minimum size=25pt}
\setbondoffset{0pt}
\setatomsep{80pt}
-\renewcommand\printatom[1]{\textsf{##1}}
+\renewcommand\printatom[1]{\textsf{#1}}
\chemfig{Moi(-[:-50,1.2]Frère)(-[:-10]Frère(-[:15]Nièce)(-[:-35]Nièce))
(-[:-155,0.8]Sœur-[:-80]Neveu)(-[:95,1.25]Père(-[:-25,0.8]Oncle)(-[:-65,0.8]Tante))
(-[:135]Mère-[:-95,0.5]Oncle)}/
@@ -1472,14 +1482,133 @@ Il suffit de rajouter les ramifications aux bons sommets. On peut notamment rema
On aurait aussi pu dessiner cette même molécule avec un 5-cycle \emph{régulier}, comme cela se fait parfois :
\exemple{Guanine avec 5-cycle}|\chemfig{*6((-H_2N)=N-*5(-\chembelow{N}{H}-=N-)=-(=O)-HN-[,,2])}|
+\section{Comment faire\ldots}
+\subsection{Écrire un atome en couleur}
+Comme le package \verb-xcolor- est chargé par \TIKZ, lui même chargé par \CF, on peut donc mettre dans le code d'une molécule des instructions de couleur, principalement \verb-\color- et \verb-\textcolor-. Les atomes étant affichés dans des nœuds de \TIKZ qui se comportent comme des boîtes de \TeX{}, tout se passe comme si ces atomes étaient confinés dans un groupe ce qui fait que le changement de couleur reste local à l'atome.
+
+\exemple{Couleurs}/\chemfig{C\color{blue}H_3-C(=[1]O)-[7]O\color{red}H}/
+
+On constate que ce code ne fonctionne pas, toujours à cause de la règle de découpage des atomes qu'utilise \CF : ici, le premier atome de la molécule commence à ``\verb-C-'' et s'étend jusqu'à la prochaine lettre majuscule. Cet atome est donc ``\verb-C\color{blue}-'' et donc, le changement de couleur se fait en fin d'atome et reste sans effet. Il faut forcer \CF à couper le premier atome juste après ``\verb-C-'' avec le caractère ``\verb-|-'' et ensuite, englober \verb-\color{blue}H_3- entre accolades de façons à ce que \CF ne stoppe pas l'atome \no2 avant le ``\verb-H-'' ce qui laisserait le changement de couleur seul et donc inefficace dans un atome :
+
+\exemple{Couleurs}/\chemfig{C|{\color{blue}H_3}-C(=[1]O)-[7]O|{\color{red}H}}/
+
+On peut obtenir le même effet avec \verb-\textcolor- :
+
+\exemple{Couleurs}/\chemfig{C|\textcolor{blue}{H_3}-C(=[1]O)-[7]O|\textcolor{red}{H}}/
+
+Le principal inconvénient est qu'il faut répéter l'opération pour chaque atome que l'on veut colorer, même si ceux-ci sont contigus.
+
+\subsection{Dessiner une liaison courbe}
+Nous avons déjà vu qu'avec la librairie ``\verb-decorations.pathmorphing-'' de \TIKZ, on peut dessiner une liaison ondulée :
+
+\exemple{Liaison ondulée}|\chemfig{A-[,3,,,decorate,decoration=snake]B}
+
+\chemfig{A-[,3,,,decorate,decoration={snake,amplitude=1.5mm,
+ segment length=2.5mm}]B}|
+
+Pour plus de souplesse, on peut aussi poser des nœuds avec le marqueur ``\verb-@-'' et réutiliser ces nœuds après que la molécule ait été tracée pour les relier avec une ligne courbe à l'aide de \verb-\chemmove- :
+
+\exemple{Liaisons courbes}/\chemfig{@{a}A-[,,,,draw=none]@{b}B}
+\chemmove{\draw[-](a)..controls +(45:7mm) and +(225:7mm)..(b);}
+\bigskip
+
+\chemfig{*6(@{a}---@{b}---)}
+\chemmove{\draw[-](a)..controls +(60:3em) and +(240:3em)..(b);}
+\quad
+\chemfig{*6(@{a}---@{b}---)}
+\chemmove{\draw[-](a)..controls +(60:3em) and +(30:1em)..
+ ++(20:2em) ..controls +(210:3em) and +(-120:4em) ..(b);}/
+
+\subsection{Modifier la taille d'une molécule}
+Deux paramètres déterminent par défaut la taille d'une molécule : la taille de la police et le paramètre de \verb-\setatomsep- qui est de 3em par défaut. On peut jouer indépendamment sur ces deux paramètres pour modifier la taille d'une molécule :
+
+\exemple{Modification de la taille}/\definesubmol\hho{H-[:30]O-[:-30]H}
+\chemfig{!\hho}
+
+\setatomsep{2.5em}\chemfig{!\hho}
+
+\scriptsize\chemfig{!\hho}
+
+\tiny\chemfig{!\hho}\setatomsep{5em}\chemfig{!\hho}/
+
+Il est possible d'utiliser le second argument optionnel de \verb-\chemfig- pour agrandir ou réduire une molécule, et ceci globalement, c'est-à-dire que le texte et les liaisons seront réduits selon la même proportion :
+
+\exemple{Modification globale de la taille}/\definesubmol\hho{H-[:30]O-[:-30]H}
+\chemfig{!\hho}
+
+\chemfig[][scale=0.75]{!\hho}
+
+\chemfig[][scale=0.5]{!\hho}
+
+\chemfig[][scale=0.33]{!\hho}/
+
+\subsection{Dessiner un élément de polymère}
+La difficulté réside dans le fait d'afficher des délimiteurs (parenthèses ou crochets) sur des liaisons. Pour cela, on va encore définir avec le caractère ``\verb-@-'' des nœuds globaux que l'on utilisera ensuite pour qu'ils servent d'ancre aux délimiteurs. Nous partirons du principe que le nœud marquant l'emplacement du délimiteur ouvrant porte le nom ``opbr'' et celui du délimiteur fermant le nom ``clbr''.
+
+Nous allons écrire une macro toute simple \verb-\setpolymerbracket- dont les deux caractères qui suivent définissent le délimiteur ouvrant et le délimiteur fermant.
+
+Ensuite, la macro \verb-\makebraces- admettra un argument optionnel de la forme``\verb-<dim up>,<dim down>-''. Ces deux dimensions seront la hauteur et la profondeur des délimiteurs par rapport à la ligne de base. L'argument obligatoire de \verb-\makebraces- sera l'indice placé après le délimiteur fermant.
+
+\exemple*{Polymères}|\newcommand\setpolymerdelim[2]{%
+ \def\delimleft{#1}\def\delimright{#2}}
+
+\def\definedelimdim#1,#2\enddefinedelim{\def\delimht{#1}\def\delimdp{#2}}
+
+\newcommand\makebraces[2][0pt,0pt]{%
+ \definedelimdim#1\enddefinedelim
+ \chemmove{%
+ \node[at=(opbr),yshift=(\delimht-\delimdp)/2]
+ {\llap{$\left\delimleft\strut\vrule height\delimht depth\delimdp width0pt \right.$}};%
+ \node[at=(clbr),yshift=(\delimht-\delimdp)/2]
+ {\rlap{$\left.\strut\vrule height\delimht depth\delimdp width0pt \right\delimright_{#2}$}};%
+ }%
+}
+\setpolymerdelim()
+Polyéthylène:
+\chemfig{\vphantom{CH_2}-[@{opbr,1}]CH_2-CH_2-[@{clbr,0}]}\makebraces{n}
+\bigskip
+
+Polyvinyl chloride:
+\chemfig{\vphantom{CH_2}-[@{opbr,1}]CH_2-CH(-[6]Cl)-[@{clbr,0}]}
+\makebraces[0pt,15pt]{\!\!\!n}
+\bigskip
+
+Nylon 6:
+\chemfig{\phantom{N}-[@{opbr,1}]{N}(-[2]H)-C(=[2]O)-{(}CH_2{)_5}-[@{clbr,0}]}
+\makebraces[20pt,0pt]{}
+\bigskip
+
+Polycaprolactame:\setatomsep{2em}
+\chemfig{[:-30]-[@{opbr,1}]N(-[6]H)-[:30](=[2]O)--[:30]--[:30]--[@{clbr,0}:30]}
+\makebraces[5pt,5pt]{n}
+
+\setpolymerdelim[]
+Polyphénylène sulfide:
+\chemfig{\vphantom{S}-[@{opbr,1}]S-(**6(---(-[@{clbr,0}])---))}
+\makebraces[15pt,15pt]{}|
+
+\subsection{Dessiner le symétrique d'une molécule}\label{retournement}
+Il existe deux commandes \verb-\hflipnext- et \verb-\vflipnext- qui permettent de tracer le symétrique de la prochaine molécule par rapport à un axe horizontal ou vertical. Si on souhaite construire le symétrique de plusieurs molécules, il faut écrire les commandes avant chaque molécule concernée.
+
+\exemple{Symétriques}/\chemfig{H_3C-C(=[:30]O)-[:-30]OH}% original
+
+\vflipnext% dessine le symétrique vertical de :
+\chemfig{H_3C-C(=[:30]O)-[:-30]OH}\medskip
+
+\chemfig{H_3C-C(=[:30]O)-[:-30]OH}% original
+\hflipnext% dessine le symétrique horizontal de :
+\chemfig{H_3C-C(=[:30]O)-[:-30]OH}/
+
\section{Liste des commandes}
Les commandes créées par \CF sont :
\begin{center}
-\begin{tabular}{>\footnotesize l>\footnotesize p{9cm}}\\\hline
+\begin{longtable}{>\footnotesize l>\footnotesize p{9cm}}\\\hline
\hfill\normalsize Commandes\hfill\null &\hfill\normalsize Description\hfill\null\\\hline
\verb-\chemfig<code>-&dessine la molécule dont le dessin est décrit par le \verb-<code>-\\
\verb-\printatom- & cette macro affiche les atomes dans les molécules. Elle peut être redéfinie pour personnaliser l'affichage, voir~\pageref{perso.affichage}\\
\verb-\setnodestyle{<style tikz>}-& à l'aide de la syntaxe de \TIKZ, cette macro définit le style de nœuds contenant les atomes, voir~\pageref{style.noeuds}\\
+\verb-\hflipnext-&la prochaine molécule sera inversée horizontalement\\
+\verb-\vflipnext-&la prochaine molécule sera inversée verticalement\\
\verb-\definesubmol{<nom>}[code1]{<code2>}- & créé un alias \verb-!<nom>- que l'on peut placer dans le code des molécules à dessiner qui remplace le \verb-<code1>- ou le \verb-<code2>- selon l'inclinaison de la dernière liaison. Voir page~\pageref{definesubmol}\\
\verb-\chemskipalign- & Ignore le groupe d'atomes en cours pour le mécanisme d'alignement vertical. Voir page~\pageref{chemskipalign}.\\
\verb-\redefinesubmol{<nom>}{<code>}- & remplace l'alias déjà existant \verb-!<nom>- par le nouveau \verb-<code>-. Voir page~\pageref{redefinesubmol}\\[2ex]\hline
@@ -1501,7 +1630,7 @@ Les commandes créées par \CF sont :
\verb-\chembelow[<dim>]{<txt1>}{txt2}- & écrit le \verb-{txt1}- et positionne le \verb-<txt2>- au dessous en laissant \verb-<dim>- d'espacement vertical. Cette commande ne change pas la boîte englobante de \verb-<txt1>-. Voir page~\pageref{chemabove}\\
\verb-\chemname[<dim>]{<molécule>}{<nom>}- & Affiche le \verb-<nom>- sous la \verb-<molécule>-\\
\verb-\chemnameinit- & Initialise la plus grande profondeur des molécules rencontrées pour avoir un alignement correct de leurs noms\\\hline
-\end{tabular}
+\end{longtable}
\end{center}
\newpage
@@ -1648,25 +1777,16 @@ $\star\quad\star$
\exemple*{Mécanismes réactionnels de la chloration}/\scriptsize
\setbondoffset{1pt}\setatomsep{2em}
-\chemfig{Cl-[4]@{a0}(=[@{a1}:120]@{a2}O)-[:-120](=[:-60]O)-[4]Cl}
-\chemsign{+}
-\chemfig{*6(-=-=(-@{oh1}OH)-=)}
-\chemrel{-stealth}
+\chemfig{Cl-[4]@{a0}(=[@{a1}:120]@{a2}O)-[:-120](=[:-60]O)-[4]Cl}\chemsign{+}
+\chemfig{*6(-=-=(-@{oh1}OH)-=)}\chemrel{-stealth}
\chemfig{*6((-O-[:150](-[@{o0}:150]@{o1}\lewis{6.,O})(-[@{cl0}:60]@{cl1}Cl)-[:240](-[4]Cl)=[6]O)=-=-=-)}
-\chemrel{-stealth}
-\chemfig{*6((-O-[:150](=[2]O)-[:-150](=[6]O)-[:150]Cl)=-=-=-)}
-\chemsign{+}
-\chemfig{HCl}
-\par
-\chemfig{*6(-=*6(-O-*6(-@{o2}(=[@{o3}]@{o4}O)-Cl)=)-=-=)}
-\chemsign{+}
-\chemfig{*6(-=-=(-@{oh2}OH)-=)}
-\chemrel{-stealth}
+\chemrel{-stealth}\chemfig{*6((-O-[:150](=[2]O)-[:-150](=[6]O)-[:150]Cl)=-=-=-)}\chemsign{+}
+\chemfig{HCl}\par
+\chemfig{*6(-=*6(-O-*6(-@{o2}(=[@{o3}]@{o4}O)-Cl)=)-=-=)}\chemsign{+}
+\chemfig{*6(-=-=(-@{oh2}OH)-=)}\chemrel{-stealth}
\chemfig{*6(-=*6(-O-(-(-[@{cl2}:60]@{cl3}Cl)(-[@{o5}:-120]@{o6}\lewis{6.,O})-O-[::-40]*6(=-=-=-))=)-=-=)}
-\kern-3em \chemrel{-stealth}
-\chemfig{[:30]*6(=-(-O-[:-60](=O)-[:-120](=[4]O)-[:-60]O-*6(=-=-=-))=-=-)}
-\kern-3em \chemsign{+}
-\chemfig{HCl}
+\kern-3em \chemrel{-stealth}\chemfig{[:30]*6(=-(-O-[:-60](=O)-[:-120](=[4]O)-[:-60]O-*6(=-=-=-))=-=-)}
+\kern-3em \chemsign{+}\chemfig{HCl}
\chemmove[line width=0.2pt,-stealth,dash pattern = on 2pt off 1pt]{
\draw[shorten <=2pt](a1)..controls+(200:5mm)and+(200:5mm)..(a2);
\draw[shorten >=2pt](oh1.west)..controls+(180:15mm)and+(60:5mm)..(a0);
@@ -1731,7 +1851,7 @@ $\left[\begin{tabular}{c}
/
\endgroup
-\exemple*{Sulfonation de la naphtalène}/\newcommand\putchemnode[1]{\begin{tikzpicture}[remember picture]\node(##1){};\end{tikzpicture}}
+\exemple*{Sulfonation de la naphtalène}/\newcommand\putchemnode[1]{\begin{tikzpicture}[remember picture]\node(#1){};\end{tikzpicture}}
\definesubmol\cycleoplus{-[,0.25,,,draw=none]\oplus}
\definesubmol{so2oh}{S(=[::90]O)(=[::-90]O)-OH}
\footnotesize
@@ -1773,7 +1893,7 @@ $\left[\begin{tabular}{c}
\exemple*{Cristallographie}/\newcommand\disk{\tikz\draw[fill=black,overlay](0,0)circle(2pt);}
\setatomsep{20pt}
-\renewcommand\printatom[1]{##1}
+\renewcommand\printatom[1]{#1}
\setbondoffset{2pt}
\definesubmol{hat}{-[:40,1.5]\disk-[::-30,2]\disk-[::-30,2]\disk-[::-120,2]\disk-[::-30,2]\disk}
\definesubmol{motif}{-[:40,1.5]\disk(-[2,3])-[::-30,2]\disk
diff --git a/Master/texmf-dist/tex/latex/chemfig/chemfig.sty b/Master/texmf-dist/tex/latex/chemfig/chemfig.sty
index 97aedb5067a..a6b34c1241c 100644
--- a/Master/texmf-dist/tex/latex/chemfig/chemfig.sty
+++ b/Master/texmf-dist/tex/latex/chemfig/chemfig.sty
@@ -1,9 +1,9 @@
% __________________________________________________________________
% | |
% | |
-% | chemfig v0.3 |
+% | chemfig v0.3a |
% | |
-% | November 21, 2010 |
+% | January 8, 2011 |
% | |
% |__________________________________________________________________|
%
@@ -14,7 +14,7 @@
% Comments, bug reports and suggestions are welcome.
% Licence : Released under the LaTeX Project Public License v1.3c or
% later, see http://www.latex-project.org/lppl.txt
-% Copyright : Christian Tellechea 2010
+% Copyright : Christian Tellechea 2010-2011
%
% The "chemfig" package consists of the 6 following files:
% chemfig.sty (this file)
@@ -37,10 +37,10 @@
%
% The Current Maintainer of this work is Christian Tellechea
% --------------------------------------------------------------------
-\newcommand*\CF@ver {0.3}
-\newcommand*\CF@date {2010/11/21}
-\newcommand*\CF@fr@date {21 novembre 2010}
-\newcommand*\CF@en@date {November 21, 2010}
+\newcommand*\CF@ver {0.3a}
+\newcommand*\CF@date {2011/01/08}
+\newcommand*\CF@fr@date {8 Janvier 2011}
+\newcommand*\CF@en@date {January 08, 2011}
\newcommand*\CF@package@name{chemfig}
\ProvidesPackage\CF@package@name[\CF@date\space v\CF@ver\space Draw molecule with an easy syntax]
@@ -103,13 +103,37 @@
\newcommand*\definesubmol{\@CF@definesubmoltrue\CF@def@submol}
\newcommand*\redefinesubmol{\@CF@definesubmolfalse\CF@def@submol}
-\newcommand*\CF@def@submol[1]{\@ifnextchar[{\CF@def@submol@i{#1}}{\CF@def@submol@i{#1}[]}}
+\newcommand*\CF@def@submol[1]{%
+ \begingroup
+ \def\CF@tmp@str{#1}%
+ \catcode`[\@ne\catcode`]\tw@
+ \futurelet\CF@toks@a\CF@test@nxttok
+}
+
+\newcommand*\CF@test@nxttok{%
+ \if[\noexpand\CF@toks@a
+ \expandafter\expandafter\expandafter\CF@grab@optalias\expandafter\expandafter\expandafter{\expandafter\CF@tmp@str\expandafter}%
+ \else
+ \CF@swap@fi
+ \expandafter\endgroup
+ \expandafter\CF@def@submol@i\expandafter{\CF@tmp@str}{}%
+ \fi
+}
+
+\newcommand*\CF@grab@optalias[2]{%
+ \endgroup
+ \begingroup
+ \everyeof{\@nil}\endlinechar\m@ne
+ \expandafter\assign@tonil\expandafter\CF@tmp@str\scantokens{#2}%
+ \CF@expand@second{\endgroup\CF@def@submol@i{#1}}\CF@tmp@str
+}
-\def\CF@def@submol@i#1[#2]#3%
-{% #1 nom, #2 = code si liaison arrive de droite , #3 = code si liaison arrive de gauche
+\newcommand*\CF@def@submol@i[3]{% #1 nom, #2 = code si liaison arrive de droite , #3 = code si liaison arrive de gauche
\ifcat\relax\expandafter\noexpand\@car#1\@nil% si #1 est une séquence de contrôle
\expandafter\ifdefined\@car#1\@nil
- \if@CF@definesubmol\PackageWarning\CF@package@name{The macro \expandafter\string\@car#1\@nil\space is already defined, the previous definition is lost.}\fi
+ \if@CF@definesubmol
+ \PackageWarning\CF@package@name{The macro \expandafter\string\@car#1\@nil\space is already defined, the previous definition is lost.}%
+ \fi
\fi
\ifx\@empty#2\@empty
\expandafter\def\@car#1\@nil{\@empty#3}%
@@ -129,10 +153,12 @@
\fi
\else
\ifcsname CF@@#1\endcsname
- \if@CF@definesubmol\PackageWarning\CF@package@name{The submol "#1" is already defined, the previous definition is lost.}\fi
+ \if@CF@definesubmol
+ \PackageWarning\CF@package@name{The submol "#1" is already defined, the previous definition is lost.}%
+ \fi
\fi
\ifx\@empty#2\@empty
- \expandafter\def\csname CF@@#1\endcsname{\@empty#3}%\@empty car sera 1-développé lorsque rencontrée
+ \expandafter\def\csname CF@@#1\endcsname{\@empty#3}% "\@empty" car tout ça sera 1-développé lorsque rencontrée
\else
\expandafter\def\csname CF@@#1\endcsname{%
\romannumeral% donnera le développement souhaité en 1 coup
@@ -480,6 +506,7 @@
\newcommand*\CF@chemfig@i[1]{%
\CF@chemfig@ii{#1}%
\endtikzpicture
+ \let\CF@split@state\z@
}
\newcommand*\CF@chemfig@ii[1]{% #1 est le code de la molécule
@@ -574,7 +601,7 @@
{\let\CF@next@action\endgroup
\CF@draw@bond\CF@bond@type{\CF@bond@outnode}{\CF@hook@cycle}\CF@previous@atomgroup\CF@hook@atomgroup
}%
- {\node[at=(\CF@bond@outnode),shift=(\CF@current@angle:\CF@current@length*\CF@atom@sep)](CF@node){};
+ {\node[at=(\CF@bond@outnode),shift=(\ifcase\CF@split@state\or180-\or-\fi\CF@current@angle:\CF@current@length*\CF@atom@sep)](CF@node){};
\let\CF@previous@angle\CF@current@angle
\let\CF@last@action\tw@
}%
@@ -871,14 +898,19 @@
\ifx\@empty#2\@empty\let\CF@node@strut\@empty\fi
}%
+\newcommand*\hflipnext{\let\CF@split@state\@ne}
+
+\newcommand*\vflipnext{\let\CF@split@state\tw@}
+\let\CF@split@state\z@
+
\newcommand*\CF@draw@atomgroup[3]{% #1=angle d'arrivée de la liaison #2=numero atome sur lequel arrive la liaison #3=groupe d'atomes
\expandafter\let\expandafter\CF@bond@outcontent% assigne le contenu de l'atome d'où part la liaison
\csname
- \ifdefined\CF@bond@outnode
- atom@\expandafter\CF@extract@atom\CF@bond@outnode\@nil
- \else
- @empty%
- \fi
+ \ifdefined\CF@bond@outnode
+ atom@\expandafter\CF@extract@atom\CF@bond@outnode\@nil
+ \else
+ @empty%
+ \fi
\endcsname
\global\advance\CF@cnt@groupnumber\@ne
\let\CF@current@atom\@empty
@@ -932,7 +964,7 @@
\expandafter\node\expandafter[\CF@opt@string](n\number\CF@cnt@groupnumber-\number\CF@cnt@atomnumber){\CF@node@content};%
\let\CF@node@strut\@empty
\advance\CF@cnt@atomnumber\@ne
- \edef\CF@opt@string{anchor=base west,at=(n\number\CF@cnt@groupnumber-\number\numexpr\CF@cnt@atomnumber-1.base east),\CF@node@style}%
+ \edef\CF@opt@string{anchor=base \ifnum\CF@split@state=\@ne east\else west\fi,at=(n\number\CF@cnt@groupnumber-\number\numexpr\CF@cnt@atomnumber-1.base \ifnum\CF@split@state=\@ne west\else east\fi),\CF@node@style}%
\repeat
\CF@cnt@atomnumber\CF@hook@atomnumber
\ifnum\CF@last@action=\tw@% s'il faut tracer une liaison
@@ -943,7 +975,7 @@
\loop
\ifnum\CF@cnt@atomnumber>\@ne
\advance\CF@cnt@atomnumber\m@ne
- \edef\CF@opt@string{anchor=base east,at=(n\number\CF@cnt@groupnumber-\number\numexpr\CF@cnt@atomnumber+1.base west),\CF@node@style}%
+ \edef\CF@opt@string{anchor=base \ifnum\CF@split@state=\@ne west\else east\fi,at=(n\number\CF@cnt@groupnumber-\number\numexpr\CF@cnt@atomnumber+1.base \ifnum\CF@split@state=\@ne east\else west\fi),\CF@node@style}%
\expandafter\expandafter\expandafter\futurelet\expandafter\expandafter\expandafter\CF@toks@a\expandafter\expandafter\expandafter
\CF@gobble@tonil\csname atom@\number\CF@cnt@atomnumber\endcsname\@nil
\expandafter\ifx\string @\CF@toks@a% l'atome courant commence par un "@"
@@ -1033,7 +1065,8 @@
{\ifx|\CF@toks@a\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi
{\expandafter\let\csname atom@\number\CF@cnt@atomingroup\endcsname\CF@current@atom
\let\CF@current@atom\@empty
- \CF@swap@fi\expandafter\CF@draw@atomgroup@i\expandafter{\@gobble#1}}%
+ \CF@swap@fi\expandafter\CF@draw@atomgroup@i\expandafter{\@gobble#1}%
+ }%
{\ifx\@sptoken\CF@toks@a\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi
{\CF@add@tocs\CF@current@atom{ }%
\CF@swap@fi\expandafter\CF@draw@atomgroup@iii\expandafter{\CF@after@space#1\@nil}%
@@ -1051,7 +1084,7 @@
{\expandafter\CF@if@firsttokmatch\expandafter{\@gobble#1}[% un crochet après le "?"
{\expandafter\CF@grab@optarg\@gobble#1\@nil\CF@after@hook}%
{\expandafter\CF@grab@optarg\expandafter[\expandafter]\@gobble#1\@nil\CF@after@hook}%
- \CF@expand@second{\CF@expand@second\CF@if@instr\CF@hook@list}{\expandafter(\CF@hook@currentname)}% crochet déjà défini ?
+ \CF@expand@second{\CF@expand@second\CF@if@instr\CF@hook@list}{\expandafter(\CF@hook@currentname)}% crochet déjà défini ?
{\expandafter\CF@hook@parselist\expandafter{\CF@hook@currentname}% va chercher les caractéristiques du crochet sauvegardé
\CF@edefadd@tocs\CF@hook@drawlist{%
[\CF@hook@currentname,\CF@hook@currentlink,\CF@hook@currenttikz]{\CF@hook@savedcoord}{n\number\CF@cnt@groupnumber-\number\CF@cnt@atomingroup}}%
@@ -1121,7 +1154,7 @@
\def\CF@remove@singlehook#1?#2\@nil{#1#2}
\newcommand*\setlewis[4][0.3ex]{%
- \def\CF@lewis@widthdouble{#1}% TODO à renseigner dans la doc (oublié dans la version 0.3)
+ \def\CF@lewis@widthdouble{#1}%
\ifx\@empty#2\@empty\def\CF@lewis@offset{0.4ex}\else\def\CF@lewis@offset{#2}\fi
\ifx\@empty#3\@empty\def\CF@lewis@length{1.5ex}\else\def\CF@lewis@length{#3}\fi
\ifx\@empty#4\@empty\def\CF@lewis@style{}\else\def\CF@lewis@style{#4}\fi
@@ -1346,4 +1379,11 @@ v0.3 2010/11/21
profondeur rencontrée.
- La commande \lewis a été modifiée de telle sorte que les
dessins des décorations soient proportionnels à la taille de la
- police. \ No newline at end of file
+ police.
+----------------------------------------------------------------------
+v0.3a 2011/01/08
+ - Correction d'un bug dans l'argument optionnel de \definesubmol
+ lorsque celui-ci comporte des crochets.
+ - Mise à jour du manuel en anglais.
+ - Ajout de \vflipnext et \hflipnext pour retourner
+ horizontalement ou verticalement la prochaine molécule. \ No newline at end of file