summaryrefslogtreecommitdiff
path: root/macros/generic/chemfig
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/generic/chemfig
Initial commit
Diffstat (limited to 'macros/generic/chemfig')
-rw-r--r--macros/generic/chemfig/README32
-rw-r--r--macros/generic/chemfig/chemfig-en.pdfbin0 -> 1075975 bytes
-rw-r--r--macros/generic/chemfig/chemfig-en.tex2842
-rw-r--r--macros/generic/chemfig/chemfig-fr.pdfbin0 -> 1101807 bytes
-rw-r--r--macros/generic/chemfig/chemfig-fr.tex2842
-rw-r--r--macros/generic/chemfig/chemfig.sty7
-rw-r--r--macros/generic/chemfig/chemfig.tex2846
-rw-r--r--macros/generic/chemfig/chemfigold.tex2835
-rw-r--r--macros/generic/chemfig/t-chemfig.tex5
9 files changed, 11409 insertions, 0 deletions
diff --git a/macros/generic/chemfig/README b/macros/generic/chemfig/README
new file mode 100644
index 0000000000..03bea23c3e
--- /dev/null
+++ b/macros/generic/chemfig/README
@@ -0,0 +1,32 @@
+___________________________________
+
+ The
+ Chemfig package
+ v1.41
+
+ 2019/05/21
+___________________________________
+
+Maintainer: Christian Tellechea
+E-mail : unbonpetit@netc.fr
+ 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
+
+----------------------------------------------------------------------
+
+This package provides the \chemfig{<code>} command which draws the 2D
+representation of a chemical molecule. The <code> describes the
+drawing using an easy, flexible and intuitive syntax.
+
+The drawing is made with the tikz package. Therefore, Chemfig works
+in dvi or pdf mode.
+
+----------------------------------------------------------------------
+
+Cette extension fournit la commande \chemfig{<code>} qui dessine la
+repr\'esentation en 2D d'une mol\'ecule chimique. Le <code> d\'ecrit
+le dessin selon une syntaxe simple, souple et intuitive.
+
+Le dessin est fait avec l'extension tikz. ChemFig fonctionne donc en
+mode dvi ou pdf.
diff --git a/macros/generic/chemfig/chemfig-en.pdf b/macros/generic/chemfig/chemfig-en.pdf
new file mode 100644
index 0000000000..be0feb42f6
--- /dev/null
+++ b/macros/generic/chemfig/chemfig-en.pdf
Binary files differ
diff --git a/macros/generic/chemfig/chemfig-en.tex b/macros/generic/chemfig/chemfig-en.tex
new file mode 100644
index 0000000000..5b247b3c09
--- /dev/null
+++ b/macros/generic/chemfig/chemfig-en.tex
@@ -0,0 +1,2842 @@
+\documentclass[10pt]{article}
+\usepackage[utf8]{inputenc}
+\usepackage[T1]{fontenc}
+\usepackage[a4paper,margin=2.5cm,head=17pt,headsep=3mm,footskip=10mm]{geometry}
+\usepackage[bottom]{footmisc}
+\usepackage{libertine,amsmath,array,longtable,xspace,fancybox,boites,textcomp,enumitem,chemfig,fancyhdr}
+\usepackage[scaled=0.8]{luximono}
+\usetikzlibrary{decorations.pathmorphing}
+\usetikzlibrary{decorations.markings}
+\usetikzlibrary{matrix}
+\usepackage[protrusion=true,expansion,final,babel=true]{microtype}
+\fancypagestyle{plain}{%
+ \fancyhead[L]{}
+ \fancyhead[C]{}
+ \fancyhead[R]{}
+ \fancyfoot[l]{\tiny Compiled the \today.}
+ \fancyfoot[c]{}
+ \fancyfoot[r]{\thepage}}
+\renewcommand\headrulewidth{0pt}
+
+\makeatletter
+\newcommand\make@car@active[1]{%
+ \catcode`#1\active
+ \begingroup
+ \lccode`\~`#1\relax
+ \lowercase{\endgroup\def~}%
+}
+
+\newif\if@exstar
+
+\newcommand\exemple{%
+ \begingroup
+ \parskip\z@
+ \@makeother\;\@makeother\!\@makeother\?\@makeother\:% neutralise frenchb
+ \@ifstar{\@exstartrue\exemple@}{\@exstarfalse\exemple@}}
+
+\newcommand\exemple@[2][65]{%
+ \medbreak\noindent
+ \begingroup
+ \let\do\@makeother\dospecials
+ \make@car@active\ { {}}%
+ \make@car@active\^^M{\par\leavevmode}%
+ \make@car@active\^^I{\space\space}%
+ \make@car@active\,{\leavevmode\kern\z@\string,}%
+ \make@car@active\-{\leavevmode\kern\z@\string-}%
+ \make@car@active\>{\leavevmode\kern\z@\string>}%
+ \make@car@active\<{\leavevmode\kern\z@\string<}%
+ \exemple@@{#1}{#2}%
+}
+
+\newcommand\exemple@@[3]{%
+ \def\@tempa##1#3{\exemple@@@{#1}{#2}{##1}}%
+ \@tempa
+}
+
+\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
+ \sffamily
+ \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{\sffamily\colorbox{black}{\leavevmode\kern0.25em{\color{white}\footnotesize\strut#2}\kern0.25em}}%
+ }%
+ {\fboxsep5pt
+ \fbox{%
+ $\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}}$%
+ }%
+ }%
+ \fi
+ \medbreak
+ \endgroup
+}
+
+\begingroup
+ \catcode`\<13 \catcode`\>13
+ \gdef\Verb{\relax\ifmmode\hbox\else\leavevmode\null\fi
+ \bgroup
+ \verb@eol@error \let\do\@makeother \dospecials
+ \verbatim@font\@noligs
+ \catcode`\<13 \catcode`\>13 \def<{\begingroup$\langle$\itshape}\def>{\/$\rangle$\endgroup}%
+ \@ifstar\@sverb\@verb}
+\endgroup
+
+\newcommand\falseverb[1]{{\ttfamily\detokenize\expandafter{\string#1}}}
+
+\def\CFengdate@i#1/#2/#3\@nil{\number#3\relax\ifnum#3=1 \ier{}\fi\space \ifcase#2 \or january\or february\or march\or april\or may\or june\or july\or august\or september\or october\or november\or december\fi\space#1}
+\edef\CFengdate{\expandafter\CFengdate@i\CFdate\@nil}
+
+\DeclareRobustCommand\CF{%
+ \textsf{%
+ chem%
+ \if\string b\detokenize\expandafter{\f@series}%
+ \lower0.01em\hbox{\itshape f}\kern-0.06em
+ \else
+ \lower0.045em\hbox{\kern-0.05em \itshape f}\kern0.026em
+ \fi ig%
+ }%
+ \xspace
+}
+\makeatother
+
+\usepackage[english]{babel}
+\def\degres{\ensuremath{{}^\circ}}
+\newcommand\TIKZ{ti\textit kz\xspace}
+\newcommand\molht[1]{\begingroup\parskip3.5pt\par\hfill\chemfig{#1}\hfill\null\par\endgroup}
+\newcommand\boxednode[2]{\fbox{$\mathrm{#1}\vphantom{M_1}$}_{#2}}
+\newcommand\boxedfalseverb[1]{{\fboxsep0pt\fbox{\vphantom|\falseverb{#1}}}}
+\newcommand*\chevrons[1]{\textlangle\textit{#1}\textrangle}
+\newcommand*\CFkey[1]{{\color{teal}\texttt{\detokenize{#1}}}}
+\newcommand*\CFval[1]{{\color{teal}\textlangle\textit{#1}\textrangle}}
+\newcommand*\CFkv[2]{\CFkey{#1}{\color{teal}${}={}$}\CFval{#2}}
+\newcommand*\CFparam[1]{\CFkey{#1}&\ifcat\relax\detokenize\expandafter\expandafter\expandafter{\useKV[chemfig]{#1}}\relax \textlangle\textit{empty}\textrangle\else\texttt{\detokenize\expandafter\expandafter\expandafter{\useKV[chemfig]{#1}}}\fi\\}
+\newcommand*\CFdelimparam[1]{\CFkey{#1}&\ifcat\relax\detokenize\expandafter\expandafter\expandafter{\useKV[CFdelimiters]{#1}}\relax \textlangle\textit{vide}\textrangle\else\texttt{\detokenize\expandafter\expandafter\expandafter{\useKV[CFdelimiters]{#1}}}\fi}
+
+\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}
+\titleformat{\part}[display]{\normalfont\filcenter\sffamily\bfseries}{}{0pt}{\Huge}
+
+\begin{document}
+\topsep=3pt plus5pt minus2pt\relax
+\begin{titlepage}
+ \catcode`!12
+ \begin{tikzpicture}[remember picture,overlay]
+ \shade [left color=blue,right color=white]([yshift=2cm]current page.west) rectangle ([xshift=-1cm]current page.south);
+ \shade [left color=white,right color=blue] ([xshift=1cm]current page.south) rectangle ([yshift=2cm]current page.east);
+ \filldraw[black](current page.north west) rectangle ([yshift=7cm]current page.east);
+ \shade[top color=black,bottom color=blue]([yshift=7cm]current page.east)rectangle([yshift=2.5cm]current page.west);
+ \filldraw[black!55!blue!100]([yshift=2.5cm]current page.east)rectangle([yshift=2cm]current page.west);
+ \end{tikzpicture}
+ \begin{center}
+ \color{white}\sffamily\fontsize{50pt}{50pt}\selectfont\CF\par
+ \Large v\CFver\par
+ \CFengdate\par\bigbreak
+ \normalsize Christian Tellechea\smallbreak
+ \href{mailto:unbonpetit@netc.fr}{\texttt{unbonpetit@netc.fr}}\par\vskip1.5cm
+ \huge A \TeX{} package for drawing molecules%
+ \end{center}
+ \vskip4cm
+ \begin{center}
+ \scriptsize
+ \setchemfig{atom sep=3em}%
+ \chemfig{-[::-30](-[5])(-[7])-[::+60]-[::-60]O-[::+60](=[::-45]O)-[::+90]HN>:[::-60](-[::+60]**6(------))-[::-30](<:[2]OH)-[::-60](=[6]O)-[::+60]O>:[::-60]*7(---?(<[::-120]OH)-(<|[1]CH_3)(<:[::-90]CH_3)-(-[1](<[::+80]HO)-[0](=[::+60]O)-[7](<|[::+130]CH_3)(-[::+75](<|[2]OH)-[::-60]-[::-60](<[::+30]O-[::-90])-[::-60](<[::+90])(<:[::+30]O-[7](-[6]CH_3)=[0]O)-[::-60])-[6]-[5,1.3]?(<:[7]O-[5](=[::-60]O)-[6]**6(------)))=(-[2]CH_3)-)}%
+ \par
+ {\sffamily\small Taxotere}%
+ \end{center}
+ \vskip1.5cm
+ \hfill
+ \hbox to 0pt{\hss\scriptsize
+ \setchemfig{bond offset=1pt,atom sep=2.5em,compound sep=5em,arrow offset=6pt}
+ \schemestart
+ \chemfig{(-[:-150]R')(-[:-30]R)=[2]N-[:30]OH}
+ \arrow{<=>[\chemfig{H^\oplus}]}
+ \chemfig{(-[@{a0}:-150]R')(-[:-30]R)=[2]@{a1}N-[@{b0}:30]@{b1}\chemabove{O}{\scriptstyle\oplus}H_2}
+ \chemmove[red,-stealth,red,shorten <=2pt]{
+ \draw(a0)..controls +(135:2mm) and +(215:4mm).. (a1);
+ \draw(b0)..controls +(120:2mm) and +(180:3mm).. ([yshift=7pt]b1.180);}
+ \arrow{<=>[\chemfig{{-}H_2O}]}[,1.1]
+ \chemleft[{\subscheme[90]{%
+ \chemfig{R'-\chemabove{N}{\scriptstyle\oplus}~C-R}
+ \arrow{<->}[,0.75]
+ \chemfig{R'-\lewis{2:,N}=@{a1}\chemabove{C}{\scriptstyle\oplus}-R}}}\chemright]
+ \arrow{<=>[\chemfig{H_2@{a0}\lewis{0:2:,O}}]}[,1.1]
+ \chemmove[red,-stealth,red,shorten <=3pt]{
+ \draw(a0)..controls+(90:10mm)and+(45:10mm)..([yshift=6pt]a1.45);}
+ \chemfig{*6(R\rlap{$'$}-N=(-R)-\chemabove{O}{\scriptstyle\oplus} H_2)}
+ \arrow{<=>[\chemfig{{-}H^\oplus}]}
+ \chemfig{*6(R\rlap{$'$}-N=(-R)-OH)}
+ \arrow
+ \chemfig{*6(R\rlap{$'$}-\chembelow{N}{H}-(-R)(=[2]O))}
+ \schemestop\hss}\hfill\null
+ \begin{center}
+ \sffamily\small The Beckmann rearrangement%
+ \end{center}
+\end{titlepage}
+\parindent0pt\pagestyle{plain}
+\tableofcontents
+\parskip\medskipamount
+\newpage
+
+\setitemize{leftmargin=3em,topsep=0pt,parsep=0pt,itemsep=0pt}
+\part{Introduction}
+\section{New in v1.4}
+\subsection{Primitive \texttt{\textbackslash expanded}}
+\fbox{\vbox{\hsize\dimexpr\linewidth-2\fboxsep-2\fboxrule\relax\textbf{Important}: As of version 1.41, \CF requires a \TeX{} engine that provides the \texttt{\string\expanded} primitive. If this is not available, an error message will be issued and version 1.4 will be loaded (last version working without the primitive \texttt{\string\expanded}); it is strongly recommended that you update your \LaTeX{} distribution in order to take advantage of the newer \TeX{} engines that provide for the use of this new primitive.}}\medbreak
+
+\subsection{Position and rotation of delimiters}
+The new key \CFkey{h align} for delimiters allows, when set to \CFval{false}, to no longer automatically align delimiters horizontally. When the delimiters are no longer on the same horizontal, they can be rotated automatically by setting the key \CFkey{auto rotate} to \CFval{true}. You can override this automatic setting and choose the rotation angle with the key \CFkey{rotate}. See page~\pageref{polymerdelim}.
+
+\subsection{Private char}
+In the code of \CF, the character used in the name of private macros is "\verb|_|" (underscore) and no longer "\verb|@|" (arobe): the prefix of private macros of \CF is "\verb|\CF_|". The majority of \CF users should not be affected by this change, but the development or maintenance of specific codes such as those presented in the "Arrow customization" section on page~\pageref{definearrow} which uses private macros should take this catcode change into account; this will require an \emph{update of macros names} for those who have used private macros from \CF. To allow "\verb|_|" in macro names, we must execute the order "\verb|\catcode`\_=11|" and then, to return to a normal state run "\verb|\catcode`\_=8|".
+
+\subsection{Char \#}
+All those who program in \TeX{} know the extreme precautions that must be taken before using the "\verb|#|" character. This character is allowed in the code representing the molecule, but for internal operating reasons at \TeX, it will be doubled if the command \verb|\chemfig| is in the argument of a macro (like \verb|\fbox| in the example below). To avoid this doubling, we can write \verb|\#| or use the macro \verb|\CFhash|:
+
+\exemple{Char \#}/\setchemfig{atom sep=5em}\fboxsep=1pt
+1) \chemfig{A#-B_#-C^#}\par
+2) \fbox{\chemfig{A#-B_#-C^#}}\par
+3) \fbox{\chemfig{A\#-B_\#-C^\#}}\par
+4) \fbox{\chemfig{A\CFhash-B_\CFhash-C^\CFhash}}/
+
+For the macro \verb|\definesubmol|, the character \verb|#| is also allowed, but its use is more complex because it covers several cases that are examined on page~\pageref{definesubmol}.
+
+\subsection{Old macros and new syntax}
+Macros previously used to set the parameters of \CF are abandoned, are no longer defined and therefore, \emph{will result in a compilation error} if they are executed:
+\begin{center}
+ \begin{tabular}{*3l}
+ \verb-\setcrambond-&\verb-\setatomsep-&\verb-\enablefixedbondlength-\\
+ \verb-\disablefixedbondlength-&\verb-\setbondoffset-&\verb-\setdoublesep-\\
+ \verb-\setangleincrement-&\verb-\setnodestyle-&\verb-\setbondstyle-\\
+ \verb-\setlewis-&\verb-\setlewisdist-&\verb-\setstacksep-\\
+ \verb-\setcompoundstyle-&\verb-\setarrowdefault-&\verb-\setandsign-\\
+ \verb-\setarrowoffset-&\verb-\setcompoundsep-&\verb-\setarrowlabelsep-\\
+ \verb-\enablebondjoin-&\verb-\disablebondjoin-&\verb-\schemedebug-
+ \end{tabular}
+ \end{center}
+Now, to set the parameters of \CF we have the choice:
+\begin{itemize}
+ \item the macro \Verb|\setchemfig{<keys>=<values>}| sets the parameters according to the key/value method for the rest of the document;
+ \item the macro \Verb|\chemfig[<keys>=<values>]| receives in its optional argument the parameters valid only for this molecule;
+ \item the macro \verb|\resetchemfig| restores the parameters to their default values.
+\end{itemize}
+
+The complete list of parameters and their default values is shown page~\pageref{listeparametres}.
+
+Starred syntax \verb|\chemfig*| is no longer allowed. To specify a constant length of bonds, use the key \CFkey{fixed length} and set it to \CFval{true}, see page~\pageref{longueur.liaison}.
+
+\subsection{Macros \texttt{\textbackslash lewis} and \texttt{\textbackslash Lewis}}
+These two macros also have a slight syntax change. Their optional argument between brackets is no longer intended to receive the diagonal spacing coefficient, but \Verb|<<key>=values>| so that the parameters can be set for each macro call. See page~\pageref{lewis}.
+
+\section{Presenting \protect\CF}
+To use this package, start by adding the following code to the preamble:
+\begin{itemize}
+ \item {\color{blue}\verb-\input chemfig.tex-} with $\varepsilon$\TeX;
+ \item {\color{blue}\verb-\usepackage{chemfig}-} with \LaTeX;
+ \item {\color{blue}\verb-\usemodule[chemfig]-} with Con\TeX t\falseverb*{ConTeXt@Con\protect\TeX{}t}.
+\end{itemize}
+
+In all cases, the \TIKZ package, if not loaded before, is loaded by \CF.
+
+The most important command for drawing molecules is \Verb|\chemfig{<code>}|. The argument \verb|code| is a set of characters describing the structure of the molecule according to the rules which are described in this manual.
+
+Care has been taken to make it possible to draw the greatest possible number of molecular configurations, while maintaining a simple, flexible, and intuitive syntax. Despite this, the \Verb-<code>- which describes the 2D structure of the molecule increases in complexity in proportion to that of the molecule being drawn.
+
+The command \verb|\chemfig| draws a molecule using the commands provided by the \TIKZ package, placed inside a \verb|tikzpicture| environment. The choice of \TIKZ implies that:
+\begin{itemize}
+\item the user has a choice of compilation method: pdf\LaTeX{} can be used equally well in \falseverb{dvi mode} (tex $\longrightarrow$ dvi $\longrightarrow$ ps $\longrightarrow$ pdf) or in \falseverb{pdf mode} (tex $\longrightarrow$ pdf). In effect \TIKZ, via the underlying \falseverb{pgf}, gives identical graphical results in the two modes;
+\item the \falseverb{bounding box} is automatically calculated by \TIKZ and the user need not worry about any overlap with the text. However, care must be taken with alignment when the molecule is drawn in a paragraph. In the following example, we have drawn the \falseverb{bounding box} for the molecule: {\fboxsep0pt \fbox{\chemfig{H_3C-C(-[:-30]OH)=[:30]O}}}.
+\end{itemize}
+
+\section{Acknowledgment}
+This package has seen the light of day thanks to the assistance of Christophe \textsc{Casseau}, who had the idea. I thank him for his help before writing the code and for the tests he carried out.
+\medbreak
+I also want to warmly thank Theo \textsc{Hopman} for offering to translate this manual into English.
+\newpage
+
+\part{Operation of \protect\CF}
+This part is devoted to describing the most common features of \CF. The user will find here explanations sufficient to draw most molecules. The presentation of features is done from a theoretical angle, and the goal of this part is not to draw real molecules but to give the user a formal description of the functionality of \CF. The ``Advanced usage'', page~\pageref{utilisation.avancee}, will be more practical and will illustrate advanced features for the most demanding uses. It will also highlight methods of building real molecules, page~\pageref{exemples.commentes}. Finally, the last part will give examples of molecules and the code used to draw them.
+
+\section{The \texttt{\textbackslash chemfig} macro}
+The macro \verb|\chemfig| has the following syntax
+\begin{center}
+ \Verb|\chemfig[list of <keys>=<values>]{<molecule code>}|
+\end{center}
+The optional argument in square brackets sets the parameters used for this molecule. It should be noted that the parameters are only modified for the current molecule and will be restored to their previous values after the macro has been executed. To permanently modify parameters, the macro \Verb|\setchemfig{<key>=<values>}| should be used.
+
+Here is the complete list of parameters as well as their default values\label{listeparametres}. It should be noted that the \chevrons{keys} from \CFkey{scheme debug} included to the end of the list concern reaction schemes and make no sense in the optional argument of the macro \verb|\chefig| where they are simply ignored:\par
+\leavevmode\hfill
+\begin{minipage}[t]{.45\linewidth}
+ \begin{longtable}{rl}\hline
+ \chevrons{keys} & default \chevrons{values}\\\hline\endhead
+ \CFparam{chemfig style}
+ \CFparam{atom style}
+ \CFparam{bond join}
+ \CFparam{fixed length}
+ \CFparam{cram rectangle}
+ \CFparam{cram width}
+ \CFparam{cram dash width}
+ \CFparam{cram dash sep}
+ \CFparam{atom sep}
+ \CFparam{bond offset}
+ \CFparam{double bond sep}
+ \CFparam{angle increment}
+ \CFparam{node style}
+ \CFparam{bond style}
+ \CFparam{lewis | width}
+ \CFparam{lewis sep}
+ \CFparam{lewis length}
+ \CFparam{lewis style}
+ \CFparam{lewis dist}\hline
+ \end{longtable}
+\end{minipage}\hfill
+\begin{minipage}[t]{.45\linewidth}
+ \begin{longtable}{rl}\hline
+ \chevrons{clés} & \chevrons{valeurs} par défaut\\\hline\endhead
+ \CFparam{lewis radius}
+ \CFparam{lewis diag coeff}
+ \CFparam{cycle radius coeff}
+ \CFparam{stack sep}
+ \CFparam{scheme debug}
+ \CFparam{compound style}
+ \CFparam{compound sep}
+ \CFparam{arrow offset}
+ \CFparam{arrow angle}
+ \CFparam{arrow coeff}
+ \CFparam{arrow style}
+ \CFparam{arrow double sep}
+ \CFparam{arrow double coeff}
+ \CFparam{arrow double harpoon}
+ \CFparam{arrow label sep}
+ \CFparam{arrow head}
+ \CFparam{+ sep left}
+ \CFparam{+ sep right}
+ \CFparam{+ vshift}\hline
+ \end{longtable}
+\end{minipage}\hfill\null\bigbreak
+
+The \Verb|<molecule code>| contains instructions for drawing the molecule according to a syntax that will be explained in this document. There are no restrictions on the characters accepted in the code:
+\begin{itemize}
+ \item all catcode 11 or 12 characters, i. e. upper and lower-case letters, numbers, mathematical operators (\texttt+ \texttt- \texttt* \texttt/ \texttt=), punctuation marks whether active or not (\verb|.| \verb|,| \verb|;| \verb|:| \verb|!| \verb|?| \verb|'| \verb|`| \verb|"| \verb-|-), parenthesis and brackets;
+ \item more special characters such as "\verb|~|", "\verb|#|"\footnote{To avoid that \texttt\# is doubled when the macro \texttt{\textbackslash chemfig} is in the argument of a macro, instead of \texttt\#, the macro \texttt{\textbackslash\#} or the macro \texttt{\textbackslash CFhash} can be used.} as well as "\verb|^|" and "\verb|_|" which have their normal mathematical mode properties;
+ \item spaces, but these are ignored by default because the atoms are composed in mathematical mode;
+ \item the "\verb|{|" and "\verb|}|" braces that have their normal behavior as group markers or macro argument delimiters;
+ \item macros.
+\end{itemize}
+
+In any case, \CF will place \emph{on the current baseline the first atom encountered}, whether it is empty or not. In the examples in this document, the baseline is drawn in light grey.
+
+\section{Groups of atoms}
+Drawing a molecule consists inherently of connecting groups of atoms with lines. Thus, in the molecule \chemfig{O=O}, there are two groups of atoms, each consisting of a single atom ``O''.
+
+{\fboxsep1pt
+However, in this molecule
+\molht{H_3C-C(-[:-30]OH)=[:30]O}
+there are four groups of atoms: ``$\mathrm{H_3C}$'', ``C'', ``O'' and ``OH''. For reasons which we shall see later, \CF splits each group into single atoms. Each atom extends up to the next capital letter or one of these special characters: {\ttfamily \boxedfalseverb{-} \boxedfalseverb{=} \boxedfalseverb{~} \boxedfalseverb{(} \boxedfalseverb{!} \boxedfalseverb{*} \boxedfalseverb{<} \boxedfalseverb{>} \boxedfalseverb{@}}. \CF ignores all characters inside braces when splitting groups into atoms.
+
+Therefore the first group of atoms ``$\mathrm{H_3C}$'' is split into two atoms: $\boxednode{H_3}{}$ and $\boxednode C{}$. In terms of chemistry, of course, these are not real atoms; $\mathrm{H_3}$, for example, consists of three hydrogen atoms. In what follows the word atom refers to \CF's definition. Thus \CF sees the preceding molecule as follows:
+\renewcommand*\printatom[1]{\fbox{\ensuremath{\mathrm{#1}}}}
+\molht{H_3C-C(=[:30]O)(-[:-30]OH)}}
+
+A space is ignored when at the beginning of a group of atoms.
+
+\section{Different types of bonds}
+For \CF, bonds between two atoms are one of nine types, represented by the characters \boxedfalseverb-, \boxedfalseverb=, \boxedfalseverb~, \boxedfalseverb>, \boxedfalseverb<, \boxedfalseverb{>:}, \boxedfalseverb{<:}, \boxedfalseverb{>|} and \boxedfalseverb{<|} :\label{types.liaisons}
+\begin{center}
+\begin{tabular}{>{\centering\arraybackslash}m{1.7cm}>{\centering\arraybackslash}m{3cm}>{\centering\arraybackslash}m{2cm}m{4cm}}
+\hline
+Bond \#&Code &Result &Bond type\\\hline
+1 &\verb+\chemfig{A-B}+ &\chemfig{A-B} &Single\\
+2 &\verb+\chemfig{A=B}+ &\chemfig{A=B} &Double\\
+3 &\verb+\chemfig{A~B}+ &\chemfig{A~B} &Triple\\
+4 &\verb+\chemfig{A>B}+ &\chemfig{A>B} &right Cram, plain\\
+5 &\verb+\chemfig{A<B}+ &\chemfig{A<B} &left Cram, plain\\
+6 &\verb+\chemfig{A>:B}+&\chemfig{A>:B}&right Cram, dashed\\
+7 &\verb+\chemfig{A<:B}+&\chemfig{A<:B}&left Cram, dashed\\
+8 &\verb+\chemfig{A>|B}+&\chemfig{A>|B}&right Cram, hollow\\
+9 &\verb+\chemfig{A<|B}+&\chemfig{A<|B}&left Cram, hollow\\\hline
+\end{tabular}
+\end{center}
+\label{double bond sep}The \chevrons{key} \Verb-double bond sep=<dim>- adjusts the spacing between the lines in double or triple bonds. This spacing is 2pt by default.
+
+\label{longueur.liaison}We must understand that when a bond is made between two atoms, these atoms are contained within invisible rectangular boxes. The centers of these two rectangles are separated by an adjustable distance $\Delta$ called the ``interatomic distance''. Furthermore, bonds do not connect to the exact edges of the rectangles: a length $\delta$, also adjustable, separates the edges of the rectangles and the beginning and end of the bond line. The rectangular boxes are made visible in the diagram below to help understanding.
+\begin{center}
+\begin{tikzpicture}[every node/.style={anchor=base,inner sep=1.5pt,outer sep=0pt,minimum size=0pt},baseline]
+ \node[draw] at(0,0)(aa){\huge A};
+ \node[draw]at(4,0)(bb){\huge B};
+ \path[shorten <=10pt,shorten >=10pt,draw](aa)--(bb)coordinate[pos=0](al) coordinate[pos=1](bl);
+ \node[draw,circle,fill,blue,minimum size=1.5pt,inner sep=0pt]at(al){};
+ \node[draw,circle,fill,blue,minimum size=1.5pt,inner sep=0pt]at([xshift=10pt]al){};
+ \node[draw,circle,fill,blue,minimum size=1.5pt,inner sep=0pt]at(bl){};
+ \node[draw,circle,fill,blue,minimum size=1.5pt,inner sep=0pt]at([xshift=-10pt]bl){};
+ \draw[blue,dash pattern=on 1pt off 1pt](bl)--([yshift=0.7cm]bl);
+ \draw[blue,dash pattern=on 1pt off 1pt]([xshift=-10pt]bl)--([xshift=-10pt,yshift=0.7cm]bl);
+ \draw[stealth-stealth]([yshift=0.6cm]bl.center)--([xshift=-10pt,yshift=0.6cm]bl.center) node [midway,above,draw=none]{$\delta$};
+ \draw[blue,dash pattern=on 1pt off 1pt](al)--([yshift=0.7cm]al);
+ \draw[blue,dash pattern=on 1pt off 1pt]([xshift=10pt]al)--([xshift=10pt,yshift=0.7cm]al);
+ \draw[stealth-stealth]([yshift=0.6cm]al.center)--([xshift=10pt,yshift=0.6cm]al.center) node [midway,above,draw=none]{$\delta$};
+ \node[draw,circle,fill,red,minimum size=2pt,inner sep=0pt]at(aa){};
+ \node[draw,circle,fill,red,minimum size=2pt,inner sep=0pt]at(bb){};
+ \draw[stealth-stealth]([yshift=1cm]aa.center)--([yshift=1cm]bb.center) node [midway,above,draw=none] {$\Delta$} ;
+ \draw[red,dash pattern=on 2pt off2pt](aa.center)--([yshift=1.1cm]aa.center);
+ \draw[red,dash pattern=on 2pt off2pt](bb.center)--([yshift=1.1cm]bb.center);
+\end{tikzpicture}
+\end{center}
+
+\label{atom sep}The \chevrons{key} \CFkv{atom sep}{dim} adjusts the interatomic distance $\Delta$. This setting, like all other settings, affects all the following molecules.
+
+\exemple{Interatomic distance}|\chemfig[atom sep=2em]{A-B}\par
+\chemfig[atom sep=50pt]{A-B}|
+
+\label{bond offset}The \chevrons{key} \CFkv{bond offset}{dim} sets the spacing $\delta$ between the bond line and the atom. Its default value is 2pt.
+\exemple{Trimming bonds}|\chemfig[bond offset=0pt]{A-B}\par
+\chemfig[bond offset=5pt]{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}/
+
+\label{bond style}The \chevrons{key} \CFkv{bond style}{tikz code} sets the style for all the bonds drawn thereafter. The \CFval{tikz code} is empty by default. To custom a single bond, see page~\pageref{perso-liaisons}.
+\exemple{Style of bonds}/\chemfig[bond style={line width=1pt,red}]{A-B=C>|D<E>:F}/
+
+\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{Fine adjustment of bond shortening}/\setchemfig{bond offset=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
+
+By default, all atoms within groups of atoms are typeset in \falseverb{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}|
+
+There are settings specifically for Cram bonds:
+\begin{itemize}
+ \item \CFkv{cram width}{dim} is the size of the base of the triangle, and is 1.5pt by default;
+ \item \CFkv{cram dash width}{dim} is the thickness of the dots, and is 1pt by default;
+ \item \CFkv{cram dash sep}{dim} is the spacing between the dots, and is 2pt by default.
+\end{itemize}
+
+Here is an example where the three dimensions are changed:
+
+\exemple{Modified Cram bonds}-\chemfig[cram width=10pt,
+ cram dash width=0.4pt,
+ cram dash sep=1pt]{A>B>:C>|D}-
+
+\section{Bond angle}
+Each bond takes an optional argument in brackets. This optional argument can adjust every aspect of a bond, and consists of five optional fields separated by commas. The first of these fields defines the bond angle. Angles increase counterclockwise, and are relative to the horizontal. If the angle field is empty, the angle takes its default value of 0\degres. We will see later how to change this default.
+
+There are several ways of specifying the bond angle.
+\subsection{Predefined angles}
+When the angle field contains an integer, this represents the angle the bond makes relative to the horizontal, in multiples of 45\degres. For example, \verb-[0]- specifies an angle of 0\degres, \verb-[1]- is 45\degres, and so on.
+
+\exemple{Predefined angles}|\chemfig{A-B-[1]C-[3]-D-[7]E-[6]F}|
+
+These angles remain valid if the atoms are empty, and this is the case for all the features we will see below:
+\exemple{Predefined angles with empty groups}|\chemfig{--[1]-[3]--[7]-[6]}|
+
+For those who find this "ugly\footnote{See \texttt{\detokenize{http://tex.stackexchange.com/questions/161796/ugly-bond-joints-in-chemfig detokenize}}}", it is now possible connect the single bonds with a slightly increased compilation time. The boolean \chevrons{key} \CFkv{bond join}{boolean} macro enables this feature when \CFval{true} and disables it when \CFval{false}, which is the better behavior, set by default.
+
+\exemple{Connecting bonds}/\setchemfig{bond style={line width=3pt}}
+\chemfig{-[1]-[7]} et
+\chemfig[bond join=true]{-[1]-[7]}/
+
+\label{angle increment}The \chevrons{key} \CFkv{angle increment}{angle} sets the default angle used to calculate the angle of a bond:
+
+\exemple{Set the predefined angle}/Default (45) : \chemfig{-[1]-[-1]-[1]-[-1]}
+
+Angle of 30 : \chemfig[angle increment=30]{-[1]-[-1]-[1]-[-1]}/
+
+\subsection{Absolute angles}
+If one wishes to specify an angle in degrees relative to the horizontal, then the optional angle field must take this form: \Verb-[:<absolute angle>]-. If necessary, the \Verb-<absolute angle>- is reduced to the interval $[0,360)$:
+\exemple{Absolute angles}/\chemfig{A-[:30]B=[:-75]C-[:10]D-[:90]>|[:60]-[:-20]E-[:0]~[:-75]F}/
+
+\subsection{Relative angles}\label{angle.relatif}
+It is often useful to specify a bond angle relative to the preceding bond. This syntax must be then be used: \Verb-[::<relative angle>]-. The sign of the \Verb-<relative angle>- can be omitted if it is a \verb-+-.
+
+Here is a molecule where the first bond has an absolute angle of $-5\degres$, and the rest of the bond angles are incremented by 20\degres:
+\exemple{Result of relative angles}|\chemfig{A-[:-5]-[::+20]-[::20]B-[::+20]-[::20]C-[::20]}|
+
+One can ``break'' a chain of relative angles by putting an absolute or predefined angle where desired. Here, atom ``B'' is followed by a bond at an absolute angle of 315\degres.
+\exemple{Result of relative angles followed by absolute}|\chemfig{A-[:-5]-[::20]-[::20]B-[7]-[::20]C-[::20]}|
+
+\section{Length of a bond}
+Rather than speaking of length of a bond, we should use the term interatomic spacing. If effect, only the interatomic spacing is adjustable with \falseverb{atom sep} as we have seen on page~\pageref{longueur.liaison}. Once this parameter is set, the length of a bond depends on the content of atoms and, to a lesser extent, the angle the bond makes with the horizontal. It should be obvious that two ``slimmer'' atoms will have larger edge separations than two which are larger. This can be seen easily in the following example where an ``I'' atom is narrower than an ``M'' atom, which means that the bond between the ``I'' atoms is longer than that between the ``M'' atoms:
+\exemple{Influence of the size of atoms}|\chemfig{I-I}\par
+\chemfig{M-M}|
+
+This aspect of the size of atoms becomes particularly acute when the atom involves subscripts or superscripts. In this example, the bond is extremely short, to the point of confusion with a negative sign $-$:
+\exemple{Too-short bond}|\chemfig{A^{++}_{2}-B^{-}_3}|
+
+It is important to note that the exponent \verb+-+ is \emph{put inside braces}. If this were not done, \CF would stop the atom on this character, which is a bond character. The atom would then be ``\verb-B^-'', which would lead to unexpected results.
+
+It is possible to change the behavior of \CF about the interatomic spacing. Indeed, when the \verb+\chemfig+ macro is immediately followed by a star, the \chevrons{key} \CFkey{atom sep}no longer defines the distance between the centers of atoms, denoted $\Delta$, but \emph{length of the bonds}. Consequently, the bonds have fixed lengths while the distance between the centers of the atoms is variable and depends on their size. Here is the diagram on page~\pageref{longueur.liaison} and what becomes with the two boolean values of key \CFkey{fixed length}:
+
+\begin{center}
+\begin{tabular}{c@{\kern2cm}c}
+ \CFkv{fixed length}{false}&\CFkv{fixed length}{true}\\[2ex]
+ \begin{tikzpicture}[every node/.style={anchor=base,inner sep=1.5pt,outer sep=0pt,minimum size=0pt},baseline]
+ \node[draw] at(0,0)(aa){\huge A};
+ \node[draw]at(4,0)(bb){\huge B};
+ \path[shorten <=10pt,shorten >=10pt,draw](aa)--(bb)coordinate[pos=0](al) coordinate[pos=1](bl);
+ \node[draw,circle,fill,blue,minimum size=1.5pt,inner sep=0pt]at(al){};
+ \node[draw,circle,fill,blue,minimum size=1.5pt,inner sep=0pt]at([xshift=10pt]al){};
+ \node[draw,circle,fill,blue,minimum size=1.5pt,inner sep=0pt]at(bl){};
+ \node[draw,circle,fill,blue,minimum size=1.5pt,inner sep=0pt]at([xshift=-10pt]bl){};
+ \draw[blue,dash pattern=on 1pt off 1pt](bl)--([yshift=0.7cm]bl);
+ \draw[blue,dash pattern=on 1pt off 1pt]([xshift=-10pt]bl)--([xshift=-10pt,yshift=0.7cm]bl);
+ \draw[stealth-stealth]([yshift=0.6cm]bl.center)--([xshift=-10pt,yshift=0.6cm]bl.center) node [midway,above,draw=none]{$\delta$};
+ \draw[blue,dash pattern=on 1pt off 1pt](al)--([yshift=0.7cm]al);
+ \draw[blue,dash pattern=on 1pt off 1pt]([xshift=10pt]al)--([xshift=10pt,yshift=0.7cm]al);
+ \draw[stealth-stealth]([yshift=0.6cm]al.center)--([xshift=10pt,yshift=0.6cm]al.center) node [midway,above,draw=none]{$\delta$};
+ \node[draw,circle,fill,red,minimum size=2pt,inner sep=0pt]at(aa){};
+ \node[draw,circle,fill,red,minimum size=2pt,inner sep=0pt]at(bb){};
+ \draw[stealth-stealth]([yshift=1cm]aa.center)--([yshift=1cm]bb.center) node [midway,above,draw=none] {$\Delta$} ;
+ \draw[red,dash pattern=on 2pt off2pt](aa.center)--([yshift=1.1cm]aa.center);
+ \draw[red,dash pattern=on 2pt off2pt](bb.center)--([yshift=1.1cm]bb.center);
+ \end{tikzpicture}
+ &
+ \begin{tikzpicture}[every node/.style={anchor=base,inner sep=1.5pt,outer sep=0pt,minimum size=0pt},baseline]
+ \node[draw] at(0,0)(aa){\huge A};
+ \node[draw]at(5,0)(bb){\huge B};
+ \path[shorten <=10pt,shorten >=10pt,draw](aa)--(bb)coordinate[pos=0](al) coordinate[pos=1](bl);
+ \node[draw,circle,fill,blue,minimum size=1.5pt,inner sep=0pt]at(al){};
+ \node[draw,circle,fill,blue,minimum size=1.5pt,inner sep=0pt]at([xshift=10pt]al){};
+ \node[draw,circle,fill,blue,minimum size=1.5pt,inner sep=0pt]at(bl){};
+ \node[draw,circle,fill,blue,minimum size=1.5pt,inner sep=0pt]at([xshift=-10pt]bl){};
+ \draw[blue,dash pattern=on 1pt off 1pt](bl)--([yshift=0.7cm]bl);
+ \draw[blue,dash pattern=on 1pt off 1pt]([xshift=-10pt]bl)--([xshift=-10pt,yshift=0.7cm]bl);
+ \draw[stealth-stealth]([yshift=0.6cm]bl.center)--([xshift=-10pt,yshift=0.6cm]bl.center) node [midway,above,draw=none]{$\delta$};
+ \draw[blue,dash pattern=on 1pt off 1pt](al)--([yshift=0.7cm]al);
+ \draw[blue,dash pattern=on 1pt off 1pt]([xshift=10pt]al)--([xshift=10pt,yshift=0.7cm]al);
+ \draw[stealth-stealth]([yshift=0.6cm]al.center)--([xshift=10pt,yshift=0.6cm]al.center) node [midway,above,draw=none]{$\delta$};
+ \draw[stealth-stealth]([yshift=1cm]al)--([yshift=1cm]bl) node [midway,above,draw=none] {$\Delta$} ;
+ \draw[red,dash pattern=on 2pt off2pt](al)--([yshift=1.1cm]al);
+ \draw[red,dash pattern=on 2pt off2pt](bl)--([yshift=1.1cm]bl);
+ \end{tikzpicture}
+\end{tabular}
+\end{center}
+
+In rings, even when \CFkv{fixed length}{true}, the default behavior is restored for the bonds of the cycle, in order to draw regular polygons.
+
+\exemple{Fixed length bonds}/\chemfig{Cl-Cl}\par
+\chemfig[fixed length=true]{Cl-Cl}/
+
+Especially with the default behavior, to avoid too short bonds, it is sometimes necessary to increase (or perhaps reduce) the interatomic distance. For this, the optional argument to bonds is actually made up of several comma-separated fields. As we have seen, the first field specifies the angle. The second field, if it is not empty, is a coefficient which multiplies the default interatomic distance $\Delta$. Thus, writing \verb+-[,2]+ asks that this bond have the default angle (first field is empty) and that the atoms it connects be separated by twice the default distance.
+\exemple{Modified bond length}/\chemfig{A^{++}_{2}-[,2]B^{-}_3}\par
+\chemfig{A-B-[,2]C=[,0.5]D}\par
+\chemfig{-=[,1.5]-[,0.75]=[:-20,2]}/
+
+We can change the \falseverb{size of molecules} by altering the font size or the \chevrons{key} \CFkey{atom sep}, possibly on both, 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
+\setchemfig{atom sep=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.
+
+Here are some examples where the bond is in the interval $(-90,90)$, and where the bond is made between D and E:
+\exemple{Default atom connections}|\chemfig{ABCD-[:75]EFG}\quad
+ \chemfig{ABCD-[:-85]EFG}\quad
+ \chemfig{ABCD-[1]EFG}|
+
+In the following examples, the angles are in the interval $[90,270]$ and so the bond is made between A and G:
+\exemple[60]{Default atom connections}|\chemfig{ABCD-[:100]EFG}\quad
+ \chemfig{ABCD-[:-110]EFG}\quad
+ \chemfig{ABCD-[5]EFG}|
+
+One may sometimes want the bond partners to be atoms other than those determined by \CF. The departure and arrival atoms can be set with the optional bond argument by writing:
+\begin{center}
+ \Verb/[,,<integer 1>,<integer 2>]/
+\end{center}
+where \Verb-<integer 1>- and \Verb-<integer 2>- are the numbers of the desired departure and arrival atoms. These atoms must exist, otherwise an error message will be given.
+\exemple{Specified atom connections}|\chemfig{ABCD-[:75,,2,3]EFG}\qquad
+ \chemfig{ABCD-[:75,,,2]EFG}\qquad
+ \chemfig{ABCD-[:75,,3,2]EFG}|
+
+\section{Customization of bonds}\label{perso-liaisons}
+There is a fifth and last optional argument for bonds which is found after the fourth comma:
+\begin{center}
+ \Verb/[,,,,<tikz code>]/
+\end{center}
+
+This \Verb-<tikz code>- is passed directly to \TIKZ when the bond is drawn. There one can put characteristics such as colour (\verb-red-), dash type (\verb-dash pattern=on 2pt off 2pt-), thickness (\verb-line width=2pt-), or even decoration if the \TIKZ decoration library has been loaded. A bond can be made invisible by writing ``\verb-draw=none-''. To set several attributes, the syntax of \TIKZ is used, separating them by a comma:
+\exemple{Passing tikz code}|\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}|
+
+Numerous \TIKZ decoration libraries are available. For example, one can use the ``\verb-pathmorphing-'' library by putting \verb-\usetikzlibrary{decorations.pathmorphing}- in the preamble in order to draw wavy bonds:
+\exemple{Wavy bonds}|\chemfig{A-[,3,,,decorate,decoration=snake]B}|
+
+Cram bonds ignore thickness and dash settings.
+
+\section{Default values}
+At the beginning of each molecule, the default values for the optional arguments are initialized. They are:
+\begin{itemize}
+ \item 0\degres{} for the bond angle;
+ \item 1 for the length multiplication coefficient;
+ \item \Verb-<empty>- for the numbers of the departure and arrival atoms, which lets \CF calculate these based on the bond angle;
+ \item \Verb-<empty>- for the parameters passed to \TIKZ.
+\end{itemize}
+
+These default values can be changed for the whole molecule by beginning the molecule code with
+\begin{center}
+ \Verb/[<angle>,<coeff>,<n1>,<n2>,<code tikz>]/
+\end{center}
+
+Thus, if the code of a molecule begins with \verb-[:20,1.5]-, then all the bonds will be at angle of 20\degres{} by default, and the interatomic distances will have a length 1.5 times the default length. These default values can be overridden at any time by giving an optional argument, such as for the bond which follows atom ``C'' in this example:
+\exemple{Overriding default values}|\chemfig{[:20,1.5]A-B-C-[:-80,0.7]D-E-F}|
+
+If something odd like \verb-[1,1.5,2,2,red,thick]- is written, then unless otherwise indicated all the bonds will have an angle of 45\degres{}, the interatomic distances will be 1.5 times the default distance, the bonds will begin and end on the second atom of each group, and the bonds will be red and thick:
+\exemple{Default values}|\chemfig{[1,1.5,2,2,red,thick]ABC-DEF=GHI}|
+
+\section{Branches}
+\subsection{Principle}
+Up to now, all the molecules have been linear, which is rare. A sub-molecule can be attached to an atom by following the atom with \Verb-<code>- in parentheses. This \Verb-<code>- is the code of the sub-molecule which will be attached to the atom.
+
+In this example, the sub-molecule ``\verb/-[1]W-X/'' will be attached to atom ``B'':
+\exemple{A branch}|\chemfig{A-B(-[1]W-X)-C}|
+
+There can be several sub-molecules which are to be attached to the same atom. Just have several parentheses containing the code for each sub-molecule:
+\exemple{Multiple branches}|\chemfig{A-B(-[1]W-X)(-[6]Y-[7]Z)-C}|
+
+The code of each sub-molecule can define its own default values, which will be valid throughout the whole sub-molecule. Here a sub-molecule ``\verb/[:60]-D-E/'' is attached to atom ``B'', with a default angle of 60\degres{} absolute. A second sub-molecule ``\verb/[::-60,1.5]-X-Y/'' is attached to ``B'' with a default bond angle 60\degres{} less than that of the preceding bond (which will be the one between ``A'' and ``B'') and with an interatomic distance 1.5 times the default value:
+\exemple{Default values in branches}|\chemfig{A-B([:60]-D-E)([::-30,1.5]-X-Y)-C}|
+
+Observe what happens if, at the beginning of the main molecule, one writes ``\verb/[:-45]/'':
+\exemple{Effect of the default bond angle}|\chemfig{[:-45]A-B([:60]-D-E)([::-30,1.5]-X-Y)-C}|
+
+We see that the angle between the bond \verb/B-C/ and the bond \verb/B-X/ stays at 30\degres{} because it is a relative angle for the sub-molecule ``\verb/-X-Y/''. By contrast, the branch ``\verb/-D-E/'' stays inclined at 60\degres{} to the horizontal, and does not follow the rotation given by the $-45\degres$ angle at the beginning; this is expected because ``\verb/-D-E/'' has an absolute angle. It is essential that all the angles be relative in order to rotate the whole molecule.
+
+\subsection{Nesting}
+Sub-molecules may be nested, and the rules seen in the preceding paragraphs stay in force:
+\exemple{Nested branches}|\chemfig{A-B([1]-X([2]-Z)-Y)(-[7]D)-C}|
+
+\subsection{Method}
+Suppose now that we want to draw an acid anhydride molecule:
+\chemfig{R-C(=[::+60]O)-[::-60]O-[::-60]C(=[::+60]O)-[::-60]R}
+
+The best way to get this is to find the longest chain. Here, for example, we can draw the chain \verb/R-C-O-C-R/ taking into account angles and using only relative angles:
+\exemple{Acid anhydride structure}|\chemfig{R-C-[::-60]O-[::-60]C-[::-60]R}|
+
+To this structure we just have to add two ``\verb/=O/'' sub-molecules to each of the carbon atoms:
+\exemple{Acid anhydride}|\chemfig{R-C(=[::+60]O)-[::-60]O-[::-60]C(=[::+60]O)-[::-60]R}|
+
+Because we used only relative angles, we can rotate this molecule by giving a default angle of e.g. 75\degres:
+\exemple[70]{Rotation of a molecule}|\chemfig{[:75]R-C(=[::+60]O)-[::-60]O-[::-60]C(=[::+60]O)-[::-60]R}|
+
+\section{Connecting distant atoms}
+We have seen how to connect atoms \emph{which are adjacent in the code}. It is often necessary to connect atoms which are not next to each other in the code. Let's call these particular bonds ``distant bonds''.
+
+Let's take this molecule:
+\exemple{Branched structure}|\chemfig{A-B(-[1]W-X)(-[7]Y-Z)-C}|
+
+and suppose that we want to connect the atoms \verb/X/ and \verb/C/. In this case, \CF allows a ``hook'' to be placed \emph{immediately} after the atom of interest. The character used for a hook is ``\verb-?-'' because of its similarity to a hook. So, if one writes \verb/X?/ then the atom \verb/X/ will have a hook. Later in the code, all atoms followed by a \verb-?- will be connected to \verb/X/:
+\exemple{Distant bond}|\chemfig{A-B(-[1]W-X?)(-[7]Y-Z)-C?}|
+
+We could connect other atoms to X by following them with \verb-?-. Here it's the atoms \verb-C- and \verb-Z-:
+\exemple{Several distant bonds}|\chemfig{A-B(-[1]W-X?)(-[7]Y-Z?)-C?}|
+
+Now imagine if we were to leave the distant bonds \verb/X-C/ and \verb/X-Z/while adding another: \verb/A-W/. We must therefore ask for two \emph{different} hooks, one on \verb/A/ and the other on \verb/X/. Fortunately the character \verb/?/ has an optional argument:
+\begin{center}
+ \Verb/?[<name>,<bond>,<tikz>]/
+\end{center}
+where each field takes its default value if it is empty:
+\begin{itemize}
+ \item The \Verb-<name>- is the name of the hook: all alphanumeric characters (a\dots z, A\dots Z, 0\dots 9) are allowed\footnote{This is not exactly right. Actually all the characters that can be put between \texttt{\string\csname...\string\endcsname} are allowed.}. The name is \verb-a- by default. In the first occurrence of the hook with this name, only this field is used.
+ \item \Verb-<bond>- specifies how the atom with the current occurrence of the named hook is to be bonded to the atom with the first occurrence of the hook. There are two ways this can be done. First, this field can be an integer representing the desired bond type: 1=single bond, 2=double bond, etc. (See the table on page~\pageref{types.liaisons} for the bond codes.)
+
+ Second, the field can be one of the bond character codes, provided that this character is \emph{between braces}.
+ \item \Verb-<tikz>- will be passed directly to \TIKZ as we have seen with regular bonds.
+\end{itemize}
+
+Here is our molecule with the required distant bonds, then with the bond \verb/A-W/ and \verb/X-C/ customized:
+\exemple{Multiple distant bonds}|\chemfig{A?[a]-B(-[1]W?[a]-X?[b])(-[7]Y-Z?[b])-C?[b]}\par\medskip
+ \chemfig{A?[a]-B(-[1]W?[a,2,red]-X?[b])(-[7]Y-
+ Z?[b,1,{line width=2pt}])-C?[b,{>},blue]}|
+
+Several different hooks can be written after an atom. Suppose that in this unfinished pentagon, we wish to connect \verb/A-E/, \verb/A-C/ and \verb/E-C/:
+\exemple{An incomplete ring}|\chemfig{A-[:-72]B-C-[:72]D-[:144]E}|
+
+Then we must do this:
+\exemple{Multiple distant bonds}|\chemfig{A?[a]-[:-72]B-C?[a]?[b]-[:72]D-[:144]E?[a]?[b]}|
+
+\section{Rings}
+The preceding example shows how to draw a regular polygon, but the method used is tedious because the angles depend on the number of sides of the polygon.
+
+\subsection{Syntax}
+\CF can easily draw regular polygons. The idea is to attach a ring to an \Verb/<atom>/ outside the ring with this syntax:
+\begin{center}
+ \Verb/<atom>*<n>(<code>)/
+\end{center}
+\Verb/<n>/ is the number of sides of the polygon and the \Verb/<code>/ describes the bonds and groups of atoms which make up its edges and vertices. This code \emph{must} begin with a bond because the atom is outside the ring.
+
+Here is a 5-ring, attached to the atom ``\verb/A/'':
+\exemple{5-ring}|\chemfig{A*5(-B=C-D-E=)}|
+
+A ring can also be drawn with one, several, or all the groups of atoms empty, as is the case for diagrams outside rings:
+\exemple{5-ring with empty groups}|\chemfig{*5(-=--=)}|
+
+A ring can be incomplete:
+\exemple{Incomplete 5-ring}|\chemfig{*5(-B=C-D)}|
+If a ring has a code which contains too many bonds and atom groups for the given number of vertices, all the bonds and groups over the maximum allowed are ignored:
+\exemple{Truncated 5-ring}|\chemfig{A*5(-B=C-D-E=F-G=H-I)}|
+
+It is possible to draw a circle or an arc in the inside of a ring. To do so, the following syntax is used:
+\begin{center}
+ \Verb/<atom>**[<angle 1>,<angle 2>,<tikz>]<n>(<code>)/
+\end{center}
+where each field of the optional argument takes its default value if it is empty:
+\begin{itemize}
+ \item \Verb/<angle 1>/ and \Verb/<angle 2>/ are the absolute angles of the start and finish of the arc. These default to 0\degres{} and 360\degres{} respectively so that a circle is drawn by default;
+ \item \Verb/<tikz>/ is the code that will be passed to \TIKZ for drawing the arc.
+\end{itemize}
+
+\exemple{Rings and arcs}|\chemfig{**6(------)}\quad
+ \chemfig{**[30,330]5(-----)}\quad
+ \chemfig{**[0,270,dash pattern=on 2pt off 2pt]4(----)}|
+
+\subsection{Angular position}
+\subsubsection{At the start}
+As can be seen in the examples above, the rule is that the attachment atom ``\verb/A/'' is always at the south-west of the ring. Furthermore, the ring is always constructed counterclockwise, and the last bond descends vertically onto the attachment atom:
+\exemple{Angular position of rings}|\chemfig{A*4(-B-C-D-)}\qquad\chemfig{A*6(------)}|
+
+If this angular position is not convenient, it is possible to specify another angle using the optional argument at the beginning of the molecule. Here is a 6-cycle which has been rotated by $+30\degres$, by $-30\degres$, and lastly by $+60\degres$:
+\exemple[55]{Rotation of rings}|\chemfig{[:30]A*6(------)}\qquad
+ \chemfig{[:-30]A*6(------)}\qquad
+ \chemfig{[:60]A*6(------)}|
+
+\subsubsection{After a bond}
+When a ring does not begin a molecule and one or more bonds have already been drawn, the default angular position changes: the ring is drawn is such a way that the bond ending on the attachment atom bisects the angle formed by the first and last sides of the ring.
+
+Here is a simple case:
+\exemple{Bond ending on a ring}|\chemfig{A-B*5(-C-D-E-F-)}|
+
+The rule remains valid, whatever the angle of the preceding bond:
+\exemple{Bonds ending on a ring}|\chemfig{A-[:25]B*4(----)}\vskip5pt
+ \chemfig{A=[:-30]*6(=-=-=-)}|
+
+\subsection{Branches on a ring}
+To have branches attached to the vertices of a ring, we use the syntax we have already seen:
+\begin{center}
+ \Verb/<atom>(<code>)/
+\end{center}
+where the \Verb/<code>/ is that of the sub-molecule and the \Verb-<atom>- is at the vertex. Unique to rings, the default angle of the sub-molecule is not 0\degres{} but is calculated so that it will bisect the sides leaving the vertex:
+\exemple{Branch on a ring}|\chemfig{X*6(-=-(-A-B=C)=-=-)}|
+
+A sub-molecule can be attached to the first vertex of a ring, just like the other vertices:
+\exemple{Ring and branches}|\chemfig{*5((-A=B-C)-(-D-E)-(=)-(-F)-(-G=)-)}|
+
+If one wants the bond leaving a vertex not to be the bisector of its sides, one can tinker with the optional global parameter or the optional bond parameter:
+\exemple[50]{Branches at specified angles}|\chemfig{*5(---([:90]-A-B)--)}\qquad
+ \chemfig{*5(---(-[:90]A-B)--)}\qquad
+ \chemfig{*5(---([::+0]-A-B)--)}|
+
+It is worth noting that in the third example, where a relative angle of 0\degres{} was given, the bonds of the branch are drawn in line with the preceding bond in the ring. This is the rule on page~\pageref{angle.relatif} which specified that the reference angle was that of the bond last drawn.
+
+We can now connect together rings with bonds:
+\exemple{Connected rings}|\chemfig{*6(--(-*5(----(-*4(----))-))----)}|
+
+\subsection{Nested rings}
+To ``glue'' two rings together, the syntax is only slightly different: the vertex is specified where the other ring is going to start. Simply follow this vertex by the usual syntax for a ring. Here for example is a 5-ring which is attached to the second vertex of a 6-ring:
+\exemple{Nested rings}|\chemfig{A*6(-B*5(----)=-=-=)}|
+
+Note that the ring which is going to be attached to the main ring has an angular position such that two of the rings' sides coincide. In addition, the 5-ring has only four bonds ``\verb/----/''. In effect, the fifth will be useless because it is the second side of the 6-ring, which has already been drawn.
+
+It is quite possible to glue multiple rings together:
+\exemple{Multiple nested rings}|\chemfig{*5(--*6(-*4(-*5(----)--)----)---)}|
+
+There is a case where a trick must be used. It can be seen in this example that the fourth side of the second 5-ring just passes through the center of atom ``\verb-E-''.
+\exemple{Flawed drawing}|\chemfig{A-B*5(-C-D*5(-X-Y-Z-)-E-F-)}|
+
+This is normal because the second 5-ring (which is attached to atom ``\verb-D-'') is drawn \emph{before} \CF knows about atom ``\verb-E-''. In this case, it is necessary to use two hooks to draw the bond \verb/Z-E/:
+\exemple{Distant bond and ring}|\chemfig{A-B*5(-C-D*5(-X-Y-Z?)-E?-F-)}|
+
+We could also use a \verb-\phantom{E}- at the last vertex of the 5-ring:
+\exemple{Using \string\phantom}/\chemfig{A-B*5(-C-D*5(-X-Y-Z-\phantom{E})-E-F-)}/
+
+\subsection{Rings and groups of atoms}
+Some care must be taken with rings when one or more vertices are made up of groups of atoms:
+\exemple{Ring and groups of atoms}|\chemfig{AB*5(-CDE-F-GH-I-)}|
+
+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-)}|
+
+\section{Representing electron movements}\label{mecanismes-reactionnels}
+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 ``\falseverb{tikzpicture}'' environments. It is assumed that the viewer supports ``\falseverb{picture remembering}'' and that the compilation is done twice.
+
+Two types of diagrams can arise, so we can ask for:
+\begin{itemize}
+ \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}
+Once the \falseverb{\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 ``\falseverb{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>-'':
+\begin{center}
+ \Verb|\chemmove[<opt>]{\draw[<tikz opt>](<name1>)<tikz link>(<name2>);}|
+\end{center}
+
+The optional argument \Verb-<opt>- of the \verb-\chemmove- command will be added to the argument of the \falseverb{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{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.
+
+Les macros \verb|\schemestart|, \verb|\schemestop|, \verb|\arrow| et \verb|\+| sont exposées
+
+\exemple{Mesomeric effect 1}/\schemestart
+ \chemfig{@{a1}=_[@{db}::30]-[::-60]\lewis{2,X}}
+ \arrow{<->}
+ \chemfig{\chemabove{\vphantom{X}}{\ominus}-[::30]=_[::-60]
+ \chemabove{X}{\scriptstyle\oplus}}
+\schemestop
+ \chemmove{\draw(db).. controls +(100:5mm) and +(145:5mm).. (a1);}/
+
+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:
+\begin{center}
+ \Verb|\chemmove{\draw(db)..controls +(80:8mm) and +(145:8mm)..(a1);}|
+\end{center}
+
+For arrows in \verb|\chemmove|, the default tip is ``CF''.In this example we ask for an arrow (\verb/[->]/) and we use two \falseverb{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}/\schemestart
+ \chemfig{@{a1}=_[@{db}::30]-[@{sb}::-60]@{dnl}\lewis{2,X}}
+ \arrow{<->}
+ \chemfig{\chemabove{\vphantom{X}}{\ominus}-[::30]=_[::-60]
+ \chemabove{X}{\scriptstyle\oplus}}
+\schemestop
+\chemmove{
+ \draw(db)..controls +(100:5mm) and +(145:5mm)..(a1);
+ \draw(dnl)..controls +(90:4mm) and +(45:4mm)..(sb);}/
+
+For our new arrow we have set the \falseverb{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}/\schemestart
+ \chemfig{@{a1}=_[@{db}::30]-[@{sb}::-60]@{dnl}\lewis{2,X}}
+ \arrow{<->}
+ \chemfig{\chemabove{\vphantom{X}}{\ominus}-[::30]=_[::-60]
+ \chemabove{X}{\scriptstyle\oplus}}
+\schemestop
+\chemmove[->]{% change the tip style
+ \draw(db).. controls +(100:5mm) and +(145:5mm).. (a1);
+ \draw[shorten <=3pt,shorten >=1pt](dnl) .. controls +(90:4mm)
+ and +(45:4mm) .. (sb);}/
+
+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.
+
+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 and set it to ``\verb|-stealth|'', 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}/\schemestart
+ \chemfig{@{a1}=_[@{db}::30]-[@{sb}::-60]@{dnl}\lewis{2,X}}
+ \arrow{<->}
+ \chemfig{\chemabove{\vphantom{X}}{\ominus}-[::30]=_[::-60]
+ \chemabove{X}{\scriptstyle\oplus}}
+\schemestop
+\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);}/
+
+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 center 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);}/
+
+In some cases it will be easier to use Cartesian coordinated for the \falseverb{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);}/
+
+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{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}/\setchemfig{atom sep=7mm}
+\schemestart
+ \chemfig{R-@{dnl}\lewis{26,O}-H}
+ \+
+ \chemfig{R-@{atoc}C([6]-OH)=[@{db}]O}
+ \arrow(.mid east--){<->[\chemfig{@{atoh}\chemabove{H}{\scriptstyle\oplus}}]}
+\schemestop
+\chemmove[shorten <=2pt]{
+ \draw(dnl)..controls +(90:1cm)and+(north:1cm)..(atoc);
+ \draw[shorten >=6pt](db)..controls +(north:5mm)and+(100:1cm)..(atoh);}/
+
+The use of the \Verb|\chemabove{<code>}{<materiel>}| command does not change the dimensions of the \falseverb{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}/\setchemfig{atom sep=7mm}
+\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);}/
+
+The rest is left as an exercise to the reader\dots.
+
+\section{Writing a name under a molecule}\label{chemname}
+For convenience, \CF can write the name of a molecule underneath it with the command
+\begin{center}
+ \Verb/\chemname[<dim>]{\chemfig{<code of the molecule>}}{<name>}/
+\end{center}
+
+The \Verb-<dim>-, which is 1.5ex by default, will be inserted between the \falseverb{baseline} of the molecule and the top of the letters of the \Verb-<name>-. The \Verb-<name>- will be centered 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.
+
+Here is a reaction with the names under the molecules:
+\exemple*{Displaying names of molecules}/\schemestart
+ \chemname{\chemfig{R-C(-[:-30]OH)=[:30]O}}{Acide carboxylique}
+ \+
+ \chemname{\chemfig{R'OH}}{Alcool}
+ \arrow(.mid east--.mid west)
+ \chemname{\chemfig{R-C(-[:-30]OR')=[:30]O}}{Ester}
+ \+
+ \chemname{\chemfig{H_2O}}{Water}
+\schemestop
+\chemnameinit{}/
+
+There are some limitations to this command. Suppose we switch the acid and the alcohol on the left side:
+\exemple*{Name alignment 1}/\schemestart
+ \chemname{\chemfig{R'OH}}{Alcohol}
+ \+
+ \chemname{\chemfig{R-C(-[:-30]OH)=[:30]O}}{Carboxylic acid}
+ \arrow(.mid east--.mid west)
+ \chemname{\chemfig{R-C(-[:-30]OR')=[:30]O}}{Ester}
+ \+
+ \chemname{\chemfig{H_2O}}{Water}
+\schemestop
+\chemnameinit{}/
+
+In fact, to draw the \Verb-<name>- the command \falseverb{\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 gray for the examples in this manual). The command \falseverb{\chenameinit}\Verb-{<stuff>}- initializes this largest depth with the \Verb-<stuff>-. Therefore one should:
+\begin{itemize}
+ \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}
+
+Thus the correct code uses \falseverb{\chemnameinit} before and after the reaction:
+\exemple*{Name alignment 2}/\chemnameinit{\chemfig{R-C(-[:-30]OH)=[:30]O}}
+\schemestart
+ \chemname{\chemfig{R'OH}}{Alcohol}
+ \+
+ \chemname{\chemfig{R-C(-[:-30]OH)=[:30]O}}{Carboxylic acid}
+ \arrow(.mid east--.mid west)
+ \chemname{\chemfig{R-C(-[:-30]OR')=[:30]O}}{Ester}
+ \+
+ \chemname{\chemfig{H_2O}}{Water}
+\schemestop
+\chemnameinit{}/
+
+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}/\schemestart
+ \chemname{\chemfig{R-C(-[:-30]OH)=[:30]O}}{Carboxilic\\Acid}
+ \+
+ \chemname{\chemfig{R'OH}}{Alcohol}
+ \arrow(.mid east--.mid west)
+ \chemname{\chemfig{R-C(-[:-30]OR')=[:30]O}}{Ester}
+ \+
+ \chemname{\chemfig{H_2O}}{Water}
+\schemestop
+\chemnameinit{}/
+
+If \Verb|\chemname*{<name>}| is written, the macro does not take into account the previous names.
+\newpage
+
+\part{Advanced usage}\label{utilisation.avancee}
+\section{Separating atoms}\label{decoupage.atomes}
+The \falseverb{separating atom 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{@}}
+
+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*{Alkene}/\chemfig{CH_3CH_2-[:-60,,3]C(-[:-120]H_3C)=C(-[:-60]H)-[:60]C{(}CH_3{)}_3}/
+
+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}
+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*{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 \falseverb{\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 \falseverb{math mode} and displays its argument with the math font family ``rm''. It is defined by the following code:
+\begin{itemize}
+ \item \verb|\newcommand*\printatom[1]{\ensuremath{\mathrm{#1}}}|\qquad when compiling with \LaTeX{}
+ \item \verb|\def\printatom#1{\ifmmode\rm#1\else$\rm#1$\fi}|\qquad when compiling with $\varepsilon$\TeX{} ou Con\TeX tX.
+\end{itemize}
+
+One can modify the code of this macro to customize how atoms are displayed. In the following example, we redefine \falseverb{\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}}}}
+\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}}}
+\chemfig{H_3C-C(=[:30]O)(-[:-30]OH)}/
+
+\section{Arguments given to tikz}\label{arguments.optionnels}
+The \chevrons{key} \CFkey{chemfig style} contains \TIKZ instructions which will be passed to the \falseverb{tikzpicture} environment in which the molecule is drawn. On the other hand, the The \chevrons{key} \CFkey{atom style} contains \TIKZ instructions which will be executed when each node; these instructions are added to the end of \texttt{every node/.style\{<argument>\}}, i.e. after the fhe following instructions: ``{\ttfamily anchor=base,inner sep=0pt,outer sep=0pt,minimum size=0pt}''.
+
+With the use of the first optional argument one can, for example, choose the global color or thickness of lines:
+\exemple{Style choice}/\chemfig{A-B-[2]C}\par\medskip
+\setchemfig{chemfig style={line width=1.5pt}}\chemfig{A-B-[2]C}\par\medskip
+\setchemfig{chemfig style=red}\chemfig{A-B-[2]C}/
+
+With \CFkey{node style}, 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
+\setchemfig{atom style=red}\chemfig{A-B-[2]C}\par\medskip
+\setchemfig{atom style={rotate=20}}\chemfig{A-B-[2]C}\par\medskip
+\setchemfig{atom style={scale=0.5}}\chemfig{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.
+
+Careful study of the following example shows that the groups of atoms are not correctly aligned on the \falseverb{baseline}:
+\exemple*{Vertical placement}/\Huge\setchemfig{atom sep=2em}
+\chemfig{A^1-B-C-D}\qquad
+\chemfig{E_1-F-G-H}/
+
+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 \falseverb{\vphantom} of the departure atom, but does not include it in the contents of the arrival atom; this \falseverb{\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 \falseverb{\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\setchemfig{atom sep=2em}
+\fboxsep=0pt
+\renewcommand\printatom[1]{\fbox{\ensuremath{\mathrm#1}}}
+\chemfig{A^1-B-C-D}\qquad
+\chemfig{E_1-F-G-H}/
+
+Since there is no satisfactory manual solution, this problem can be worked around manually by putting \emph{inside} the third atom a \falseverb{\vphantom} having the same height as the first, so that the height affects the following atoms:
+\exemple*{Vertical placement workaround}/\Huge\setchemfig{atom sep=2em}
+\chemfig{A^1-B-{\vphantom{A^1}C}-D}\qquad
+\chemfig{E_1-F-{\vphantom{E_1}G}-H}/
+
+\label{chemskipalign}For any group of atoms it is possible to temporarily deactivate the alignment adjustment mechanism and thus neutralize the \falseverb{\vphantom}. Simply place the \falseverb{\chemskipalign} command in the group of atoms; the alignment will resume in the following group of atoms as if the group of atoms containing \falseverb{\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]{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}}}}
+\chemfig{A-.-B}\quad
+\chemfig{A-\chemskipalign.-B}/
+
+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 \falseverb{\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}}}}
+\chemfig{A-\chemskipalign.B-C}/
+
+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}
+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 \falseverb{\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{Use of \string\chemskipalign\ and #}/\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
+
+
+
+\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.
+
+To shift the bond to the left, write ``\verb-=^-'' and to shift it to the right, write ``\verb-=_-'':
+\exemple{Shifted double bonds}/\chemfig{A-=-B}\par
+\chemfig{A-=^-B}\par
+\chemfig{A-=_-B}/
+
+In rings, double bonds are automatically shifted to the left. However, they can be shifted to the right by specifying it with ``\verb-=_-'':
+\exemple{Shifted double bonds and rings}/\chemfig{*6(-=-=-=)}\qquad
+\chemfig{*6(-=_-=_-=_)}/
+
+Shifted bonds are particularly useful in drawing skeleton diagrams of molecules consisting of carbon chains with double bonds. They give a continuous zig-zag path, whereas the path will be broken with regular double bonds:
+\exemple{Shifted bonds and skeleton diagrams}/\chemfig{-[:30]=[:-30]-[:30]=[:-30]-[:30]}\par
+\chemfig{-[:30]=^[:-30]-[:30]=^[:-30]-[:30]}\par
+\chemfig{-[:30]=_[:-30]-[:30]=_[:-30]-[:30]}/
+
+\section{Delocalized double bonds}
+It is sometimes necessary to draw a double bond so that one line would be full and the other dashed. This feature is not hard-coded in \CF since \TIKZ, with its ``decorations.markings'' library makes it possible.
+
+\exemple*{Delocalized bonds}|\catcode`\_=11
+\tikzset{
+ ddbond/.style args={#1}{
+ draw=none,
+ decoration={%
+ markings,
+ mark=at position 0 with {
+ \coordinate (CF@startdeloc) at (0,\dimexpr#1\CF_doublesep/2)
+ coordinate (CF@startaxis) at (0,\dimexpr-#1\CF_doublesep/2);
+ },
+ mark=at position 1 with {
+ \coordinate (CF@enddeloc) at (0,\dimexpr#1\CF_doublesep/2)
+ coordinate (CF@endaxis) at (0,\dimexpr-#1\CF_doublesep/2);
+ \draw[dash pattern=on 2pt off 1.5pt] (CF@startdeloc)--(CF@enddeloc);
+ \draw (CF@startaxis)--(CF@endaxis);
+ }
+ },
+ postaction={decorate}
+ }
+}
+\catcode`\_=8
+\chemfig{A-[,,,,ddbond={+}]B-[,,,,ddbond={-}]C}|
+
+\section{Saving a sub-molecule}\label{definesubmol}
+\CF is capable of saving a \Verb-<code>- as an alias for reuse in a more compact form in the code of a molecule. This is particularly useful when the \Verb-<code>- appears several times.
+
+To do this, one gives the command
+\begin{center}
+ \Verb|\definesubmol{<name>}{<code>}|
+\end{center}
+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 a sequence of characters: all the alphanumeric characters able to be between \texttt{\string\csname} and \texttt{\string\endcsname} are accepted;
+ \item a control sequence.
+\end{itemize}
+
+In all cases, if the alias is already defined you should not overwrite it with a new definition using \falseverb{\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}
+\begin{center}
+ \Verb|\redefinesubmol{<name>}{<code>}|
+\end{center}
+
+Here is a code which draws the pentane molecule. An alias ``\verb/xy/'' was defined beforehand for the code \verb/CH_2/:
+\exemple{Pentane}|\definesubmol{xy}{CH_2}
+ \chemfig{H_3C-!{xy}-!{xy}-!{xy}-CH_3}|
+
+In this case the technique is not very interesting because ``\verb/!{xy}/'' is just as long to type as the code it replaces.
+
+But in certain cases, this feature saves a lot of space in the code of the molecule and increases readability. In the following example, we draw the complete structural diagram of butane. We will define an alias with the control sequence ``\verb/\xx/'' for the sub-molecule $\mathrm{CH_2}$. If we use only relative angles, it is possible to rotate the entire molecule to any given angle by using the optional global angle parameter which specifies the default bond angle of the main molecule. It is set to 15\degres{} here:
+\exemple{Butane}|\definesubmol\xx{C(-[::+90]H)(-[::-90]H)}
+\chemfig{[:15]H-!\xx-!\xx-!\xx-!\xx-H}|
+
+The \falseverb{\definesubmol} command takes an optional argument; its syntax is as follows:
+\begin{center}
+ \Verb/\definesubmol{<name>}[<code1>]{code2}/
+\end{center}
+
+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>-.
+
+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)-)}/
+
+\label{definesubmolarg}The sub-molecule saved with a \Verb|<name>| does not admit an argument when it is called after "\verb|!||". To define a sub-molecule admitting one or more arguments, place this \Verb|<number>| of arguments just after the \Verb|<name>|. And the full syntax of \verb|\definesubmol| is:
+\begin{center}
+ \Verb/\definesubmol{<name>}<number>[<code1>]{<code2>}/
+\end{center}
+
+In the \Verb|<codes>|, the arguments must appear in their usual form "\Verb|#<n>|" where \Verb|<n>| is the argument number.
+
+\exemple{\texttt{\string\definesubmol} with arguments}/\definesubmol\X1{-[,-0.2,,,draw=none]{\scriptstyle#1}}
+\chemfig{*6((!\X A)-(!\X B)-(!\X C)-(!\X D)-(!\X E)-(!\X F)-)}
+
+\definesubmol{foo}3[#3|\textcolor{#1}{#2}]{\textcolor{#1}{#2}|#3}
+\chemfig{A(-[:135]!{foo}{red}XY)-B(-[:45]!{foo}{green}{W}{zoo})}/
+
+It should be noted that if the \Verb|<number>| of arguments is incorrect (negative or greater than 9), an error message will be issued and \CF will consider that the sub molecule does not admit an argument.
+
+Except in cases where the character "\verb|#|" is followed by a number between 1 and \Verb|<number>| in which case it represents an argument, "\verb|#|" are allowed in the sub-molecule codes.
+
+\exemple{Use of \#}/\definesubmol\X2{#1-#2-#2-#3-###(3pt,3pt)#4}
+\chemfig{A-!\X{M}{N}-B}/
+
+In this example, only \verb|#1| and \verb|#2| are understood as the arguments of the sub molecule \verb|\X|. The other "\verb|#|" are displayed as they are in the molecule (case of \verb|#3| and \verb|#4|) or understood as the character specifying the fine adjustment of the offset of the bonds.
+
+\section{Decorations}
+\subsection{Lewis diagrams}\label{lewis}
+The macro \falseverb{\lewis} allows placement of pairs of electrons, of single electrons, or of empty slots. This syntax is used:
+\begin{center}
+ \Verb|\lewis{<n1><n2>...<ni>,<atom>}|
+\end{center}
+where the \Verb-<n1>-\dots\Verb-<ni>- represent the desired positions (in multiples of 45\degres) around the \Verb-<atom>-. These whole numbers must be between 0 and 7.
+
+This command can also be used inside the argument of \verb-\chemfig-:
+\exemple{The \string\lewis\ macro}|\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}|
+
+If one wishes to draw two electrons instead of a line, follow the integer with a ``\verb-:-''. If one wishes to draw a single electron, follow it with a ``\verb-.-''. To draw a lacuna, follow it with a ``\verb-|-'':
+\exemple{Lewis diagrams}*\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
+Hydronium ion: \chemfig{H-\lewis{5|7,O^+}(-[2]H)-H}*
+
+All the decorations drawn by \falseverb{\lewis} are not included in the \falseverb{bounding box} of the atom; they are drawn afterwards. A consequence of this is seen in the two examples above, where the frame does not appear to be properly fitted to the drawing of the molecule, which extends downward slightly. This will be seen more often in this the ``Decorations'' chapter, which presents commands which do not change the bounding box.
+
+\label{Lewis}The \falseverb{\Lewis} macro works the same way as \verb-\lewis- but decorations are taken into account in the bounding box.
+
+This can be seen more clearly by drawing an \verb-\fbox- around decorated atoms:
+\exemple{Bounding box and the \string\lewis\ macro}*\fboxsep0pt
+\fbox{\lewis{0.2.4.6.,A}}\quad\fbox{\Lewis{0.2.4.6.,A}}\par\medskip
+\fbox{\lewis{13,B}}\quad\fbox{\Lewis{13,B}}*
+
+\label{setlewis}Several parameters can be set with the help of these \chevrons{keys}
+\begin{itemize}
+ \item \CFkv{lewis | width}{dim}is the width of the rectangle which represents the empty slot obtained whith the character ``|'';
+ \item \CFkv{lewis sep}{dim} is the distance between the bounding box and the decoration. It is 0.2ex by default;
+ \item \CFkv{lewis length}{dim} is the length of the line segment representing a pair of electrons. It is 1.5ex by default;
+ \item \CFkv{lewis style}{code tikz} is code which is passed directly to \TIKZ. This code is empty by default.
+ \item \CFkv{lewis dist}{dim}: is the distance between 2 discs drawn with "\string:. This distance is set to \CFval{0.3em} by default;
+ \item \CFkv{lewis radius}{dim}: is the radius of the disc drawn with "." or "\string:". Its default value is \CFval{0.15ex};
+ \item \CFkv{lewis diag coeff}{decimal}: is the diagonal spacing factor and its default value is \CFval{1}.
+\end{itemize}
+
+It should be noted that the parameters specific to Lewis decorations can be passed by
+\begin{itemize}
+ \item \Verb|\setchemfig{<keys>=<values>}| so that they last for the rest of the document;
+ \item \Verb|\chemfig[<keys>=<values>]| and in this case, the settings are effective in the current molecule;
+ \item \Verb|\lewis[<keys>=<values>]| so that the parameters are specific to this execution of the macro \verb|\lewis|.
+\end{itemize}
+
+The last way, of course, allows individual settings, but must be used with caution when the macro \verb|\lewis| is in the argument of \verb|\chemfig|. Indeed, the signs \verb-=- of the \Verb|<key>=<values>| should not be interpreted as a double bond and to do so, the macro \verb|\lewis|, its optional and mandatory argument \emph{must} be inside braces:
+
+\exemple{Optional argument of \string\lewis}/\chemfig{{\lewis[lewis style=red]{1:3:5:7:,X}}-{\lewis[lewis style=blue]{0:2:4:6:,Y}}}/
+
+Here are some examples of customization:
+
+\exemple{Parameters for the \string\lewis\ macro}*\setchemfig{lewis sep=4pt,lewis length=1.5em,lewis style=red}
+\chemfig{A-\lewis{26,B}-C}\bigbreak
+
+\chemfig[lewis style={line width=0.4pt}]{A-\lewis{2|,B}-C}\bigbreak
+
+\Lewis{1:3:5:7:,X}\qquad\Lewis{0:2:4:6:,X}\bigbreak
+
+\Lewis[lewis dist=0.2em]{1:3:5:7:,X}\qquad
+\Lewis[lewis dist=0.2em]{0:2:4:6:,X}\bigbreak
+
+\Lewis[lewis dist=4pt,lewis radius=1.5pt]{1:3:5:7:,X}\qquad
+\Lewis[lewis dist=4pt,lewis radius=1.5pt]{0:2:4:6:,X}*
+
+A problem sometimes occurs with the decorations of Lewis in the odd directions. In the example below with the atom ``O'', the decoration in position 1 seems farther from the atom than the decoration in position 4:
+\exemple{Odd directions}/\huge
+\Lewis{1|4|,O}/
+However, it is not the case as shown below by drawing the bounding box of the atom:
+\exemple{Optical illusion}/\huge
+\fboxsep0pt
+\def\printatom#1{\fbox{$\mathrm{#1}$}}
+\Lewis{1|4|,O}/
+\label{opt.lewis}The impression of greater distance is due to the shape of the letter ``O'' which is farther from the one of the bounding box in the corners, that is to say, in odd directions.
+
+To move nearer (or farther) the Lewis drawings in odd directions, the \chevrons{clé} \CFkv{lewis diag coeff}{decimal} sets the factor which multiplies the gap between the bounding box and decoration Lewis. For the letter ``O'', it seems that 0.5 is the appropriated value:
+\exemple*{Optional argument of \string\lewis}/\huge
+\Lewis{1|4|,O}\quad \Lewis[lewis diag coeff=0.5]{1|4|,O}
+
+\Lewis{0:5:,O}\quad \Lewis[lewis diag coeff=2]{0:5:,O}\quad \Lewis[lewis diag coeff=0.5]{0:5:,O}/
+
+\subsection{Stacking characters}
+The macros\label{chemabove}
+\begin{center}
+ \Verb|\chemabove[<dim>]{<code>}{<stuff>}|
+\end{center}
+and
+\begin{center}
+ \Verb|\chembelow[<dim>]{<code>}{<stuff>}|
+\end{center}
+place the \Verb-<stuff>- above and below the \Verb-<code>- respectively at a vertical distance \Verb-<dim>-, without changing the \falseverb{bounding box} of \Verb-<code>-. The optional argument allows, if written, to specify this dimension at each call. If the optional argument is not used, a default size will be taken: its value is \CFval{1.5pt} but it can be modified with the \chevrons{key} \CFkv{stack sep}{dim}.
+
+These commands are independent of the macro \verb-\chemfig- and can be used either inside or outside its argument.
+
+They are especially useful in rings, if care is taken to put braces around the letters A, B, C and D in order to prevent \CF from starting a new atom on these letters:
+\exemple{Staking in rings}|\chemfig{*5(-\chembelow{A}{B}--\chemabove{C}{D}--)}|
+
+They are sometimes useful for placing pseudo-exponents which do not change the bounding box of the atoms, so that the bonds do not end up being too short:
+\exemple{Hydronium ion}*\chemfig{H-\chemabove{\lewis{5|7,O}}{\quad\scriptstyle+}(-[2]H)-H}*
+
+\label{Chemabove}The \falseverb{\Chemabove} and \falseverb{\Chembelow} commands work in the same way, except that the bounding box takes into account the \Verb-<stuff>- placed above or below.
+
+\section{Using {\protect\ttfamily\protect\textbackslash chemfig} in the {\protect\ttfamily tikzpicture} environment}
+It is possible to call the \falseverb{\chemfig} inside a {\ttfamily\falseverb{tikzpicture}} environment:
+\exemple{\textbackslash chemfig inside 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}|
+
+\section{Beyond chemistry}\label{style.noeuds}
+At heart \CF is a tool for drawing graphs, and this tool has been programmed to adapt it for chemistry. In some ways it is possible to return \CF to its roots to draw organization charts or other diagrams represented by graphs.
+
+Each atom is contained in a \TIKZ node. By default these nodes have an ``inner sep'' and an ``outer sep'' equal to 0pt. They are rectangular as seen on page~\pageref{longueur.liaison}. These defaults can be overwritten with the \chevrons{key} \CFkey{node style}, the argument of which is passed to \TIKZ and specifies the style of the nodes containing the atoms.
+
+In this example we specify only ``draw,inner sep=2pt'', which has the effect of drawing the outline of the nodes and separating the outline and node contents by 2pt. We also specify \CFkv{bond offset}{0pt} so that the bonds touch the edges of the nodes. The interatomic spacing is increased to 75pt. Finally, the command \falseverb{\printatom} is made as simple as possible so that math mode is no longer used and spaces are thus preserved.
+\exemple*{An organization chart}/\setchemfig{node style={draw,inner sep=2pt},bond offset=0pt,atom sep=75pt}
+\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}/\setchemfig{bond offset=0pt,atom sep=80pt,node style={draw,circle,fill=cyan,minimum size=25pt}}
+\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)}/
+
+\section{Annotated examples}\label{exemples.commentes}
+In this chapter, several molecules will be drawn, putting into use the methods previously described. The aim here is to show a logical order for putting together a molecule so that the user unfamiliar with \CF will learn how to construct complex molecules. The construction steps will be shown to help with this learning process.
+
+In addition, several possibilities --- some intuitive and others less so --- will be shown which give the same graphical results, with the objective being to show that \CF allows some flexibility in encoding molecules. One can see how each is put together and adopt the methods with which one is most comfortable.
+
+\subsection{Ethanal}
+Here we will draw the ethanal (or acetaldehyde) molecule: \chemfig{H-C(-[2]H)(-[6]H)-C(-[7]H)=[1]O}
+
+The best method for non-cyclic molecules is to select the longest chain. Here one could take ``\verb|H-C-C=0|'' for example. The bond \verb|C=O| is tilted to 45\degres{} by using the predefined angle ``\verb-[1]-''. This give a ``backbone'' of the molecule to which the branches merely have to be added:
+\exemple{Backbone of ethanal}|\chemfig{H-C-C=[1]O}|
+
+The three hydrogen atoms still have to placed at the correct orientation with the help of predefined angles. The first is at 90\degres{} with the branch ``\verb/(-[2]H)/'', the second at 270\degres{} with ``\verb/(-[6H])/'', and the one on the right at 315\degres{} with ``\verb/(-[7]H)/'':
+\exemple{Ethanal}|\chemfig{H-C(-[2]H)(-[6]H)-C(-[7]H)=[1]O}|
+
+\subsection{2-amino-4-oxohexanoic acid}
+Here is the molecule to be drawn: \chemfig{-[::+30]-[::-60](=[:-90]O)-[::+60]-[::-60](-[:-90]NH_2)-[::+60](=[:90]O)-[::-60]OH}
+
+As is often the case for most molecules, there are several methods and for each several different ways of getting the result. Here we will look at four different methods.
+
+\subsubsection{Absolute angles}
+We will first of all draw the central chain with absolute angles. We set the default angle to $+30\degres$ with the optional argument, and so only the descending bonds need to have their absolute angle set to $-30\degres$:
+\exemple{Backbone (absolute angles)}|\chemfig{[:30]--[:-30]--[:-30]--[:-30]OH}|
+
+The branches ``\verb/(=[6]O)/'', ``\verb/(-[6]NH_2)/'' and ``\verb/(=[2]O)/'' still have to be added to the correct vertices:
+\exemple{Molecule (absolute angles)}|\chemfig{[:30]--[:-30](=[6]O)--[:-30](-[6]NH_2)-(=[2]O)-[:-30]OH}|
+
+\subsubsection{Relative angles}
+A more general approach uses only relative angles, in this way:
+\exemple{Structure (relative angles)}|\chemfig{[:30]--[::-60]--[::-60]--[::-60]OH}|
+
+then
+\exemple{Molecule (relative angles)}|\chemfig{[:30]--[::-60](=[::-60]O)--[::-60](-[::-60]NH_2)
+-(=[::60]O)-[::-60]OH}|
+
+\subsubsection{Ring}
+Since the angles between the bonds are 120\degres{}, it is possible to use a 6-ring, although this method is less natural. Here we take advantage of the fact that a ring can be left unfinished. The ring must be rotated 120\degres{} so that the first vertex is to the south-east of the ring:
+\exemple{Backbone (ring)}|\chemfig{[:120]NH_2*6(---=O)}|
+
+Now the branches must be added to the right vertices:
+\exemple{Molecule (ring)}|\chemfig{[:120]NH_2*6(-(-(=[::60]O)-[::-60]OH)--(--[::60])=O)}|
+
+\subsubsection{Nested rings}
+Delving deeper into the ring method, we can also consider nesting incomplete 6-rings. We could start with this backbone:
+\exemple{Backbone (nested rings)}|\chemfig{*6(--*6(--=O))}|
+
+And then add the bonds which leave the vertices of these rings. There are no angles to worry about because the bonds leaving the rings are the bisectors of the sides of the ring, exactly what we want here:
+\exemple{Molecule (nested rings)}|\chemfig{*6((-)-(=O)-*6(-(-NH_2)-(-OH)=O))}|
+
+A close look shows that the second line segment of the double bond to the oxygen atom is \emph{inside} the incomplete 6-ring\footnote{This was also true for the preceding method with one ring.} Despite its brevity, this code does not give a perfect drawing. This can of course be corrected by adding a little to the code:
+\exemple{Molecule (corrected nested rings)}|\chemfig{*6((-)-(=O)-*6(-(-NH_2)-(-OH)(=[::60]O)))}|
+
+\subsection{Glucose}
+The goal here is to represent the glucose molecule according to several different conventions.
+
+\subsubsection{Skeleton diagram}
+The code here looks like that of 2-amino-4-oxohexanoic acid. This gives almost the same structure with absolute angles, except here the default angle is $-30\degres$:
+\exemple[60]{Backbone}|\chemfig{[:-30]HO--[:30]--[:30]--[:30]-H}|
+
+Adding the branches is no problem. We use predefined absolute angles:
+\exemple[60]{Glucose, skeleton diagram}|\chemfig{[:-30]HO--[:30](<[2]OH)-(<:[6]OH)
+-[:30](<:[2]OH)-(<:[6]OH)-[:30](=[2]O)-H}|
+
+\subsubsection{Fisher projection}
+The goal is to get the molecule below:
+\begin{center}
+ \definesubmol{x}{(-[4]H)(-[0]OH)}
+ \definesubmol{y}{(-[0]H)(-[4]OH)}
+ \chemfig{[2]OH-[3]-!x-!x-!y-!x-=[1]O}
+\end{center}
+The idea is to begin to draw the longest chain vertically by giving a default angle of ``\verb-[2]-''. Here is the skeleton, where we have added lower case letters at the end of each vertical bond:
+\exemple{Skeleton}|\chemfig{[2]OH-[3]-a-b-c-d-=[1]O}|
+
+Next we define two aliases for the horizontal bonds and the atoms at their ends. Lets choose ``\verb-x-'' which we will put in place of the lower case a, c and d, and ``\verb-y-'' which will replace the letter c. Since these alias are just one character, we do not need braces and can write ``\verb-!x-'' instead of ``\verb-!{x}-'':
+\exemple{Glucose (Fisher projection)}|\definesubmol{x}{(-[4]H)(-[0]OH)}
+\definesubmol{y}{(-[0]H)(-[4]OH)}
+\chemfig{[2]OH-[3]-!x-!x-!y-!x-=[1]O}|
+
+\subsubsection{``Chair'' representation}
+We will depict the $\alpha$-D-glucose molecule:
+\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)}
+
+To do this, we will first of all draw five sides of the chair and link the first vertex to the last with a hook ``\verb-?-''. We will use the following absolute angles, running counterclockwise: $-50\degres$, $10\degres$, $-10\degres$, $130\degres$, $190\degres$.
+\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 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)}|
+
+\subsubsection{Haworth projection}
+The goal is to depict this D-glucopyranose molecule:
+\chemfig[cram width=2pt]{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)}
+
+First of all we will choose the longest chain, which starts at the ``HO'' group on the left and continues through fives sides of the ring. The ring will be closed with a hook. For the vertical bond which leaves from the first ``HO'' group, we need to specify that it will leave from the second atom using the optional argument. Furthermore, it will be shortened with a coefficient of 0.5. Its optional argument will thus be ``\verb/[2,0.5,2]/''.
+
+Next, to give the impression of perspective to the ring, the diagonal bonds will be shortened by a coefficient of 0.7. For the bold diagonal lines we will use Cram bonds, having redefined the base of the triangles to be 2pt. The bold horizontal bond needs to be drawn with a thickness of 2pt, and so its optional argument will be ``\verb/[0,,,,line width=2pt]/''. Here is the skeleton of the molecule:
+\exemple{Structure}|\chemfig[cram width=2pt]{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 perspective:
+\exemple{Projection de Haworth}|\chemfig[cram width=2pt]{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)}|
+
+\subsection{Adrenaline}
+We want to draw the adrenaline molecule:
+\chemfig{*6((-HO)-=-(-(<[::60]OH)-[::-60]-[::-60,,,2]HN-[::+60]CH_3)=-(-HO)=)}
+
+We are going to use two different methods.
+
+\subsubsection{Using one ring}
+First of all, we start with a 6-ring and we draw the start of the branches which leave it:
+\exemple[60]{Skeleton of adrenaline}|\chemfig{*6((-HO)-=-(-)=-(-HO)=)}|
+
+The branch on the right still needs to be completed using, for example, relative angles:
+\exemple[60]{Adrenaline, step two}|\chemfig{*6((-HO)-=-(--[::-60]-[::-60]
+HN-[::+60]CH_3)=-(-HO)=)}|
+
+Then we need to add a Cram-bonded \verb-OH- and indicate that the bond which arrives at ``\verb-HN-'' does so on the second atom, i.e., ``N''. We use the fourth optional argument of the bond:
+\exemple[60]{Adrenaline}|\chemfig{*6((-HO)-=-(-(<[::60]OH)-[::-60]-[::-60,,,2]
+HN-[::+60]CH_3)=-(-HO)=)}|
+
+\subsubsection{Using two rings}
+This method is less natural, but the goal is to show here how to make a bond invisible.
+
+We could improve this code by considering that the drawing of the adrenaline molecule is made of two 6-rings adjacent to each other:
+\exemple[60]{Adrenaline, two-ring skeleton}|\chemfig{*6((-HO)-=*6(--HN---)-=-(-HO)=)}|
+
+Now the first two bonds of the ring on the right need to be made invisible. To do this we use the argument that is passed to \TIKZ, specifying ``\verb-draw=none-''. These bonds will thus have this code: ``\verb/-[,,,,,draw=none]/''. To keep the code readable, we define an alias named ``\verb-&-'' for these bonds:
+\exemple[60]{Adrenaline, step two}|\definesubmol{&}{-[,,,,draw=none]}
+\chemfig{*6((-HO)-=*6(!&!&HN---)-=-(-HO)=)}|
+
+The rest becomes easy; just add the branches to the right vertices:
+\exemple[60]{Adrenaline, step three}|\definesubmol{&}{-[,,,,draw=none]}
+\chemfig{*6((-HO)-=*6(!&!&HN(-CH_3)--(<OH)-)-=-(-HO)=)}|
+
+To finish, we specify that the bonds that \emph{arrive at and leave from} ``\verb-HN-'' must do so at the second atom. We therefore define another alias for the invisible bond which arrives at ``\verb-HN-'':
+\exemple[60]{Adrenaline}|\definesubmol{&}{-[,,,,draw=none]}
+\definesubmol{&&}{-[,,,2,draw=none]}
+\chemfig{*6((-HO)-=*6(!&!{&&}HN(-CH_3)-[,,2]-(<OH)-)-=-(-HO)=)}|
+
+\subsection{Guanine}
+We will draw the guanine molecule:
+\chemfig{*6((-H_2N)=N-*6(-\chembelow{N}{H}-=N?)=?-(=O)-HN-[,,2])}\medskip
+
+First of all, let's begin by drawing the nested rings, putting just the nitrogen atoms at the vertices:
+\exemple{Guanine, skeleton}|\chemfig{*6(=N-*6(-N-=N)=--N-)}|
+
+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 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)/'':
+\exemple{Guanine}|\chemfig{*6((-H_2N)=N-*6(-\chembelow{N}{H}-=N?)=?-(=O)-HN-[,,2])}|
+
+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 \protect\ldots}
+\subsection{Write a colored atom}
+Since the package \verb-xcolor- is loaded by \TIKZ, itself loaded by \CF, we can write color commands in the code of a molecule, mainly \falseverb{\color} and \falseverb\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 starts 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{Add a superscript without modifying a bond}
+Adding a \falseverb{charge} to an atom with a mathematical exponent implies that the box (and therefore the \TIKZ node) containing the atom has its dimensions modified. It has no importance when the atom is trailing but the alignment may be compromised if a bond is attached to the atom. The first reaction is to put the charge in a box with no width and therefore use the command \falseverb\rlap\footnote{If you have to put the charge at the left of the atom, you must use the command \texttt{\string\llap.}}, which often gives good results. We see here that with \falseverb\rlap, the \falseverb{horizontal alignment} of atoms is preserved:
+\exemple{Charge and bond}/\chemfig{A^+-[2]B}
+\qquad
+\chemfig{A\rlap{${}^+$}-[2]B}/
+If you want to use the command \verb-\oplus- which displays ``$\oplus$'', some could find that the charge is too low: $\mathrm{A^\oplus}$. In that case, why not use \falseverb{\chemabove} to put as precisely as you will, both vertically and horizontally the charge:
+\exemple{Charge et \string\chemabove}/\chemfig{\chemabove[0.5pt]{A}{\scriptstyle\hspace{3.5mm}\oplus}-[2]B}
+\qquad
+\chemfig{{\chemabove[-0.5pt]{A}{\scriptstyle\hspace{3.5mm}\oplus}}-[2]B}/
+We notice an additional level of braces for the second molecule. Indeed, as we specify ``\verb/-0.5pt/'' for the optional argument of \falseverb{\chemabove} to lower the charge, it is necessary to prevent \CF to understand the sign ``\verb/-/'' as a single bond.
+
+To add a load near the vertex of a cycle , the best method is to attach an invisible bond to this vertex, which is done here with \falseverb{\definesubmol} with a bond with a length coefficient equal to 0.2:
+\exemple{Charges and cycles}/\definesubmol\nobond{-[,0.2,,,draw=none]}
+\chemfig{*5(---(!\nobond\scriptstyle\oplus)-(!\nobond\scriptstyle{-})-)}/
+
+\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 \falseverb\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{Draw a ploymer element}\label{polymerdelim}
+The macro \verb|\polymerdelim|, until now undocumented and in the test phase, becomes officially released in \CF with version 1.33. Its syntax is as follows:
+\begin{center}
+ \Verb|\polymerdelim[<keys>=<values>]{<node1>}<node2>}|
+\end{center}
+
+The effect, after possibly \emph{two} compilations, is to place vertical delimiters at the specified nodes. The parameters are specified via the \chevrons{keys} and \chevrons{values}, which are listed below, default values and actions.
+\begin{center}
+\begin{tabular}{rlp{8cm}}\hline
+ \chevrons{keys} & default \chevrons{values} & Action\\\hline
+ \CFdelimparam{delimiters} & Defines the delimiters. If these delimiters are brackets, write \verb|delimiters={[]}|.\\
+ \CFdelimparam{height} & Defines the height (above the node) of the delimiters.\\
+ \CFdelimparam{depth} & Defines the depth (below the node) of the delimiters. If the \chevrons{value} is empty, then the depth is equal to the height.\\
+ \CFdelimparam{h align}&Boolean which, when \CFval{false}, places the 2nd delimiter on the 2nd node, at the risk that the delimiters are not on the same horizontal line.\\
+ \CFdelimparam{auto rotate}&Booléen which, when \CFval{true} and \CFkv{h align}{false}, automatically turns the delimiters to be perpendicular to the line that connects the two nodes.\\
+ \CFdelimparam{rotate}&When \CFkv{h align}{false} and \CFkv{auto rotate}{false}, sets the rotation angle of the two delimiters.\\
+ \CFdelimparam{open xshift}& Defines the horizontal offset of the opening delimiter.\\
+ \CFdelimparam{close xshift}& Defines the horizontal offset of the closing delimiter. If the \chevrons{value} is empty, then this offset becomes opposite to the offset of the opening delimiter.\\
+ \CFdelimparam{indice} & Defines the indices that will be placed at the right bottom of the closing delimiter.\\\hline
+\end{tabular}
+\end{center}
+\exemple*{Polymers}|Polyethylen:
+\chemfig{\vphantom{CH_2}-[@{op,.75}]CH_2-CH_2-[@{cl,0.25}]}
+\polymerdelim[height = 5pt, indice = \!\!n]{op}{cl}
+\bigskip
+
+Polyvinyl chloride:
+\chemfig{\vphantom{CH_2}-[@{op,1}]CH_2-CH(-[6]Cl)-[@{cl,0}]}
+\polymerdelim[height = 5pt, depth = 25pt, open xshift = -10pt, indice = \!\!n]{op}{cl}
+\bigskip
+
+Nylon 6:
+\chemfig{\phantom{N}-[@{op,.75}]{N}(-[2]H)-C(=[2]O)-{(}CH_2{)_5}-[@{cl,0.25}]}
+\polymerdelim[height = 30pt, depth = 5pt, indice = {}]{op}{cl}
+\bigskip
+
+Polycaprolactame
+\chemfig[atom sep = 2em]{[:-30]-[@{left,.75}]N(-[6]H)-[:30](=[2]O)--[:30]--[:30]--[@{right,0.25}:30]}
+\polymerdelim[height = 5pt, indice = \!\!n]{left}{right}
+\bigskip
+
+Polyphénylène sulfide:
+\chemfig{\vphantom{S}-[@{op,.75}]S-(**6(---(-[@{cl,0.25}])---))}
+\polymerdelim[delimiters = (), height = 15pt, indice = {}]{op}{cl}
+\bigskip
+
+\chemfig{-CH_2-CH([6]-CO-NH-CH_2-NH-CO-CH([4]-CH_2-)([0]-[@{downleft,0.8},2]CH_2
+-CH([2]-CO-NH_2)-[@{downright,0.3},2]CH_2-[,1.5]C?H-))-[@{upleft,0.8},2]CH_2
+-CH([6]-CO-NH_2)-[@{upright,0.3},2]CH_2-[,1.5]CH([6]-CO-NH-CH_2-NH-C?O)-}
+\polymerdelim[delimiters ={[]}, height = 5pt, depth = 40pt, indice = n]{upleft}{upright}
+\polymerdelim[delimiters ={[]}, height = 40pt, depth = 5pt, indice = n]{downleft}{downright}
+
+\chemfig{-[@{op,.5}:-30]O-[::60](=[::60]O)-[::-60]*6(-=-(-(=[::-60]O)-[::60]O-[::-60]-[::60]-[@{cl,.5}::-60])=-=)}
+\polymerdelim[height=6ex, indice=n, h align=false]{op}{cl}|
+
+\subsection{Draw the symmetrical of a molecule}\label{retournement}
+The two commands \falseverb{\hflipnext} and \falseverb{\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}/
+
+\subsection{Add text above bonds and arc to angles}
+Once we have understood that the character ``\verb-@-'' can put a ``global'' \TIKZ node, that is to say a node accessible after the molecule has been drawn, everything that \TIKZ can do with nodes (that is to say a lot of things) becomes possible.
+
+To write something above or below a bond, we can put two ``global'' nodes on the atoms at the ends of this bond and write midway of them a text, raised or lowered so that it falls to just above or below the bond. This is done by the macro \verb-\bondname- in the code below.
+
+To draw an arc between two bonds, three atoms are involved on which we have to put three ``global'' nodes. The macro \verb-\arcbetweennodes- calculates the angle between two lines drawn from a node. Then \verb-\arclabel- draws an arc between two bonds and writes a text next to the arc: the optional argument of this macro is the \TIKZ code used to custom the arc. The second argument is the radius of the arc and the following three arguments are the names of global nodes between which the arc must be drawn, the middle name needs to be the vertex of the angle. The last argument is the text to write.
+
+\exemple*{Arcs and text on bonds}|\newcommand\angstrom{\mbox{\normalfont\AA}}
+\newcommand\namebond[4][5pt]{\chemmove{\path(#2)--(#3)node[midway,sloped,yshift=#1]{#4};}}
+
+\newcommand\arcbetweennodes[3]{%
+ \pgfmathanglebetweenpoints{\pgfpointanchor{#1}{center}}{\pgfpointanchor{#2}{center}}%
+ \let#3\pgfmathresult}
+
+\newcommand\arclabel[6][stealth-stealth,shorten <=1pt,shorten >=1pt]{%
+ \chemmove{%
+ \arcbetweennodes{#4}{#3}\anglestart \arcbetweennodes{#4}{#5}\angleend
+ \draw[#1]([shift=(\anglestart:#2)]#4)arc(\anglestart:\angleend:#2);
+ \pgfmathparse{(\anglestart+\angleend)/2}\let\anglestart\pgfmathresult
+ \node[shift=(\anglestart:#2+1pt)#4,anchor=\anglestart+180,rotate=\anglestart+90,inner sep=0pt,
+ outer sep=0pt]at(#4){#6};}}
+
+\chemfig{@{a}A=[:30,1.5]@{b}B-[7,2]@{c}C-@{d}D}
+\namebond{a}{b}{\scriptsize My text}
+\namebond[-3.5pt]{b}{c}{\small\color{red}$\pi$}
+\namebond{c}{d}{\small1 \angstrom}
+\medskip
+
+Horizontal water molecule: \chemfig{@{1}H-[::37.775,2]@{2}O-[::-75.55,2]@{3}H}.
+\namebond{1}{2}{\footnotesize0.9584 \angstrom}
+\namebond{2}{3}{\footnotesize0.9584 \angstrom}
+\arclabel{0.5cm}{1}{2}{3}{\footnotesize104.45\textdegree}
+\qquad
+Water molecule rotated 30\textdegree: \chemfig{[:30]@1H-[::37.775,2]@2O-[::-75.55,2]@3H}
+\namebond12{\footnotesize0.9584 \angstrom}
+\namebond23{\footnotesize0.9584 \angstrom}
+\arclabel{0.5cm}{1}{2}{3}{\footnotesize104.45\textdegree}|
+
+\subsection{Schéma de Lewis à l'angle près}
+In some very special cases, it is sometimes necessary to position Lewis diagrams to the nearest degree and no longer to multiples of 45 degrees.
+
+For this, it is relatively easy to write a macro \verb-\mylewis-, admitting an optional argument (the length of the doublet) which is 2ex and two mandatory arguments; the first being the name of the atom and the second being the list of angles separated by commas.
+
+The trick is to create an invisible circular node that contains the atom and draw the dipoles at the desired angles so that they are tangent to this circle:
+
+\exemple*{Doublets au degrés prés}|\catcode`\_11
+\newcommand\mylewis[3][2ex]{% #1=longueur, #2=atome #3=liste des angles
+ \tikzpicture[baseline,anchor=base]%
+ \node[inner sep=0pt,outer sep=1pt,circle,overlay](atom@@)at(0,0){\phantom{#2}};%
+ \node[inner sep=0pt,outer sep=0pt]at(0,0){#2};%
+ \def\list_angle{#3,}%
+ \loop
+ \expandafter\grab_angle\list_angle\_nil
+ \pgfextractx\CF_dim{\pgfpointanchor{atom@@}\current_angle}\edef\CF_dimax{\the\CF_dim}%
+ \pgfextracty\CF_dim{\pgfpointanchor{atom@@}\current_angle}\edef\CF_dimay{\the\CF_dim}%
+ \pgfmathparse{#1*sin(\current_angle)/2}\let\offset_xx\pgfmathresult
+ \pgfmathparse{#1*cos(\current_angle)/2}\let\offset_yy\pgfmathresult
+ \draw[line width=.4pt,overlay]
+ (\CF_dimax-\offset_xx,\CF_dimay+\offset_yy)--(\CF_dimax+\offset_xx,\CF_dimay-\offset_yy);%
+ \unless\ifx\empty\list_angle
+ \repeat
+ \endtikzpicture
+}
+\def\grab_angle#1,#2\_nil{\def\current_angle{#1}\def\list_angle{#2}}
+\catcode`\_8
+Essai : \mylewis{Cl}{15}\qquad \mylewis[3ex]{Cl}{-60}\qquad \mylewis[1.5ex]{Cl}{60,120,240,300}
+\bigskip
+
+\chemfig{P(-[:72]\mylewis{Cl}{-18,72,162})(-[:-72]Cl)
+(-[:144]Cl)(-[:-144]Cl)-\mylewis{Cl}{0,90,-90}}|
+
+\subsection{Dessiner des liaisons multiples}
+Again, the ``decorations.markings'' library allows to draw multiple bonds:
+
+\exemple*{Liaisons multiples}|\catcode`_=11
+\tikzset{nbond/.style args={#1}{%
+ draw=none,%
+ decoration={%
+ markings,%
+ mark=at position 0 with {\coordinate (CFstart@) at (0,0);},
+ mark=at position 1 with {%
+ \foreach\CF_i in{0,1,...,\number\numexpr#1-1}{%
+ \pgfmathsetmacro\CF_nbondcoeff{\CF_i-0.5*(#1-1)}%
+ \draw ([yshift=\CF_nbondcoeff\CF_doublesep]CFstart@)--(0,\CF_nbondcoeff\CF_doublesep);
+ }%
+ }
+ },
+ postaction={decorate}
+ }
+}
+\catcode`\_=8
+\chemfig{A-[1,,,,nbond=4]B-[:-30,,,,nbond=5]C-[6,,,,nbond=6]D}|
+
+\part{Reaction schemes}\label{schemas}
+Following several requests from users, it had become evident that \CF had a weakness regarding the drawing of reaction schemes. The gap is now filled. Therefore, \CF has now reached version 1.0 since I consider that the main features sought are now available.
+
+I thank Clemens \textsc {Niederberger} for his help and the tests he carried out on the new features presented in this part.
+\section{Overview}\label{schemestart}
+A reaction scheme must be contained between the commands ``\falseverb\schemestart'' and ``\falseverb\schemestop''. As shown in this example, \falseverb{debug information} is either hidden or displayed with the \chevrons{key} \CFkey{scheme debug} and the value \CFval{true} ou \CFval{false}:
+\exemple[50]{Example 1}/\setchemfig{scheme debug=false}
+\schemestart
+ \chemfig{*6(-=-=-=)}\arrow
+ \chemfig{X=[1]Y}\arrow
+ \chemfig{S>T}
+\schemestop
+\bigskip
+
+\setchemfig{scheme debug=true}
+\schemestart
+ \chemfig{*6(-=-=-=)}\arrow
+ \chemfig{X=[1]Y}\arrow
+ \chemfig{S>T}
+\schemestop/
+
+Some comments:
+\begin{itemize}
+ \item the \falseverb{\arrow} commands draw the arrows;
+ \item everything lying between two \falseverb{\arrow} commands is considered a \falseverb{compound}. It was decided that all possible settings, whether for arrows or compounds, are controlled by the arguments of the \falseverb{\arrow} command, whose syntax may become quite complex;
+ \item arrows are plotted horizontally, this can obviously be modified;
+ \item arrows are plotted on the imaginary line connecting the center of the compounds' bounding boxes (the red and blue squares are the anchoring points of arrows). This behavior can also be modified;
+ \item debug information is displayed with the \CFkey{scheme debug} \chevrons{key}. It consists of:
+ \begin{itemize}
+ \item the green label above the bounding boxes is the default name assigned to compounds by \CF. It follows the series "c1", "c2", etc. Numbering is reset to 1 for every reaction scheme.
+ \item display of the compounds bounding boxes;
+ \item the arrows start and end points represented by red points and anchors by blue points;
+ \end{itemize}
+ \item the distance from edge to edge between two compounds is defined with the \chevrons{key} \CFkv{compound sep}{dim}\label{compound sep}. By default this \CFval{dim} is 5em;
+ \item finally, the distance between the edges of the compounds and the beginning and end of the arrows is defined with the \chevrons{key} \CFkv{arrow offset}{dim}. By default, this \CFval{dim} is 4pt.\label{arrow offset}
+\end{itemize}
+
+\section{Arrow types}\label{arrow}
+When the \falseverb{\arrow} command is followed by an optional argument in braces (which is not mandatory), the argument defines the type of arrow:
+\exemple[50]{Arrow types}|\schemestart A\arrow{->}B\schemestop\par % by default
+\schemestart A\arrow{-/>}B \schemestop\par
+\schemestart A\arrow{<-}B \schemestop\par
+\schemestart A\arrow{<->}B \schemestop\par
+\schemestart A\arrow{<=>}B \schemestop\par
+\schemestart A\arrow{<->>}B \schemestop\par
+\schemestart A\arrow{<<->}B \schemestop\par
+\schemestart A\arrow{0}B \schemestop\par
+\schemestart A\arrow{-U>}B \schemestop|
+The arrow ``\verb/-U>/'' is not fully drawn, an arc can be added tangent to the arrow center using optional arguments on the command, see page~\pageref{fleche.arg.optionnel}. Here is a ``\verb/-U>/'' arrow with the arc on top of it: \schemestart A\arrow{-U>[$\scriptstyle x$][$\scriptstyle y$]}B\schemestop
+
+For the sake of clarity, capital letters will be used throughout the documentation instead of chemical formulas made with the \falseverb\chemfig command except for specific examples. Reaction schemes obviously work identically with letters and drawn molecules. Several examples are shown in the Gallery with proper reaction schemes.
+
+\section{Arrows features}
+Each \falseverb{arrow} is characterized by:
+\begin{itemize}
+ \item an angle expressed in degrees;
+ \item a coefficient that specifies the arrow length through the multiplication of the compounds spacing value defined by \CFkey{compound sep};
+ \item a style with \TIKZ instructions to customize the color, the thickness or other graphical attribute of the arrow.
+\end{itemize}
+
+These features are defined with the \chevrons{keys}
+\begin{itemize}
+ \item \CFkv{arrow angle}{angle}, which default value is 0;
+ \item \CFkv{arrow coeff}{decimal}, which default value is 1;
+ \item \CFkv{arrow style}{code tikz}, empty by default.
+\end{itemize}
+
+\exemple[50]{Definition of default values}/\schemestart A\arrow B\arrow C\schemestop
+
+\setchemfig{arrow angle=15,arrow coeff=1.5,
+arrow style={red, thick}}
+\schemestart A\arrow B\arrow C\schemestop
+
+\setchemfig{arrow coeff=2.5,arrow style=dashed}
+\schemestart A\arrow B\arrow C\schemestop
+
+\setchemfig{arrow angle={},arrow coeff={},arrow style={}}
+\schemestart A\arrow B\arrow C\schemestop/
+
+In order to locally modify one or all of these default values, the \falseverb{\schemestart} command accepts an optional argument in the form \verb-[angle,coeff,style]- which changes the default arrow features within the sole reaction scheme:
+\exemple[50]{Optional argument}/\setchemfig{arrow angle=5,arrow coeff=2.5,arrow style=blue}
+\schemestart A\arrow B\arrow C\schemestop
+
+\schemestart[0] A\arrow B\arrow C\schemestop
+
+\schemestart[0,1] A\arrow B\arrow C\schemestop
+
+\schemestart[0,1,thick] A\arrow B\arrow C\schemestop
+
+\schemestart[0,1,black] A\arrow B\arrow C\schemestop/
+
+Regarding style, the rule is: the style specified in the argument in brackets applies \emph{after} the default style, without overwriting it! This is why only the ``black'' color attribute is able to overwrite the `` blue'' default style.
+
+Finally, the \falseverb{\arrow} command accepts an optional argument in brackets in the form \verb-[angle,coeff,style]- to change the feature of that given arrow. As above, style applies \emph{after} the default style and \emph{after} the style possibly-specified in the optional argument of the \verb-\schemestart- command, again without overwrting them.
+\exemple[50]{Arrows features}/\schemestart
+ A\arrow[45]B\arrow[-20,2]C
+\schemestop
+\bigskip
+
+\schemestart
+ A\arrow[90,,thick]B\arrow[,2]C
+ \arrow[-45,,dashed,red]D
+\schemestop/
+
+\section{Compounds names}
+Automatic naming of compounds (``c1'', ``c2'', etc.) can be overridden. For this, the \falseverb{\arrow} command must be immediately followed by an argument in parentheses. The argument is of the form: \verb/(n1--n2)/. The compounds located at the beginning and at the end of the arrow are named ``\verb-n1-'' and ``\verb-n2-'', respectively. Any alphanumeric string can be used. The numbering of the names "c<n>" continues internally, so if a \falseverb{compound} has a different name than the default one, it does not affect the default name of the subsequent compounds.
+
+Names are optional, and the argument can be either \verb/(n1--)/ and \verb/(--n2)/.
+
+\exemple[50]{Compounds names}/\setchemfig{scheme debug=true}
+\schemestart
+ A\arrow(aa--bb)B\arrow(--cc)C\arrow(--dd)D\arrow E
+\schemestop
+\bigskip
+
+\schemestart
+ A\arrow(aa--)B\arrow(bb--)C\arrow(cc--dd)D\arrow E
+\schemestop/
+Note that both methods are equivalent. Therefore, compounds can either be named by arrows preceding or following them. However, when a \falseverb{compound} is surrounded by two arrows specifying its name, the first name is ignored and a warning message is generated:
+\exemple[50]{Overfull naming}/\setchemfig{scheme debug=true}
+\schemestart
+ A\arrow(--foo)B\arrow(bar--)C
+\schemestop/
+Here \falseverb{compound} ``B'' is called ``foo'' by the arrow pointing at it, and ``bar'' by the arrowing leaving from it. Thus \CF generates a warning mentioning that the name "foo" will be ignored:
+
+\hfill\verb-Package chemfig Warning: two names for the same node, first name "foo" ignored-\hfill\null
+
+\section{Anchoring}
+As noted above, arrows lie on the line connecting the center of the compounds' bounding boxes. Default anchors are called ``center'' in the sense of \TIKZ. Non-default anchoring points can be user-specified as well with an argument between brackets:
+
+\hfill\verb/(n1.a1--n2.a2)/\hfill\null
+
+where the anchor ``\verb-a1-'' or ``\verb-a2-'' can be: north west, north, north east, west, center, east, mid west, mid, mid east, base west, base, base east, south west, south , south east, text, or any angle. Here is an example from the \TIKZ manual where the anchors are located on the bounding box:
+\exemple*{TikZ anchoring}|\Huge
+\begin{tikzpicture}[baseline]
+\node[anchor=base west,name=x,draw,inner sep=25pt] {\color{lightgray}Rectangle\vrule width 1pt height 2cm};
+\foreach \anchor/\placement in
+{north west/above left, north/above, north east/above right,west/left, center/above, east/right,
+mid west/left, mid/above, mid east/right,base west/left, base/below, base east/right,
+south west/below left, south/below, south east/below right,text/below,10/right,45/above,150/left}
+\draw[shift=(x.\anchor)] plot[mark=x] coordinates{(0,0)}
+node[\placement,inner sep=0pt,outer sep=2pt] {\scriptsize\texttt{(\anchor)}};
+\end{tikzpicture}|
+Like for names, arrival and departure anchoring points are independent and optional.
+
+In this example, the default alignment is not good because the two ``A'' are not aligned vertically. Debug information show that the default ``center'' anchors are not suitable:
+\exemple[50]{Alignment problems}/\setchemfig{scheme debug=true}
+\schemestart
+ \chemfig{A*5(-----)}
+ \arrow
+ \chemfig{A*5(---(-)--)}
+\schemestop/
+For the alignment to be correct, arrows will leave/arrive either from the anchor ``base east''/``base west'', or from anchor ``mid east''/``mid west'':
+\exemple[50]{Alignment problems}/\setchemfig{scheme debug=true}
+\schemestart
+ \chemfig{A*5(-----)}
+ \arrow(.base east--.base west)
+ \chemfig{A*5(---(-)--)}
+\schemestop
+\bigskip
+
+\schemestart
+ \chemfig{A*5(-----)}
+ \arrow(foo.mid east--bar.mid west)
+ \chemfig{A*5(---(-)--)}
+\schemestop/
+
+One last anchor need be specified: the anchor of the first \falseverb{compound} with respect to the \falseverb{baseline} of the text just before it. This is illustrated by the green point on the left-hand side of the scheme below:
+\exemple[50]{Initial anchoring}/\setchemfig{scheme debug=true}
+Preceding text:
+\schemestart
+ \chemfig{A*5(-----)}\arrow A
+\schemestop/
+
+The default position of this anchor on the first \falseverb{compound}'s bounding box is that given by ``text''. This position can be controlled with the second optional argument of the \falseverb{\schemestart} command:
+\exemple[50]{Adjusting the initial anchoring}/\setchemfig{scheme debug=true}
+Preceding text:
+\schemestart[][south]
+ \chemfig{A*5(-----)}\arrow A
+\schemestop
+\bigskip
+
+Preceding text:
+\schemestart[][north west]
+ \chemfig{A*5(-----)}\arrow A
+\schemestop
+\bigskip
+
+Preceding text:
+\schemestart[][west]
+ \chemfig{A*5(-----)}\arrow A
+\schemestop/
+
+\section{Compounds style}
+The \falseverb{\arrow} command can also include \TIKZ instructions to define the bounding box style ``\verb-s-'' of the reactant and the product of the reaction. This is done with the argument between parentheses. Always style through the argument in brackets of the \falseverb{\arrow}, we can specify with \TIKZ instructions the style ``\verb-s-'' to bounding box of the \falseverb{compound} of departure or of arrival. Therefore the complete syntax of the \falseverb{\arrow} command, with each specification being optional, is as follows:
+
+\hfill\verb/\arrow(n1.a1[s1]--n2.a2[s2]){arrow type}[angle,coeff,arrow style]/\hfill\null
+
+Like forn names, if specific styles are given to one compound by arrows arriving on it and leaving from it, the first style will be ignored with a warning.
+
+\exemple[60]{Compounds style}/\schemestart
+ A
+ \arrow([red]--[fill=blue,semitransparent,text opacity=1,
+ inner sep=10pt,rounded corners=2mm])
+ B
+\schemestop
+\bigskip
+
+\schemestart
+ A\arrow(--foo[yshift=5mm])B
+\schemestop/
+
+\label{setcompoundstyle}The macro \falseverb\setcompoundstyle\Verb-{<code tikz>}- allows to globally define the style of compounds displayed thereafter. Entering an empty argument results in the absence of style, which corresponds to the default case.
+
+Here a style is defined with round corner-shaped boxes and semitransparent background:
+\exemple[50]{Global styles}/\setchemfig{compound style={draw,line width=0.8pt,
+semitransparent,text opacity=1,inner sep=8pt,
+rounded corners=1mm}}
+\schemestart
+ A\arrow([fill=red]--[fill=blue])[90]
+ B\arrow(--[fill=gray])
+ C\arrow(--[fill=green])[-90]
+ D\arrow(--[draw=none])[-180]
+\schemestop/
+
+\section{Branching}
+So far, only linear reaction schemes have been treated. Branched schemes are also possible and this is where compound names play a key role. When a name is preceded by ``\verb-@-'' in the argument between brackets of the \falseverb{\arrow} command, it means that the \falseverb{compound} already exists. Several scenarios are possible:
+\begin{itemize}
+ \item \verb/(@n1--n2)/: the arrow will leave from the existing compound ``\verb-n1-'' and the scheme will continue following the arrow, thus creating a branch;
+ \item \verb/(@n1--@n2)/: the arrow is drawn between two existing compounds, no matter whether they are already defined or whether they will later in the reaction scheme: therefore this syntax can be placed \emph{anywhere} in the code of the reaction scheme;
+ \item \verb/(n1--@n2)/: this syntax is not permitted;
+\end{itemize}
+
+In the following example, 3 branches are made, a first one from ``B'', a second one from ``D'' and a last one from ``X''. Finally one more arrow connects two existing compounds: ``XX'' and ``D'':
+\exemple[50]{Branching}/\schemestart
+ A\arrow(aa--bb)B\arrow(--cc)C\arrow D
+ \arrow(@bb--xx1)[-90]X\arrow[-90]Y% 1st branch
+ \arrow(@c4--)[-90]Z\arrow W% 2nd branch
+ \arrow(@xx1--xx2)[-45]XX% 3rd branch
+ \arrow(@xx2--@c4)% XX-to-D arrow
+\schemestop/
+
+One may wish to have ``Y'' and ``XX'' on the same horizontal line. To achieve this, a horizontal invisible bond is drawn between ``Y'' and ``XX''; the scheme is completed with a final arrow between the two existing compounds ``XX'' and ``D'':
+\exemple[50]{Branching}/\schemestart
+ A\arrow(aa--bb)B\arrow(--cc)C\arrow D
+ \arrow(@bb--xx1)[-90]X\arrow[-90]Y\arrow(--xx2){0}XX
+ \arrow(@c4--)[-90]Z\arrow W
+ \arrow(@xx1--@xx2)% X-to-XX arrow
+ \arrow(@xx2--@c4)% XX-to-D arrow
+\schemestop/
+
+\section{Subscheme}\label{subscheme}
+A fraction of the reaction scheme can be defined within a single bounding box, so that \CF treats it as a \falseverb{compound}. The reaction scheme fraction is defined inside the compulsory argument between braces of the \falseverb{\subscheme} command so it is subsequently regarded as a single entity. When \falseverb{\subscheme} is located after an arrow, the command labels this subscheme as a \falseverb{compound} named ``c<n+1>'':
+\exemple[50]{Subscheme}/\setchemfig{scheme debug=true}
+\schemestart
+ A\arrow
+ \subscheme{B\arrow[-90,2]C}
+ \arrow
+ D
+\schemestop/
+Although this is not clearly seen because of labels overlap, the box around the subscheme is called ``c2'', and name numbering continues inside the subscheme with B called ``c3'' and C called ``c4''. Since the first \falseverb{compound} in the subscheme is ``B'', the subscheme's baseline is that of ``B''. This can be pointed out by specifying the anchors:
+\exemple[50]{Subscheme}/\setchemfig{scheme debug=true}
+\schemestart
+ A\arrow(--.mid west)
+ \subscheme{B\arrow[-90,2]C}
+ \arrow
+ D
+\schemestop/
+Note that since ``\falseverb\subscheme\Verb-{<scheme>}-'' is only a convenient shortcut for
+\begin{center}
+\falseverb\schemestart\Verb-<scheme>-\falseverb\schemestop
+\end{center}
+Consequently, it can be used with the same optional arguments as \falseverb\schemestart.
+
+\label{chemleft}\CF provides the \falseverb{\chemleft} and \falseverb{\chemright} command pair. These allow to set expandable delimiters on either side of a material. The commands must be followed by delimiters, just like in the case of \TeX{} primitive commands \verb-\left- and \verb-\right-:
+\begin{center}
+ \Verb/\chemleft<car1><material>\chemright<car2>/
+\end{center}
+where \Verb-<car1>- and \Verb-<car2>- can be ``('' et ``)'' or ``['' and ``]'', or any other expandable delimiter consistent with the \verb-\left- et \verb-\right- commands.
+\exemple{The \string\chemleft\ and \string\chemright macros}/\chemleft\lfloor\chemfig{A-[1]B}\chemright)
+
+\chemleft\{\chemfig{A-[1,1.25]B-[6,1.25]C}\chemright|
+
+\chemleft[\chemfig{H-[1]O-[7]H}\chemright]/
+The code of the reaction scheme discussed above including \falseverb{\chemleft} and \falseverb{\chemright} is written:
+\exemple{Reaction scheme with \string\chemleft\ and \string\chemright}/\schemestart
+ A\arrow
+ \chemleft[\subscheme{B\arrow[-90,2]C}\chemright]
+ \arrow
+ D
+\schemestop/
+\label{chemup}By analogy, the macros \falseverb{\chemup} and \falseverb{\chemdown} can be used to draw expandable delimiters above and below the material, respectively:
+\begin{center}
+ \Verb/\chemup<car1><material>\chemdown<car2>/
+\end{center}
+For example:
+\exemple{The \string\chemup\ and \string\chemdown macros}/\schemestart[-90]
+X\arrow
+\chemup\{\chemfig{A-[1]B-[7]C}\chemdown\}
+\arrow Y
+\schemestop
+\qquad
+\schemestart[-90]
+X\arrow
+\chemup[\chemfig{A-[1]B-[7]C}\chemdown]
+\arrow Y
+\schemestop/
+
+Delimiters can can also be drawn through compounds' style and apply them to a random compound (and hereby to a subscheme). These expandable delimiters (parentheses, brackets, braces) can be used upon loading the ``matrix'' \TIKZ library in the document preamble:
+
+\hfill\verb-\usetikzlibrary{matrix}-\hfill\null
+
+Since the \falseverb{\chemleft}, \falseverb{\chemright}, \falseverb{\chemup} and \falseverb{\chemdown} commands are available, the \CF package will \emph{not} automatically load the library. As long as the user want to access this special set of delimiters, the library must be explicitly loaded.
+
+The same brackets-delimited subscheme as above is presented again:
+\exemple[50]{The ``matrix'' library delimiters}/\schemestart
+ A\arrow(--[left delimiter={[}, right delimiter={]}])
+ \subscheme{B\arrow[-90,2]C}
+ \arrow
+ D
+\schemestop/
+Since the delimiters are drawn outside the bounding box, it is advisable to slightly shorten the incoming and outgoing arrows:
+\exemple[50]{Subscheme}/\schemestart
+ A\arrow(--[left delimiter={[},
+ right delimiter={]}])[,,shorten >=6pt]
+ \subscheme{B\arrow[-90,2]C}
+ \arrow[,,shorten <=6pt]
+ D
+\schemestop/
+
+Subschemes should be used with care, undesired results are sometimes observed. In this example, a subscheme is used to horizontally align 3 different compounds:
+\exemple[50]{Subscheme}/\setchemfig{scheme debug=true}
+\schemestart
+ A
+ \arrow{0}[-90]
+ \subscheme{%
+ tagada\arrow{}
+ tsoin\arrow{}
+ fin}
+ \arrow(xx--yy){}E
+ \arrow(@c1--@c3){}
+ \arrow(@c1--@c5){}
+ \arrow(@c1--@c4){}
+\schemestop/
+The center of the subscheme is exactly located on the same vertical line as the center of compound "A". This is because the two entities are connected by an invisible arrow with a $-90 $ angle. However, the arrow between the two pre-existing compounds ``A'' and ``tsoin'' is \emph{not} vertical because ``tsoin'' is not on the center of the subscheme since "tagada" is wider than "end". If this arrow is to be vertical within the use of the \falseverb{\subscheme} command, one must find a correct angle for the arrival anchor of the invisible arrow by try-and-error.
+
+A much simpler method is to use a branch instead of a subscheme: draw a \emph{visible} arrow between ``A'' and ``tsoin'', and then draw horizontal arrows on both sides of ``tsoin'', with a branch for the right-hand side arrows.
+\exemple[50]{Subscheme}/\setchemfig{scheme debug=true}
+\schemestart
+ A
+ \arrow(--tsoin){->}[-90]
+ tsoin
+ \arrow{<-}[180]
+ tagada
+ \arrow(@tsoin--fin){}
+ fin
+ \arrow{}
+ E
+ \arrow(@c1--@c3){}
+ \arrow(@c1--@fin){}
+\schemestop/
+
+\section{Arrows optional arguments}\label{fleche.arg.optionnel}
+Within the argument in braces of the \falseverb\arrow command, the arrow name can be followed by optional arguments written between brackets. Here are the possible values for these optional arguments and their meaning, as defined by \CF:
+\begin{itemize}
+ \item the arrows ``\verb|->|'', ``\verb|<-|'', ``\verb|<->|'', ``\verb|<=>|'', ``\verb|<<->|'',``\verb|<->>|'', ``\verb|-/>|'' have three optional arguments:
+ \begin{itemize}
+ \item the first one contains the ``label'' to be placed above the arrow;
+ \item the second one contains the ``label'' to be placed below the arrow. The orientation of these two labels is given by the same angle as the arrow. The perpendicular shift between the arrow and the label anchor can be adjusted with the \chevrons{key} \CFkv{arrow label sep}{dim}\label{arrow label sep} which value is 3pt by default. Labels contained in the two optional arguments are \emph{not} typed in math mode.
+ \item the third one is a dimension corresponding to a shift perpendicular to the arrow that can be applied to it: the dimension is positive for an upward shift of the arrow (and of its labels, if any), and negative for a downward shift.
+ \end{itemize}
+ \item the ``\verb|-U>|'' arrow has 5 optional arguments:
+ \begin{itemize}
+ \item the first three are identical to those found in the other arrow types;
+ \item the fourth one is a coefficient (which is 0.333 by default) which multiplies the length of the arrow to get the radius of the arc;
+ \item the fifth one is the half-angle from the center of the arc path, it is 60 degrees by default.
+ \end{itemize}
+ \item the invisible arrow ``\verb-0-'' accepts two optional arguments of the same type as the first two listed above;
+\end{itemize}
+\exemple[50]{Arrows optional arguments}/\setchemfig{scheme debug=false}
+\schemestart A\arrow{->[up][down]}B \schemestop
+\qquad
+\schemestart A\arrow{->[up][down][4pt]}B \schemestop
+\qquad
+\schemestart A\arrow{->[up][down][-4pt]}B \schemestop
+\medskip
+
+\schemestart A\arrow{<=>[up][down]}[30,1.5]B \schemestop
+\medskip
+
+\schemestart[-20]
+ A\arrow{->}B\arrow{->[][][3pt]}C\arrow{->[][][-3pt]}D
+\schemestop/
+A problem arises for vertical arrows:
+\exemple[50]{Vertical arrows}/\schemestart
+ A\arrow{->[up][down]}[-90]B
+\schemestop/
+For the sake of clarity, one may prefer to have the ``above'' and ``below'' labels written horizontally. Label angles can be specified, while default is the same angle as that of the arrow. To choose a specific angle, \Verb-*{<angle>}- can be written at the beginning of the optional arguments:
+\exemple[55]{Choice of angles}/\setchemfig{scheme debug=true}
+\schemestart A\arrow{->[*{0}up][*{0}down]}[90]B\schemestop
+\qquad
+\schemestart A\arrow{->[*{0}up][*{0}down]}[45]B\schemestop
+\qquad
+\schemestart A\arrow{->[*{0}up][*{0}down]}[-45]B\schemestop
+\qquad
+\schemestart A\arrow{->[*{0}up][*{0}down]}[-90]B\schemestop/
+The default position of the label anchor can lead to undesired results:
+\exemple[50]{Anchors}/\setchemfig{scheme debug=true}
+\schemestart
+ A\arrow{->[*{0}on top of][*{0}underneath]}[45,2]B
+\schemestop/
+To counter this, the anchoring position can be specified as well to override the one selected by \CF by default. The syntax for this is: \Verb-*{<angle>.<ancre>}-.
+\exemple[50]{Anchors}/\setchemfig{scheme debug=true}
+\schemestart
+ A\arrow{->[*{0.0}on top of][*{0.180}underneath]}[45,2]B
+\schemestop
+\qquad
+\schemestart
+ A\arrow{->[*{0.south east}on top of]%
+ [*{0.north west}underneath]}[45,2]B
+\schemestop/
+
+The ``\verb/-U>/'' arrow remains a particular case. If one of the two labels from the first two optional arguments is present, the corresponding arc is plotted:
+\exemple[50]{The \texttt{-U>} arrow}/\schemestart A\arrow{-U>[123][456]}B\schemestop
+\qquad
+\schemestart A\arrow{-U>[123]}[30]B\schemestop
+\qquad
+\schemestart A\arrow{-U>[][456]}[-30]B\schemestop/
+
+The fourth and fifth optional arguments modify the appearance of the arc: respectively the arrow length coefficient which sets the arc radius, and the angle that defines the half arc:
+\exemple[50]{The \texttt{-U>} arrow}/\schemestart A\arrow{-U>[123][456][][0.25]}B\schemestop
+\qquad
+\schemestart A\arrow{-U>[123][456][][][90]}B\schemestop
+\qquad
+\schemestart A\arrow{-U>[123][456][][1][45]}B\schemestop/
+With negative values for the radius and the angle, the arc is drawn below the arrow:
+\exemple[50]{The \texttt{-U>} arrow}/\schemestart
+ A\arrow{-U>[123][456][][-0.333][-60]}B
+\schemestop/
+Label angles and anchoring customization is controlled with the first two arguments, just like for other arrows:
+\exemple[50]{The \texttt{-U>} arrow}/\schemestart
+ A\arrow{-U>[123][456]}[-90]B
+\schemestop
+\qquad
+\schemestart
+ A\arrow{-U>[*{0.180}123][*{0.180}456]}[-90]B
+\schemestop/
+
+\section{Arrows customization}\label{definearrow}
+This section is quite technical and requires some knowledge of \TIKZ. It is targeted at advanced users only who need to define their own arrows.
+
+The \falseverb{\definearrow} command allows to build custom arrows. Its syntax is:
+
+\hfill\Verb-\definearrow{<number>}{<arrow name>}{<code>}-\hfill\null
+
+where \Verb-<number>- is the number of optional arguments that will be used in the \Verb-<code>-, with the usual syntax \verb-#1-, \verb-#2-, etc. These optional arguments cannot accept default values; if no value is specified upon using the macro \verb-\arrow-, the arguments will remain empty.
+
+Before going further, let's examine the available internal macros when drawing arrows. Since these macros include the "\verb-@-" character in their name, they can only be accessed between \verb|\catcode`\_=11| and \verb|\catcode`\_=8| commands.
+\begin{itemize}
+ \item \falseverb{\CF_arrowstartname} and \falseverb{\CF_arrowendname} include the names of the compounds (considered as nodes by \TIKZ) between which the arrow is drawn;
+ \item \falseverb{\CF_arrowstartnode} and \falseverb{\CF_arrowendnode} include the node names where arrow ends will be located. After these names, user-defined anchors can be specified in the argument between brackets of the \falseverb\arrow command, unless the field is left empty;
+ \item \falseverb{\CF_arrowcurrentstyle} and \falseverb{\CF_arrowcurrentangle} contain the style and the angle of the arrow to be drawn;
+ \item \falseverb{\CF_arrowshiftnodes}\Verb-{<dim>}- shifts the nodes ``\falseverb{\CF_arrowstartnode}'' and ``\falseverb{\CF_arrowendnode}'' perpendicularly relative to the arrow by a dimension specified in the argument;
+ \item \falseverb{\CF_arrowdisplaylabel}\verb/{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}/ is the most complex one. It gives the labels position with the following arguments:
+ \begin{itemize}
+ \item \verb-#1- and \verb-#5- are the labels to be written;
+ \item \verb-#2- and \verb-#6- are real numbers between 0 and 1. They specify the location of the labels on the arrow. 0 is the beginning of the arrow and 1 is its end, assuming a \emph{straight} arrow;
+ \item \verb-#3- and \verb-#7- are the ``+'' or ``-'' characters. ``+'' displays the label above the arrow, while ``-'' does it below it;
+ \item \verb-#4- and \verb-#8- are the names of the nodes corresponding to the beginning and the end of the arrow.
+ \end{itemize}
+ \item arrow heads are based on ``\verb-CF-'' for a full arrow and have the ``harpoon'' option for half arrows.
+\end{itemize}
+
+\subsection{First arrow}
+As an example, assume we want to make an arrow with a circle on its center. Let's call it ``\verb/-.>/''. This arrow will accept four optional arguments. Like for previously-defined arrows, the first and second arguments will be the labels to be located above and below the arrow. The third one will define the perpendicular shift relative to the arrow direction. Finally, the 4th argument will define the circle size. If this last argument is absent the default circle size will be equal to 2pt.
+
+Let's start with \verb/\definearrow{4}{-.>}/ to declare that the arrow will have 4 optional arguments and that it will be called \verb/-.>/. First, the position of the nodes between which the arrow is to be drawn must be modified in order to take the third-argument shift into account. This is made with the macro \falseverb{\CF_arrowshiftnodes}, so the code of the arrow will start with: \falseverb{\CF_arrowshiftnodes}\verb-{#3}%-. Then, one must plot the arrow itself, while taking the opportunity to set a node on the center of the segment, which will be called "\verb-mid@point-". Finally, the circle is defined with its center on that node. The whole \TIKZ code is:
+
+{\hskip2em\verb-\edef\pt_radius{\ifx\empty#4\empty 2pt\else #4\fi}% circle radius-\par\parskip0pt
+\hskip2em\verb/\expandafter\draw\expandafter[\CF_arrowcurrentstyle,-CF]/\par
+\hskip4em\verb/(\CF_arrowstartnode)--(\CF_arrowendnode)coordinate[midway](mid@point);/\par
+\hskip2em\verb-\filldraw(mid@point)circle(\pt_radius);%-}
+
+The last step is to enter the labels, if any, with the folwing line:
+
+\hskip2em\verb/\CF_arrowdisplaylabel{#1}{0.5}{+}{\CF_arrowstartnode}{#2}{0.5}{-}{\CF_arrowendnode}/
+
+Here is the completed arrow:
+\exemple*{Arrow ``-.>''}/\catcode`\_11
+\definearrow4{-.>}{%
+ \edef\pt_radius{\ifx\empty#4\empty 2pt\else #4\fi}% dot radius
+ \CF_arrowshiftnodes{#3}%
+ \expandafter\draw\expandafter[\CF_arrowcurrentstyle,-CF](\CF_arrowstartnode)--(\CF_arrowendnode)
+ coordinate[midway](mid@point);
+ \filldraw(mid@point)circle(\pt_radius);%
+ \CF_arrowdisplaylabel{#1}{0.5}{+}{\CF_arrowstartnode}{#2}{0.5}{-}{\CF_arrowendnode}
+ }
+\catcode`\_8
+\schemestart
+A \arrow{-.>} B \arrow{-.>[above][below][][1pt]} C \arrow{-.>[][below]}[30] D \arrow{-.>[above][][5pt][1.5pt]} E
+\schemestop/
+
+\subsection{Curved arrow}
+How about a curved arrow? To make things as simple as possible, assume it will have one single optional argument with the \TIKZ code that will specify the point(s) of control. If this argument is empty, a ``\verb/-CF/'' type arrow will be plotted.
+
+If \verb-#1- is not empty, attention should not be drawn to ``\falseverb{\CF_arrowstartnode}'' and ``\falseverb{\CF_arrowendnode}'' which contain the node names of arrow ends positions, because the location of these nodes is already determined by the anchors calculated for \emph{straight} arrows! Instead we will use \falseverb{\CF_arrowstartname} and \falseverb{\CF_arrowendname} which contain the names of the compound (which are nodes for \TIKZ), since the arrow must be plotted between them. Here's the \TIKZ code to draw the curved arrow between the two compounds:
+
+{\verb/\draw[shorten <=\CF_arrowoffset,shorten >=\CF_arrowoffset,\CF_arrowcurrentstyle,-CF,/\par\parskip0pt
+\verb/(\CF_arrowstartname).. controls #1 ..(\CF_arrowendname);%/}
+
+One must add a \TIKZ code to shorten the arrow by an amount \falseverb{\CF_arrowoffset} defined by \falseverb{\setarrowoffset}. Indeed, the nodes ar not the same as those for straight arrows (\falseverb{\CF_arrowstartnode} and \falseverb{\CF_arrowendnode}). So before \falseverb{\CF_arrowcurrentstyle}, the following code must be added:
+\begin{center}
+ \verb/shorten <=\CF_arrowoffset, shorten >=\CF_arrowoffset/
+\end{center}
+this is the role the two lines after \verb-\else-.
+
+So here is our curved arrow:
+\exemple*{Curved arrow}/\catcode`\_11
+\definearrow1{s>}{%
+\ifx\empty#1\empty
+ \expandafter\draw\expandafter[\CF_arrowcurrentstyle,-CF](\CF_arrowstartnode)--(\CF_arrowendnode);%
+\else
+ \def\curvedarrow_style{shorten <=\CF_arrowoffset,shorten >=\CF_arrowoffset,}%
+ \CF_eaddtomacro\curvedarrow_style\CF_arrowcurrentstyle
+ \expandafter\draw\expandafter[\curvedarrow_style,-CF](\CF_arrowstartname)..controls#1..(\CF_arrowendname);
+\fi
+}
+\catcode`\_8
+\schemestart
+A\arrow{s>}
+B\arrow{s>[+(0.5cm,0.5cm)]}
+C\arrow{s>[+(45:1cm)]}
+D\arrow(.60--.120){s>[+(60:1cm) and +(-120:1cm)]}
+E\arrow{s>[+(45:1) and +(-135:1)]}
+F\arrow{s>[+(-30:1) and +(150:1)]}[,1.5]
+G\arrow(.90--.90){s>[+(60:1)and+(120:1)]}[,2]
+H
+\schemestop
+
+\schemestart
+A\arrow(.90--.180){s>[+(90:0.8) and +(180:0.8)]}[45]B
+\arrow(.0--.90){s>[+(0:0.8) and +(90:0.8)]}[-45]C
+\arrow(.-90--.0){s>[+(-90:0.8) and +(0:0.8)]}[-135]D
+\arrow(.180--.-90){s>[+(180:0.8) and +(-90:0.8)]}[135]
+\schemestop/
+
+\section{The \protect\texttt{\textbackslash merge} command}
+The \falseverb{\merge} command allows to draw arrows coming from several existing compounds that merge into one single arrow that arrive to one single compounds.
+
+Just after the \falseverb{\merge} command, the direction that follows up must be specified. For this, 4 different direction characters can be used: ``\verb->-'' (the default direction if no character is entered), ``\verb-<-'', ``\verb-^-'' and ``\verb-v-''.
+
+The syntax follows with:
+
+\hfill\verb/\merge{dir}(n1.a1)(n2.a2)(...)(ni.ai)--(n.a[s])/\hfill\null
+
+where the ``\verb-ni-'' names before the double dash are those already-defined compounds from which out coming arrows will merge into a single one. One can also specify the ``\verb-ai-'' anchor, when the default one is not convenient. Like for the \falseverb\arrow command, the command ``\verb-n.a[s]-'' includes the name, the anchor and the style of the target compound.
+
+\exemple[50]{The \string\merge command}/\schemestart
+ABC\arrow[30]EFGHIJ\arrow[45]KLM\arrow[60]NO
+\merge>(c1)(c2)(c3)--()series 1
+\arrow series 2
+\schemestop
+\bigskip
+
+\schemestart
+Foooo\arrow(foo--bar){<=>}Bar\arrow(--baz){<=>}Bz
+\merge^(foo)(bar)(baz)--()series
+\schemestop
+\bigskip
+
+\setchemfig{scheme debug=true}
+\schemestart
+A\arrow{<->}[90]B
+\merge<(c1.120)(c2)--(foobar.45[circle,blue])CCC
+\schemestop/
+
+Regarding the geometry of the \falseverb{\merge} arrow, it consists of $n$ segments leaving from $n$ compounds up to the perpendicular line that connects them: the default length of the shortest of these segments is worth half of the compound-spacing distance defined by \falseverb\setcompoundsep. The arrow drawn from the connecting line to the target compound has the same default length, its origin is on the middle of the connecting line. These three geometric features can be customized with the optional argument immediately after the target compound:
+
+\hfill\verb/\merge{dir}(n1.a1)(n2.a2)(...)(ni.ai)--(n.a[s])[c1,c2,c,style]/\hfill\null
+
+where:
+\begin{itemize}
+ \item the shortest segment distance between reactants and the connecting line is controlled through the multiplication of the \falseverb{\setcompoundsep} distance by a coefficient \verb-c1-, whose default value is 0.5;
+ \item the length of the arrow between the connecting line and the product compound is controlled through the multiplication of the \falseverb{\setcompoundsep} distance by a coefficient \verb-c2-, whose default value is 0.5;
+ \item the origin of the arrow between the connecting line and the product compound is determined by the coefficient \verb-c-, a value of 0 involves a departure from the the left of the connect line (or from its top if the direction is \verb-v- or \verb-^-);
+ \item the style of the \falseverb{\merge} arrow is defined with the last argument: \verb-style-.
+\end{itemize}
+
+\exemple*{Geometrical parameters of \string\merge}/\schemestart A\arrow{<=>}[90]B\merge(c1)(c2)--()C\schemestop\qquad
+\schemestart A\arrow{<=>}[90]B\merge(c1)(c2)--()[1]C\schemestop\qquad
+\schemestart A\arrow{<=>}[90]B\merge(c1)(c2)--()[,1]C\schemestop\qquad
+\schemestart A\arrow{<=>}[90]B\merge(c1)(c2)--()[,,0.2]C\schemestop\qquad
+\schemestart A\arrow{<=>}[90]B\merge(c1)(c2)--()[,,0.9,red,thick]C\schemestop
+\bigskip
+
+\schemestart A\arrow{<=>}B\merge^(c1)(c2)--()C\schemestop\qquad
+\schemestart A\arrow{<=>}B\merge^(c1)(c2)--()[1]C\schemestop\qquad
+\schemestart A\arrow{<=>}B\merge^(c1)(c2)--()[,1]C\schemestop\qquad
+\schemestart A\arrow{<=>}B\merge^(c1)(c2)--()[,,0.2]C\schemestop\qquad
+\schemestart A\arrow{<=>}B\merge^(c1)(c2)--()[,,0.9,red,thick]C\schemestop/
+
+Finally, it is possible to write labels above or below the merged arrow. For this, the direction character accepts two optional arguments in brackets, a first one for the label above the arrow and a second one for the label below it. Therefore, the full syntax of the \falseverb{merge} command is:
+
+\hfill\verb/\merge{dir}[labelup][labeldow](n1.a1)(n2.a2)(...)(ni.ai)--(n.a[s])[c1,c2,c,style]/\hfill\null
+
+All the features introduced before for arrow labeling can be implemented here as well, i.e. rotation angle and anchoring with the syntax \verb-*{angle.anchor}- entered just before the content of the label.
+
+\exemple*{Labels of the \string\merge command}/\schemestart
+ABC\arrow{<=>}[90]DEF\merge>[above][below](c1)(c2)--()[0.25,1,0.75]GHIJ
+\schemestop\qquad
+\schemestart
+ABC\arrow{<=>}[90]DEF\merge>[*{45.south west}above][*{45.north east}below](c1)(c2)--()[0.25,1,0.75]GHIJ
+\schemestop\qquad
+\schemestart
+ABC\arrow{<=>}[90]DEF\merge>[*{90}above][*{90}below](c1)(c2)--()[0.25,1,0.75]GHIJ
+\schemestop
+\bigskip
+
+\schemestart
+ABC\arrow{<=>}DEF\merge v[above][below](c1)(c2)--()[0.25,1,0.75]GHIJ
+\schemestop\qquad
+\schemestart
+ABC\arrow{<=>}DEF\merge v[*{45.north west}above][*{45.south east}below](c1)(c2)--()[0.25,1,0.75]GHIJ
+\schemestop\qquad
+\schemestart
+ABC\arrow{<=>}DEF\merge v[*{0}above][*{0}below](c1)(c2)--()[0.25,1,0.75]GHIJ
+\schemestop/
+
+\section{The + sign}\label{signe+}
+The use of a ``\falseverb\+'' macro that displays a ${}+{}$ sign is available between the commands \falseverb{\schemestart} and \falseverb{\schemestop}. This macro accepts an optional argument in braces with 3 dimensions in the form \Verb-{<dim1>,<dim2>,<dim3>}-, where:
+\begin{itemize}
+ \item \Verb-<dim1>- and \Verb-<dim2>- are the dimensions to be inserted before and after the ${}+{}$ sign;
+ \item \Verb-<dim3>- is the vertical offset of the sign.
+\end{itemize}
+
+These dimensions can also be set, for all the following ${}+{}$ signs with the \chevrons{keys} \CFkv{+ sep left}{dim}, \CFkv{+ sep right}{dim} et \CFkv{+ vshift}{dim}. The default values are 0.5em for the two first and 0pt for the third.
+
+\exemple[50]{The \string\+ command}/\schemestart
+A\+B\+{2em,,5pt}C\+{0pt,0pt,-5pt}D\arrow E\+F
+\schemestop
+
+\setchemfig{+ sep left=1em,+ sep right=1em,+ vshift=0pt}
+\schemestart
+A\+B\+{2em,,5pt}C\+{0pt,0pt,-5pt}D\arrow E\+F
+\schemestop/
+
+As shown in the example below, it should be kept in mind that the ${}+{}$ sign inserted by the \falseverb{\+} command is part of the compound:
+\exemple[50]{Compounds and \string\+}/\setchemfig{scheme debug=true}
+\schemestart A\+ B\+{,,5pt}C\arrow D\+ E\schemestop/
+This makes it difficult to draw a vertical arrow exactly below the letter ``A'' since this letter is not a single compound for \CF. This issue can be solved with the use of the \falseverb{\subscheme} command to uniquely define the letter ``A'' as a single compound (the same procedure can be applied to the ${}+{}$ sign itself) so that it can be referred to later on with its own name:
+\exemple[50]{Subcompound and \string\+}/\setchemfig{scheme debug=true}
+\schemestart
+\subscheme{A}\+ B\arrow C
+\arrow(@c2--)[-90]E
+\schemestop
+\medskip
+
+\schemestart
+A\subscheme{\+}BCDEF \arrow G
+\arrow(@c2--)[-90]H
+\schemestop/%
+
+A common problem can be the misalignment of the ``+'' sign with the molecules before or after it. For example:
+\exemple{+ sign alignment}/\setchemfig{scheme debug=true}
+\schemestart
+ \chemfig{C(<[:40])(<[:160])=[6]C(<[:-130])<[:-20]}
+ \+
+ \chemfig{\lewis{246,Br}-\lewis{026,Br}}
+\schemestop/
+Here, the ``+'' sign sits on the same baseline as the compound before it, and this baseline is that of the top carbon atom. One may shift the ``+'' sign, but this would not change the vertical position of ``\kern0.3333em\chemfig{\lewis{246,Br}-\lewis{026,Br}}\kern0.3333em''. In fact, the ``+'' sign does not prevent \CF from reading a compound, as shown in the example above where everything is included in the compound `` c1''. Therefore, one must stop the compound right after the first molecule with a \verb-\arrow{0}[,0]- that will draw an invisible, zero-length arrow. In order to vertically center the whole scheme, one must also set the the anchor of the first compound as ``west'' (or ``180'', which is a synonym) with the second optional argument of the \verb-\schemestart- command:
+\exemple{+ sign alignment}/\setchemfig{scheme debug=true}
+\schemestart[][west]
+ \chemfig{C(<[:40])(<[:160])=[6]C(<[:-130])<[:-20]}
+ \arrow{0}[,0]\+
+ \chemfig{\lewis{246,Br}-\lewis{026,Br}}
+\schemestop/
+Thus, the first compound `` c1'' consists of the first molecule and the second compound consists of everything else, i.e. the ``+'' sign and the second molecule. Alternatively, one can play with anchors or styles via the \verb-\arrow- command to move the second compound to another location. Here, for example, the second compound is shifted downwards by 10pt in the first case. In the second case, the ``south east'' anchor of the first compound matches the ``south west'' anchor of the second one:
+\exemple{+ sign alignment}/\setchemfig{scheme debug=true}
+\schemestart[][west]
+ \chemfig{C(<[:40])(<[:160])=[6]C(<[:-130])<[:-20]}
+ \arrow(--[yshift=-10pt]){0}[,0]\+
+ \chemfig{\lewis{246,Br}-\lewis{026,Br}}
+\schemestop
+\medskip
+
+\schemestart[][west]
+ \chemfig{C(<[:40])(<[:160])=[6]C(<[:-130])<[:-20]}
+ \arrow(.south east--.south west){0}[,0]\+
+ \chemfig{\lewis{246,Br}-\lewis{026,Br}}
+\schemestop/
+\newpage
+
+\part{List of commands}
+The commands created by \CF are:
+\begin{center}
+\begin{longtable}{>\footnotesize l>\footnotesize p{9cm}}\\\hline
+\hfill\normalsize Commands\hfill\null &\hfill\normalsize Description\hfill\null\\\hline
+\Verb-\chemfig[<settings>]{<code>}-& draws the molecule whose design is described by the \Verb-<code>-\\
+\Verb|\setchemfig{<settings>}|& sets the parameters with the syntax \chevrons{key}${}={}$\chevrons{value}. Here is the full list of keys with the default values:
+\begin{itemize}
+ \item \CFkv{chemfig style} {{}}: style given to \TIKZ
+ \item \CFkv{atom style} {{}}: style of \TIKZ nodes (atoms)
+ \item \CFkv{bond join} {false}: boolean for bond joins
+ \item \CFkv{fixed length} {false}: boolean for fixed bond widths
+ \item \CFkv{cram rectangle} {false}: boolean to draw rectangle Cram bond
+ \item \CFkv{cram width} {1.5ex}: length of the base of the triangles Cram bonds
+ \item \CFkv{cram dash width} {1pt}: width of dash Cram bonds
+ \item \CFkv{cram dash sep} {2pt}: space between dash Cram bonds
+ \item \CFkv{atom sep} {3em}: space between atoms
+ \item \CFkv{bond offset} {2pt}: space between atom and bond
+ \item \CFkv{double bond sep} {2pt}: space between multiple bonds lines
+ \item \CFkv{angle increment} {45}: increment of the angle of bonds
+ \item \CFkv{node style} {{}}: style of atoms
+ \item \CFkv{bond style} {{}}: style of bonds
+ \item \CFkv{lewis | width} {0.3ex}: width of the rectangle Lewis "|"
+ \item \CFkv{lewis sep} {0.4ex}: space between atom and Lewis decorations
+ \item \CFkv{lewis length} {1.5ex}: length of Lewis decorations
+ \item \CFkv{lewis style} {{}}: style of Lewis decorations
+ \item \CFkv{lewis dist} {0.3em}: space between discs of the ":" Lewis decoration
+ \item \CFkv{lewis radius} {0.15ex}: radius of discs for Lewis decorations
+ \item \CFkv{lewis diag coeff} {1}: factor that multiplies the distance to Lewis decorations in odd directions
+ \item \CFkv{cycle radius coeff} {0.75}: shrinkage ratio of the circle or arc inside cycles
+ \item \CFkv{stack sep} {1.5pt}: vertical gap between arguments of \verb-\chemabove- and \verb-\chembelow- macros
+ \item \CFkv{compound style} {{}}: style of compounds
+ \item \CFkv{compound sep} {5em}: space between compounds
+ \item \CFkv{arrow offset} {4pt}: space between compound and arrow
+ \item \CFkv{arrow angle} {0}: angle of the reaction arrow
+ \item \CFkv{arrow coeff} {1}: length ratio of arrows
+ \item \CFkv{arrow style} {{}}: style of arrows
+ \item \CFkv{arrow double sep} {2pt}: space between double arrows
+ \item \CFkv{arrow double coeff} {0.6}: shrinkage ratio for the little arrow in "<->>" and "<<->"
+ \item \CFkv{arrow double harpoon}{true}: boolean for double harpoon arrows
+ \item \CFkv{arrow label sep} {3pt}: space between arrow and its label
+ \item \CFkv{arrow head} {-CF}: style of arrow head
+ \item \CFkv{+ sep left} {0.5em}: space before the $+$ sign
+ \item \CFkv{+ sep right} {0.5em}: space after the $+$ sign
+ \item \CFkv{+ vshift} {0pt}: vertical shift of the $+$ sign
+\end{itemize}
+\\
+\verb|\resetchemfig|&Reset the parameters to their default values\\
+\falseverb\printatom& displays the atoms within the molecules. It can be redefined to customize the output. See page~\pageref{perso.affichage}\\
+\falseverb\hflipnext&the next molecule will be horizontally flipped\\
+\falseverb\vflipnext&the next molecule will be vertically flipped\\
+\Verb-\definesubmol{<name>}<n>[<code1>]{<code2>}- & creates an alias \Verb-!<name>- 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}\\
+\falseverb\chemskipalign& tells the vertical alignment mechanism to ignore the current group of atoms. See page~\pageref{chemskipalign}.\\
+\Verb-\redefinesubmol{<name>}<n>[<code1>]{<code2>}- & replaces a preexisting alias \Verb-!<name>- with the new \Verb-<code>-. See page~\pageref{redefinesubmol}\\[2ex]\hline
+&\\
+\Verb-\lewis[coeff]{<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-\Lewis[coeff]{<codes>,<atom>}-& displays the \Verb-<atom>- and places Lewis dot decorations as specified in the \Verb-<code>-. See page~\pageref{lewis}\\
+\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}.\\[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-\Chemabove[<dim>]{<txt1>}{txt2}- & writes \Verb-<txt1>- and places \Verb-<txt2>- above, leaving \Verb-<dim>- of vertical space. See page~\pageref{chemabove}\\
+\Verb-\Chembelow[<dim>]{<txt1>}{txt2}- & writes \Verb-{txt1}- and places \Verb-<txt2>- below, leaving \Verb-<dim>- of vertical space. See page~\pageref{chemabove}\\
+\Verb-\chemname[<dim>]{<molecule>}{<name>}- & Places \Verb-<name>- under the \Verb-<molecule>-\\
+\falseverb\chemnameinit & Initializes the greatest molecule depth to ensure correct alignment of the names of the following molecules.\\[2ex]\hline
+&\\
+\falseverb\schemestart\dots\falseverb\schemestop& commands between which a reaction scheme is drawn. See page~\pageref{schemestart}.\\
+\falseverb\arrow& draws an arrow in a reaction scheme (this command is only defined inside a reaction scheme). See page~\pageref{arrow}.\\
+\falseverb\+ & prints a $+$ sign in a reaction scheme (this command is only defined inside a reaction scheme). See page~\pageref{signe+}.\\
+\falseverb\subscheme\Verb-{<code>}- & draws a subscheme (this command is only defined inside a reaction scheme). See~\pageref{subscheme}.\\
+\falseverb\definearrow & defines an arrow. See page~\pageref{definearrow}.\\
+\Verb-\chemleft<car1><stuff>-\falseverb\chemright\Verb-<car1>-& draws expandable delimiters defined with \Verb-<car1>- and \Verb-<car2>- on the left and on the right of the \Verb-<stuff>-, see page~\pageref{chemleft}.\\
+\Verb-\chemup<car1><stuff>-\falseverb\chemdown\Verb-<car1>-& draws expandable delimiters defined with \Verb-<car1>- and \Verb-<car2>- above and below the \Verb-<stuff>-, see page~\pageref{chemup}.\\
+\Verb|\polymerdelim[<settings]{<node1>}{node2>}|& draws delimiters at specified nodes, see page~\pageref{polymerdelim}\\\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 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. Although \CF has been thoroughly tested and although its version number is now greater than 1.0, I hope that you will be forgiving with bugs you encounter and send me an \href{mailto:unbonpetit@netc.fr}{\texttt{\textbf{email}}} to let me know of any malfunctions or suggestions for improvement.
+
+\hfill Christian \textsc{Tellechea}
+\bigskip
+
+\begin{center}
+\parskip0pt
+$\star$\par
+$\star\quad\star$
+\end{center}
+\bigskip
+
+\exemple*{2-methylpentane}/\chemfig{[7]H_3C-CH(-[6]CH_3)-[1]CH_2-CH_2-[1]CH_3}/
+
+\exemple*{3-ethyl-2-methylhexane}/\chemfig{H_3C-[7]CH(-[6]CH_3)-[1]CH(-[7]C_3H_7)-[2]CH_2-[3]H_3C}/
+
+\exemple*{Stearine, condensed structural diagram}/\definesubmol{@}{([0,2]-O-[0,1]C(=[2,1]O)-C_{17}H_{33})}
+\chemfig{[2,2]CH_2!@-CH_{\phantom 2}!@-CH_2!@}/
+
+\exemple*{Stearine, skeleton diagram}/\definesubmol{x}{-[:+30,.6]-[:-30,.6]}
+\definesubmol{y}{-O-(=[2,.6]O)-!x!x!x!x!x!x!x!x}
+\chemfig{[2]([0]!y)-[,1.5]([0]!y)-[,1.5]([0]!y)}/
+
+\exemple*{Methyl 2-methylpropanoate}/\chemfig{H_3C-CH_2(-[2]CH_3)-C(=[1]O)-[7]O-CH_3}/
+
+\exemple*{Vanillin}/\chemfig{HC*6(-C(-OH)=C(-O-[::-60]CH_3)-CH=C(-[,,,2]HC=[::-60]O)-HC=[,,2])} \quad or \quad
+\chemfig{*6(-(-OH)=(-OCH_3)-=(-=[::-60]O)-=)}/
+
+\exemple*{Caffeine}/\chemfig{*6((=O)-N(-CH_3)-*5(-N=-N(-CH_3)-=)--(=O)-N(-H_3C)-)}/
+
+\exemple*{Aspirin}/\chemfig{*6(-=-(-O-[::-60](=[::-60]O)-[::+60])=(-(=[::+60])-[::-60]OH)-=)}/Aspirin is a registered trademark of Bayer in many countries.
+
+\exemple*{Phthalic anhydride}/\chemfig{*6(=*5(-(=O)-O-(=O)-)-=-=-)}/
+
+\exemple*{Camphor}/\chemfig{*6(-(<:[::120](-[::-100,0.7])(-[::100,0.7]))--(=O)-(-)(<:[::120])--)}
+\quad or \quad
+\setchemfig{cram width=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 or \quad
+\definesubmol{@}{*6(=-=-=-)}
+\chemfig{(-[:-30]!@)(-[:90]!@)(-[:210]!@)}/
+
+\exemple*{Amygdalin}/\setchemfig{cram width=2pt}
+\definesubmol{c1}{-[:200]-[:120]O-[:190]}
+\definesubmol{c2}{-[:170](-[:200,0.7]HO)<[:300](-[:170,0.6]HO)
+-[:10,,,,line width=2pt](-[:-40,0.6]OH)>[:-10]}
+\definesubmol{csub}{-[:155,0.65]-[:90,0.65]}
+\chemfig{O(!{c1}(!{csub}O(!{c1}(!{csub}OH)!{c2}))!{c2})-[:-30](-[:-90]CN)-[:30]*6(=-=-=-)}/
+
+\exemple*{Adenosine triphosphate}/\setchemfig{cram width=3pt}
+\definesubmol{a}{-P(=[::-90,0.75]O)(-[::90,0.75]HO)-}
+\chemfig{[:-54]*5((--[::60]O([::-60]!aO([::-60]!aO([::60]!aHO))))<(-OH)
+-[,,,,line width=2pt](-OH)>(-N*5(-=N-*6(-(-NH_2)=N-=N-)=_-))-O-)}/
+
+\exemple*{Viagra}/\chemfig{N*6((-H_3C)---N(-S(=[::+120]O)(=[::+0]O)-[::-60]*6(-=-(-O-[::-60]-[::+60]CH_3)
+=(-*6(=N-*5(-(--[::-60]-[::+60]CH_3)=N-N(-CH_3)-=)--(=O)-N(-H)-))-=))---)}/
+
+\exemple*{Cholesterol ester}/\chemfig{[:30]R-(=[::+60]O)-[::-60]O-*6(--*6(=--*6(-*5(---(-(-[::+60]Me)
+-[::-60]-[::-60]-[::+60]-[::-60](-[::-60]Me)-[::+60]Me)-)-(-[::+0]Me)---)--)-(-[::+0]Me)---)}/
+
+\exemple*{Porphyrin}/\chemfig{?=[::+72]*5(-N=(-=[::-72]*5(-[,,,2]HN-[,,2](=-[::-36]*5(=N-(=-[::-72]*5(-NH-[,,1]?=-=))
+-=-))-=-))-=-)}/
+
+\exemple*{Manganese 5,10,15,20-tetra(N-ethyl-3-carbazolyl) porphyrin}/\definesubmol{A}{*6(=-*5(-*6(-=-=-)--N(--[::-60])-)=-=-)}
+\chemfig{([::+180]-!A)=[::+72]*5(-N=(-(-[::+54]!A)=[::-72]*5(-N(-[::-33,1.5,,,draw=none]Mn)
+-(=(-[::+72]!A)-[::-36]*5(=N-(=(-[::+54]!A)-[::-72]*5(-N-(-)=-=))-=-))-=-))-=-)}/
+
+\exemple*{Penicillin}/\chemfig{[:-90]HN(-[::-45](-[::-45]R)=[::+45]O)>[::+45]*4(-(=O)-N*5(-(<:(=[::-60]O)
+-[::+60]OH)-(<[::+0])(<:[::-108])-S>)--)}/
+
+\exemple*{LSD}/\chemfig{[:150]?*6(=*6(--*6(-N(-CH_3)--(<(=[::+60]O)-[::-60]N(-[::+60]-[::-60])
+-[::-60]-[::+60])-=)([::-120]<H)---)-*6(-=-=-(-[::-30,1.155]\chembelow{N}{H}?)=))}/
+
+\exemple*{Strychnine}/\chemfig{*6(=-*6(-N*6(-(=O)--([::-120]<:H)*7(-O--=?[0]([::-25.714]-[,2]?[1]))
+-*6(-?[0,{>}]--(<N?[1]?[2])-(<[::-90]-[::-60]?[2]))(<:[::+0]H)-([::+120]<H))--?)=?-=-)}/
+
+\exemple*{Codeine}/\chemfig{[:-30]**6(-(-OH)-?-*6(-(-[3]-[2,2]-[0,.5])*6(-(<:[:-150,1.155]O?)
+-(<:OH)-=-)-(<:[1]H)-(-[2]NCH_3)--)---)}/
+
+\exemple*{A dye (red)}/\chemfig{**6(--*6(-(-NO_2)=-(-\lewis{26,O}-[0]H)=(-\lewis{4,N}=[0]\lewis{2,N}-[0]Ar)-)----)}/
+
+\exemple*{Menthone}/\chemfig{CH_3-?(-[2]H)(-[::-30,2]-[::+60](=[1]\lewis{20,O})
+-[::-150,1.5](-[:20]CH(-[1]CH_3)(-[7]CH_3))(-[6]H)-[::-90,2]-[::+60]?)}/
+
+\exemple*{Fischer indole synthesis}/\schemestart
+ \chemfig{*6(=-*6(-\chembelow{N}{H}-NH_2)=-=-)}
+ \+
+ \chemfig{(=[:-150]O)(-[:-30]R_2)-[2]-[:150]R_1}
+ \arrow(.mid east--.mid west){->[\chemfig{H^+}]}
+ \chemfig{*6(-=*5(-\chembelow{N}{H}-(-R_2)=(-R_1)-)-=-=)}
+\schemestop/
+
+\exemple*{Reaction mechanisms: carbonyl group}/
+\schemestart
+ \chemfig{C([3]-)([5]-)=[@{db,.5}]@{atoo}\lewis{06,O}}
+ \arrow(.mid east--.mid west){<->}
+ \chemfig{\chemabove{C}{\scriptstyle\oplus}([3]-)([5]-)-\chemabove
+ {\lewis{026,O}}{\hspace{5mm}\scriptstyle\ominus}}
+\schemestop
+\chemmove{\draw[shorten <=2pt, shorten >=2pt](db) ..controls +(up:5mm) and +(up:5mm)..(atoo);}/
+
+\exemple*{Reaction mechanisms: nitro group}/\schemestart
+ \chemfig{R-\chembelow{N}{\hspace{-5mm}\scriptstyle\oplus}([1]=[@{db}]@{atoo1}O)([7]-[@{sb}]@{atoo2}
+ \chemabove{\lewis{157,O}}{\hspace{7mm}\scriptstyle\ominus})}
+ \arrow(.mid east--.mid west){<->}
+ \chemfig{R-\chemabove{N}{\hspace{-5mm}\scriptstyle\oplus}([1]-\chemabove{O}{\scriptstyle\ominus})([7]=O)}
+\schemestop
+\chemmove{
+ \draw[shorten <=2pt, shorten >=2pt](db) ..controls +(120:5mm) and +(120:5mm)..(atoo1);
+ \draw[shorten <=3pt, shorten >=2pt](atoo2) ..controls +(225:10mm) and +(225:10mm)..(sb);
+}/
+
+\exemple*{Nucleophilic addition. Primary amines}/\setchemfig{atom sep=2.5em,compound sep=5em}
+\schemestart
+ \chemfig{R-@{aton}\lewis{2,N}H_2}
+ \+
+ \chemfig{@{atoc}C([3]-CH_3)([5]-CH_3)=[@{atoo1}]O}
+ \chemfig{@{atoo2}\chemabove{H}{\scriptstyle\oplus}}
+ \chemmove[-stealth,shorten <=3pt,dash pattern= on 1pt off 1pt,thin]{
+ \draw[shorten >=2pt](aton) ..controls +(up:10mm) and +(left:5mm)..(atoc);
+ \draw[shorten >=8pt](atoo1) ..controls +(up:10mm) and +(north west:10mm)..(atoo2);}
+ \arrow{<=>[\tiny addition]}
+ \chemfig{R-@{aton}\chembelow{N}{\scriptstyle\oplus}H([2]-[@{sb}]H)-C(-[2]CH_3)(-[6]CH_3)-OH}
+\schemestop
+\chemmove{
+ \draw[-stealth,dash pattern= on 1pt off 1pt,shorten <=3pt, shorten >=2pt]
+ (sb)..controls +(left:5mm) and +(135:2mm)..(aton);}
+\par
+\schemestart
+ \arrow{<=>}
+ \chemfig{R-@{aton}\lewis{2,N}([6]-[@{sbh}]H)-[@{sb}]C(-[2]CH_3)(-[6]CH_3)-[@{sbo}]@{atoo}
+ \chemabove{O}{\scriptstyle\oplus}(-[1]H)(-[7]H)}
+ \chemmove[-stealth,shorten <=3pt,shorten >=2pt,dash pattern= on 1pt off 1pt,thin]{
+ \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);}
+ \arrow{<=>[\tiny élimination]}\chemfig{R-N=C(-[1]CH_3)(-[7]CH_3)}
+ \+
+ \chemfig{H_3\chemabove{O}{\scriptstyle\oplus}}
+\schemestop/
+
+\exemple*{Reaction scheme}/\setchemfig{atom sep=2em}
+\schemestart[-90]
+ \chemfig{**6(---(-NH _2)---)}\arrow{0}\chemfig{HNO_2}
+ \merge(c1)(c2)--()
+ \chemfig{**6(---(-N_2|{}^\oplus)---)}\arrow{0}\chemfig{**6(---(-NH _2)---)}
+ \merge(c3)(c4)--()
+ \chemfig{**6(---(-N=[::-30]N-[::-30]**6(---(-NH_2)---))---)}
+\schemestop/
+
+\exemple*{Addition}/\setchemfig{atom sep=2.5em}
+\schemestart
+ \chemfig{*6(=-(-)(=[2]O))}
+ \arrow{->[\+\chemfig{H^\oplus}]}
+ \chemleft[\subscheme[90]{%
+ \chemfig{*6((-[2,0.33,,,draw=none]\scriptstyle\oplus)-=(-)-OH)}
+ \arrow{<->}
+ \chemfig{*6(=-(-)(-[6,0.33,,,draw=none]\scriptstyle\oplus)-OH)}}\chemright]
+ \arrow(@c3--)\chemfig{*6((-[2]R)-=(-)-OH)}
+ \arrow(@c4--)\chemfig{*6(=-(-)(-[6]R)-OH)}
+\schemestop/
+
+\exemple*{Electrophilic aromatic substitution}Z\setchemfig{atom sep=1.5em}%
+\definesubmol{+}{-[,-0.4,,,draw=none]\oplus}%
+\schemestart
+ \arrow{0}[,0]
+ \chemleft[\subscheme{\chemfig{*6(=-=-(-[:120]Br)(-[:60]H)-(!+)-)}
+ \arrow{<->}
+ \chemfig{*6(-(!+)-=-(-[:120]Br)(-[:60]H)-=)}
+ \arrow{<->}
+ \chemfig{*6(-=-(!+)-(-[:120]Br)(-[:60]H)-=)}}\chemright]
+ \arrow(@c2--){<-[*0\chemfig{{-}AlBr_4|^\ominus}][*0\chemfig{Br_2/Al_2Br_3}]}[90,1.5]
+ \chemname{\chemfig{*6(-=-=-=-)}}{Benzène 1}
+ \arrow(@c4--){->[*0\chemfig{{-}H^\oplus}]}[90,1.5]
+ \chemname{\chemfig{*6(-=-=(-Br)-=-)}}{Bromobenzène 2}
+ \arrow(@c5.mid east--@c6.mid west)
+\schemestop
+\chemnameinit{}Z
+
+\exemple*{Reaction mechanism of chlorination}/\scriptsize\setchemfig{bond offset=1pt,atom sep=2em,compound sep=4em}
+\schemestart
+ \chemfig{Cl-[4]@{a0}(=[@{a1}:120]@{a2}O)-[:-120](=[:-60]O)-[4]Cl}\+\chemfig{*6(-=-=(-@{oh1}OH)-=)}\arrow
+ \chemfig{*6((-O-[:150](-[@{o0}:150]@{o1}\lewis{6.,O})(-[@{cl0}:60]@{cl1}Cl)-[:240](-[4]Cl)=[6]O)=-=-=-)}
+ \arrow\chemfig{*6((-O-[:150](=[2]O)-[:-150](=[6]O)-[:150]Cl)=-=-=-)}\+\chemfig{HCl}
+ \arrow(@c1--){0}[-90,0.5]
+ \chemfig{*6(-=*6(-O-*6(-@{o2}(=[@{o3}]@{o4}O)-Cl)=)-=-=)}\+\chemfig{*6(-=-=(-@{oh2}OH)-=)}\arrow
+ \chemfig{*6(-=*6(-O-(-(-[@{cl2}:60]@{cl3}Cl)(-[@{o5}:-120]@{o6}\lewis{6.,O})-O-[::-40]*6(=-=-=-))=)-=-=)}
+ \kern-3em \arrow\chemfig{[:30]*6(=-(-O-[:-60](=O)-[:-120](=[4]O)-[:-60]O-*6(=-=-=-))=-=-)}
+ \kern-3em \+\chemfig{HCl}
+\schemestop
+\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);
+ \draw[shorten <=6pt,shorten >=2pt](o1)..controls+(270:5mm)and+(270:5mm)..(o0);
+ \draw[shorten <=2pt](cl0)..controls+(150:5mm)and+(150:5mm)..(cl1.150);
+ \draw[shorten <=2pt](o3)..controls +(30:3mm) and +(30:5mm)..(o4.east);
+ \draw[shorten >=2pt](oh2.135).. controls +(150:10mm) and +(90:10mm).. (o2);
+ \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 reaction}/\schemestart
+ \chemfig{[:-30]*6(=-=(-@{atoc}C([6]=[@{db}]@{atoo1}O)-H)-=-)}
+ \arrow(start.mid east--.mid west){->[\chemfig{@{atoo2}\chemabove{O}{\scriptstyle\ominus}}H]}
+ \chemmove[-stealth,shorten >=2pt,dash pattern=on 1pt off 1pt,thin]{
+ \draw[shorten <=8pt](atoo2) ..controls +(up:10mm) and +(up:10mm)..(atoc);
+ \draw[shorten <=2pt](db) ..controls +(left:5mm) and +(west:5mm)..(atoo1);}
+ \chemfig{[:-30]*6(=-=(-C([6]-[@{sb1}]@{atoo1}\chembelow{O}{\scriptstyle\ominus})([2]-OH)-[@{sb2}]H)-=-)}
+ \hspace{1cm}
+ \chemfig{[:-30]*6((-@{atoc}C([6]=[@{db}]@{atoo2}O)-[2]H)-=-=-=)}
+ \chemmove[-stealth,shorten <=2pt,shorten >=2pt,dash pattern=on 1pt off 1pt,thin]{
+ \draw([yshift=-4pt]atoo1.270) ..controls +(0:5mm) and +(right:10mm)..(sb1);
+ \draw(sb2) ..controls +(up:10mm) and +(north west:10mm)..(atoc);
+ \draw(db) ..controls +(right:5mm) and +(east:5mm)..(atoo2);}
+ \arrow(@start.base west--){0}[-75,2]
+ {}
+ \arrow
+ \chemfig{[:-30]*6(=-=(-C([1]-@{atoo2}O-[@{sb}0]@{atoh}H)([6]=O))-=-)}
+ \arrow{0}
+ \chemfig{[:-30]*6((-C(-[5]H)(-[7]H)-[2]@{atoo1}\chemabove{O}{\scriptstyle\ominus})-=-=-=)}
+ \chemmove[-stealth,shorten >=2pt,dash pattern=on 1pt off 1pt,thin]{
+ \draw[shorten <=7pt](atoo1.90) ..controls +(+90:8mm) and +(up:10mm)..(atoh);
+ \draw[shorten <=2pt](sb) ..controls +(up:5mm) and +(up:5mm)..(atoo2);}
+\schemestop/
+
+\begingroup
+\catcode`;=12
+\exemple*{Beckmann rearrangement}/\setchemfig{bond offset=1pt,atom sep=2.5em,compound sep=5em,arrow offset=6pt}
+\schemestart
+ \chemfig{(-[:-150]R')(-[:-30]R)=[2]N-[:30]OH}
+ \arrow{<=>[\chemfig{H^\oplus}]}
+ \chemfig{(-[@{a0}:-150]R')(-[:-30]R)=[2]@{a1}N-[@{b0}:30]@{b1}\chemabove{O}{\scriptstyle\oplus}H_2}
+ \chemmove[red,-stealth,red,shorten <=2pt]{
+ \draw(a0)..controls +(135:2mm) and +(215:4mm).. (a1);
+ \draw(b0)..controls +(120:2mm) and +(180:3mm).. ([yshift=7pt]b1.180);}
+ \arrow{<=>[\chemfig{{-}H_2O}]}[,1.1]
+ \chemleft[\subscheme[90]{%
+ \chemfig{R'-\chemabove{N}{\scriptstyle\oplus}~C-R}
+ \arrow{<->}[,0.75]
+ \chemfig{R'-\lewis{2:,N}=@{a1}\chemabove{C}{\scriptstyle\oplus}-R}}\chemright]
+ \arrow{<=>[\chemfig{H_2@{a0}\lewis{0:2:,O}}]}[,1.1]
+ \chemmove[red,-stealth,red,shorten <=3pt]{
+ \draw(a0)..controls+(90:10mm)and+(45:10mm)..([yshift=6pt]a1.45);}
+ \arrow(@c1--){0}[-90,0.333]
+ \chemfig{*6(R\rlap{$'$}-N=(-R)-\chemabove{O}{\scriptstyle\oplus} H_2)}
+ \arrow{<=>[\chemfig{{-}H^\oplus}]}
+ \chemfig{*6(R\rlap{$'$}-N=(-R)-OH)}
+ \arrow
+ \chemfig{*6(R\rlap{$'$}-\chembelow{N}{H}-(-R)(=[2]O))}
+\schemestop/
+\endgroup
+
+\exemple*{Reaction scheme}/\setchemfig{atom sep=1.5em,compound sep=4em}
+\schemestart
+ \chemfig{-[::30]=_[::-60](-[:: -60])-[::60]}
+ \arrow{->[\chemfig{HCl}]}
+ \chemfig{-[::30]-[::-60](-[::120]Cl)(-[::-60])-[::60]}\+\chemfig{-[::30](-[::60]Cl)-[::-60](-[::-60])-[::60]}
+ \arrow(@c1--.north west){->[\chemfig{H_2O}]}[-45,1.7]
+ \chemfig{-[::30]-[::-60](-[::120]OH)(-[::-60])-[::60]}\+\chemfig{-[::30](-[::60]OH)-[::-60](-[::-60])-[::60]}
+\schemestop/
+
+\exemple*{Esterification of formic acid}Z\tikzset{obrace/.style={left delimiter={[},inner sep=3pt},
+ cbrace/.style={right delimiter={]},inner sep=3pt},
+ braces/.style={left delimiter={[},right delimiter={]},inner sep=3pt}}
+\setchemfig{atom sep=2em}
+\schemestart
+ \chemfig{H-C(=[:60]O)-[:-60]O-H}
+ \arrow(--M1[obrace]){-U>[\scriptsize\chemfig{H_2SO_4^{}}][\scriptsize\chemfig{HSO_4^\ominus}][][.25]}%
+ [,1.5,shorten >=6pt]
+ \chemfig{H-@{a2}C(-[:60]O-H)(-[:30,.5,,,draw=none]{\scriptstyle\oplus})-[:-60]O-H}
+ \arrow(--[cbrace]){<->}
+ \chemfig{H-C(=[:60]\chemabove{O}{\scriptstyle\oplus}-H)-[:-60]O-H}
+ \arrow(@M1--){<=>[*{0}\scriptsize\chemfig{H-[:120]@{a1}O-[:60]CH_3}][*{0}\tiny addition]}[-90,1.33]
+ \chemfig{H-C(-[2]O-[:30]H)(-\chemabove{O}{\scriptstyle\oplus}(-[:60]CH_3)-[:-60]H)-[6]O-[:-30]H}
+ \arrow{<=>[\tiny protolysis]}[180]
+ \chemfig{H-C(-[2]O-[:30]H)(-O-CH_3)-[@{b1}6]@{a3}\chemabove{O}{\kern-4mm\scriptstyle\oplus}(-[:-150]H)-[:-30]H}
+ \arrow(--[obrace]){<=>[*{0}\scriptsize\chemfig{{-}H_2O}][*{0}\tiny elimination]}[-90,,shorten >=6pt]
+ \chemfig{H-C(-[:60]O-H)(-[,.5,,,draw=none]{\scriptstyle\oplus})-[:-60]O-CH_3}
+ \arrow(--[cbrace]){<->}
+ \chemfig{H-C(=[:60]\chemabove{O}{\scriptstyle\oplus}-H)-[:-60]O-CH_3}
+ \arrow{-U>[\scriptsize\chemfig{HSO_4^\ominus}][\scriptsize\chemfig{H_2SO_4^{}}][][.25]}[,1.5]
+ \chemfig{H-C(=[:60]O)-[:-60]O-CH_3}
+ \arrow(@M1--[yshift=-5pt]){0}[180,.5]{\tiny protolysis}
+ \chemmove[red,shorten <=3pt,shorten >=1pt]{
+ \draw(a1)..controls +(0:1.5cm)and+(0:3cm).. (a2);
+ \draw(b1)..controls +(0:5mm)and+(20:5mm)..(a3);}
+\schemestop Z
+
+\exemple*{Electrophilic addition of halogen to olefin}/\schemestart
+ \subscheme{%
+ \chemfig{C(<[:40])(<[:160])=[6]C(<[:-130])<[:-20]}
+ \arrow{0}[,0]\+\chemfig{\lewis{246,Br}-\lewis{026,Br}}}
+ \arrow(@c1--olefin){<=>[*{0}rapide]}[-90]
+ \chemfig{>[:-20]C(<[:40])=[@{db}6]C(<[:-130])<[:-20]}
+ \arrow(--bromonium){0}[-90]
+ \chemname{\chemfig{C*3((<)(<:[:-155])-\raise1.5pt\llap{$\scriptstyle\oplus$}\lewis{17,Br}-C(<:)(<[:155])-)}}
+ {bromonium ion}
+ \arrow(--carbeniumA){<<->}[,1.5]
+ \chemname{\chemfig{-[:-30]\chemabove{C}{\scriptstyle\oplus}(-[:30])-[6]C(<:[:-150])(<[:-100])-[:-30]
+ \lewis{157,Br}}}{Xarbenium ion}
+ \arrow(@bromonium--carbeniumB){<<->}[180,1.5]
+ \chemname{\chemfig{-[:-30]\chemabove{C}{\scriptstyle\oplus}(-[:30])-[6]C(<[:-150])
+ (<:[:-100])-[:-30]\lewis{137,Br}}}{carbenium ion}
+ \arrow(@olefin--){0}[,.25]
+ \chemfig{@{Br1}\chemabove[3pt]{\lewis{246,Br}}{\scriptstyle\delta\oplus}-[@{b2}]@{Br2}
+ \chemabove[3pt]{\lewis{026,Br}}{\scriptstyle\delta\ominus}}
+ \arrow(@olefin--[left]){0}[180,0]
+ $\pi$ complexe
+ \arrow(@carbeniumA--@olefin){<=>[lent, \chemfig{{-}Br^\ominus}]}
+ \arrow(@carbeniumB--@olefin){<=>[lent, \chemfig{{-}Br^\ominus}]}
+ \chemmove[-stealth,red,shorten <=3pt,shorten >=2pt]{
+ \draw(db) .. controls +(20:5mm) and +(135:5mm) .. (Br1);
+ \draw(b2) .. controls +(-90:5mm) and +(-120:5mm) .. (Br2);}
+\schemestop
+\chemnameinit{}/
+
+\exemple*{Sulfonation of naphthalene}/\definesubmol\cycleoplus{-[,0.25,,,draw=none]\oplus}
+\definesubmol{so2oh}{S(=[::90]O)(=[::-90]O)-OH}
+\setchemfig{atom sep=2.5em}
+\schemestart[,1.5]
+ \chemname{\chemfig{*6(=-*6(-=-=-)=-=-)}}{Naphtalène}\+\chemfig{H_2SO_4}
+ \arrow(nph.mid east--.south west){->[80\degres C]}[45]
+ \chemname{\chemfig{*6(=-*6(-=-(!\cycleoplus)-(-SO_3H)-)=-=-)}}{Ion 1-arenium}
+ \arrow(.mid east--.mid west)
+ \chemname{\chemfig{*6(=-*6(-=-=(-!{so2oh})-)=-=-)}}{Acide 1-naphthalenesulfonique}
+ \arrow(@nph.mid east--.north west){->[160\degres C]}[-45]
+ \chemname{\chemfig{*6(=-*6(-=-(-SO_3H)-(!\cycleoplus)-)=-=-)}}{Ion 2-arenium}\kern-4em
+ \arrow(.mid east--.mid west)
+ \chemname{\chemfig{*6(=-*6(-=-(-!{so2oh})=-)=-=-)}}{Acide 2-naphthalenesulfonique}
+\schemestop
+\chemnameinit{}/
+
+\begingroup\catcode`;12
+\exemple*{Explanatory diagram}/\parbox{0.8\linewidth}{%
+ \hspace{10em}
+ \tikz[remember picture]\node(n0){\chemname{}{Attacks\\nucleophiles}};\par
+ \vspace{2ex}\hspace{15em}
+ \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){};Addition reactions}\kern1em
+ \chemname{}{\tikz[remember picture]\node(n2){};Basic properties}\par
+ \vspace{6ex}\hspace{8em}
+ \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)..(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);
+ }%
+}
+\chemnameinit{}/
+\endgroup
+
+\exemple*{Taxotere}/\chemfig{-[::-30](-[5])(-[7])-[::+60]-[::-60]O-[::+60](=[::-45]O)-[::+90]HN>:[::-60](-[::+60]**6(------))
+-[::-30](<:[2]OH)-[::-60](=[6]O)-[::+60]O>:[::-60]*7(---?(<[::-120]OH)-(<|[1]CH_3)(<:[::-90]CH_3)
+-(-[1](<[::+80]HO)-[0](=[::+60]O)-[7](<|[::+130]CH_3)(-[::+75](<|[2]OH)-[::-60]-[::-60](<[::+30]O-[::-90])
+-[::-60](<[::+90])(<:[::+30]O-[7](-[6]CH_3)=[0]O)-[::-60])-[6]-[5,1.3]?(<:[7]O-[5](=[::-60]O)
+-[6]**6(------)))=(-[2]CH_3)-)}/
+\end{document} \ No newline at end of file
diff --git a/macros/generic/chemfig/chemfig-fr.pdf b/macros/generic/chemfig/chemfig-fr.pdf
new file mode 100644
index 0000000000..1528fd19ac
--- /dev/null
+++ b/macros/generic/chemfig/chemfig-fr.pdf
Binary files differ
diff --git a/macros/generic/chemfig/chemfig-fr.tex b/macros/generic/chemfig/chemfig-fr.tex
new file mode 100644
index 0000000000..c0b65b52d1
--- /dev/null
+++ b/macros/generic/chemfig/chemfig-fr.tex
@@ -0,0 +1,2842 @@
+\documentclass[10pt,french]{article}
+\usepackage[utf8]{inputenc}
+\usepackage[T1]{fontenc}
+\usepackage[a4paper,margin=2.5cm,footskip=10mm]{geometry}
+\usepackage[bottom]{footmisc}
+\usepackage{libertine,amsmath,array,longtable,xspace,fancybox,boites,textcomp,enumitem,chemfig,fancyhdr,multicol}
+\usepackage[scaled=0.8]{luximono}
+\usetikzlibrary{decorations.pathmorphing}
+\usetikzlibrary{decorations.markings}
+\usetikzlibrary{matrix}
+\usepackage[protrusion=true,expansion,final,babel=true]{microtype}
+\fancypagestyle{plain}{%
+ \fancyhead[L]{}
+ \fancyhead[C]{}
+ \fancyhead[R]{}
+ \fancyfoot[l]{\tiny Compilé le \today.}
+ \fancyfoot[c]{}
+ \fancyfoot[r]{\thepage}}
+\renewcommand\headrulewidth{0pt}
+
+\makeatletter
+\newcommand\make@car@active[1]{%
+ \catcode`#1\active
+ \begingroup
+ \lccode`\~`#1\relax
+ \lowercase{\endgroup\def~}%
+}
+
+\newif\if@exstar
+
+\newcommand\exemple{%
+ \begingroup
+ \parskip\z@
+ \@makeother\;\@makeother\!\@makeother\?\@makeother\:% neutralise frenchb
+ \@ifstar{\@exstartrue\exemple@}{\@exstarfalse\exemple@}}
+
+\newcommand\exemple@[2][65]{%
+ \medbreak\noindent
+ \begingroup
+ \let\do\@makeother\dospecials
+ \make@car@active\ { {}}%
+ \make@car@active\^^M{\par\leavevmode}%
+ \make@car@active\^^I{\space\space}%
+ \make@car@active\,{\leavevmode\kern\z@\string,}%
+ \make@car@active\-{\leavevmode\kern\z@\string-}%
+ \make@car@active\>{\leavevmode\kern\z@\string>}%
+ \make@car@active\<{\leavevmode\kern\z@\string<}%
+ \exemple@@{#1}{#2}%
+}
+
+\newcommand\exemple@@[3]{%
+ \def\@tempa##1#3{\exemple@@@{#1}{#2}{##1}}%
+ \@tempa
+}
+
+\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
+ \sffamily
+ \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{\sffamily\colorbox{black}{\leavevmode\kern0.25em{\color{white}\footnotesize\strut#2}\kern0.25em}}%
+ }%
+ {\fboxsep5pt
+ \fbox{%
+ $\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}}$%
+ }%
+ }%
+ \fi
+ \medbreak
+ \endgroup
+}
+
+\begingroup
+ \catcode`\<13 \catcode`\>13
+ \gdef\Verb{\relax\ifmmode\hbox\else\leavevmode\null\fi
+ \bgroup
+ \verb@eol@error \let\do\@makeother \dospecials
+ \verbatim@font\@noligs
+ \catcode`\<13 \catcode`\>13 \def<{\begingroup$\langle$\itshape}\def>{\/$\rangle$\endgroup}%
+ \@ifstar\@sverb\@verb}
+\endgroup
+
+\newcommand\falseverb[1]{{\ttfamily\detokenize\expandafter{\string#1}}}
+
+\def\CFfrdate@i#1/#2/#3\@nil{\number#3\relax\ifnum#3=1 \ier{}\fi\space \ifcase#2 \or janvier\or février\or mars\or avril\or mai\or juin\or juillet\or aout\or septembre\or octobre\or novembre\or décembre\fi\space#1}
+\edef\CFfrdate{\expandafter\CFfrdate@i\CFdate\@nil}
+
+\DeclareRobustCommand\CF{%
+ \textsf{%
+ chem%
+ \if\string b\detokenize\expandafter{\f@series}%
+ \lower0.01em\hbox{\itshape f}\kern-0.06em
+ \else
+ \lower0.045em\hbox{\kern-0.05em \itshape f}\kern0.026em
+ \fi ig%
+ }%
+ \xspace
+}
+\makeatother
+
+\usepackage{babel}
+\frenchbsetup{StandardLists=true,og=«,fg=»}
+\newcommand\TIKZ{ti\textit kz\xspace}
+\newcommand\molht[1]{\begingroup\parskip3.5pt\par\hfill\chemfig{#1}\hfill\null\par\endgroup}
+\newcommand\boxednode[2]{\fbox{$\mathrm{#1}\vphantom{M_1}$}_{#2}}
+\newcommand\boxedfalseverb[1]{{\fboxsep0pt\fbox{\vphantom|\falseverb{#1}}}}
+\newcommand*\chevrons[1]{\textlangle\textit{#1}\textrangle}
+\newcommand*\CFkey[1]{{\color{teal}\texttt{\detokenize{#1}}}}
+\newcommand*\CFval[1]{{\color{teal}\textlangle\textit{#1}\textrangle}}
+\newcommand*\CFkv[2]{\CFkey{#1}{\color{teal}${}={}$}\CFval{#2}}
+\newcommand*\CFparam[1]{\CFkey{#1}&\ifcat\relax\detokenize\expandafter\expandafter\expandafter{\useKV[chemfig]{#1}}\relax \textlangle\textit{vide}\textrangle\else\texttt{\detokenize\expandafter\expandafter\expandafter{\useKV[chemfig]{#1}}}\fi\\}
+\newcommand*\CFdelimparam[1]{\CFkey{#1}&\ifcat\relax\detokenize\expandafter\expandafter\expandafter{\useKV[CFdelimiters]{#1}}\relax \textlangle\textit{vide}\textrangle\else\texttt{\detokenize\expandafter\expandafter\expandafter{\useKV[CFdelimiters]{#1}}}\fi}
+
+\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}
+
+\csname @addtoreset\endcsname{section}{part}
+\usepackage{titlesec}
+\titleformat{\part}[display]{\normalfont\filcenter\sffamily\bfseries}{}{0pt}{\Huge}
+
+\begin{document}
+\topsep=3pt plus5pt minus2pt\relax
+\begin{titlepage}
+ \catcode`!12
+ \begin{tikzpicture}[remember picture,overlay]
+ \shade [left color=blue,right color=white]([yshift=2cm]current page.west) rectangle ([xshift=-1cm]current page.south);
+ \shade [left color=white,right color=blue] ([xshift=1cm]current page.south) rectangle ([yshift=2cm]current page.east);
+ \filldraw[black](current page.north west) rectangle ([yshift=7cm]current page.east);
+ \shade[top color=black,bottom color=blue]([yshift=7cm]current page.east)rectangle([yshift=2.5cm]current page.west);
+ \filldraw[black!55!blue!100]([yshift=2.5cm]current page.east)rectangle([yshift=2cm]current page.west);
+ \end{tikzpicture}
+ \begin{center}
+ \color{white}\sffamily\fontsize{50pt}{50pt}\selectfont\CF\par
+ \Large v\CFver\par
+ \CFfrdate\par\bigbreak
+ \normalsize Christian Tellechea\smallbreak
+ \href{mailto:unbonpetit@netc.fr}{\texttt{unbonpetit@netc.fr}}\par\vskip1.5cm
+ \huge Une extension \TeX{} pour dessiner des molécules%
+ \end{center}
+ \vskip4cm
+ \begin{center}
+ \scriptsize
+ \setchemfig{atom sep=3em}%
+ \chemfig{-[::-30](-[5])(-[7])-[::+60]-[::-60]O-[::+60](=[::-45]O)-[::+90]HN>:[::-60](-[::+60]**6(------))-[::-30](<:[2]OH)-[::-60](=[6]O)-[::+60]O>:[::-60]*7(---?(<[::-120]OH)-(<|[1]CH_3)(<:[::-90]CH_3)-(-[1](<[::+80]HO)-[0](=[::+60]O)-[7](<|[::+130]CH_3)(-[::+75](<|[2]OH)-[::-60]-[::-60](<[::+30]O-[::-90])-[::-60](<[::+90])(<:[::+30]O-[7](-[6]CH_3)=[0]O)-[::-60])-[6]-[5,1.3]?(<:[7]O-[5](=[::-60]O)-[6]**6(------)))=(-[2]CH_3)-)}%
+ \par
+ {\sffamily\small Le taxotère}%
+ \end{center}
+ \vskip1.5cm
+ \hfill
+ \hbox to 0pt{\hss\scriptsize
+ \setchemfig{bond offset=1pt,atom sep=2.5em,compound sep=5em,arrow offset=6pt}
+ \schemestart
+ \chemfig{(-[:-150]R')(-[:-30]R)=[2]N-[:30]OH}
+ \arrow{<=>[\chemfig{H^\oplus}]}
+ \chemfig{(-[@{a0}:-150]R')(-[:-30]R)=[2]@{a1}N-[@{b0}:30]@{b1}\chemabove{O}{\scriptstyle\oplus}H_2}
+ \chemmove[red,-stealth,red,shorten <=2pt]{
+ \draw(a0)..controls +(135:2mm) and +(215:4mm).. (a1);
+ \draw(b0)..controls +(120:2mm) and +(180:3mm).. ([yshift=7pt]b1.180);}
+ \arrow{<=>[\chemfig{{-}H_2O}]}[,1.1]
+ \chemleft[{\subscheme[90]{%
+ \chemfig{R'-\chemabove{N}{\scriptstyle\oplus}~C-R}
+ \arrow{<->}[,0.75]
+ \chemfig{R'-\lewis{2:,N}=@{a1}\chemabove{C}{\scriptstyle\oplus}-R}}}\chemright]
+ \arrow{<=>[\chemfig{H_2@{a0}\lewis{0:2:,O}}]}[,1.1]
+ \chemmove[red,-stealth,red,shorten <=3pt]{
+ \draw(a0)..controls+(90:10mm)and+(45:10mm)..([yshift=6pt]a1.45);}
+ \chemfig{*6(R\rlap{$'$}-N=(-R)-\chemabove{O}{\scriptstyle\oplus} H_2)}
+ \arrow{<=>[\chemfig{{-}H^\oplus}]}
+ \chemfig{*6(R\rlap{$'$}-N=(-R)-OH)}
+ \arrow
+ \chemfig{*6(R\rlap{$'$}-\chembelow{N}{H}-(-R)(=[2]O))}
+ \schemestop\hss}\hfill\null
+ \begin{center}
+ \sffamily\small Réarrangement de Beckmann%
+ \end{center}
+\end{titlepage}
+\parindent0pt\pagestyle{plain}
+\tableofcontents
+\parskip\medskipamount
+\newpage
+
+\setitemize{leftmargin=3em,topsep=0pt,parsep=0pt,itemsep=0pt,label=--}
+\part{Introduction}
+\section{Nouveau dans la v1.4}
+\subsection{Primitive \texttt{\textbackslash expanded}}
+\fbox{\vbox{\hsize\dimexpr\linewidth-2\fboxsep-2\fboxrule\relax\textbf{Important} : à partir de la version 1.41, \CF nécessite un moteur \TeX{} fournissant la primitive \texttt{\string\expanded}. Si ce n'est pas le cas, un message d'erreur sera émis et la version 1.4 sera chargée (dernière version fonctionnant sans la primitive \texttt{\string\expanded}) : il est vivement conseillé de mettre à jour sa distribution \LaTeX{} afin de profiter d'un moteur \TeX{} récent permettant l'utilisation de cette nouvelle primitive.}}\medbreak
+
+\subsection{Position et rotation des délimiteurs}
+La nouvelle clé \CFkey{h align} pour les délimiteurs permet, lorsqu'elle est mise à \CFval{false} de ne plus aligner automatiquement les délimiteurs horizontalement. Lorsque les délimiteurs ne sont plus sur une même horizontale, on peut les faire pivoter automatiquement en rendant la clé \CFkey{auto rotate} égale à \CFval{true}. On peut passer outre ce réglage automatique et choisir l'angle de rotation avec la clé \CFkey{rotate}. Voir page~\pageref{polymerdelim}.
+
+\subsection{Caractère privé}
+Dans le code de \CF, le caractère utilisé dans le nom des macros privées est «\verb|_|» (underscore) et non plus «\verb|@|» (arobe) : le préfixe des macros privées de \CF est «\verb|\CF_|». La majorité des utilisateurs de \CF ne doit pas devrait pas être concernée par ce changement, mais l'élaboration ou la maintenance de codes spécifiques tel que ceux présentés à la section «Créer ses propres flèches» à la page~\pageref{definearrow} qui font appel à des macros privées doit conduire à tenir compte de ce changement de catcode; cela va donc nécessiter une \emph{mise à jour du nom des macros} pour ceux qui ont eu recours aux macros privées de \CF. Pour rendre possible l'utilisation de «\verb|_|» dans les noms des macros, on doit exécuter l'ordre «\verb|\catcode`\_=11|» et pour revenir à un l'état normal «\verb|\catcode`\_=8|».
+
+\subsection{Caractère \#}
+Tous ceux qui programment en \TeX{} connaissent les extrêmes précautions qui doivent être prises avant d'utiliser le caractère «\verb|#|». Ce caractère est autorisé dans le code représentant la molécule, mais pour des raisons de fonctionnement interne à \TeX, il sera doublé si la commande \verb|\chemfig| se trouve dans l'argument d'une macro (comme \verb|\fbox| dans l'exemple ci-dessous). Pour éviter ce doublement, on peut écrire \verb|\#| ou avoir recours à la macro \verb|\CFhash| :
+
+\exemple{Caractère \#}/\setchemfig{atom sep=5em}\fboxsep=1pt
+1) \chemfig{A#-B_#-C^#}\par
+2) \fbox{\chemfig{A#-B_#-C^#}}\par
+3) \fbox{\chemfig{A\#-B_\#-C^\#}}\par
+4) \fbox{\chemfig{A\CFhash-B_\CFhash-C^\CFhash}}/
+
+Pour la macro \verb|\definesubmol|, le caractère \verb|#| est également autorisé, mais son emploi est plus complexe car il recouvre plusieurs cas qui sont examinés à la page~\pageref{definesubmol}.
+
+\subsection{Anciennes macros, nouvelle syntaxe}
+Les macros auparavant utilisées pour régler les paramètres de \CF sont abandonnées, ne sont plus définies et donc, \emph{produiront à une erreur de compilation} si elles sont exécutées:
+\begin{center}
+ \begin{tabular}{*3l}
+ \verb-\setcrambond-&\verb-\setatomsep-&\verb-\enablefixedbondlength-\\
+ \verb-\disablefixedbondlength-&\verb-\setbondoffset-&\verb-\setdoublesep-\\
+ \verb-\setangleincrement-&\verb-\setnodestyle-&\verb-\setbondstyle-\\
+ \verb-\setlewis-&\verb-\setlewisdist-&\verb-\setstacksep-\\
+ \verb-\setcompoundstyle-&\verb-\setarrowdefault-&\verb-\setandsign-\\
+ \verb-\setarrowoffset-&\verb-\setcompoundsep-&\verb-\setarrowlabelsep-\\
+ \verb-\enablebondjoin-&\verb-\disablebondjoin-&\verb-\schemedebug-
+ \end{tabular}
+\end{center}
+Désormais, pour régler les paramètres de \CF on a le choix entre :
+\begin{itemize}
+ \item la macro \Verb|\setchemfig{<clés>=<valeurs>}| règle les paramètres selon la méthode de clés/valeurs pour le reste du document;
+ \item la macro \Verb|\chemfig[<clés>=<valeurs>]| reçoit dans son argument optionnel les paramètres valables uniquement pour cette molécule;
+ \item la macro \verb|\resetchemfig| restaure les paramètres à leurs valeurs par défaut.
+\end{itemize}
+
+La liste des paramètres et leurs valeurs par défaut est présentée à la page~\pageref{listeparametres}.
+
+La syntaxe étoilée \verb|\chemfig*| n'est plus autorisée. Pour spécifier une longueur constante de liaisons, il faut utiliser la clé \CFkey{fixed length} et la positionner à \CFval{true}, voir page~\pageref{longueur.liaison}.
+
+\subsection{Les macros \texttt{\textbackslash lewis} et \texttt{\textbackslash Lewis}}
+Ces deux macros subissent également un léger changement de syntaxe. Leur argument optionnel entre crochets n'est plus destiné à recevoir le coefficient d'espacement diagonal, mais des \Verb|<clés>=<valeurs>| afin que les paramètres puissent être spécifiés individuellement pour chaque appel de la macro \verb|\lewix| ou \verb|\Lewis|. Voir page~\pageref{lewis}.
+
+\section{Présentation}
+Pour charger \CF, il faut écrire :
+\begin{itemize}
+ \item {\color{blue}\verb-\input chemfig.tex-} avec $\varepsilon$\TeX;
+ \item {\color{blue}\verb-\usepackage{chemfig}-} avec \LaTeX;
+ \item {\color{blue}\verb-\usemodule[chemfig]-} avec Con\TeX t;
+\end{itemize}
+
+Dans tous les cas, le package \TIKZ, s'il n'a pas été chargé auparavant, est chargé par \CF.
+
+La commande principale permettant de dessiner les molécules est \Verb|\chemfig{<code>}|. L'argument \Verb|<code>| est la suite de caractères décrivant le dessin de la molécule selon les règles qui seront exposées dans ce manuel.
+
+Tout a été fait pour qu'il soit possible de dessiner le plus grand nombre de configurations de molécules chimiques, tout en privilégiant une syntaxe simple, souple et intuitive. Malgré tout, le \Verb-<code>- qui décrit le dessin en 2D de la molécule voit sa complexité augmenter proportionnellement à celle de la molécule à dessiner.
+
+La commande \verb|\chemfig| dessine une molécule en se servant de commandes de l'extension \TIKZ, placées à l'intérieur de l'environnement \verb|tikzpicture|. Le choix de \TIKZ implique que:
+\begin{itemize}
+\item l'utilisateur a le choix pour le moteur de compilation : pdf\LaTeX{} peut indifféremment être utilisé en mode dvi (tex $\longrightarrow$ dvi $\longrightarrow$ ps $\longrightarrow$ pdf) ou en mode pdf (tex $\longrightarrow$ pdf). En effet, \TIKZ, via la sous-couche \falseverb{pgf}, donne des résultats graphiques identiques dans les deux modes;
+\item la boîte englobante est automatiquement calculée par \TIKZ et l'utilisateur n'a pas à se préoccuper d'éventuels chevauchements avec le texte. En revanche il faut faire attention à la régularité des interlignes lorsque la molécule est dessinée dans un paragraphe. À titre d'exemple, on a tracé la boîte englobante pour cette molécule : {\fboxsep0pt \fbox{\chemfig{H_3C-C(-[:-30]OH)=[:30]O}}}.
+\end{itemize}
+
+\section{Remerciements}
+Cette extension a pu voir le jour grâce à l'aide de Christophe \textsc{Casseau} qui en a eu l'idée. Je le remercie pour l'aide qu'il m'a apportée en amont de l'écriture du code ainsi que pour les tests qu'il a effectués.
+\bigbreak
+Enfin, je tiens à chaleureusement remercier Theo \textsc{Hopman} qui m'a spontanément proposé d'effectuer la traduction de ce manuel en anglais.
+\newpage
+
+\part{Fonctionnement de \protect\CF}
+Cette partie est consacrée à la description des fonctionnalités les plus courantes de \CF. L'utilisateur trouvera ici les explications suffisantes pour dessiner la plupart des molécules. La présentation des fonctionnalités est faite sous un angle théorique, et le but de cette partie n'est pas de dessiner de vraies molécules chimiques mais de donner à l'utilisateur une description formelle des fonctionnalités de \CF. La partie «Utilisation avancée», page~\pageref{utilisation.avancee}, sera plus pratique et dévoilera des fonctionnalités plus avancées pour les utilisations les plus pointues. On y mettra aussi en avant des méthodes pour construire de vraies molécules chimiques, page \pageref{exemples.commentes}. Enfin, la dernière partie présentera des molécules chimiques et le code utilisé pour les dessiner.
+
+\section{La macro \texttt{\textbackslash chemfig}}
+La macro \verb|\chemfig| a la syntaxe suivante
+\begin{center}
+ \Verb|\chemfig[liste de <clés>=<valeurs>]{<code molécule>}|
+\end{center}
+L'argument optionnel entre crochets spécifie les réglages des paramètres qui seront utilisés pour le tracé de la molécule. Il est à noter que les paramètres ainsi modifiés ne le sont \emph{que pour la molécule en cours} et seront restaurés à leurs valeurs précédentes une fois la macro terminée. Pour modifier de façon durable des paramètres, il faut passer par la macro \Verb|\setchemfig{<clés>=<valeurs>}|.
+
+Voici la liste exhaustive des paramètres ainsi que leurs valeurs par défaut\label{listeparametres}. Il faut noter que les \chevrons{clés} depuis \CFkey{scheme debug} inclus jusqu'à la fin de la liste concernent les schémas réactionnels et n'ont pas de sens dans l'argument optionnel de la macro \verb|\chemfig| où elles sont simplement ignorées :\par
+\leavevmode\hfill
+\begin{minipage}[t]{.45\linewidth}
+ \begin{longtable}{rl}\hline
+ \chevrons{clés} & \chevrons{valeurs} par défaut\\\hline\endhead
+ \CFparam{chemfig style}
+ \CFparam{atom style}
+ \CFparam{bond join}
+ \CFparam{fixed length}
+ \CFparam{cram rectangle}
+ \CFparam{cram width}
+ \CFparam{cram dash width}
+ \CFparam{cram dash sep}
+ \CFparam{atom sep}
+ \CFparam{bond offset}
+ \CFparam{double bond sep}
+ \CFparam{angle increment}
+ \CFparam{node style}
+ \CFparam{bond style}
+ \CFparam{lewis | width}
+ \CFparam{lewis sep}
+ \CFparam{lewis length}
+ \CFparam{lewis style}
+ \CFparam{lewis dist}\hline
+ \end{longtable}
+\end{minipage}\hfill
+\begin{minipage}[t]{.45\linewidth}
+ \begin{longtable}{rl}\hline
+ \chevrons{clés} & \chevrons{valeurs} par défaut\\\hline\endhead
+ \CFparam{lewis radius}
+ \CFparam{lewis diag coeff}
+ \CFparam{cycle radius coeff}
+ \CFparam{stack sep}
+ \CFparam{scheme debug}
+ \CFparam{compound style}
+ \CFparam{compound sep}
+ \CFparam{arrow offset}
+ \CFparam{arrow angle}
+ \CFparam{arrow coeff}
+ \CFparam{arrow style}
+ \CFparam{arrow double sep}
+ \CFparam{arrow double coeff}
+ \CFparam{arrow double harpoon}
+ \CFparam{arrow label sep}
+ \CFparam{arrow head}
+ \CFparam{+ sep left}
+ \CFparam{+ sep right}
+ \CFparam{+ vshift}\hline
+ \end{longtable}
+\end{minipage}\hfill\null\bigbreak
+
+Le \Verb|<code molécule>| contient les instructions pour tracer la molécule selon une syntaxe qui sera expliquée dans ce document. Il n'y a pas de restriction a priori sur les caractères acceptés dans ce code :
+\begin{itemize}
+ \item tous les caractères de catcode 11 ou 12, c'est-à-dire les lettres majuscules ou minuscules, les chiffres, les opérateurs mathématiques (\texttt+ \texttt- \texttt* \texttt/ \texttt=), les signes de ponctuation qu'ils soient actifs ou non (\verb|.| \verb|,| \verb|;| \verb|:| \verb|!| \verb|?| \verb|'| \verb|`| \verb|"| \verb-|-), les parenthèses et les crochets;
+ \item les caractères plus spéciaux tels que «\verb|~|», «\verb|#|»\footnote{Pour éviter que \texttt\# ne soit doublé lorsque la macro \texttt{\textbackslash chemfig} se trouve dans l'argument d'une macro, on peut utiliser à la place \texttt{\textbackslash\#} ou la macro \texttt{\textbackslash CFhash}.} ainsi que «\verb|^|» et «\verb|_|» qui ont leur propriétés normales du mode mathématique;
+ \item les espaces, mais ceux-ci sont ignorés par défaut car les atomes sont composés en mode mathématique;
+ \item les accolades «\verb|{|» et «\verb|}|» qui ont leur comportement normal de marqueurs de groupe ou délimiteurs d'argument de macro;
+ \item des macros.
+\end{itemize}
+
+Dans tous les cas, \CF placera \emph{sur la ligne de base courante le premier atome rencontré}, qu'il soit vide ou pas. Dans les exemples figurant dans ce document, la ligne de base est tracée en gris clair.
+
+\section{Groupes d'atomes}
+Intrinsèquement, le dessin d'une molécule chimique consiste à relier par des traits de différents types des groupes d'atomes. Ainsi, dans la molécule \chemfig{O=O}, il y a 2 groupes d'atomes, chacun constitué d'un seul atome «O».
+
+{\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 :
+\renewcommand*\printatom[1]{\fbox{\ensuremath{\mathrm{#1}}}}
+\molht{H_3C-C(=[:30]O)(-[:-30]OH)}}
+
+Un espace est ignoré s'il est au début d'un groupe d'atomes.
+
+\section{Différents types de liaisons}
+Pour \CF, les liaisons entre 2 atomes sont de 9 types, correspondant aux caractères \boxedfalseverb-, \boxedfalseverb=, \boxedfalseverb~, \boxedfalseverb>, \boxedfalseverb<, \boxedfalseverb{>:}, \boxedfalseverb{<:}, \boxedfalseverb{>|} et \boxedfalseverb{<|} :\label{types.liaisons}
+\begin{center}
+\begin{tabular}{>{\centering\arraybackslash}m{1.7cm}>{\centering\arraybackslash}m{3cm}>{\centering\arraybackslash}m{2cm}m{4cm}}
+\hline
+\No{} liaison&Code &Résultat &Type de liaison\\\hline
+1 &\verb+\chemfig{A-B}+ &\chemfig{A-B} &Simple\\
+2 &\verb+\chemfig{A=B}+ &\chemfig{A=B} &Double\\
+3 &\verb+\chemfig{A~B}+ &\chemfig{A~B} &Triple\\
+4 &\verb+\chemfig{A>B}+ &\chemfig{A>B} &Cram pleine droite\\
+5 &\verb+\chemfig{A<B}+ &\chemfig{A<B} &Cram pleine gauche\\
+6 &\verb+\chemfig{A>:B}+&\chemfig{A>:B}&Cram pointillée droite\\
+7 &\verb+\chemfig{A<:B}+&\chemfig{A<:B}&Cram pointillée gauche\\
+8 &\verb+\chemfig{A>|B}+&\chemfig{A>|B}&Cram évidée droite\\
+9 &\verb+\chemfig{A<|B}+&\chemfig{A<|B}&Cram évidée gauche\\\hline
+\end{tabular}
+\end{center}
+\label{double bond sep}La \chevrons{clé} \CFkv{double bond sep}{dim} permet de régler l'espacement entre les traits des liaisons doubles ou triples. Cet espacement vaut 2pt par défaut.
+
+\label{longueur.liaison}Lorsqu'une liaison est faite entre 2 atomes, il faut comprendre que ces atomes sont contenus dans des boîtes invisibles rectangulaires. Les centres des deux rectangles sont séparés par une distance réglable $\Delta$, appelée «distance interatome». De plus, les liaisons ne relient pas exactement les frontières des rectangles : une distance $\delta$, réglable elle aussi, sépare le bord des rectangles du début et de la fin de la liaison. Pour aider à la compréhension, les boîtes rectangulaires sont rendues visibles dans ce schéma :
+\begin{center}
+\begin{tikzpicture}[every node/.style={anchor=base,inner sep=1.5pt,outer sep=0pt,minimum size=0pt},baseline]
+ \node[draw] at(0,0)(aa){\huge A};
+ \node[draw]at(4,0)(bb){\huge B};
+ \path[shorten <=10pt,shorten >=10pt,draw](aa)--(bb)coordinate[pos=0](al) coordinate[pos=1](bl);
+ \node[draw,circle,fill,blue,minimum size=1.5pt,inner sep=0pt]at(al){};
+ \node[draw,circle,fill,blue,minimum size=1.5pt,inner sep=0pt]at([xshift=10pt]al){};
+ \node[draw,circle,fill,blue,minimum size=1.5pt,inner sep=0pt]at(bl){};
+ \node[draw,circle,fill,blue,minimum size=1.5pt,inner sep=0pt]at([xshift=-10pt]bl){};
+ \draw[blue,dash pattern=on 1pt off 1pt](bl)--([yshift=0.7cm]bl);
+ \draw[blue,dash pattern=on 1pt off 1pt]([xshift=-10pt]bl)--([xshift=-10pt,yshift=0.7cm]bl);
+ \draw[stealth-stealth]([yshift=0.6cm]bl.center)--([xshift=-10pt,yshift=0.6cm]bl.center) node [midway,above,draw=none]{$\delta$};
+ \draw[blue,dash pattern=on 1pt off 1pt](al)--([yshift=0.7cm]al);
+ \draw[blue,dash pattern=on 1pt off 1pt]([xshift=10pt]al)--([xshift=10pt,yshift=0.7cm]al);
+ \draw[stealth-stealth]([yshift=0.6cm]al.center)--([xshift=10pt,yshift=0.6cm]al.center) node [midway,above,draw=none]{$\delta$};
+ \node[draw,circle,fill,red,minimum size=2pt,inner sep=0pt]at(aa){};
+ \node[draw,circle,fill,red,minimum size=2pt,inner sep=0pt]at(bb){};
+ \draw[stealth-stealth]([yshift=1cm]aa.center)--([yshift=1cm]bb.center) node [midway,above,draw=none] {$\Delta$} ;
+ \draw[red,dash pattern=on 2pt off2pt](aa.center)--([yshift=1.1cm]aa.center);
+ \draw[red,dash pattern=on 2pt off2pt](bb.center)--([yshift=1.1cm]bb.center);
+\end{tikzpicture}
+\end{center}
+
+\label{atom sep}La \chevrons{clé} \CFkv{atom sep}{dim} règle cette distance interatome $\Delta$. Ce paramètre, comme tous les paramètres, agit sur toutes les molécules qui vont suivre.
+
+\exemple{Distance interatome}|\chemfig[atom sep=2em]{A-B}\par
+\chemfig[atom sep=50pt]{A-B}|
+
+\label{bond offset}La \chevrons{clé} \CFkv{bond offset}{dim} permet de régler l'espacement $\delta$ entre le trait représentant la liaison et l'atome. Sa valeur par défaut est 2pt.
+\exemple{Retrait des liaisons}|\chemfig[bond offset=0pt]{A-B}\par
+\chemfig[bond offset=5pt]{A-B}|
+
+Si deux liaisons se suivent, alors \CF insère un groupe vide \verb-{}-, et autour de ce groupe vide, l'espacement $\delta$ est nul :
+\exemple{Groupes vides}/\chemfig{A-B=-=C}/
+
+\label{bond style}La \chevrons{clé} \CFkv{bond style}{code tikz} définit le style de toutes les liaisons qui seront dessinées par la suite. Le \CFval{code tikz} est vide par défaut. Pour personnaliser les liaisons une par une, voir page~\pageref{perso-liaisons}.
+\exemple{Style des liaisons}/\chemfig[bond style={line width=1pt,red}]{A-B=C>|D<E>:F}/
+
+\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 :
+\begingroup
+\catcode`\#12
+\exemple{Réglage fin du retrait des liaisons}/\setchemfig{bond offset=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
+
+Par défaut, tous les atomes se trouvant dans les groupes d'atomes sont composés en mode mathématique (les espaces sont ignorés). Ils peuvent donc contenir des caractères propres à ce mode comme la mise en indice ou en exposant\footnote{Il existe un problème de placement des groupes d'atomes contenant des exposants ou des indices. Voir page~\pageref{alignement.vertical}.}:
+\exemple{Mode mathématique}|\chemfig{A_1B^2-C _ 3 ^ 4}|
+
+Il existe des réglages spécifiques aux liaisons de Cram:
+\begin{itemize}
+ \item \CFkv{cram width}{dim} est la largeur de la base des triangles et vaut 1.5ex par défaut;
+ \item \CFkv{cram dash width}{dim} est l'épaisseur des pointillés et vaut 1pt par défaut;
+ \item \CFkv{cram dash sep}{dim} est l'espacement entre les pointillés et vaut 2pt par défaut.
+\end{itemize}
+
+Voici un exemple où les 3 dimensions sont modifiées :
+
+\exemple{Liaison de Cram modifiée}-\chemfig[cram width=10pt,
+ cram dash width=0.4pt,
+ cram dash sep=1pt]{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.
+
+Il y a plusieurs façons de spécifier l'angle d'une liaison.
+\subsection{Angle prédéfini}
+Lorsque l'argument optionnel contient un entier celui-ci représente l'angle que fait la liaison avec l'horizontale, en multiples de 45\degres. Ainsi, \verb-[0]- spécifie un angle de 0\degres, \verb-[1]- de 45\degres, etc.
+
+\exemple{Angles prédéfinis}|\chemfig{A-B-[1]C-[3]-D-[7]E-[6]F}|
+
+Ces angles restent valable si les atomes sont vides et il en sera de même par la suite pour toutes les fonctionnalités que nous verrons :
+\exemple{Angles prédéfinis, groupes vides}|\chemfig{--[1]-[3]--[7]-[6]}|
+
+Pour ceux qui trouvent cela « affreux\footnote{Voir \texttt{\detokenize{http://tex.stackexchange.com/questions/161796/ugly-bond-joints-in-chemfig}}} », il est désormais possible de raccorder les liaisons simples entres-elles moyennant un temps de compilation légèrement augmenté. La \chevrons{clé} booléenne \CFkv{bond join}{booléen} permet, lorsqu'elle est \CFval{true} d'activer cette fonctionnalité. La valeur par défaut est \CFval{false} qui est le comportement préférable.
+
+\exemple{Raccord entre liaisons}/\setchemfig{bond style={line width=3pt}}
+\chemfig{-[1]-[7]} et
+\chemfig[bond join=true]{-[1]-[7]}/
+
+\label{angle increment}La \chevrons{clé} \CFkv{angle increment}{angle} permet de choisir un autre angle que celui de 45\degres{} sélectionné par défaut :
+
+\exemple{Modification de l'angle prédéfini}/Par défaut (45) : \chemfig{-[1]-[-1]-[1]-[-1]}
+
+Angle de 30 : \chemfig[angle increment=30]{-[1]-[-1]-[1]-[-1]}/
+
+\subsection{Angle absolu}
+Si on veut spécifier un angle en degrés avec l'horizontale, alors l'argument optionnel doit prendre cette forme : \Verb-[:<angle absolu>]-. S'il le faut, l'\Verb-<angle absolu>- est ramené dans l'intervalle $[0\;;\;360]$ :
+\exemple{Angles absolus}/\chemfig{A-[:30]B=[:-75]C-[:10]D-[:90]>|[:60]-[:-20]E-[:0]~[:-75]F}/
+
+\subsection{Angle relatif}\label{angle.relatif}
+Il est souvent intéressant de spécifier pour une liaison l'angle qu'elle fera relativement à la précédente. On doit alors employer cette syntaxe pour l'argument optionnel : \Verb-[::<angle relatif>]-. Le signe de l'\Verb-<angle relatif>- peut être omis s'il s'agit d'un \verb-+-.
+
+Voici une molécule où les angles des liaisons augmentent de 20\degres{} à chacune après la première dont l'angle est absolu de $-5\degres$ :
+\exemple{Suite d'angles relatifs}|\chemfig{A-[:-5]-[::+20]-[::20]B-[::+20]-[::20]C-[::20]}|
+
+On peut «casser» un enchaînement d'angles relatifs en mettant un angle absolu ou prédéfini lorsqu'on le souhaite. Ici, c'est à l'atome «B» dont la liaison suivante un angle absolu de 315\degres.
+\exemple{Suite d'angles relatif puis angle absolu}|\chemfig{A-[:-5]-[::20]-[::20]B-[7]-[::20]C-[::20]}|
+
+\section{Longueur d'une liaison}
+En fait, il faudrait plutôt parler d'espace interatome que de longueur d'une liaison. En effet, seul l'espace interatome est réglable avec \CFkey{atom sep} comme on l'a vu page~\pageref{longueur.liaison}. Une fois ce paramètre fixé, la longueur d'une liaison dépend du contenu des atomes et, dans une moindre mesure, de l'angle que fait la liaison avec l'horizontale. Il est bien évident que deux atomes peu «encombrants» auront leurs bords plus lointains que s'il avaient été encombrants. On s'en rend très bien compte sur cet exemple où les atomes «I» sont plus étroits que les atomes «M» ce qui entraîne que la liaison entre les «I» est plus longue que celle entre les «M» :
+\exemple{Influence de la largeur de l'atome}|\chemfig{I-I}\par
+\chemfig{M-M}|
+
+Cet aspect de l'encombrement des atomes se fait particulièrement sentir lorsqu'ils comportent les exposants ou des indices. Dans cet exemple, la liaison est bien plus courte, au point de se confondre avec un signe mathématique $-$ :
+\exemple{Liaison trop courte}|\chemfig{A^{++}_{2}-B^{-}_3}|
+
+Il est important de remarquer que l'exposant «\verb+-+» est \emph{mis entre accolades}. En effet si ce n'était pas le cas, \CF stopperait l'atome sur ce caractère qui est un caractère de liaison. L'atome serait donc «\verb-B^-», ce qui conduirait à des résultats inattendus.
+
+Il est possible de changer le comportement de \CF quant à l'espace interatome. En effet, lorsque la \chevrons{clé} \CFkey{fixed legnth} est mise à \CFval{true}, la \chevrons{clé} \CFkey{atom sep} ne spécifie plus la distance entre les centres des atomes, notée $\Delta$, mais \emph{la longueur des liaisons}. Dès lors, les liaisons ont des longueurs fixes tandis que la distance entre les centres des atomes devient variable et dépend de leur encombrement. Voici les deux configurations du schéma de la page~\pageref{longueur.liaison} avec les deux valeurs booléennes de \CFkey{fixed length} :
+
+\begin{center}
+\begin{tabular}{c@{\kern2cm}c}
+ \CFkv{fixed length}{false}&\CFkv{fixed length}{true}\\[2ex]
+ \begin{tikzpicture}[every node/.style={anchor=base,inner sep=1.5pt,outer sep=0pt,minimum size=0pt},baseline]
+ \node[draw] at(0,0)(aa){\huge A};
+ \node[draw]at(4,0)(bb){\huge B};
+ \path[shorten <=10pt,shorten >=10pt,draw](aa)--(bb)coordinate[pos=0](al) coordinate[pos=1](bl);
+ \node[draw,circle,fill,blue,minimum size=1.5pt,inner sep=0pt]at(al){};
+ \node[draw,circle,fill,blue,minimum size=1.5pt,inner sep=0pt]at([xshift=10pt]al){};
+ \node[draw,circle,fill,blue,minimum size=1.5pt,inner sep=0pt]at(bl){};
+ \node[draw,circle,fill,blue,minimum size=1.5pt,inner sep=0pt]at([xshift=-10pt]bl){};
+ \draw[blue,dash pattern=on 1pt off 1pt](bl)--([yshift=0.7cm]bl);
+ \draw[blue,dash pattern=on 1pt off 1pt]([xshift=-10pt]bl)--([xshift=-10pt,yshift=0.7cm]bl);
+ \draw[stealth-stealth]([yshift=0.6cm]bl.center)--([xshift=-10pt,yshift=0.6cm]bl.center) node [midway,above,draw=none]{$\delta$};
+ \draw[blue,dash pattern=on 1pt off 1pt](al)--([yshift=0.7cm]al);
+ \draw[blue,dash pattern=on 1pt off 1pt]([xshift=10pt]al)--([xshift=10pt,yshift=0.7cm]al);
+ \draw[stealth-stealth]([yshift=0.6cm]al.center)--([xshift=10pt,yshift=0.6cm]al.center) node [midway,above,draw=none]{$\delta$};
+ \node[draw,circle,fill,red,minimum size=2pt,inner sep=0pt]at(aa){};
+ \node[draw,circle,fill,red,minimum size=2pt,inner sep=0pt]at(bb){};
+ \draw[stealth-stealth]([yshift=1cm]aa.center)--([yshift=1cm]bb.center) node [midway,above,draw=none] {$\Delta$} ;
+ \draw[red,dash pattern=on 2pt off2pt](aa.center)--([yshift=1.1cm]aa.center);
+ \draw[red,dash pattern=on 2pt off2pt](bb.center)--([yshift=1.1cm]bb.center);
+ \end{tikzpicture}
+ &
+ \begin{tikzpicture}[every node/.style={anchor=base,inner sep=1.5pt,outer sep=0pt,minimum size=0pt},baseline]
+ \node[draw] at(0,0)(aa){\huge A};
+ \node[draw]at(5,0)(bb){\huge B};
+ \path[shorten <=10pt,shorten >=10pt,draw](aa)--(bb)coordinate[pos=0](al) coordinate[pos=1](bl);
+ \node[draw,circle,fill,blue,minimum size=1.5pt,inner sep=0pt]at(al){};
+ \node[draw,circle,fill,blue,minimum size=1.5pt,inner sep=0pt]at([xshift=10pt]al){};
+ \node[draw,circle,fill,blue,minimum size=1.5pt,inner sep=0pt]at(bl){};
+ \node[draw,circle,fill,blue,minimum size=1.5pt,inner sep=0pt]at([xshift=-10pt]bl){};
+ \draw[blue,dash pattern=on 1pt off 1pt](bl)--([yshift=0.7cm]bl);
+ \draw[blue,dash pattern=on 1pt off 1pt]([xshift=-10pt]bl)--([xshift=-10pt,yshift=0.7cm]bl);
+ \draw[stealth-stealth]([yshift=0.6cm]bl.center)--([xshift=-10pt,yshift=0.6cm]bl.center) node [midway,above,draw=none]{$\delta$};
+ \draw[blue,dash pattern=on 1pt off 1pt](al)--([yshift=0.7cm]al);
+ \draw[blue,dash pattern=on 1pt off 1pt]([xshift=10pt]al)--([xshift=10pt,yshift=0.7cm]al);
+ \draw[stealth-stealth]([yshift=0.6cm]al.center)--([xshift=10pt,yshift=0.6cm]al.center) node [midway,above,draw=none]{$\delta$};
+ \draw[stealth-stealth]([yshift=1cm]al)--([yshift=1cm]bl) node [midway,above,draw=none] {$\Delta$} ;
+ \draw[red,dash pattern=on 2pt off2pt](al)--([yshift=1.1cm]al);
+ \draw[red,dash pattern=on 2pt off2pt](bl)--([yshift=1.1cm]bl);
+ \end{tikzpicture}
+\end{tabular}
+\end{center}
+
+Afin que les cycles soient des polygones réguliers, le comportement par défaut est rétabli pour les liaisons des cycles, même si \CFkv{fixed length}{true}.
+
+\exemple{Liaisons de longueur fixe}/\chemfig{Cl-Cl}\par
+\chemfig[fixed length=true]{Cl-Cl}/
+
+Notamment lorsque le comportement par défaut est en vigueur et pour se prémunir de liaisons trop courtes, il est parfois nécessaire de pouvoir augmenter (ou parfois réduire) la distance interatome. Pour cela, l'argument optionnel des liaisons est en réalité constitué de plusieurs champs séparés par des virgules. Comme on l'a vu, le premier champ spécifie l'angle. Le deuxième champ, s'il est non vide, est un coefficient qui multipliera la distance interatome $\Delta$ par défaut. Ainsi, écrire \verb+-[,2]+ demandera à ce que cette liaison ait l'angle par défaut (1\ier{} champ vide) et que les atomes qu'elle relie soit espacés d'une distance double de celle par défaut.
+\exemple{Longueur de liaison modifiée}/\chemfig{A^{++}_{2}-[,2]B^{-}_3}\par
+\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 la \chevrons{clé} \CFkey{atom sep}, éventuellement sur les deux, 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
+\setchemfig{atom sep=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}|
+
+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}|
+
+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 :
+\begin{center}
+ \Verb/[,,<entier 1>,<entier 2>]/
+\end{center}
+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}|
+
+\section{Personnalisation des liaisons}\label{perso-liaisons}
+Il existe un 5\ieme{} et dernier argument optionnel pour les liaisons qui se trouve à droite de la 4\ieme{} virgule :
+\begin{center}
+ \Verb/[,,,,<code tikz>]/
+\end{center}
+
+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}|
+
+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}|
+
+Les liaisons de Cram sont insensibles aux attributs d'épaisseur et de pointillés.
+
+\section{Valeurs par défaut}
+Au début de chaque molécule, les valeurs par défaut des arguments optionnels des liaisons sont initialisées. Elles valent :
+\begin{itemize}
+ \item 0\degres{} pour l'angle des liaisons;
+ \item 1 pour le coefficient multiplication des longueurs;
+ \item \Verb-<vide>- pour les numéros de départ et d'arrivée des atomes, ce qui laisse à \CF le soin de calculer ceux-ci en fonction de l'angle de la liaison;
+ \item \Verb-<vide>- pour le paramètre passé à \TIKZ.
+\end{itemize}
+
+On peut changer ces valeurs par défaut pour toute la molécule en débutant le code de la molécule par
+\begin{center}
+ \Verb/[<angle>,<coeff>,<n1>,<n2>,<code tikz>]/
+\end{center}
+
+Ainsi, si le code de la molécule commence par \verb-[:20,1.5]-, alors toutes les liaisons auront un angle de 20\degres{} par défaut et les distances interatomes une longueur qui vaut 1,5 fois la distance interatomes par défaut. On peut à tout moment ignorer ces valeurs par défaut en spécifiant un argument optionnel, comme pour la liaison qui suit l'atome «C» de cet exemple :
+\exemple{Écrasement des valeurs par défaut}|\chemfig{[:20,1.5]A-B-C-[:-80,0.7]D-E-F}|
+
+Si on écrit un improbable \verb-[1,1.5,2,2,red,thick]-, sauf indication contraire, toutes les liaisons auront un angle de 45\degres{} avec l'horizontale, les distances interatomes vaudront 1,5 fois la distance par défaut, les liaisons partiront et arriveront sur le deuxième atome de chaque groupe et seront rouges et épaisses :
+\exemple{Valeurs par défaut}|\chemfig{[1,1.5,2,2,red,thick]ABC-DEF=GHI}|
+
+\section{Ramifications}
+\subsection{Principe}
+Jusqu'à présent, toutes les molécules étaient linéaires, ce qui est rare. On peut attacher une sous molécule à un atome faisant suivre cet atome d'un \Verb-<code>- entre parenthèses. Ce \Verb-<code>- est le code d'une sous molécule qui viendra d'attacher sur l'atome.
+
+Dans cet exemple, la sous molécule «\verb/-[1]W-X/» vient s'attacher sur l'atome «B» :
+\exemple{Ramification}|\chemfig{A-B(-[1]W-X)-C}|
+
+On peut avoir plusieurs sous molécules qui viennent s'attacher sur un même atome. Il suffit de le faire suivre de plusieurs parenthèses contenant le code de chaque sous molécule :
+\exemple{Ramifications multiples}|\chemfig{A-B(-[1]W-X)(-[6]Y-[7]Z)-C}|
+
+Le code de chaque sous molécule peut définir ses propres valeurs par défaut qui seront valables dans toute l'étendue de la sous molécule. Ici, on attache sur «B» une sous molécule «\verb/[:60]-D-E/» dont l'angle par défaut vaut 60\degres{} absolus. On attache également sur «B» une sous molécule «\verb/[::-30,1.5]-X-Y/» dont l'angle par défaut vaut 30\degres{} de moins que celui de la liaison précédente (qui était celle qui allait de «A» à «B») et dont la distance interatome est 1,5 fois celle par défaut :
+\exemple{Valeur par défaut dans les ramifications}|\chemfig{A-B([:60]-D-E)([::-30,1.5]-X-Y)-C}|
+
+Maintenant, que se passe t-il si au début de la molécule principale, on écrit «\verb/[:-45]/» :
+\exemple{Influence de l'angle par défaut}|\chemfig{[:-45]A-B([:60]-D-E)([::-30,1.5]-X-Y)-C}|
+
+On constate que l'angle entre la liaison \verb/B-C/ et la liaison \verb/B-X/ reste de 30\degres{} puisqu'il s'agissait d'un angle relatif pour la sous molécule «\verb/-X-Y/». Par contre, la branche «\verb/-D-E/» reste inclinée à 60\degres{} avec l'horizontale et n'a pas suivi le mouvement de rotation imprimé par l'angle de $-45\degres$ du début, ce qui est normal puisque «\verb/-D-E/» a un angle absolu. Pour faire pivoter la totalité d'une molécule il est donc important que tous les angles soient relatifs.
+
+\subsection{Imbrication}
+Les sous molécules peuvent être imbriquées, et les règles vues au paragraphe précédent restent valables :
+\exemple{Ramifications imbriquées}|\chemfig{A-B([1]-X([2]-Z)-Y)(-[7]D)-C}|
+
+\subsection{Méthode}
+Mettons maintenant que nous voulions dessiner la molécule d'anhydride d'acide :
+\chemfig{R-C(=[::+60]O)-[::-60]O-[::-60]C(=[::+60]O)-[::-60]R}
+
+La meilleure méthode pour y arriver est de choisir le plus long chemin. Ici nous pouvons par exemple dessiner le chemin \verb/R-C-O-C-R/ en tenant compte des angles et en n'utilisant que les angles relatifs :
+\exemple{Structure de l'anhydride d'acide}|\chemfig{R-C-[::-60]O-[::-60]C-[::-60]R}|
+
+Partant de cette structure, il suffit de rajouter deux sous molécules «\verb/=O/» sur les atomes de carbone :
+\exemple{Anhydride d'acide}|\chemfig{R-C(=[::+60]O)-[::-60]O-[::-60]C(=[::+60]O)-[::-60]R}|
+
+N'ayant utilisé que des angles relatifs, on peut faire pivoter cette molécule, en spécifiant un angle par défaut de 75\degres{} par exemple :
+\exemple[70]{Rotation de la molécule}|\chemfig{[:75]R-C(=[::+60]O)-[::-60]O-[::-60]C(=[::+60]O)-[::-60]R}|
+
+\section{Lier des atomes éloignés}
+Nous avons vu comment relier des atomes \emph{qui se suivent dans le code}. Il est parfois indispensable de relier entre-eux des atomes ne se suivant pas dans le code. Appelons «liaisons distantes» ces liaisons particulières.
+
+Prenons cette molécule :
+\exemple{Structure ramifiée}|\chemfig{A-B(-[1]W-X)(-[7]Y-Z)-C}|
+
+Et mettons que l'on veuille relier les atomes \verb/X/ et \verb/C/. Dans ce cas, \CF permet de poser un «crochet» \emph{immédiatement} après l'atome qui nous intéresse. Le caractère utilisé pour poser ce crochet est «\verb-?-», pour sa ressemblance avec un crochet. Ainsi, si l'on écrit \verb/X?/, alors, l'atome \verb/X/ portera ce crochet. Par la suite dans le code, tous les atomes suivis d'un \verb-?- seront reliés à \verb/X/ :
+\exemple{Liaison éloignée}|\chemfig{A-B(-[1]W-X?)(-[7]Y-Z)-C?}|
+
+On aurait pu relier d'autres atomes à X en les faisant suivre de \verb-?-. Ici, ce sont les atomes \verb-C- et \verb-Z- :
+\exemple{Plusieurs liaisons éloignées}|\chemfig{A-B(-[1]W-X?)(-[7]Y-Z?)-C?}|
+
+Maintenant, imaginons que nous devions laisser ces liaisons distantes \verb/X-C/ et \verb/X-Z/, tout en ajoutant une autre : \verb/A-W/. Il faut donc poser deux crochets \emph{différents}, l'un sur \verb/A/ et l'autre sur \verb/X/. En fait, le caractère \verb/?/ a un argument optionnel :
+\begin{center}
+ \Verb/?[<nom>,<liaison>,<tikz>]/
+\end{center}
+où chaque champ prend sa valeur par défaut s'il est vide :
+\begin{itemize}
+ \item le \Verb-<nom>- est le nom du crochet : tous les caractères alphanumériques (a..z, A..Z, 0..9) sont admis\footnote{Ce n'est pas totalement exact. En réalité, tous les caractères pouvant être mis entre \texttt{\string\csname...\string\endcsname} sont autorisés.}. Ce nom vaut «\verb-a-» par défaut. Seul ce champ est pris en compte lors de la première occurrence de ce crochet portant ce nom.
+ \item \Verb-<liaison>- spécifie avec quelle liaison l'atome portant cette occurrence du crochet doit être reliée a l'atome portant la première occurrence. Deux cas de figure sont possibles; soit ce champ est un entier représentant le type de liaison voulu : 1=liaison simple, 2=liaison double, etc. Voir le tableau page~\pageref{types.liaisons} pour les codes des liaisons.
+
+ Soit la \Verb-<liaison>- est constituée des caractères codant la liaison, à condition que ces caractères soient \emph{entre accolades};
+ \item \Verb-<tikz>- sera passé directement à \TIKZ comme on l'a vu avec les liaisons classiques.
+\end{itemize}
+
+Voici notre molécule avec les liaisons distantes requises, puis avec les liaisons \verb/A-W/ et \verb/X-C/ personnalisées :
+\exemple{Plusieurs liaisons éloignées}|\chemfig{A?[a]-B(-[1]W?[a]-X?[b])(-[7]Y-Z?[b])-C?[b]}\par\medskip
+ \chemfig{A?[a]-B(-[1]W?[a,2,red]-X?[b])(-[7]Y-
+ Z?[b,1,{line width=2pt}])-C?[b,{>},blue]}|
+
+On peut écrire plusieurs crochets différents après un atome. Mettons que dans ce pentagone incomplet, on veuille relier \verb/A-E/, \verb/A-C/ et \verb/E-C/ :
+\exemple{Un cycle incomplet}|\chemfig{A-[:-72]B-C-[:72]D-[:144]E}|
+
+Alors, il faut procéder de cette façon :
+\exemple{Plusieurs liaisons éloignées}|\chemfig{A?[a]-[:-72]B-C?[a]?[b]-[:72]D-[:144]E?[a]?[b]}|
+
+\section{Cycles}
+L'exemple précédent montre comment tracer un polygone régulier, mais la méthode est fastidieuse puisque les angles dépendent du nombre de côté du polygone.
+
+\subsection{Syntaxe}
+\CF peut tracer des polygones réguliers facilement. L'idée est d'attacher un cycle à un \Verb/<atome>/ extérieur à ce cycle avec cette syntaxe :
+\begin{center}
+ \Verb/<atome>*<n>(<code>)/
+\end{center}
+\Verb/<n>/ est le nombre de côtés du polygone et le \Verb/<code>/ représente les liaisons et les groupes d'atomes qui constituent ses sommets et arêtes. Ce code \emph{doit} commencer par une liaison puisque l'atome se trouve à l'extérieur du cycle.
+
+Voici un 5-cycle, attaché a l'atome «\verb/A/» :
+\exemple{5-cycle}|\chemfig{A*5(-B=C-D-E=)}|
+
+On peut également dessiner un cycle avec un, plusieurs, ou tous les groupes d'atomes vides, comme c'est le cas pour les dessins hors des cycles :
+\exemple{5-cycle avec groupes vides}|\chemfig{*5(-=--=)}|
+
+Un cycle peut être incomplet :
+\exemple{5-cycle incomplet}|\chemfig{*5(-B=C-D)}|
+Si un cycle a un code qui contient trop de liaisons et de groupes d'atomes pour le nombre de sommets spécifiés, toutes les liaisons et les groupes au delà du maximum admissible sont ignorés :
+\exemple{5-cycle tronqué}|\chemfig{A*5(-B=C-D-E=F-G=H-I)}|
+
+Il est possible de dessiner un cercle ou un arc de cercle à l'intérieur d'un cycle. Pour cela, on utilise cette syntaxe :
+\begin{center}
+ \Verb/<atome>**[<angle 1>,<angle 2>,<tikz>]<n>(<code>)/
+\end{center}
+où chaque champ de l'argument optionnel prend sa valeur par défaut s'il est vide :
+\begin{itemize}
+ \item \Verb/<angle 1>/ et \Verb/<angle 2>/ sont les angles absolus de départ et de fin de l'arc de cercle. Ceux-ci valent 0\degres{} et 360\degres{} de telle sorte qu'un cercle complet est tracé par défaut;
+ \item \Verb/<tikz>/ est le code qui sera passé à \TIKZ pour le dessin de l'arc de cercle.
+\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(----)}|
+
+\subsection{Position angulaire}
+\subsubsection{Au départ}
+Comme on le voit dans les exemples ci-dessous, la règle est que l'atome d'attache «\verb/A/» se trouve toujours au sud ouest du cycle. De plus, le cycle est toujours construit dans le sens trigonométrique et la dernière liaison tombe verticalement sur l'atome de rattachement :
+\exemple{Position angulaire des cycles}|\chemfig{A*4(-B-C-D-)}\qquad\chemfig{A*6(------)}|
+
+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(------)}|
+
+\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.
+
+Voici un cas simple :
+\exemple{Liaison arrivant sur un cycle}|\chemfig{A-B*5(-C-D-E-F-)}|
+
+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(=-=-=-)}|
+
+\subsection{Ramifications partant d'un cycle}
+Pour faire partir une ramification d'un des sommets du cycle, on emploie la syntaxe déjà vue :
+\begin{center}
+ \Verb/<atome>(<code>)/
+\end{center}
+où le \Verb/<code>/ est celui de la sous molécule et l'\Verb-<atome>- occupe le sommet. Une chose particulière aux cycles est que l'angle par défaut de la sous molécule n'est pas 0\degres{} mais est calculé de telle sorte qu'il soit la bissectrice des côtés partant du sommet :
+\exemple{Ramification partant d'un cycle}|\chemfig{X*6(-=-(-A-B=C)=-=-)}|
+
+On peut faire partir une sous molécule du premier sommet du cycle, ainsi que de tous les autres sommets :
+\exemple{Cycle et ramifications}|\chemfig{*5((-A=B-C)-(-D-E)-(=)-(-F)-(-G=)-)}|
+
+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)--)}|
+
+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.
+
+On peut désormais lier des cycles entre eux par des liaisons :
+\exemple{Cycles liés}|\chemfig{*6(--(-*5(----(-*4(----))-))----)}|
+
+\subsection{Cycles emboîtés}
+Pour «coller» 2 cycles entre eux, la syntaxe est légèrement différente : on identifie le sommet d'où va commencer l'autre cycle. Il suffit de faire suivre ce sommet par la syntaxe habituelle d'un cycle. Voici par exemple un 5-cycle qui part du deuxième sommet d'un 6-cycle :
+\exemple{Cycles imbriqués}|\chemfig{A*6(-B*5(----)=-=-=)}|
+
+On remarque que le cycle qui vient se greffer sur le cycle principal a une position angulaire telle que deux de leurs côté coïncident. De plus, le 5-cycle n'a que 4 liaisons «\verb/----/». En effet, la 5\ieme{} serait inutile puisqu'il s'agit du deuxième côté du 6-cycle qui est déjà tracé.
+
+Il est bien entendu possible de coller plusieurs cycles entre eux :
+\exemple{Plusieurs cycles imbriqués}|\chemfig{*5(--*6(-*4(-*5(----)--)----)---)}|
+
+Il y a un cas où on doit employer une ruse. On voit sur cet exemple que le quatrième côté du deuxième 5-cycle vient boucler sur le centre de l'atome «\verb-E-».
+\exemple{Dessin non parfait}|\chemfig{A-B*5(-C-D*5(-X-Y-Z-)-E-F-)}|
+
+Ceci est normal puisque le deuxième 5-cycle (qui part de l'atome «\verb-D-») est dessiné \emph{avant} que \CF n'ait pris connaissance de l'atome «\verb-E-». Dans ce cas, il faut se servir de deux crochets pour tracer la liaison \verb/Z-E/ :
+\exemple{Liaison distante et cycle}|\chemfig{A-B*5(-C-D*5(-X-Y-Z?)-E?-F-)}|
+
+On aurait aussi pu utiliser un \verb-\phantom{E}- au dernier sommet du 5-cycle :
+\exemple{Utilisation de \string\phantom}/\chemfig{A-B*5(-C-D*5(-X-Y-Z-\phantom{E})-E-F-)}/
+
+\subsection{Cycles et groupes d'atomes}
+Il faut prendre des précautions avec les cycles lorsque un ou plusieurs sommets sont constitués de plusieurs atomes :
+\exemple{Cycle et groupes d'atomes}|\chemfig{AB*5(-CDE-F-GH-I-)}|
+
+Pour que le cycle ait une forme régulière, il faut passer outre le mécanisme de \CF qui calcule automatiquement les atomes de départ et d'arrivée des liaisons. Ici, il faut relier \verb/C-F/ et \verb/F-G/ en le spécifiant avec l'argument optionnel de ces liaisons :
+\exemple{Atomes de départ et d'arrivée imposés}|\chemfig{AB*5(-CDE-[,,1]F-[,,,1]GH-I-)}|
+
+\section{Représentation des déplacements d'électrons}\label{mecanismes-reactionnels}
+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 «\falseverb{tikzpicture}». Cela suppose que le visualiseur prenne en charge le «\falseverb{picture remembering}» et que la compilation soit lancée deux fois.
+
+Deux cas de figure peuvent se présenter, on peut poser :
+\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.
+\end{itemize}
+Une fois que la commande \falseverb{\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 «\falseverb{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>-» :
+\begin{center}
+ \Verb|\chemmove[<opt>]{\draw[<opt tikz>](<nom1>)<link tikz>(<nom2>);}|
+\end{center}
+
+L'argument optionnel \Verb-<opt>- de la commande \verb-\chemmove- sera ajouté à l'argument de l'environnement \falseverb{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.
+
+\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.
+
+Les macros \verb|\schemestart|, \verb|\schemestop|, \verb|\arrow| et \verb|\+| sont exposées au chapitre \ref{schemas}, à partir de la page \pageref{schemas}.
+
+\exemple{Effet mésomère 1}/\schemestart
+ \chemfig{@{a1}=_[@{db}::30]-[::-60]\lewis{2,X}}
+ \arrow{<->}
+ \chemfig{\chemabove{\vphantom{X}}{\ominus}-[::30]=_[::-60]
+ \chemabove{X}{\scriptstyle\oplus}}
+\schemestop
+ \chemmove{\draw(db).. controls +(100:5mm) and +(145:5mm).. (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 :
+\begin{center}
+ \Verb|\chemmove{\draw(db)..controls +(100:5mm) and +(145:5mm)..(a1);}|
+\end{center}
+
+Le style de flèche par défaut dans \verb|\chemmove| est «CF». 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 à 100\degres{} et 5~mm de «db» pour le premier et à 145\degres{} et 5~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}/\schemestart
+ \chemfig{@{a1}=_[@{db}::30]-[@{sb}::-60]@{dnl}\lewis{2,X}}
+ \arrow{<->}
+ \chemfig{\chemabove{\vphantom{X}}{\ominus}-[::30]=_[::-60]
+ \chemabove{X}{\scriptstyle\oplus}}
+\schemestop
+\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}/\schemestart
+ \chemfig{@{a1}=_[@{db}::30]-[@{sb}::-60]@{dnl}\lewis{2,X}}
+ \arrow{<->}
+ \chemfig{\chemabove{\vphantom{X}}{\ominus}-[::30]=_[::-60]
+ \chemabove{X}{\scriptstyle\oplus}}
+\schemestop
+\chemmove[->]{% change le style de flèche
+ \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.
+
+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 en «\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}/\schemestart
+ \chemfig{@{a1}=_[@{db}::30]-[@{sb}::-60]@{dnl}\lewis{2,X}}
+ \arrow{<->}
+ \chemfig{\chemabove{\vphantom{X}}{\ominus}-[::30]=_[::-60]
+ \chemabove{X}{\scriptstyle\oplus}}
+\schemestop
+\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);}/
+
+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}}
+\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}}
+\hspace{2cm}
+\chemfig{@{x2}\lewis{2|,X}}
+\chemmove[shorten <=4pt,shorten >=4pt]{
+ \draw(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}}
+\hspace{2cm}
+\chemfig{@{x2}\lewis{2|,X}}
+\chemmove[shorten <=4pt,shorten >=4pt]{
+ \draw(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.
+
+\subsection{Mécanismes réactionnels}
+Grâce à l'option \verb|remember 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}/\setchemfig{atom sep=7mm}
+\schemestart
+ \chemfig{R-@{dnl}\lewis{26,O}-H}
+ \+
+ \chemfig{R-@{atoc}C([6]-OH)=[@{db}]O}
+ \arrow(.mid east--){<->[\chemfig{@{atoh}\chemabove{H}{\scriptstyle\oplus}}]}
+\schemestop
+\chemmove[shorten <=2pt]{
+ \draw(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>}{<matériel>}| ne change pas les dimensions de la boîte 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}/\setchemfig{atom sep=7mm}
+\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);}/
+
+Nous laissons le soin au lecteur d'écrire la suite\ldots
+
+\section{Écrire un nom sous une molécule}\label{chemname}
+Pour plus de commodité, \CF permet d'écrire le nom d'une molécule sous celle-ci avec la commande
+\begin{center}
+ \Verb/\chemname[<dim>]{\chemfig{<code de la molécule>}}{<nom>}/
+\end{center}
+
+La \Verb-<dimension>-, qui vaut 1.5ex par défaut, sera insérée verticalement entre la \falseverb{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.
+
+Voici une réaction avec les noms sous les molécules :
+\exemple*{Affichage du nom des molécules}/\schemestart
+ \chemname{\chemfig{R-C(-[:-30]OH)=[:30]O}}{Acide carboxylique}
+ \+
+ \chemname{\chemfig{R'OH}}{Alcool}
+ \arrow(.mid east--.mid west)
+ \chemname{\chemfig{R-C(-[:-30]OR')=[:30]O}}{Ester}
+ \+
+ \chemname{\chemfig{H_2O}}{Eau}
+\schemestop
+\chemnameinit{}/
+
+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}/\schemestart
+ \chemname{\chemfig{R'OH}}{Alcool}
+ \+
+ \chemname{\chemfig{R-C(-[:-30]OH)=[:30]O}}{Acide carboxylique}
+ \arrow(.mid east--.mid west)
+ \chemname{\chemfig{R-C(-[:-30]OR')=[:30]O}}{Ester}
+ \+
+ \chemname{\chemfig{H_2O}}{Eau}
+\schemestop
+\chemnameinit{}/
+
+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 \falseverb{\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}. \label{chemnameinit}La macro \Verb-\chemnameinit{<argument>}- initialise cette plus grande profondeur avec le contenu de l'\Verb-<argument>-. Il convient donc :
+\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.
+\end{itemize}
+
+Le code correct est donc d'utiliser \falseverb{\chemnameinit} avant et après la réaction :
+\exemple*{Alignement des noms 2}/\chemnameinit{\chemfig{R-C(-[:-30]OH)=[:30]O}}
+\schemestart
+ \chemname{\chemfig{R'OH}}{Alcool}
+ \+
+ \chemname{\chemfig{R-C(-[:-30]OH)=[:30]O}}{Acide carboxylique}
+ \arrow(.mid east--.mid west)
+ \chemname{\chemfig{R-C(-[:-30]OR')=[:30]O}}{Ester}
+ \+
+ \chemname{\chemfig{H_2O}}{Eau}
+\schemestop
+\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}/\schemestart
+ \chemname{\chemfig{R-C(-[:-30]OH)=[:30]O}}{Acide\\carboxylique}
+ \+
+ \chemname{\chemfig{R'OH}}{Alcool}
+ \arrow(.mid east--.mid west)
+ \chemname{\chemfig{R-C(-[:-30]OR')=[:30]O}}{Ester}
+ \+
+ \chemname{\chemfig{H_2O}}{Eau}
+\schemestop
+\chemnameinit{}/
+
+Si l'on écrit \Verb|\chemname*{<nom>}|, alors la macro ne tient pas compte des noms rencontrés précédemment.
+\newpage
+
+\part{Utilisation avancée}\label{utilisation.avancee}
+\section{Découpage des atomes}\label{decoupage.atomes}
+Le mécanisme de découpage en 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{@}}
+
+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 :
+
+\exemple*{Alcène}/\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 boîtes contenant les atomes :
+\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 «|» provoque la coupure de l'atome en cours à l'endroit où 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 :
+
+\exemple*{Alcène}/\chemfig{CH_3CH_2-[:-60,,3]C(-[:-120]H_3C)=C(-[:-60]H)-[:60]C|{(CH_3)_3}}/
+
+\section{Affichage des atomes}\label{perso.affichage}
+Une fois le découpage en atomes effectué, la macro \falseverb{\printatom} est appelée de façon interne par \CF pour afficher chaque atome. Son unique argument est le code produisant l'affichage de l'atome (par exemple «\verb-H_3-»). Par défaut, cette macro se place en mode mathématique et affiche son argument avec la police mathématique «rm». Elle est définie par le code suivant :
+\begin{itemize}
+ \item \verb|\newcommand*\printatom[1]{\ensuremath{\mathrm{#1}}}|\qquad en compilant avec \LaTeX{}
+ \item \verb|\def\printatom#1{\ifmmode\rm#1\else$\rm#1$\fi}|\qquad en compilant avec $\varepsilon$\TeX{} ou Con\TeX tX.
+\end{itemize}\medskip
+
+On peut modifier le code de cette macro pour personnaliser l'affichage de atomes. Dans l'exemple ci-dessous, on redéfinit \falseverb{\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}}}}
+\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}}}
+\chemfig{H_3C-C(=[:30]O)(-[:-30]OH)}/
+
+\section{Paramètres passés à tikz}\label{arguments.optionnels}
+La \chevrons{clé} \CFkey{chemfig style} contient des instructions \TIKZ qui seront passées à l'environnement \falseverb{tikzpicture} dans lequel est dessinée la molécule. Par ailleurs, la \chevrons{clé} \CFkey{atom style} contient des instructions \TIKZ qui seront exécutées lors du dessin de chaque nœud; ces instructions sont ajoutées à la fin de \texttt{every node/.style\{<argument>\}}, c'est-à-dire après les instructions suivantes : «{\ttfamily anchor=base,inner sep=0pt,outer sep=0pt,minimum size=0pt}».
+
+Par l'intermédiaire de \CFkey{chemfig style}, 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
+\chemfig[chemfig style={line width=1.5pt}]{A-B-[2]C}\par\medskip
+\chemfig[chemfig style=red]{A-B-[2]C}/
+
+Avec \CFkey{node style}, 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
+\setchemfig{atom style=red}\chemfig{A-B-[2]C}\par\medskip
+\setchemfig{atom style={rotate=20}}\chemfig{A-B-[2]C}\par\medskip
+\setchemfig{atom style={scale=0.5}}\chemfig{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.
+
+Un examen attentif de l'exemple suivant révèle que les groupes d'atomes ne sont pas correctement alignés sur la \falseverb{ligne de base} :
+\exemple*{Placement horizontal}/\Huge\setchemfig{atom sep=2em}
+\chemfig{A^1-B-C-D}\qquad
+\chemfig{E_1-F-G-H}/
+
+Il est étonnant que le deuxième atome soit correctement aligné alors que les deux derniers subissent un décalage vertical qui semblent être la conséquence de la hauteur différente de la boîte englobant le premier atome «\verb-A^1-» et «\verb-E_1-».
+
+Pour comprendre ce phénomène, il faut examiner comment \CF place les groupes d'atomes les uns par rapport aux autres. Pour cela, limitons nous aux liaisons horizontales ce qui permet d'employer un vocabulaire particulier, mais l'algorithme est le même pour les autres inclinaisons. En fait, une liaison horizontale part du milieu du côté droit de la boîte englobant l'atome d'où part cette liaison. L'atome d'arrivée est positionné de telle sorte que le milieu du côté gauche de sa boîte englobante soit à l'extrémité de la liaison. Il en découle que le placement vertical de l'atome d'arrivée dépend de l'encombrement vertical de l'atome de départ. Pour limiter ce phénomène, \CF ajoute devant chaque atome d'arrivée le \falseverb{\vphantom} de l'atome de départ, mais sans l'inclure dans le contenu de cet atome d'arrivée : ce \falseverb{\vphantom} n'est donc pas destiné à se répercuter sur les atomes suivants. 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.
+
+On peut donc mieux expliquer l'alignement défectueux constaté. Les atomes «\verb-B-» et «\verb-F-» sont correctement alignés car ils tiennent compte de la hauteur des atomes qui les précèdent grâce à leur \falseverb\vphantom. Pour les atomes «\verb-C-» et «\verb-F-», la hauteur des atomes précédents est prise en compte, mais celle des atomes «\verb-A^1-» et «\verb-E_1-» est oubliée ! Il en résulte que, dépendant de l'altitude de ces liaisons, ces atomes sont un peu trop haut ou trop bas.
+
+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\setchemfig{atom sep=2em}
+\fboxsep=0pt
+\renewcommand\printatom[1]{\fbox{\ensuremath{\mathrm#1}}}
+\chemfig{A^1-B-C-D}\qquad
+\chemfig{E_1-F-G-H}/
+
+Aucune solution automatique n'étant satisfaisante, on peut contourner manuellement ce problème en plaçant \emph{à l'intérieur} du troisième atome un \falseverb{\vphantom} ayant la même hauteur que le premier pour que cette hauteur se répercute sur les suivants :
+\exemple*{Contournement du placement vertical}/\Huge\setchemfig{atom sep=2em}
+\chemfig{A^1-B-{\vphantom{A^1}C}-D}\qquad
+\chemfig{E_1-F-{\vphantom{E_1}G}-H}/
+
+\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 \falseverb\vphantom. Il suffit pour cela de placer dans le groupe d'atomes la commande \falseverb{\chemskipalign} : l'alignement reprendra au groupe d'atomes suivant comme si le groupe d'atome contenant \falseverb{\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 :
+
+\exemple[60]{Désactivation du mécanisme d'alignement}/\large
+\chemfig{A-.-B}\quad
+\chemfig{A-\chemskipalign.-B}\par\bigskip
+\fboxsep=0pt
+\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 \falseverb{\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}}}}
+\chemfig{A-\chemskipalign.B-C}/
+
+Cette fonctionnalité peut parfois s'avérer utile. Mettons que l'on veuille dessiner la molécule
+\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 \falseverb{\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}. 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{;}- :
+\begingroup\catcode`;12 \catcode`#12
+\exemple{Utilisation de \string\chemskipalign\ et #}/\begingroup
+\shorthandoff{;}
+\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
+
+\section{Liaisons doubles déportées}
+Toutes les liaisons doubles sont composées de 2 traits et ces traits sont tracés de part et d'autre de la ligne théorique que prendrait la liaison simple. Il est possible de déporter cette liaison double de telle sorte qu'un des deux traits soit sur cette ligne théorique. L'autre trait étant alors au dessus ou au dessous de la liaison. En fait, il est plus rigoureux de dire «à gauche» ou «à droite» de la ligne théorique lorsqu'on parcourt la liaison dans le sens du tracé.
+
+Pour déporter la liaison vers la gauche, il suffit d'écrire «\verb-=^-» et pour la déporter vers la droite «\verb-=_-» :
+\exemple{Liaisons doubles déportées}/\chemfig{A-=-B}\par
+\chemfig{A-=^-B}\par
+\chemfig{A-=_-B}/
+
+Dans les cycles, les liaisons doubles sont automatiquement déportées vers la gauche. On peut cependant les déporter vers la droite en le spécifiant avec «\verb-=_-» :
+\exemple{Liaisons doubles déportées et cycles}/\chemfig{*6(-=-=-=)}\qquad
+\chemfig{*6(-=_-=_-=_)}/
+
+Les liaisons déportées sont particulièrement utiles dans le tracé de formules topologiques de molécules comprenant chaînes carbonées avec des liaisons doubles. Elles permettent d'avoir une ligne brisée continue, alors que cette ligne brisée serait discontinue avec les liaisons doubles normales :
+\exemple{Liaisons déportées et formules topologiques}/\chemfig{-[:30]=[:-30]-[:30]=[:-30]-[:30]}\par
+\chemfig{-[:30]=^[:-30]-[:30]=^[:-30]-[:30]}\par
+\chemfig{-[:30]=_[:-30]-[:30]=_[:-30]-[:30]}/
+
+\section{Liaisons doubles délocalisées}
+Il est parfois nécessaire de tracer une liaison double dont un trait serait plein et l'autre en pointillé. Cette fonctionnalité n'est pas codée en dur dans \CF puisque \TIKZ, avec sa librairie «decorations.markings» le rend possible.
+
+\exemple*{Liaisons délocalisées}|\catcode`\_=11
+\tikzset{
+ ddbond/.style args={#1}{
+ draw=none,
+ decoration={%
+ markings,
+ mark=at position 0 with {
+ \coordinate (CF_startdeloc) at (0,\dimexpr#1\CF_doublesep/2)
+ coordinate (CF_startaxis) at (0,\dimexpr-#1\CF_doublesep/2);
+ },
+ mark=at position 1 with {
+ \coordinate (CF_enddeloc) at (0,\dimexpr#1\CF_doublesep/2)
+ coordinate (CF_endaxis) at (0,\dimexpr-#1\CF_doublesep/2);
+ \draw[dash pattern=on 2pt off 1.5pt] (CF_startdeloc)--(CF_enddeloc);
+ \draw (CF_startaxis)--(CF_endaxis);
+ }
+ },
+ postaction={decorate}
+ }
+}
+\catcode`\_8
+\chemfig{A-[,,,,ddbond={+}]B-[,,,,ddbond={-}]C}|
+
+\section{Sauvegarde d'une sous molécule}\label{definesubmol}
+\CF est capable de sauvegarder un \Verb-<code>- sous forme d'un alias pour le réutiliser sous forme compacte dans le code d'une molécule. Ceci est particulièrement utile lorsque le \Verb-<code>- apparaît plusieurs fois.
+
+Pour cela, on dispose de la commande
+\begin{center}
+ \Verb|\definesubmol{<nom>}{<code>}|
+\end{center}
+qui sauvegarde le \Verb/<code>/ de façon à l'appeler dans le code de la molécule par le raccourci «\Verb/!{<nom>}/». Ce \Verb-<nom>- peut être :
+\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 une séquence de contrôle.
+\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 \falseverb{\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}
+\begin{center}
+ \Verb|\redefinesubmol{<nom>}{<code>}|
+\end{center}
+
+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}|
+
+Ici, la manœuvre n'est pas très intéressante puisque «\verb/!{xy}/» est aussi long à taper que le code qu'il remplace.
+
+Mais dans certains cas, cette fonctionnalité fait gagner beaucoup de place dans le code de la molécule et en améliore la lisibilité. Dans l'exemple suivant, on dessine la molécule développée de butane. Pour cela, on va définir un alias avec la séquence de contrôle «\verb/\xx/» pour la sous molécule $\mathrm{CH_2}$. Comme on n'emploie que des angles relatifs, il est possible de faire pivoter la molécule entière de l'angle que l'on veut via l'angle du paramètre optionnel global qui spécifie l'angle par défaut des liaisons de la molécule principale. On met ici 15\degres :
+\exemple{Butane}|\definesubmol\xx{C(-[::+90]H)(-[::-90]H)}
+\chemfig{[:15]H-!\xx-!\xx-!\xx-!\xx-H}|
+
+La commande \falseverb{\definesubmol} admet un argument optionnel et sa syntaxe est la suivante :
+\begin{center}
+ \Verb/\definesubmol{<nom>}[<code1>]{<code2>}/
+\end{center}
+
+Dans le 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 connaît même pas) :
+\exemple{Alias dual}/\definesubmol\Me[H_3C]{CH_3}
+\chemfig{*6((-!\Me)=(-!\Me)-(-!\Me)=(-!\Me)-(-!\Me)=(-!\Me)-)}/
+
+\label{definesubmolarg}La sous-molécule sauvegardée via un \Verb|<nom>| n'admet pas d'argument lorsqu'elle est appelée après «\verb|!|». Pour définir une sous-molécule admettant un ou plusieurs argument, il faut écrire ce \Verb|<nombre>| d'arguments juste après le \Verb|<nom>|. La syntaxe complète de \verb|\definesubmol| est donc:
+\begin{center}
+ \Verb/\definesubmol{<nom>}<nombre>[<code1>]{<code2>}/
+\end{center}
+
+Dans les \Verb|<codes>|, les arguments doivent figurer sous leur forme habituelle «\Verb|#<n>|» où \Verb|<n>| est le numéro de l'argument.
+
+\exemple{\texttt{\string\definesubmol} avec arguments}/\definesubmol\X1{-[,-0.2,,,draw=none]{\scriptstyle#1}}
+\chemfig{*6((!\X A)-(!\X B)-(!\X C)-(!\X D)-(!\X E)-(!\X F)-)}
+
+\definesubmol{foo}3[#3|\textcolor{#1}{#2}]{\textcolor{#1}{#2}|#3}
+\chemfig{A(-[:135]!{foo}{red}XY)-B(-[:45]!{foo}{green}{W}{zoo})}/
+
+Il est à noter que si le \Verb|<nombre>| d'arguments est incorrect (négatif ou supérieur à 9), un message d'erreur sera émis et \CF considèrera que la sous molécule n'admet pas d'argument.
+
+En dehors des cas où le caractère «\verb|#|» est suivi d'un chiffre compris entre 1 et \Verb|<nombre>| auquel cas il représente un argument, les «\verb|#|» sont autorisés dans les codes des sous molécules.
+
+\exemple{Utilisation de \#}/\definesubmol\X2{#1-#2-#3-#(3pt,3pt)#4}
+\chemfig{A-!\X{M}{N}-B}/
+
+Dans cet exemple, seuls \verb|#1| et \verb|#2| sont compris comme les arguments de la sous molécule \verb|\X|. Les autres «\verb|#|» sont affichés tels quels dans la molécule (cas de \verb|#3| et \verb|#4|) ou compris comme le caractère spécifiant le réglage fin du retrait des liaisons.
+
+\section{Décorations}
+\subsection{Formule de Lewis}\label{lewis}
+La macro \falseverb{\lewis} permet de placer des paires d'électrons, des électrons ou une lacune. On utilise cette syntaxe :
+\begin{center}
+ \Verb|\lewis{<n1><n2>...<ni>,<atome>}|
+\end{center}
+où les \Verb-<n1>-\ldots\Verb-<ni>- représentent les positions (en multiples de 45\degres) désirées autour de l'\Verb-<atome>-. Ces entiers doivent être compris entre 0 et 7.
+
+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}|
+
+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}*
+
+Toutes les décorations dessinées par l'intermédiaire de \falseverb{\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.
+
+\label{Lewis}Il faut noter que la macro \falseverb{\Lewis} fonctionne de la même façon que la macro \verb-\lewis- mais les décorations seront \emph{prises en compte} dans 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}}\quad\fbox{\Lewis{0.2.4.6.,A}}\par\medskip
+\fbox{\lewis{13,B}}\quad\fbox{\Lewis{13,B}}*
+
+\label{setlewis}On peut régler plusieurs paramètres à l'aide des \chevrons{clés} suivantes :
+\begin{itemize}
+ \item \CFkv{lewis | width}{dim} : est la largeur du rectangle représentant une lacune obtenue avec «|». Elle vaut \CFval{0.3ex} par défaut;
+ \item \CFkv{lewis sep}{dim}: est la distance entre la boîte englobant l'atome et la décoration. Elle vaut \CFval{0.4ex} par défaut;
+ \item \CFkv{lewis length}{dim} : est la longueur du trait représentant la paire d'électrons. Elle vaut \CFval{1.5ex} par défaut;
+ \item \CFkv{lewis style}{code tikz} : est le code qui sera passé directement à \TIKZ. Ce code est \CFval{vide} par défaut;
+ \item \CFkv{lewis dist}{dim} : est la distance entre les deux disques dessinés avec «\string:». Cette distance vaut \CFval{0.3em} par défaut;
+ \item \CFkv{lewis radius}{dim} : est le rayon du disque d'une décoration de Lewis «.» ou «\string:». Il vaut \CFval{0.15ex} par défaut;
+ \item \CFkv{lewis diag coeff}{décimal} : est le coefficient d'espacement diagonal qui vaut \CFval{1} par défaut.
+\end{itemize}
+
+Il faut noter que les paramètres spécifiques aux décorations de Lewis peuvent être passées par
+\begin{itemize}
+ \item \Verb|\setchemfig{<clés>=<valeurs>}| afin qu'ils perdurent pour la suite du document;
+ \item \Verb|\chemfig[<clés>=<valeurs>]| et dans ce cas, les réglages sont effectifs dans la molécule en cours;
+ \item \Verb|\lewis[<clés>=<valeurs>]| pour que les paramètres soient spécifiques à cette exécution de la macro \verb|\lewis|.
+\end{itemize}
+
+La dernière façon de faire, certes permet des réglages individuels, mais doit être utilisée avec précaution lorsque la macro \verb|\lewis| se trouve dans l'argument de \verb|\chemfig|. En effet, les signes \verb-=- des \Verb|<clés>=<valeurs>| ne doivent pas être interprétés comme double liaison et pour ce faire, la macro \verb|\lewis|, son argument optionnel et obligatoire \emph{doivent} être entre accolades:
+
+\exemple*{Argument optionnel de \string\lewis}/\chemfig{{\lewis[lewis style=red]{1:3:5:7:,X}}-{\lewis[lewis style=blue]{0:2:4:6:,Y}}}/
+
+Voici quelques exemple de personnalisation:
+
+\exemple{Les paramètres de la macro \string\lewis}*\setchemfig{lewis sep=4pt,lewis length=1.5em,lewis style=red}
+\chemfig{A-\lewis{26,B}-C}\bigbreak
+
+\chemfig[lewis style={line width=0.4pt}]{A-\lewis{2|,B}-C}\bigbreak
+
+\Lewis{1:3:5:7:,X}\qquad\Lewis{0:2:4:6:,X}\bigbreak
+
+\Lewis[lewis dist=0.2em]{1:3:5:7:,X}\qquad
+\Lewis[lewis dist=0.2em]{0:2:4:6:,X}\bigbreak
+
+\Lewis[lewis dist=4pt,lewis radius=1.5pt]{1:3:5:7:,X}\qquad
+\Lewis[lewis dist=4pt,lewis radius=1.5pt]{0:2:4:6:,X}*
+
+Un problème concernant les décorations de Lewis dans les directions obliques peut parfois survenir. Pour l'atome «O» dans l'exemple ci-dessous, il semble que la décoration en position 1 soit plus éloignée de l'atome que celle en position 4 :
+\exemple{Directions obliques}/\huge
+\Lewis{1|4|,O}/
+Or, il n'en en rien comme on peut le voir en traçant la boîte englobante de l'atome :
+\exemple{Illusion d'optique}/\huge
+\fboxsep0pt
+\def\printatom#1{\fbox{$\mathrm{#1}$}}
+\Lewis{1|4|,O}/
+\label{opt.lewis}L'impression de plus grand éloignement est dû au fait que les contours de la lettre «O» sont plus éloignés de ceux de la boîte englobante dans les coins, c'est-à-dire dans les directions impaires.
+
+Pour rapprocher (ou éloigner) les décorations de Lewis dans les directions impaires, la \chevrons{clé} \CFkv{lewis diag coeff}{decimal} spécifie le coefficient qui vient multiplier le décalage entre la boite englobante et la décoration de Lewis. Pour la lettre «O», il semble que la valeur 0.5 soit satisfaisante pour ce coefficient :
+\exemple*{Argument optionnel de \string\lewis}/\huge
+\Lewis{1|4|,O}\quad \Lewis[lewis diag coeff=0.5]{1|4|,O}
+
+\Lewis{0:5:,O}\quad \Lewis[lewis diag coeff=2]{0:5:,O}\quad \Lewis[lewis diag coeff=0.5]{0:5:,O}/
+
+\subsection{Empilement de caractères}
+Les macros\label{chemabove}
+\begin{center}
+ \Verb|\chemabove[<dim>]{<code>}{<matériel>}|
+\end{center}
+et\label{chembelow}
+\begin{center}
+ \Verb|\chembelow[<dim>]{<code>}{<matériel>}|
+\end{center}
+placent le \Verb-<matériel>- respectivement au-dessus et au-dessous du \Verb-<code>- à une distance verticale \Verb-<dim>-, et cela sans changer la boîte englobante du \Verb-<code>-. L'argument optionnel permet si on le souhaite, de spécifier cette dimension à chaque appel. Si l'argument optionnel n'est pas utilisé, une dimension par défaut sera prise : elle vaut \CFval{1.5pt} mais peut être modifiée avec \chevrons{clé} \CFkv{stack sep}{dim}.
+
+Ces commandes sont indépendantes de la macro \verb-\chemfig- et peuvent aussi bien être appelées à l'intérieur ou à l'extérieur de son argument.
+
+On peut les utiliser notamment dans les cycles en prenant soin de mettre des accolades autour des lettres A, B, C et D pour éviter que \CF ne stoppe la lecture de l'atome sur ces lettres :
+\exemple{Superposition dans les cycles}|\chemfig{*5(-\chembelow{A}{B}--\chemabove{C}{D}--)}|
+
+Elles sont parfois utiles pour placer des pseudo exposants tenant lieu de charge qui ne changent pas la boîte englobante de l'atome, de façon à ce que les liaisons n'en soient pas trop éloignées :
+\exemple{ion oxonium}*\chemfig{H-\chemabove{\lewis{5|7,O}}{\quad\scriptstyle+}(-[2]H)-H}*
+
+Les commandes \falseverb{\Chemabove} et \falseverb{\Chembelow} fonctionnent de la même façon sauf que la boîte englobante \emph{tient compte} du \Verb-<matériel>- placé au dessus ou au dessous.
+
+\section{Utilisation de {\protect\ttfamily\protect\textbackslash chemfig} dans l'environnement \protect\ttfamily tikzpicture}
+Il est possible d'appeler la commande \falseverb{\chemfig} à l'intérieur d'un environnement {\ttfamily\falseverb{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}|
+
+\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.
+
+Chaque atome est contenu dans un nœud de \TIKZ. Par défaut, ces nœuds ont un «inner sep» et un «outer sep» égal à 0pt. Ils sont rectangulaires comme on l'a vu page~\pageref{longueur.liaison}. Ces valeurs par défaut peuvent être écrasées avec la \chevrons{clé} \CFkey{node style} dont l'argument est passé à \TIKZ et spécifie le style des nœuds contenant les atomes.
+
+Dans cet exemple, on spécifie simplement «draw,inner sep=2pt» ce qui a pour effet de tracer le contour des nœuds et espacer de 2pt leur contour de leur contenu. On spécifie également \CFkv{bond offset}{0pt} pour que les liaisons touchent les frontières des nœuds. L'espace interatome est allongé à 75pt. Enfin, la commande \falseverb{\printatom} est réduite à sa plus simple expression de façon à ne plus se placer en mode mathématique pour afficher les atomes et donc tenir compte des espaces :
+\exemple*{Un organigramme}/\setchemfig{node style={draw,inner sep=2pt},bond offset=0pt,atom sep=75pt}
+\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}/\setchemfig{bond offset=0pt,atom sep=80pt,node style={draw,circle,fill=cyan,minimum size=25pt}}
+\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)}/
+
+\section{Exemples commentés}\label{exemples.commentes}
+Dans ce chapitre, plusieurs molécules seront dessinées en mettant en œuvre les méthodes précédemment exposées. Le but recherché ici est de montrer dans quel ordre logique peut se construire une molécule de façon à ce que l'utilisateur peu familier avec \CF acquière une méthode pour construire des molécules complexes. Pour l'y aider, les étapes de la construction seront montrées.
+
+De plus, on mettra en évidence que plusieurs possibilités s'offrent à l'utilisateur pour un même résultat graphique, certaines intuitives et d'autres beaucoup moins, l'essentiel étant de montrer que \CF permet une certaine souplesse dans le codage des molécules. À chacun ensuite de se construire et s'approprier les méthodes avec lesquelles il est le plus à l'aise.
+
+\subsection{L'éthanal}
+On va ici dessiner la molécule d'éthanal : \chemfig{H-C(-[2]H)(-[6]H)-C(-[7]H)=[1]O}
+
+La meilleure méthode pour les molécules non cycliques est de choisir la plus longue chaîne. Ici on peut prendre «\verb|H-C-C=O|» par exemple. Il faut incliner la liaison \verb|C=O| de 45\degres{} en utilisant l'angle prédéfini «\verb-[1]-». On obtient la «structure» de la molécule sur laquelle il suffira de rajouter les ramifications :
+\exemple{Structure de l'éthanal}|\chemfig{H-C-C=[1]O}|
+
+Il reste à placer 3 atomes d'hydrogène avec les bonnes inclinaisons à l'aide des angles prédéfinis. Le premier à 90\degres{} avec la ramification «\verb/(-[1]H)/», le second à 270\degres{} avec «\verb/(-[6]H)/» et celui de droite à 315\degres{} avec «\verb/(-[7]H)/» :
+\exemple{Ethanal}|\chemfig{H-C(-[2]H)(-[6]H)-C(-[7]H)=[1]O}|
+
+\subsection{L'acide 2-amino-4-oxohexanoïque}
+Voici la molécule à dessiner : \chemfig{-[::+30]-[::-60](=[:-90]O)-[::+60]-[::-60](-[:-90]NH_2)-[::+60](=[:90]O)-[::-60]OH}
+
+Il existe ---~comme c'est le souvent cas pour la plupart des molécules~--- plusieurs méthodes, et pour chacune, plusieurs façons différentes d'arriver au résultat. Ici, nous allons examiner 4 méthodes différentes.
+
+\subsubsection{Angles absolus}
+On va tout d'abord tracer la chaîne médiane avec des angles absolus. On règle l'angle par défaut à $+30\degres$ avec l'argument optionnel, ainsi seules les liaisons «descendantes» auront besoin que l'on spécifie leur angle absolu de $-30\degres$ :
+\exemple{Structure (angles absolus)}|\chemfig{[:30]--[:-30]--[:-30]--[:-30]OH}|
+
+Il reste à ajouter les ramifications «\verb/(=[6]O)/», «\verb/(-[6]NH_2)/» et «\verb/(=[2]O)/» sur les bons sommets :
+\exemple{Molécule (angles absolus)}|\chemfig{[:30]--[:-30](=[6]O)--[:-30](-[6]NH_2)-(=[2]O)-[:-30]OH}|
+
+\subsubsection{Angles relatifs}
+Une approche plus générale aurait été de n'utiliser que des angles relatifs. Il aurait fallu procéder de cette façon :
+\exemple{Structure (angles relatifs)}|\chemfig{[:30]--[::-60]--[::-60]--[::-60]OH}|
+
+puis
+\exemple{Molécule (angles relatifs)}|\chemfig{[:30]--[::-60](=[::-60]O)--[::-60](-[::-60]NH_2)
+-(=[::60]O)-[::-60]OH}|
+
+\subsubsection{Cycle}
+Les angles entre les liaisons étant de 120\degres{}, on peut penser à utiliser un 6-cycle, quoique cette méthode soit moins naturelle. Il faut ici profiter du fait qu'un cycle peut être incomplet. Il est également nécessaire de faire pivoter le cycle de 120\degres{} pour que le premier sommet soit au sud-est du cycle :
+\exemple{Structure}|\chemfig{[:120]NH_2*6(---=O)}|
+
+Il faut maintenant faire partir les ramifications des sommets adéquats :
+\exemple{Molécule (cycle)}|\chemfig{[:120]NH_2*6(-(-(=[::60]O)-[::-60]OH)--(--[::60])=O)}|
+
+\subsubsection{Cycles imbriqués}
+En approfondissant la méthode avec les cycles, on peut aussi penser à imbriquer des 6-cycles incomplets. On pourrait partir de cette structure :
+\exemple{Structure}|\chemfig{*6(--*6(--=O))}|
+
+Et ensuite ajouter les liaisons qui partent des sommets des ces cycles. Il n'y a pas à se préoccuper des angles puisque les liaisons qui partent des cycles sont les bissectrices des côtés du cycle, ce que justement, on cherche ici :
+\exemple{Molécule (cycles imbriqués)}|\chemfig{*6((-)-(=O)-*6(-(-NH_2)-(-OH)=O))}|
+
+Un examen attentif révèle cependant que la seconde double liaison vers l'atome d'oxygène se trouve \emph{à l'intérieur} du 6-cycle incomplet\footnote{C'était aussi le cas pour la méthode précédente avec un seul cycle.}. Malgré sa concision, ce code ne conduit donc pas à un dessin parfait. On peut bien sûr corriger ce défaut en allongeant un peu le code :
+\exemple{Molécule (cycles imbriqués corrigés)}|\chemfig{*6((-)-(=O)-*6(-(-NH_2)-(-OH)(=[::60]O)))}|
+
+\subsection{Glucose}
+Le but ici est de représenter selon différentes conventions la molécule de glucose.
+
+\subsubsection{Formule topologique}
+Le code ressemble ici à celui de l'acide 2-amino-4-oxohexanoïque. On obtient quasiment la même structure avec des angles absolus sauf qu'ici, l'angle par défaut est de $-30\degres$ :
+\exemple[60]{Structure}|\chemfig{[:-30]HO--[:30]--[:30]--[:30]-H}|
+
+Et l'ajout des ramifications ne pose pas de problème particulier. On utilise des angles absolus :
+\exemple[60]{Fructose, formule topologique}|\chemfig{[:-30]HO--[:30](<[2]OH)-(<:[6]OH)
+-[:30](<:[2]OH)-(<:[6]OH)-[:30](=[2]O)-H}|
+
+\subsubsection{Projection de Fisher}
+Le but est d'obtenir la molécule ci dessous :
+\begin{center}
+ \definesubmol{x}{(-[4]H)(-[0]OH)}
+ \definesubmol{y}{(-[0]H)(-[4]OH)}
+ \chemfig{[2]OH-[3]-!x-!x-!y-!x-=[1]O}
+\end{center}
+L'idée est de commencer à dessiner la plus longue chaîne verticale en indiquant un angle «\verb-[2]-» par défaut. Voici la structure où l'on met volontairement des lettres minuscules au bout de chaque liaison verticale :
+\exemple{Structure}|\chemfig{[2]OH-[3]-a-b-c-d-=[1]O}|
+
+Ensuite, on définit deux alias pour les liaisons horizontales et les atomes qui les termineront. Prenons «\verb-x-» que nous mettrons à la place des minuscules a, c et d et «\verb-y-» qui prendra la place de la lettre c. Comme les alias ne comportent qu'un seul caractère, on peut se passer d'accolade et écrire «\verb-!x-» au lieu de «\verb-!{x}-» :
+\exemple{Glucose (projection de Fisher)}|\definesubmol{x}{(-[4]H)(-[0]OH)}
+\definesubmol{y}{(-[0]H)(-[4]OH)}
+\chemfig{[2]OH-[3]-!x-!x-!y-!x-=[1]O}|
+
+\subsubsection{Représentation "chaise"}
+On va représenter cette molécule d'$\alpha$-D-glucose :
+\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)}
+
+Pour cela, on va tout d'abord tracer 5 côtés de la chaise et relier le premier sommet au dernier avec un crochet «\verb-?-». On adopte les angles absolus suivants, donnés dans l'ordre de parcourt trigonométrique : $-50\degres$, $10\degres$, $-10\degres$, $130\degres$, $190\degres$.
+\exemple{Structure}|
+\chemfig{?-[:-50]-[:10]-[:-10]-[:130]O-[:190]?}|
+
+Maintenant, il suffit de rajouter les ramifications entre parenthèses. Les angles sont choisis au mieux pour rendre une impression de perspective, et certaines liaisons sont raccourcis d'un coefficient de 0,7 :
+\exemple{Représentation chaise}|\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)}|
+
+\subsubsection{Projection de Haworth}
+Le but est de représenter cette molécule de D-glucopyranose :
+\chemfig[cram width=2pt]{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)}
+
+Tout d'abord, on va choisir la plus longue chaîne qui part du groupe «HO» de gauche et continue sur 5 côtés du cycle. Le cycle sera fermé avec un crochet. Pour la liaison verticale qui part du premier groupe «HO», il faut spécifier qu'elle doit partir du second atome avec l'argument optionnel. De plus, elle sera raccourcie avec un coefficient de 0,5. Son argument optionnel sera donc «\verb/[2,0.5,2]/».
+
+Ensuite, pour donner une impression de perspective au cycle, les liaisons inclinées seront réduites d'un coefficient de 0,7. Pour les traits gras inclinés, on va se servir des liaisons de Cram en ayant redéfini la largeur de la base des triangles à 2pt. Pour la liaison horizontale en trait gras, il faudra la tracer avec une épaisseur de 2pt et son argument optionnel sera donc «\verb/[0,,,,line width=2pt]/». Voici la structure de la molécule :
+\exemple{Structure}|\chemfig[cram width=2pt]{HO-[2,0.5,2]?<[7,0.7]-[,,,,
+line width=2pt]>[1,0.7]-[3,0.7]O-[4]?}|
+
+Il ne reste plus qu'à rajouter les ramifications, mises au bon endroit, en spécifiant des angles absolus correctement choisis et des longueurs parfois réduites pour mieux donner l'illusion de la perspective :
+\exemple{Projection de Haworth}|\chemfig[cram width=2pt]{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)}|
+
+\subsection{Adrénaline}
+On cherche à dessiner la molécule d'adrénaline :
+\chemfig{*6((-HO)-=-(-(<[::60]OH)-[::-60]-[::-60,,,2]HN-[::+60]CH_3)=-(-HO)=)}
+
+Nous allons utiliser deux méthodes différentes.
+
+\subsubsection{Utilisation d'un cycle}
+Tout d'abord, on part du 6-cycle et nous dessinons le début des ramifications qui en partent :
+\exemple[60]{Structure de l'adrénaline}|\chemfig{*6((-HO)-=-(-)=-(-HO)=)}|
+
+Il faut maintenant compléter la ramification de droite en utilisant, par exemple, des angles relatifs :
+\exemple[60]{Adrénaline, étape 2}|\chemfig{*6((-HO)-=-(--[::-60]-[::-60]
+HN-[::+60]CH_3)=-(-HO)=)}|
+
+Puis, il faut rajouter la liaison de Cram vers \verb-OH- et spécifier que la liaison qui arrive sur «\verb-NH-» le fait sur le second atome «N». Nous utilisons le 4\ieme{} argument optionnel de la liaison :
+\exemple[60]{Adrénaline}|\chemfig{*6((-HO)-=-(-(<[::60]OH)-[::-60]-[::-60,,,2]
+HN-[::+60]CH_3)=-(-HO)=)}|
+
+\subsubsection{Utilisation de 2 cycles}
+Cette méthode est moins naturelle, mais le but est ici d'expliquer comment rendre une liaison invisible.
+
+On pourrait améliorer ce code en considérant que le dessin de la molécule d'adrénaline est constitué de deux 6-cycles accolés l'un à l'autre :
+\exemple[60]{Adrénaline, structure 2 cycles}|\chemfig{*6((-HO)-=*6(--HN---)-=-(-HO)=)}|
+
+Il faut donc rendre invisible les deux premières liaisons du cycle de droite. Pour cela, on se sert de l'argument qui est passé à \TIKZ en spécifiant «\verb-draw=none-». Ces liaisons ont donc ce code : «\verb/-[,,,,,draw=none]/». Pour que le code reste lisible, on définit un alias nommé «\verb-&-» pour ces liaisons :
+\exemple[60]{Adrénaline, étape 2}|\definesubmol{&}{-[,,,,draw=none]}
+\chemfig{*6((-HO)-=*6(!&!&HN---)-=-(-HO)=)}|
+
+Le reste devient facile, il suffit d'ajouter les ramification aux bons sommets :
+\exemple[60]{Adrénaline, étape 3}|\definesubmol{&}{-[,,,,draw=none]}
+\chemfig{*6((-HO)-=*6(!&!&HN(-CH_3)--(<OH)-)-=-(-HO)=)}|
+
+Pour finir, on spécifie que les liaisons qui \emph{arrivent et partent} de «\verb-HN-» doivent le faire sur deuxième atome. On définit donc un autre alias pour la liaison invisible qui arrive sur «\verb-HN-» :
+\exemple[60]{Adrénaline}|\definesubmol{&}{-[,,,,draw=none]}
+\definesubmol{&&}{-[,,,2,draw=none]}
+\chemfig{*6((-HO)-=*6(!&!{&&}HN(-CH_3)-[,,2]-(<OH)-)-=-(-HO)=)}|
+
+\subsection{Guanine}
+Nous allons dessiner la molécule de guanine :
+\chemfig{*6((-H_2N)=N-*6(-\chembelow{N}{H}-=N?)=?-(=O)-HN-[,,2])}\medskip
+
+Tout d'abord, commençons par dessiner les cycles imbriqués en mettant seulement les atomes d'azote aux sommets :
+\exemple{Guanine, structure}|\chemfig{*6(=N-*6(-N-=N)=--N-)}|
+
+Puis nous allons tracer la liaison horizontale dans le cycle de droite avec un crochet. Nous allons aussi positionner un atome d'hydrogène sous l'atome d'azote du 5-cycle avec la commande \verb-\chembelow{N}{H}-. Il faut aussi écrire «\verb-HN-» au lieu de «\verb-N-» au sommet en haut à gauche de la molécule :
+\exemple{Guanine, étape 2}|\chemfig{*6(=N-*6(-\chembelow{N}{H}-=N?)=?--HN-)}|
+
+On constate qu'une liaison part du mauvais atome\footnote{Ceci semble illogique puisque l'angle de la liaison du groupe \texttt{HN} vers le premier sommet du 6-cycle est comprise entre $-90\degres$ et $90\degres$; \CF devrait donc partir du 2\ieme{} atome. Pour expliquer cette contradiction, il faut savoir que dans les cycles, la dernière liaison relie toujours le dernier sommet au premier sommet en ignorant l'angle \emph{calculé théorique} de cette liaison (qui est ici de $-90\degres{}$). \CF utilise cet angle théorique pour déterminer les atomes de départ et d'arrivée, mais ne s'en sert pas pour tracer la liaison puisque les deux extrémités sont déjà définies. L'atome de départ de la dernière liaison est donc le \no1.} ! Il faut corriger le mécanisme de calcul automatique pour que la liaison parte du 2\ieme{} atome «\verb-N-» au lieu du premier. Pour cela, on spécifie un argument optionnel pour la dernière liaison du premier 6-cycle «\verb-[,,2]-» :
+\exemple{Guanine, étape 3}|\chemfig{*6(=N-*6(-\chembelow{N}{H}-=N?)=?--HN-[,,2])}|
+
+Il suffit de rajouter les ramifications aux bons sommets. On peut notamment remarquer la ramification qui part du premier sommet du premier 6-cycle «\verb/(-H_2N)/» :
+\exemple{Guanine}|\chemfig{*6((-H_2N)=N-*6(-\chembelow{N}{H}-=N?)=?-(=O)-HN-[,,2])}|
+
+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\protect\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 \falseverb{\color} et \falseverb{\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 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{Ajouter un exposant sans influer sur une liaison}
+Ajouter une \falseverb{charge} sous forme d'exposant mathématique à un atome implique que la boîte (et donc le nœud de \TIKZ) le contenant aura ses dimensions modifiées. Cela n'a guerre d'importance si l'atome est un fin de chaîne mais l'esthétique peut être compromise si une liaison doit en partir. Le premier réflexe est de mettre l'exposant dans une boîte de \TeX{} de dimensions nulles et donc d'utiliser la macro\falseverb\rlap\footnote{Si l'on doit mettre la charge a gauche de l'atome, il faut employer la commande \texttt{\string\llap}.}, ce qui donne des résultats souvent satisfaisants. On voit ici que grâce à \falseverb\rlap, l'\falseverb{alignement horizontal} des atomes est préservé :
+\exemple{Charge et liaison}/\chemfig{A^+-[2]B}
+\qquad
+\chemfig{A\rlap{${}^+$}-[2]B}/
+Si l'on veut utiliser la commande \verb-\oplus- qui affiche «$\oplus$», on peut trouver que la charge est trop basse : $\mathrm{A^\oplus}$. Dans ce cas, pourquoi ne pas se servir de \falseverb{\chemabove} pour placer aussi précisément que l'on veut, aussi bien verticalement qu'horizontalement la charge :
+\exemple{Charge et \string\chemabove}/\chemfig{\chemabove[0.5pt]{A}{\scriptstyle\hspace{3.5mm}\oplus}-[2]B}
+\qquad
+\chemfig{{\chemabove[-0.5pt]{A}{\scriptstyle\hspace{3.5mm}\oplus}}-[2]B}/
+On remarque un niveau d'accolades supplémentaire pour la seconde molécule. En effet, comme on spécifie «\verb/-0.5pt/» pour l'argument optionnel de \falseverb{\chemabove} pour descendre la charge, il faut éviter que \CF ne comprenne ce signe «\verb/-/» comme une liaison simple.
+
+Pour ajouter une charge près du sommet d'un cycle, la meilleure méthode est de créer une liaison invisible qui parte de ce sommet, ce qu'on fait ici avec \falseverb\definesubmol{} avec une liaison ayant un coefficient de longueur égal à 0.2 :
+\exemple{Charges et cycles}/\definesubmol\nobond{-[,0.2,,,draw=none]}
+\chemfig{*5(---(!\nobond\scriptstyle\oplus)-(!\nobond\scriptstyle{-})-)}/
+
+\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 \falseverb{\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{Dessiner un élément de polymère}\label{polymerdelim}
+La macro \verb|\polymerdelim|, jusqu'alors non documentée et en phase de test, fait avec la version 1.33 son entrée officielle dans le package \CF. Sa syntaxe est la suivante :
+\begin{center}
+ \Verb|\polymerdelim[<clés>=<valeurs>]{<nœud1>}<nœud2>}|
+\end{center}
+
+L'effet, après éventuellement \emph{deux} compilations, est de positionner des délimiteurs verticaux aux nœuds spécifiés : par défaut, le 1\ier{} délimiteur est placé sur le premier nœud et le second sur la même horizontale que le premier, mais à l'abscisse du second. Les paramètres sont spécifiés via les \chevrons{clés} et les \chevrons{valeurs} dont voici la liste, les valeurs par défaut et les actions.
+\begin{center}
+\begin{tabular}{rlp{8cm}}\hline
+ \chevrons{clés} & \chevrons{valeurs} par défaut & Action\\\hline
+ \CFdelimparam{delimiters} & Définit les délimiteurs. Si ces délimiteurs sont des crochets, il faut écrire \verb|delimiters={[]}|.\\
+ \CFdelimparam{height} & Définit la hauteur (au-dessus du nœud) des délimiteurs.\\
+ \CFdelimparam{depth} & Définit la profondeur (au-dessous du nœud) des délimiteurs. Si la \chevrons{valeur} est vide, alors la profondeur est égale à la hauteur.\\
+ \CFdelimparam{h align}&Booléen qui lorsqu'il est \CFval{false}, place le 2\ieme{} délimiteur sur le 2\ieme{} nœud, au risque que les délimiteurs ne soient pas sur une même ligne horizontale.\\
+ \CFdelimparam{auto rotate}&Booléen qui, lorsqu'il est \CFval{true} et \CFkv{h align}{false}, tourne automatiquement les délimiteurs pour qu'ils soient perpendiculaires à la ligne qui relie les deux nœuds.\\
+ \CFdelimparam{rotate}&Lorsque \CFkv{h align}{false} et \CFkv{auto rotate}{false}, spécifie l'angle de rotation des deux délimiteurs.\\
+ \CFdelimparam{open xshift}& Définit le décalage horizontal du délimiteur ouvrant.\\
+ \CFdelimparam{close xshift}& Définit le décalage horizontal du délimiteur fermant. Si la \chevrons{valeur} est vide, alors ce décalage devient opposé au décalage du délimiteur ouvrant.\\
+ \CFdelimparam{indice} & Définit l'indice qui sera placé en bas à droite du délimiteur fermant.\\\hline
+\end{tabular}
+\end{center}
+\exemple*{Polymères}|Polyéthylène:
+\chemfig{\vphantom{CH_2}-[@{op,.75}]CH_2-CH_2-[@{cl,0.25}]}
+\polymerdelim[height = 5pt, indice = \!\!n]{op}{cl}
+\bigskip
+
+Polyvinyl chloride:
+\chemfig{\vphantom{CH_2}-[@{op,1}]CH_2-CH(-[6]Cl)-[@{cl,0}]}
+\polymerdelim[height = 5pt, depth = 25pt, open xshift = -10pt, indice = \!\!n]{op}{cl}
+\bigskip
+
+Nylon 6:
+\chemfig{\phantom{N}-[@{op,.75}]{N}(-[2]H)-C(=[2]O)-{(}CH_2{)_5}-[@{cl,0.25}]}
+\polymerdelim[height = 30pt, depth = 5pt, indice = {}]{op}{cl}
+\bigskip
+
+Polycaprolactame:
+\chemfig[atom sep = 2em]{[:-30]-[@{left,.75}]N(-[6]H)-[:30](=[2]O)--[:30]--[:30]--[@{right,0.25}:30]}
+\polymerdelim[height = 5pt, indice = \!\!n]{left}{right}
+\bigskip
+
+Polyphénylène sulfide:
+\chemfig{\vphantom{S}-[@{op,.75}]S-(**6(---(-[@{cl,0.25}])---))}
+\polymerdelim[delimiters = (), height = 15pt, indice = {}]{op}{cl}
+\bigskip
+
+\chemfig{-CH_2-CH([6]-CO-NH-CH_2-NH-CO-CH([4]-CH_2-)([0]-[@{downleft,0.8},2]CH_2
+-CH([2]-CO-NH_2)-[@{downright,0.3},2]CH_2-[,1.5]C?H-))-[@{upleft,0.8},2]CH_2
+-CH([6]-CO-NH_2)-[@{upright,0.3},2]CH_2-[,1.5]CH([6]-CO-NH-CH_2-NH-C?O)-}
+\polymerdelim[delimiters ={[]}, height = 5pt, depth = 40pt, indice = n]{upleft}{upright}
+\polymerdelim[delimiters ={[]}, height = 40pt, depth = 5pt, indice = n]{downleft}{downright}
+
+\chemfig{-[@{op,.5}:-30]O-[::60](=[::60]O)-[::-60]*6(-=-(-(=[::-60]O)-[::60]O-[::-60]-[::60]-[@{cl,.5}::-60])=-=)}
+\polymerdelim[height=6ex, indice=n, h align=false]{op}{cl}|
+
+\subsection{Dessiner le symétrique d'une molécule}\label{retournement}
+Il existe deux commandes \falseverb{\hflipnext} et \falseverb{\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}/
+
+\subsection{Ajouter du texte au dessus des liaisons et coder les angles}
+Une fois que l'on a compris que le caractère «\verb-@-» permet de poser un nœud «global» pour \TIKZ, c'est-à-dire accessible après que la molécule ait été dessinée, tout ce qui est possible avec \TIKZ et les nœuds (c'est-à-dire beaucoup de choses) devient envisageable.
+
+Pour écrire quelque chose au-dessus ou au-dessous d'une liaison, on peut donc poser des nœuds «globaux» sur les atomes situés aux extrémités de cette liaison et écrire à mi-chemin de ces deux nœuds un texte que l'on aura soin d'élever ou d'abaisser pour qu'il se situe juste au dessus ou au dessous de la liaison. C'est ce que fait la commande \verb-\bondname- dans le code ci-dessous.
+
+Pour les angles entre deux liaisons partant d'un atome, 3 atomes sont impliqués et il faudra poser un nœud global sur chacun d'eux. On peut aisément calculer l'angle entre deux lignes issues d'un même nœud, c'est ce que fait la commande \verb-\arcbetweennodes-. Ensuite, la macro \verb-\arclabel- trace un arc de cercle entre deux liaisons et écrit un texte à côté de cet arc : l'argument optionnel de cette macro est le code passé à \TIKZ. L'argument \no2 est le rayon de l'arc tandis que les trois arguments suivants sont les noms des nœuds globaux entre lesquels doit être tracé l'arc, le nom du milieu devant être celui du sommet de l'angle. Enfin, le dernier argument est le texte à écrire.
+
+\exemple*{Angles et texte sur les liaisons}|\newcommand\angstrom{\mbox{\normalfont\AA}}
+\newcommand\namebond[4][5pt]{\chemmove{\path(#2)--(#3)node[midway,sloped,yshift=#1]{#4};}}
+
+\newcommand\arcbetweennodes[3]{%
+ \pgfmathanglebetweenpoints{\pgfpointanchor{#1}{center}}{\pgfpointanchor{#2}{center}}%
+ \let#3\pgfmathresult}
+
+\newcommand\arclabel[6][stealth-stealth,shorten <=1pt,shorten >=1pt]{%
+ \chemmove{%
+ \arcbetweennodes{#4}{#3}\anglestart \arcbetweennodes{#4}{#5}\angleend
+ \draw[#1]([shift=(\anglestart:#2)]#4)arc(\anglestart:\angleend:#2);
+ \pgfmathparse{(\anglestart+\angleend)/2}\let\anglestart\pgfmathresult
+ \node[shift=(\anglestart:#2+1pt)#4,anchor=\anglestart+180,rotate=\anglestart+90,inner sep=0pt,
+ outer sep=0pt]at(#4){#6};}}
+
+\chemfig{@{a}A=[:30,1.5]@{b}B-[7,2]@{c}C-@{d}D}
+\namebond{a}{b}{\scriptsize My text}
+\namebond[-3.5pt]{b}{c}{\small\color{red}$\pi$}
+\namebond{c}{d}{\small1 \angstrom}
+\medskip
+
+Molécule d'eau horizontale : \chemfig{@{1}H-[::37.775,2]@{2}O-[::-75.55,2]@{3}H}.
+\namebond{1}{2}{\footnotesize0,9584 \angstrom}
+\namebond{2}{3}{\footnotesize0,9584 \angstrom}
+\arclabel{0.5cm}{1}{2}{3}{\footnotesize104,45\textdegree}
+\qquad
+Molécule d'eau pivotée de +30\textdegree : \chemfig{[:30]@1H-[::37.775,2]@2O-[::-75.55,2]@3H}
+\namebond12{\footnotesize0,9584 \angstrom}
+\namebond23{\footnotesize0,9584 \angstrom}
+\arclabel{0.5cm}{1}{2}{3}{\footnotesize104,45\textdegree}|
+
+\subsection{Schéma de Lewis à l'angle près}
+Pour quelques cas très particuliers, il est parfois nécessaire de positionner des schémas de Lewis au degrés près et non plus à des multiples de 45 degrés.
+
+Pour cela, il est relativement facile d'écrire une macro \verb-\mylewis-, admettant un argument optionnel (la longueur du doublet) qui vaut ici 2ex et deux arguments obligatoires; le premier étant le nom de l'atome et le second étant la liste des angles séparés par des virgules.
+
+L'astuce consiste à créer un n\oe ud invisible circulaire qui contient l'atome et tracer les doublets aux angles désirés de façon à ce qu'ils soient tangents à ce cercle :
+
+\exemple*{Doublets au degrés prés}|\catcode`\_11
+\newcommand\mylewis[3][2ex]{% #1=longueur, #2=atome #3=liste des angles
+ \tikzpicture[baseline,anchor=base]%
+ \node[inner sep=0pt,outer sep=1pt,circle,overlay](atom@@)at(0,0){\phantom{#2}};%
+ \node[inner sep=0pt,outer sep=0pt]at(0,0){#2};%
+ \def\list_angle{#3,}%
+ \loop
+ \expandafter\grab_angle\list_angle\_nil
+ \pgfextractx\CF_dim{\pgfpointanchor{atom@@}\current_angle}\edef\CF_dimax{\the\CF_dim}%
+ \pgfextracty\CF_dim{\pgfpointanchor{atom@@}\current_angle}\edef\CF_dimay{\the\CF_dim}%
+ \pgfmathparse{#1*sin(\current_angle)/2}\let\offset_xx\pgfmathresult
+ \pgfmathparse{#1*cos(\current_angle)/2}\let\offset_yy\pgfmathresult
+ \draw[line width=.4pt,overlay]
+ (\CF_dimax-\offset_xx,\CF_dimay+\offset_yy)--(\CF_dimax+\offset_xx,\CF_dimay-\offset_yy);%
+ \unless\ifx\empty\list_angle
+ \repeat
+ \endtikzpicture
+}
+\def\grab_angle#1,#2\_nil{\def\current_angle{#1}\def\list_angle{#2}}
+\catcode`\_8
+Essai : \mylewis{Cl}{15}\qquad \mylewis[3ex]{Cl}{-60}\qquad \mylewis[1.5ex]{Cl}{60,120,240,300}
+\bigskip
+
+\chemfig{P(-[:72]\mylewis{Cl}{-18,72,162})(-[:-72]Cl)
+(-[:144]Cl)(-[:-144]Cl)-\mylewis{Cl}{0,90,-90}}|
+
+\subsection{Dessiner des liaisons multiples}
+Là encore, la librairie «decorations.markings» permet de tracer des liaisons multiples :
+
+\exemple*{Liaisons multiples}|\catcode`\_=11
+\tikzset{nbond/.style args={#1}{%
+ draw=none,%
+ decoration={%
+ markings,%
+ mark=at position 0 with {\coordinate (CFstart@) at (0,0);},
+ mark=at position 1 with {%
+ \foreach\CF_i in{0,1,...,\number\numexpr#1-1}{%
+ \pgfmathsetmacro\CF_nbondcoeff{\CF_i-0.5*(#1-1)}%
+ \draw ([yshift=\CF_nbondcoeff\CF_doublesep]CFstart@)--(0,\CF_nbondcoeff\CF_doublesep);
+ }%
+ }
+ },
+ postaction={decorate}
+ }
+}
+\catcode`\_=8
+\chemfig{A-[1,,,,nbond=4]B-[:-30,,,,nbond=5]C-[6,,,,nbond=6]D}|
+
+\part{Schémas réactionnels}\label{schemas}
+Suite à plusieurs demandes d'utilisateurs et étant devenu évident que \CF présentait une faiblesse quant au tracé de schémas réactionnels, cette lacune est désormais comblée. Par conséquent, \CF passe en version 1.0 puisque je considère que les fonctionnalités principales que je souhaitais implémenter sont désormais disponibles.
+
+Je remercie Clemens \textsc{Niederberger} pour l'aide qu'il m'a apportée et les tests qu'il a effectués sur les nouvelles fonctionnalités présentées dans cette partie.
+\section{Généralités}\label{schemestart}
+Un schéma réactionnel doit être contenu entre les commandes «\falseverb\schemestart» et «\falseverb\schemestop». Comme on le constate sur cet exemple, des \falseverb{informations de débogage} ont été masquées puis rendues visibles pour aider à la compréhension avec la \chevrons{clé} \CFkey{scheme debug} et la valeur \CFval{true} ou \CFval{false} :
+\exemple[50]{Exemple 1}/\setchemfig{scheme debug=false}
+\schemestart
+ \chemfig{*6(-=-=-=)}\arrow
+ \chemfig{X=[1]Y}\arrow
+ \chemfig{S>T}
+\schemestop
+\bigskip
+
+\setchemfig{scheme debug=true}
+\schemestart
+ \chemfig{*6(-=-=-=)}\arrow
+ \chemfig{X=[1]Y}\arrow
+ \chemfig{S>T}
+\schemestop/
+
+Quelques remarques :
+\begin{itemize}
+ \item les commandes \falseverb{\arrow} tracent les flèches;
+ \item tout ce qui se trouve entre deux commande \falseverb{\arrow} est considéré comme étant un composé. Le parti a été pris que tous les réglages possibles, qu'ils concernent les flèches ou les composés, le seront grâce aux arguments de la commande \falseverb{\arrow}, dont la syntaxe en devient assez complexe;
+ \item les flèches sont tracées horizontalement, ce qui est bien évidemment modifiable;
+ \item les flèches sont sur la ligne imaginaire reliant les centre des boîtes englobantes les composés (les points rouges et bleus sont les points d'attache des flèches). Ce comportement est également modifiable;
+ \item Les informations de débogage, qui sont rendues visibles ou pas avec la \chevrons{clé} \CFkey{scheme debug} sont :
+ \begin{itemize}
+ \item ce qui se trouve en vert au dessus des boîtes englobantes est le nom attribué par défaut par \CF aux composés et suit la progression "c1", "c2", etc. La numérotation recommence à 1 pour un nouveau schéma réactionnel.
+ \item les boîtes englobantes des composés ont été tracées;
+ \item les extrémités des flèches sont matérialisés par des points rouge et les ancres par des points bleu;
+ \end{itemize}
+ \item la distance de bord à bord entre deux composés est définie avec la \chevrons{clé} \CFkv{compound sep}{dim}\label{compound sep}. La valeur par défaut de la \CFval{dim} est 5em;
+ \item enfin, la distance entre les bords des composés et le début et la fin des flèches est défini avec la \chevrons{clé} \CFkv{arrow offset}{dim}. Par défaut, cette \CFval{dim} vaut 4pt.\label{arrow offset}
+\end{itemize}
+
+\section{Types de flèches}\label{arrow}
+Lorsque la commande \falseverb{\arrow} est suivie d'un argument optionnel entre accolades (qui n'est donc pas obligatoire), cet argument contient le type de flèche :
+\exemple[50]{Types de flèches}|\schemestart A\arrow{->}B\schemestop\par % par défaut
+\schemestart A\arrow{-/>}B \schemestop\par
+\schemestart A\arrow{<-}B \schemestop\par
+\schemestart A\arrow{<->}B \schemestop\par
+\schemestart A\arrow{<=>}B \schemestop\par
+\schemestart A\arrow{<->>}B \schemestop\par
+\schemestart A\arrow{<<->}B \schemestop\par
+\schemestart A\arrow{0}B \schemestop\par
+\schemestart A\arrow{-U>}B \schemestop|
+La flèche «\verb/-U>/» n'est pas dessinée de façon complète, un arc de cercle qui lui est tangent en son milieu peut être rajouté avec les arguments optionnels passés à cette flèche, voir page~\pageref{fleche.arg.optionnel}. Voici une flèche «\verb/-U>/» avec son arc de cercle : \schemestart A\arrow{-U>[$\scriptstyle x$][$\scriptstyle y$]}B\schemestop
+
+Par souci de concision, par la suite, sauf exemple spécial, des lettres majuscules seront mises au lieu de formules chimiques crées via la commande \falseverb\chemfig. Il est bien évident que les schémas réactionnels fonctionnent de façon identique avec des lettres ou des dessins de molécules. On peut voir dans la galerie plusieurs exemples où les schémas réactionnels entrent en jeu.
+
+\section{Caractéristiques des flèches}
+Chaque flèche est caractérisée par :
+\begin{itemize}
+ \item un angle exprimé en degrés;
+ \item un coefficient qui spécifie la longueur de la flèche par multiplication de la valeur de l'espacement entre composés défini par \CFkey{compound sep};
+ \item un style qui contient des instructions \TIKZ qui vont permettre de personnaliser la couleur, l'épaisseur de la flèche ou un autre attribut graphique.
+\end{itemize}
+
+On peut définir ces caractéristiques à l'aide des \chevrons{clés}
+\begin{itemize}
+ \item \CFkv{arrow angle}{angle}, dont la valeur est 0 par défaut;
+ \item \CFkv{arrow coeff}{decimal}, dont la valeur est 1 par défaut;
+ \item \CFkv{arrow style}{code tikz}, dont la valeur par défaut est vide.
+\end{itemize}
+
+\exemple[50]{Définition de valeurs par défaut}/\schemestart A\arrow B\arrow C\schemestop
+
+\setchemfig{arrow angle=15,arrow coeff=1.5,
+arrow style={red, thick}}
+\schemestart A\arrow B\arrow C\schemestop
+
+\setchemfig{arrow coeff=2.5,arrow style=dashed}
+\schemestart A\arrow B\arrow C\schemestop
+
+\setchemfig{arrow angle={},arrow coeff={},arrow style={}}
+\schemestart A\arrow B\arrow C\schemestop/
+
+Pour modifier localement une, ou toutes ces valeurs par défaut, la commande \falseverb{\schemestart} admet un argument optionnel de la forme \verb-[angle,coeff,style]- qui change les caractéristiques par défaut à l'intérieur du schéma réactionnel concerné :
+\exemple[50]{Argument optionnel}/\setchemfig{arrow angle=5,arrow coeff=2.5,arrow style=blue}
+\schemestart A\arrow B\arrow C\schemestop
+
+\schemestart[0] A\arrow B\arrow C\schemestop
+
+\schemestart[0,1] A\arrow B\arrow C\schemestop
+
+\schemestart[0,1,thick] A\arrow B\arrow C\schemestop
+
+\schemestart[0,1,black] A\arrow B\arrow C\schemestop/
+
+Pour le style, la règle est la suivante : le style spécifié dans l'argument entre crochets s'applique \emph{après} le style par défaut, sans l'écraser ! C'est pour cette raison que seul l'attribut de couleur «black» parvient à écraser celui par défaut qui est «blue».
+
+Enfin, la commande \falseverb{\arrow} admet un argument optionnel entre crochets de la forme \verb-[angle,coeff,style]- pour modifier les caractéristiques de la flèche concernée. Pour le style, comme précédemment, celui est-ci est appliqué \emph{après} le style par défaut et l'éventuel style spécifié dans l'argument optionnel de la commande \verb-\schemestart-, le tout sans écrasement.
+\exemple[50]{Caractéristiques des flèches}/\schemestart
+ A\arrow[45]B\arrow[-20,2]C
+\schemestop
+\bigskip
+
+\schemestart
+ A\arrow[90,,thick]B\arrow[,2]C
+ \arrow[-45,,dashed,red]D
+\schemestop/
+
+\section{Nom des composés}
+On peut passer outre le mécanisme automatique qui nomme les composés «c1», «c2», etc. Pour cela, la commande \falseverb{\arrow} admet un argument entre parenthèses qui doit suivre immédiatement la commande. Cet argument est de la forme : \verb/(n1--n2)/. Il nomme «\verb-n1-» le composé se trouvant à l'origine de la flèche et «\verb-n2-» celui se trouvant à sa fin. N'importe quelle chaîne de caractères alphanumériques peut être utilisée. La numérotation des noms "c<n>" continue en interne ce qui signifie que si un composé porte un autre nom que celui par défaut, cela ne change pas le nom par défaut des composés suivants.
+
+Les noms sont facultatifs et l'argument peut aussi bien être \verb/(n1--)/ que \verb/(--n2)/.
+
+\exemple[50]{Nom des composés}/\setchemfig{scheme debug=true}
+\schemestart
+ A\arrow(aa--bb)B\arrow(--cc)C\arrow(--dd)D\arrow E
+\schemestop
+\bigskip
+
+\schemestart
+ A\arrow(aa--)B\arrow(bb--)C\arrow(cc--dd)D\arrow E
+\schemestop/
+On le voit, les deux méthodes sont équivalentes et l'on peut donc nommer un composé avec la flèche qui le précède ou avec la flèche qui le suit. Par contre lorsqu'un composé est entouré de deux flèches spécifiant son nom, le premier nom est ignoré et un warning est émis :
+\exemple[50]{Noms surabondants}/\setchemfig{scheme debug=true}
+\schemestart
+ A\arrow(--foo)B\arrow(bar--)C
+\schemestop/
+Ici, le composé «B» est nommé «foo» par la flèche qui lui arrive dessus et «bar» par celle qui en part. \CF émet donc le warning suivant annonçant que le nom "foo" sera ignoré :
+
+\hfill\verb-Package chemfig Warning: two names for the same node, first name "foo" ignored-\hfill\null
+
+\section{Ancres}
+Comme on l'a vu, les flèches sont sur la ligne reliant les centre de boites englobant les composés. On peut spécifier un ancre autre que celui par défaut (qui, au sens de \TIKZ, s'appelle «center»). On utilise pour cela l'argument entre parenthèses :
+
+\hfill\verb/(n1.a1--n2.a2)/\hfill\null
+
+où l'ancre »\verb-a1-« ou »\verb-a2-« peut être : north west, north, north east, west, center, east, mid west, mid, mid east, base west, base, base east, south west, south, south east, text, ou n'importe quel angle. Voici un exemple du manuel de \TIKZ où les ancres sont placés sur la boîte englobante :
+\exemple*{Ancres de tikz}|\Huge
+\begin{tikzpicture}[baseline]
+\node[anchor=base west,name=x,draw,inner sep=25pt] {\color{lightgray}Rectangle\vrule width 1pt height 2cm};
+\foreach \anchor/\placement in
+{north west/above left, north/above, north east/above right,west/left, center/above, east/right,
+mid west/left, mid/above, mid east/right,base west/left, base/below, base east/right,
+south west/below left, south/below, south east/below right,text/below,10/right,45/above,150/left}
+\draw[shift=(x.\anchor)] plot[mark=x] coordinates{(0,0)}
+node[\placement,inner sep=0pt,outer sep=2pt] {\scriptsize\texttt{(\anchor)}};
+\end{tikzpicture}|
+Comme les noms, les ancres de départ et de fin sont indépendants et facultatifs.
+
+Voici un exemple où l'alignement par défaut n'est pas bon car les deux «A» ne sont pas alignés verticalement. Les \falseverb{informations de débogage} ont été rendues visibles pour constater que les ancres «center» par défaut ne conviennent pas :
+\exemple[50]{Problèmes d'alignement}/\setchemfig{scheme debug=true}
+\schemestart
+ \chemfig{A*5(-----)}
+ \arrow
+ \chemfig{A*5(---(-)--)}
+\schemestop/
+Pour que l'alignement soit correct, on va faire partir/arriver la flèche soit des ancres «base east»/«base west», soit des ancres «mid east»/«mid west» :
+\exemple[50]{Problèmes d'alignement}/\setchemfig{scheme debug=true}
+\schemestart
+ \chemfig{A*5(-----)}
+ \arrow(.base east--.base west)
+ \chemfig{A*5(---(-)--)}
+\schemestop
+\bigskip
+
+\schemestart
+ \chemfig{A*5(-----)}
+ \arrow(foo.mid east--bar.mid west)
+ \chemfig{A*5(---(-)--)}
+\schemestop/
+
+Un dernier ancre reste à spécifier, c'est celui du premier composé par rapport à la \falseverb{ligne de base} du texte qui le précède, il s'agit du point vert de gauche sur le schéma qui suit :
+\exemple[50]{Ancre initial}/\setchemfig{scheme debug=true}
+Texte qui précède :
+\schemestart
+ \chemfig{A*5(-----)}\arrow A
+\schemestop/
+
+L'emplacement de cet ancre sur la boîte contenant le premier composé vaut par défaut «text». Il est réglable avec le second argument optionnel de la commande \falseverb{\schemestart} :
+\exemple[50]{Réglage de l'ancre initial}/\setchemfig{scheme debug=true}
+Texte qui précède :
+\schemestart[][south]
+ \chemfig{A*5(-----)}\arrow A
+\schemestop
+\bigskip
+
+Texte qui précède :
+\schemestart[][north west]
+ \chemfig{A*5(-----)}\arrow A
+\schemestop
+\bigskip
+
+Texte qui précède :
+\schemestart[][west]
+ \chemfig{A*5(-----)}\arrow A
+\schemestop/
+
+\section{Style des composés}
+Toujours par l'intermédiaire de l'argument entre parenthèses de la commande \falseverb{\arrow}, on peut spécifier avec des instructions de \TIKZ le style «\verb-s-» de la boîte englobante du composé de départ ou de celui d'arrivée. La syntaxe complète de la commande \falseverb{\arrow} est donc la suivante, où chaque spécification est optionnelle et peut être omise :
+
+\hfill\verb/\arrow(n1.a1[s1]--n2.a2[s2]){type flèche}[angle,coeff,style flèche]/\hfill\null
+
+Tout comme les noms, si un style est spécifié à un composé par la flèche qui lui arrive dessus et par celle qui en part, le premier style sera ignoré avec un warning.
+
+\exemple[60]{Style des composés}/\schemestart
+ A
+ \arrow([red]--[fill=blue,semitransparent,text opacity=1,
+ inner sep=10pt,rounded corners=2mm])
+ B
+\schemestop
+\bigskip
+
+\schemestart
+ A\arrow(--foo[yshift=5mm])B
+\schemestop/
+
+\label{compound style}La \chevrons{clé} \CFkv{compound style}{code tikz} permet de définir de façon générale le style des composés affichés par la suite. Il faut bien évidemment entrer un argument vide pour qu'aucun style ne soit appliqué, ce qui est le cas par défaut.
+
+Ici, nous allons définir un style en forme de boites aux coins arrondis, dont le fond sera semi transparent :
+\exemple[50]{Styles globaux}/\setchemfig{compound style={draw,line width=0.8pt,
+semitransparent,text opacity=1,inner sep=8pt,
+rounded corners=1mm}}
+\schemestart
+ A\arrow([fill=red]--[fill=blue])[90]
+ B\arrow(--[fill=gray])
+ C\arrow(--[fill=green])[-90]
+ D\arrow(--[draw=none])[-180]
+\schemestop/
+
+\section{Embranchements}
+Jusqu'à présent, on n'a pu tracer que des schémas réactionnels linéaires. On peut également faire des embranchements et c'est là que le nom des composés va prendre toute son importance. Dans l'argument entre parenthèses de la commande \falseverb{\arrow}, si un nom est précédé de \og\verb-@-\fg, cela signifie que ce composé existe déjà. Plusieurs cas de figure peuvent se présenter :
+\begin{itemize}
+ \item \verb/(@n1--n2)/ : la flèche sera tracée depuis le composé existant \og\verb-n1-\fg{} et le schéma continuera à la suite de cette flèche, créant donc un embranchement;
+ \item \verb/(@n1--@n2)/ : la flèche est tracée entre deux composés existants, qu'ils soient déjà définis ou qu'ils soient définis plus tard dans le schéma réactionnel : cette syntaxe peut donc se placer \emph{n'importe où} dans le code du schéma réactionnel;
+ \item \verb/(n1--@n2)/ : cette syntaxe n'est pas admise;
+\end{itemize}
+
+Voici un exemple où 3 embranchements sont créés, l'un partant de «B», l'autre de «D» et le dernier de «X». À la fin, une flèche est tracée entre 2 composés existants \og XX\fg{} et \og D\fg{} :
+\exemple[50]{Embranchements}/\schemestart
+ A\arrow(aa--bb)B\arrow(--cc)C\arrow D
+ \arrow(@bb--xx1)[-90]X\arrow[-90]Y% 1er embranchement
+ \arrow(@c4--)[-90]Z\arrow W% 2è embranchement
+ \arrow(@xx1--xx2)[-45]XX% 3è embranchement
+ \arrow(@xx2--@c4)% flèche XX à D
+\schemestop/
+
+On pourrait vouloir que «Y» et «XX» soient sur une même horizontale. Pour cela, on va tracer une liaison invisible horizontale de «Y» à «XX» et finir le schéma par une flèche entre les deux composés existants «XX» et «D» :
+\exemple[50]{Embranchements}/\schemestart
+ A\arrow(aa--bb)B\arrow(--cc)C\arrow D
+ \arrow(@bb--xx1)[-90]X\arrow[-90]Y\arrow(--xx2){0}XX
+ \arrow(@c4--)[-90]Z\arrow W
+ \arrow(@xx1--@xx2)% flèche de X à XX
+ \arrow(@xx2--@c4)% flèche XX à D
+\schemestop/
+
+\section{Sous schéma}\label{subscheme}
+On peut placer une partie d'un schéma réactionnel dans une boîte englobante unique, considérée par \CF comme un composé. La commande \falseverb{\subscheme} dont l'argument obligatoire contient le sous schéma entre accolades permet de grouper un sous schéma comme un tout et lorsque \falseverb{\subscheme} se trouve après une flèche, la commande enveloppe ce sous schéma dans un composé portant le nom «c<n+1>» :
+\exemple[50]{Sous schéma}/\setchemfig{scheme debug=true}
+\schemestart
+ A\arrow
+ \subscheme{B\arrow[-90,2]C}
+ \arrow
+ D
+\schemestop/
+Bien que ça ne soit pas clair car les noms se superposent, la boîte contenant le sous schéma porte le nom «c2» et la numérotation se poursuit à l'intérieur du sous schéma «c3» pour B, «c4» pour C. Comme le premier composé du sous schéma est «B», la ligne de base du sous schéma est celle de «B». On peut le mettre en évidence en précisant les ancres :
+\exemple[50]{Sous schéma}/\setchemfig{scheme debug=true}
+\schemestart
+ A\arrow(--.mid west)
+ \subscheme{B\arrow[-90,2]C}
+ \arrow
+ D
+\schemestop/
+Il faut noter que la commande \falseverb\subscheme\Verb-{<scheme>}- n'étant rien d'autre qu'un raccourci pratique pour
+\begin{center}
+\falseverb\schemestart\Verb-<scheme>-\falseverb\schemestop
+\end{center}
+Par conséquent, \falseverb\subscheme{} admet les mêmes arguments optionnels que \falseverb\schemestart.
+
+\label{chemleft}\CF fournit la paire de commandes \falseverb{\chemleft} et \falseverb{\chemright} qui permettent de placer des délimiteurs extensibles de part et d'autre d'un matériel. Ces commandes doivent être suivies de délimiteurs, tout comme on en mettrait à la suite des primitives de \TeX{} \verb-\left- et \verb-\right- :
+\begin{center}
+ \Verb/\chemleft<car1><matériel>\chemright<car2>/
+\end{center}
+où \Verb-<car1>- et \Verb-<car2>- sont «(» et «)» ou «[» et «]» ou tout autre délimiteur extensible accepté par les commandes \verb-\left- et \verb-\right-.
+\exemple{Les macros \string\chemleft\ et \string\chemright}/\chemleft\lfloor\chemfig{A-[1]B}\chemright)
+
+\chemleft\{\chemfig{A-[1,1.25]B-[6,1.25]C}\chemright|
+
+\chemleft[\chemfig{H-[1]O-[7]H}\chemright]/
+Voici le code du schéma réactionnel vu précédemment où l'on utilise \falseverb{\chemleft} et \falseverb{\chemright} :
+\exemple{Schéma réactionnel avec \string\chemleft\ et \string\chemright}/\schemestart
+ A\arrow
+ \chemleft[\subscheme{B\arrow[-90,2]C}\chemright]
+ \arrow
+ D
+\schemestop/
+\label{chemup}Dans le même ordre d'idée, les macros \falseverb{\chemup} et \falseverb{\chemdown} fonctionnent de la même façon sauf que les délimiteurs extensibles sont positionnés au dessus et au dessous du matériel :
+\begin{center}
+ \Verb/\chemup<car1><matériel>\chemdown<car2>/
+\end{center}
+Voici un exemple :
+\exemple{Les macros \string\chemup\ et \string\chemdown}/\schemestart[-90]
+X\arrow
+\chemup\{\chemfig{A-[1]B-[7]C}\chemdown\}
+\arrow Y
+\schemestop
+\qquad
+\schemestart[-90]
+X\arrow
+\chemup[\chemfig{A-[1]B-[7]C}\chemdown]
+\arrow Y
+\schemestop/
+
+Avec les styles des composés, il est possible également possible de délimiter un composé quelconque (et donc un sous schéma) par des délimiteurs extensibles (parenthèses, crochets, accolades), ceci après avoir chargé la librairie de \TIKZ \og matrix\fg{} en mettant dans le préambule du document :
+
+\hfill\verb-\usetikzlibrary{matrix}-\hfill\null
+
+Comme les commandes \falseverb{\chemleft}, \falseverb{\chemright}, \falseverb{\chemup} et \falseverb{\chemdown} sont disponibles, l'extension \CF ne procède \emph{pas} à ce chargement, il appartient donc à l'utilisateur de le faire s'il souhaite avoir accès à ces délimiteurs.
+
+Voici le sous schéma précédent délimité par des crochets :
+\exemple[50]{les délimiteurs de la librairie «matrix»}/\schemestart
+ A\arrow(--[left delimiter={[}, right delimiter={]}])
+ \subscheme{B\arrow[-90,2]C}
+ \arrow
+ D
+\schemestop/
+Les délimiteurs étant tracés en dehors de la boîte englobante, il est souhaitable ici de raccourcir un peu les flèches arrivant et partant de ces délimiteurs :
+\exemple[50]{Sous schéma}/\schemestart
+ A\arrow(--[left delimiter={[},
+ right delimiter={]}])[,,shorten >=6pt]
+ \subscheme{B\arrow[-90,2]C}
+ \arrow[,,shorten <=6pt]
+ D
+\schemestop/
+
+Les sous schémas doivent être utilisés à bon escient et peuvent parfois donner des résultats non désirés. Voici un exemple où l'on se sert d'un sous schéma pour aligner horizontalement 3 composés :
+\exemple[50]{Sous schéma}/\setchemfig{scheme debug=true}
+\schemestart
+ A
+ \arrow{0}[-90]
+ \subscheme{%
+ tagada\arrow{}
+ tsoin\arrow{}
+ fin}
+ \arrow(xx--yy){}E
+ \arrow(@c1--@c3){}
+ \arrow(@c1--@c5){}
+ \arrow(@c1--@c4){}
+\schemestop/
+On constate que le centre du sous schéma est sur la même verticale que le centre du composé "A" puisqu'on a tracé une flèche invisible avec un angle de $-90$. Par contre, la flèche entre deux composés existants \og A\fg{} et \og tsoin\fg{} n'est \emph{pas} verticale car \og tsoin\fg{} ne se trouve pas sous le centre du sous-schéma puisque "tagada" est plus large que "fin". Pour rendre cette flèche verticale, on ne peut pas s'en sortir avec un sous schéma, sauf à spécifier un angle trouvé en tâtonnant pour l'ancre d'arrivée de la flèche invisible.
+
+Il sera beaucoup plus simple de procéder sans sous-schéma et en utilisant un embranchement : tracer une flèche \emph{visible} entre \og A\fg{} et \og tsoin\fg{}, puis partir de \og tsoin\fg{} pour tracer de part et d'autre des flèches horizontales, en créant un embranchement pour les flèches vers la droite.
+\exemple[50]{Sous schéma}/\setchemfig{scheme debug=true}
+\schemestart
+ A
+ \arrow(--tsoin){->}[-90]
+ tsoin
+ \arrow{<-}[180]
+ tagada
+ \arrow(@tsoin--fin){}
+ fin
+ \arrow{}
+ E
+ \arrow(@c1--@c3){}
+ \arrow(@c1--@fin){}
+\schemestop/
+
+\section{Arguments optionnels des flèches}\label{fleche.arg.optionnel}
+À l'intérieur de l'argument entre accolades de la commande \falseverb\arrow, le nom des flèches peut être suivi d'arguments optionnels placés entre crochets. Voici ces arguments optionnels et leur signification pour les flèches définies par \CF :
+\begin{itemize}
+ \item les flèches «\verb|->|», «\verb|<-|», «\verb|<->|», «\verb|<=>|», «\verb|<<->|»,«\verb|<->>|», «\verb|-/>|» ont trois arguments optionnels :
+ \begin{itemize}
+ \item le premier contient le «label» qui sera placé au dessus de la flèche;
+ \item le second contient le «label» qui sera placé sous la flèche. Ces deux labels sont orientés selon le même angle que la flèche. On peut régler le décalage perpendiculaire entre la flèche et l'ancre des labels avec la \chevrons{clé} \CFkv{arrow label sep}{dim}\label{arrow label sep} qui vaut 3pt par défaut. Les labels contenus dans les deux arguments optionnels ne \emph{sont pas} composés en mode mathématique.
+ \item le troisième est une dimension qui correspond au décalage dans la direction perpendiculaire au sens de la flèche que l'on veut lui faire subir : cette dimension sera positive pour un décalage de la flèche (et ses éventuels labels) vers le haut et négative si l'on souhaite un décalage vers le bas.
+ \end{itemize}
+ \item la flèche «\verb|-U>|» dispose de 5 arguments optionnels :
+ \begin{itemize}
+ \item les trois premiers sont identiques à ceux des autres types de flèches;
+ \item le quatrième est le coefficient (qui vaut 0.333 par défaut) qui multiplie la longueur de la flèche pour obtenir le rayon de l'arc de cercle;
+ \item le cinquième est le demi angle partant du centre de l'arc de cercle tracé, il vaut 60 degrés par défaut.
+ \end{itemize}
+ \item la flèche invisible «\verb-0-» admet 2 arguments optionnels qui sont du même type que les deux premiers vus au dessus;
+\end{itemize}
+\exemple[50]{Arguments optionnels des flèches}/\setchemfig{scheme debug=false}
+\schemestart A\arrow{->[sur][sous]}B \schemestop
+\qquad
+\schemestart A\arrow{->[sur][sous][4pt]}B \schemestop
+\qquad
+\schemestart A\arrow{->[sur][sous][-4pt]}B \schemestop
+\medskip
+
+\schemestart A\arrow{<=>[sur][sous]}[30,1.5]B \schemestop
+\medskip
+
+\schemestart[-20]
+ A\arrow{->}B\arrow{->[][][3pt]}C\arrow{->[][][-3pt]}D
+\schemestop/
+Un problème survient lorsque les flèches sont verticales :
+\exemple[50]{Flèches verticales}/\schemestart
+ A\arrow{->[sur][sous]}[-90]B
+\schemestop/
+Par souci de lisibilité, il serait souhaitable que les labels placés au dessus et au dessous soient horizontaux. On peut choisir l'angle selon lequel les labels sont affichés, la valeur par défaut étant l'angle de la flèche. Pour spécifier un autre angle, il suffit de placer au début des arguments optionnels \Verb-*{<angle>}- :
+\exemple[55]{Choix des angles}/\setchemfig{scheme debug=true}
+\schemestart A\arrow{->[*{0}sur][*{0}sous]}[90]B\schemestop
+\qquad
+\schemestart A\arrow{->[*{0}sur][*{0}sous]}[45]B\schemestop
+\qquad
+\schemestart A\arrow{->[*{0}sur][*{0}sous]}[-45]B\schemestop
+\qquad
+\schemestart A\arrow{->[*{0}sur][*{0}sous]}[-90]B\schemestop/
+L'ancre par défaut où est attaché chaque label provoque parfois des affichages indésirables :
+\exemple[50]{Ancres}/\setchemfig{scheme debug=true}
+\schemestart
+ A\arrow{->[*{0}au-dessus][*{0}au-dessous]}[45,2]B
+\schemestop/
+On peut spécifier également l'ancre d'attache pour écraser celui choisi par \CF par défaut. Il suffit d'utiliser la syntaxe suivante : \Verb-*{<angle>.<ancre>}-.
+\exemple[50]{Ancres}/\setchemfig{scheme debug=true}
+\schemestart
+ A\arrow{->[*{0.0}au-dessus][*{0.180}au-dessous]}[45,2]B
+\schemestop
+\qquad
+\schemestart
+ A\arrow{->[*{0.south east}au-dessus]%
+ [*{0.north west}au-dessous]}[45,2]B
+\schemestop/
+
+Le cas particulier à envisager est la flèche «\verb/-U>/». Si l'un des deux labels contenus dans les deux premiers arguments optionnels est présent, l'arc de cercle correspondant est tracé :
+\exemple[50]{La flèche \texttt{-U>}}/\schemestart A\arrow{-U>[123][456]}B\schemestop
+\qquad
+\schemestart A\arrow{-U>[123]}[30]B\schemestop
+\qquad
+\schemestart A\arrow{-U>[][456]}[-30]B\schemestop/
+
+Le quatrième et cinquième argument optionnel changent les dimensions de l'arc de cercle. Ils représentent respectivement le coefficient qui multiplie la longueur de la flèche pour obtenir le rayon et l'angle correspondant au demi arc de cercle (seule la valeur absolue de l'angle est prise en compte) :
+\exemple[50]{La flèche \texttt{-U>}}/\schemestart A\arrow{-U>[123][456][][0.25]}B\schemestop
+\qquad
+\schemestart A\arrow{-U>[123][456][][][90]}B\schemestop
+\qquad
+\schemestart A\arrow{-U>[123][456][][1][45]}B\schemestop/
+En mettant un rayon et un angle négatif, l'arc de cercle se situe sous la flèche :
+\exemple[50]{La flèche \texttt{-U>}}/\schemestart
+ A\arrow{-U>[123][456][][-0.333][-60]}B
+\schemestop/
+Les deux premiers arguments disposent des mêmes fonctionnalités concernant les angles d'affichage et les ancres paramétrables que ceux des autres flèches :
+\exemple[50]{La flèche \texttt{-U>}}/\schemestart
+ A\arrow{-U>[123][456]}[-90]B
+\schemestop
+\qquad
+\schemestart
+ A\arrow{-U>[*{0.180}123][*{0.180}456]}[-90]B
+\schemestop/
+
+\section{Créer ses propres flèches}\label{definearrow}
+Cette section, assez technique et demandant des connaissances sur \TIKZ, n'intéressera que les utilisateurs confirmés ayant besoin de définir leur propres flèches.
+
+La commande \falseverb{\definearrow} permet de construire des flèches personnalisées. La syntaxe de cette commande est la suivante :
+
+\hfill\Verb-\definearrow{<nombre>}{<nom flèche>}{<code>}-\hfill\null
+
+où \Verb-<nombre>- est le nombre d'arguments optionnels auxquels on fera référence dans le \Verb-<code>- avec la syntaxe habituelle \verb-#1-, \verb-#2-, etc. On ne peut pas définir de valeur par défaut pour ces arguments optionnels, et s'ils sont absents lorsque l'utilisateur utilise la macro \verb-\arrow-, ils seront vides.
+
+Avant d'aller plus loin, examinons les macros disponibles en interne lors du tracé des flèches. Comme ces macros ont le caractère «\verb-_-» dans leur nom, on ne peut y accéder qu'entre les commandes \verb|\catcode`\_=11| et \verb|\catcode`\_=8|.
+\begin{itemize}
+ \item \falseverb{\CF_arrowstartname} et \falseverb{\CF_arrowendname} contiennent les noms des composés (qui sont des nœuds pour \TIKZ) entre lesquels doit être tracée la flèche;
+ \item \falseverb{\CF_arrowstartnode} et \falseverb{\CF_arrowendnode} contiennent les noms des nœuds où seront placés les extrémités des flèches. À la suite de ces noms viennent s'ajouter, s'ils ne sont pas vides, les ancres spécifiés par l'utilisateur dans l'argument entre parenthèses de la commande \falseverb\arrow;
+ \item \falseverb{\CF_arrowcurrentstyle} et \falseverb{\CF_arrowcurrentangle} contiennent le style et l'angle de la flèche devant être tracée;
+ \item \falseverb{\CF_arrowshiftnodes}\Verb-{<dim>}- décale les nœuds «\falseverb{\CF_arrowstartnode}» et «\falseverb{\CF_arrowendnode}» de la dimension contenue dans son argument et ce, dans la direction perpendiculaire à la flèche;
+ \item \falseverb{\CF_arrowdisplaylabel}\verb/{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}/ est la plus complexe et se charge de placer les labels avec les arguments suivants :
+ \begin{itemize}
+ \item \verb-#1- et \verb-#5- sont les labels a écrire;
+ \item \verb-#2- et \verb-#6- sont des réels compris entre 0 et 1 spécifiant à quel endroit de la flèche ces labels doivent être écrits, 0 étant le début et 1 étant la fin,, le tout étant supposé que la flèche est \emph{rectiligne};
+ \item \verb-#3- et \verb-#7- sont les caractères «+» ou «-», «+» affichant le label au dessus et «-» l'affichant au dessous
+ \item \verb-#4- et \verb-#8- sont les nom des nœuds correspondant au début et à la fin de la flèche.
+ \end{itemize}
+ \item les extrémités de flèches employées sont basées sur le modèle «\verb-CF-» pour une flèche complète et avec l'option «harpoon» pour la demi flèche supérieure.
+\end{itemize}
+
+\subsection{Une première flèche}
+Pour créer un exemple, mettons que l'on veuille construire une flèche avec un disque en son milieu que l'on va appeler «\verb/-.>/». Décidons qu'elle admettra 4 arguments optionnels. Comme pour les flèches déjà définies, le premier et le second seront les labels à mettre au dessus et au dessous et le troisième sera le décalage de la flèche dans le sens perpendiculaire à sa direction. Enfin, le 4\ieme{} argument sera la taille du point que l'on prendra égale à 2pt si le 4\ieme{} argument est absent.
+
+Nous allons d'abord écrire \verb/\definearrow{4}{-.>}/ pour déclarer que la flèche aura 4 arguments optionnels et s'appellera \verb/-.>/. Tout d'abord, il faut modifier les positions des nœuds entre lesquels doit être tracée la flèche pour tenir compte du décalage contenu dans le 3\ieme{} argument. Ceci est réalisé par la macro \falseverb{\CF_arrowshiftnodes}, et il suffit donc de commencer le code de la flèche par : \falseverb{\CF_arrowshiftnodes}\verb-{#3}%-. Ensuite, il faut tracer la flèche elle même et en profiter pour poser un nœud au milieu du segment que nous appelons "\verb-mid@point-", puis tracer un cercle dont le centre est ce dernier nœud. Tout ceci est fait par le code \TIKZ suivant :
+
+{\hskip2em\verb-\edef\pt_radius{\ifx\empty#4\empty 2pt\else #4\fi}% rayon du point-\par\parskip0pt
+\hskip2em\verb/\expandafter\draw\expandafter[\CF_arrowcurrentstyle,-CF]/\par
+\hskip4em\verb/(\CF_arrowstartnode)--(\CF_arrowendnode)coordinate[midway](mid@point);/\par
+\hskip2em\verb-\filldraw(mid@point)circle(\pt_radius);%-}
+
+Il ne nous reste plus qu'à placer les labels s'ils existent avec la ligne suivante :
+
+\hskip2em\verb/\CF_arrowdisplaylabel{#1}{0.5}{+}{\CF_arrowstartnode}{#2}{0.5}{-}{\CF_arrowendnode}/
+
+Voici notre flèche achevée :
+\exemple*{Flèche «-.>»}/\catcode`\_11
+\definearrow4{-.>}{%
+ \edef\pt_radius{\ifx\empty#4\empty 2pt\else #4\fi}% rayon du point
+ \CF_arrowshiftnodes{#3}%
+ \expandafter\draw\expandafter[\CF_arrowcurrentstyle,-CF](\CF_arrowstartnode)--(\CF_arrowendnode)
+ coordinate[midway](mid@point);
+ \filldraw(mid@point)circle(\pt_radius);%
+ \CF_arrowdisplaylabel{#1}{0.5}{+}{\CF_arrowstartnode}{#2}{0.5}{-}{\CF_arrowendnode}
+ }
+\catcode`\_8
+\schemestart
+A \arrow{-.>} B \arrow{-.>[sur][sous][][1pt]} C \arrow{-.>[][sous]}[30] D \arrow{-.>[sur][][5pt][1.5pt]} E
+\schemestop/
+
+\subsection{Une flèche courbe}
+Pourquoi ne pas maintenant créer une flèche courbe ? Pour rendre les choses simples, mettons qu'elle n'aura qu'un seul argument optionnel contenant le code \TIKZ qui définira le (ou les) point de contrôle, et si cet argument est vide, une flèche du type «\verb/-CF/» sera tracée.
+
+Si l'argument \verb-#1- n'est pas vide, ce qui nous intéresse ne sont pas \falseverb{\CF_arrowstartnode} et \falseverb{\CF_arrowendnode} qui contiennent les noms des nœuds où seront placés les extrémités des flèches parce que l'emplacement des ces nœuds est déjà déterminés par les ancres qui sont calculés pour des flèches \emph{rectilignes} ! Nous allons plutôt prendre \falseverb{\CF_arrowstartname} et \falseverb{\CF_arrowendname} qui contiennent les noms des composés (qui sont des nœuds pour \TIKZ) entre lesquels doit être tracée la flèche. Voici le code \TIKZ qui va tracer la ligne courbe entre ces deux composés :
+
+{\verb/\draw[shorten <=\CF_arrowoffset,shorten >=\CF_arrowoffset,\CF_arrowcurrentstyle,-CF,/\par\parskip0pt
+\verb/(\CF_arrowstartname).. controls #1 ..(\CF_arrowendname);%/}
+
+On doit rajouter le code \TIKZ qui permet de raccourcir la flèche tracée de la valeur \falseverb{\CF_arrowoffset} définie par \falseverb{\setarrowoffset} puisqu'on ne part pas des nœuds correspondant aux flèches rectilignes \falseverb{\CF_arrowstartnode} et \falseverb{\CF_arrowendnode}. Il faudra donc rajouter au début de \falseverb{\CF_arrowcurrentstyle} le code suivant :
+\begin{center}
+ \verb/shorten <=\CF_arrowoffset, shorten >=\CF_arrowoffset/
+\end{center}
+c'est ce que font les deux lignes qui suivent le \verb-\else-.
+
+Voici donc notre flèche :
+\exemple*{Flèche courbe}/\catcode`\_11
+\definearrow1{s>}{%
+\ifx\empty#1\empty
+ \expandafter\draw\expandafter[\CF_arrowcurrentstyle,-CF](\CF_arrowstartnode)--(\CF_arrowendnode);%
+\else
+ \def\curvedarrow_style{shorten <=\CF_arrowoffset,shorten >=\CF_arrowoffset,}%
+ \CF_eaddtomacro\curvedarrow_style\CF_arrowcurrentstyle
+ \expandafter\draw\expandafter[\curvedarrow_style,-CF](\CF_arrowstartname)..controls#1..(\CF_arrowendname);
+\fi
+}
+\catcode`\_8
+\schemestart
+A\arrow{s>}
+B\arrow{s>[+(0.5cm,0.5cm)]}
+C\arrow{s>[+(45:1cm)]}
+D\arrow(.60--.120){s>[+(60:1cm) and +(-120:1cm)]}
+E\arrow{s>[+(45:1) and +(-135:1)]}
+F\arrow{s>[+(-30:1) and +(150:1)]}[,1.5]
+G\arrow(.90--.90){s>[+(60:1)and+(120:1)]}[,2]
+H
+\schemestop
+
+\schemestart
+A\arrow(.90--.180){s>[+(90:0.8) and +(180:0.8)]}[45]B
+\arrow(.0--.90){s>[+(0:0.8) and +(90:0.8)]}[-45]C
+\arrow(.-90--.0){s>[+(-90:0.8) and +(0:0.8)]}[-135]D
+\arrow(.180--.-90){s>[+(180:0.8) and +(-90:0.8)]}[135]
+\schemestop/
+
+\section{La commande \protect\texttt{\textbackslash merge}}
+La commande \falseverb{\merge} permet de tracer des flèches qui partent de plusieurs composés existants puis qui se rejoignent pour continuer le schéma réactionnel.
+
+Immédiatement après la commande \falseverb{\merge}, il faut spécifier dans quelle direction va se faire la progression. Pour cela, on utilise un des 4 caractères de direction : «\verb->-» (qui est celui par défaut si le caractère est absent), «\verb-<-», «\verb-^-» et «\verb-v-».
+
+La syntaxe devient ensuite :
+
+\hfill\verb/\merge{dir}(n1.a1)(n2.a2)(...)(ni.ai)--(n.a[s])/\hfill\null
+
+Où les noms «\verb-ni-» avant le double tiret sont ceux que des composés déjà existant que l'on veut joindre. On peut également préciser l'ancre «\verb-ai-» duquel doit partir la flèche si l'ancre par défaut ne convient pas. Comme pour la commande \falseverb\arrow, «\verb-n.a[s]-» contient le nom, l'ancre et le style du prochain composé.
+
+\exemple[50]{La commande \string\merge}/\schemestart
+ABC\arrow[30]EFGHIJ\arrow[45]KLM\arrow[60]NO
+\merge>(c1)(c2)(c3)--()suite 1
+\arrow suite 2
+\schemestop
+\bigskip
+
+\schemestart
+Foooo\arrow(foo--bar){<=>}Bar\arrow(--baz){<=>}Bz
+\merge^(foo)(bar)(baz)--()suite
+\schemestop
+\bigskip
+
+\setchemfig{scheme debug=true}
+\schemestart
+A\arrow{<->}[90]B
+\merge<(c1.120)(c2)--(foobar.45[circle,blue])CCC
+\schemestop/
+
+En ce qui concerne la géométrie de la flèche \falseverb{\merge}, celle-ci se compose de $n$ traits qui partent de chaque composé et vont jusqu'à la ligne de jonction qui leur est perpendiculaire : la longueur par défaut du plus court de ces traits est la moitié de l'espacement entre les composés défini avec \falseverb\setcompoundsep. La flèche tracée depuis la ligne de jonction jusqu'au composé suivant a également cette longueur par défaut, et elle part du milieu de la ligne de jonction. Ces 3 caractéristiques géométriques peuvent être modifiées au moyen de l'argument optionnel qui vient après le nom de composé suivant :
+
+\hfill\verb/\merge{dir}(n1.a1)(n2.a2)(...)(ni.ai)--(n.a[s])[c1,c2,c,style]/\hfill\null
+
+où :
+\begin{itemize}
+ \item la longueur de trait le plus court entre les composés à joindre et la ligne de jonction s'obtient en multipliant l'espacement entre les composés défini avec \falseverb{\setcompoundsep} par le coefficient \verb-c1-, qui vaut 0.5 par défaut;
+ \item la longueur de la flèche entre la ligne de jonction et le composé suivant s'obtient en l'espacement entre les composés par le coefficient \verb-c2-, qui vaut 0.5 par défaut;
+ \item l'endroit d'où part la flèche depuis la ligne de jonction est déterminée par le coefficient \verb-c-, sachant que s'il vaut 0, la flèche partira de la gauche de la ligne de jonction (ou du haut si la direction est \verb-v- ou \verb-^-);
+ \item le style de la flèche tracée avec \falseverb{\merge} est défini par le dernier argument \verb-style-.
+\end{itemize}
+
+\exemple*{Paramètres géométriques de \string\merge}/\schemestart A\arrow{<=>}[90]B\merge(c1)(c2)--()C\schemestop\qquad
+\schemestart A\arrow{<=>}[90]B\merge(c1)(c2)--()[1]C\schemestop\qquad
+\schemestart A\arrow{<=>}[90]B\merge(c1)(c2)--()[,1]C\schemestop\qquad
+\schemestart A\arrow{<=>}[90]B\merge(c1)(c2)--()[,,0.2]C\schemestop\qquad
+\schemestart A\arrow{<=>}[90]B\merge(c1)(c2)--()[,,0.9,red,thick]C\schemestop
+\bigskip
+
+\schemestart A\arrow{<=>}B\merge^(c1)(c2)--()C\schemestop\qquad
+\schemestart A\arrow{<=>}B\merge^(c1)(c2)--()[1]C\schemestop\qquad
+\schemestart A\arrow{<=>}B\merge^(c1)(c2)--()[,1]C\schemestop\qquad
+\schemestart A\arrow{<=>}B\merge^(c1)(c2)--()[,,0.2]C\schemestop\qquad
+\schemestart A\arrow{<=>}B\merge^(c1)(c2)--()[,,0.9,red,thick]C\schemestop/
+
+Enfin, il est possible d'écrire des labels au dessus ou au dessous de la flèche créée par la commande \falseverb{\merge}. Pour cela, le caractère définissant la direction admet deux arguments optionnels entre crochets, le premier contenant le label mis au dessus et le second celui mis au dessous de la flèche. La syntaxe complète de la commande \falseverb{\merge} est donc :
+
+\hfill\verb/\merge{dir}[labelup][labeldow](n1.a1)(n2.a2)(...)(ni.ai)--(n.a[s])[c1,c2,c,style]/\hfill\null
+
+Toutes les fonctionnalités déjà présentées pour les labels des flèches sont ici possibles, à savoir choisir l'angle de rotation et l'ancre avec la syntaxe \verb-*{angle.ancre}- placée juste avant le contenu du label.
+
+\exemple*{Labels de la commande \string\merge}/\schemestart
+ABC\arrow{<=>}[90]DEF\merge>[sur][sous](c1)(c2)--()[0.25,1,0.75]GHIJ
+\schemestop\qquad
+\schemestart
+ABC\arrow{<=>}[90]DEF\merge>[*{45.south west}sur][*{45.north east}sous](c1)(c2)--()[0.25,1,0.75]GHIJ
+\schemestop\qquad
+\schemestart
+ABC\arrow{<=>}[90]DEF\merge>[*{90}sur][*{90}sous](c1)(c2)--()[0.25,1,0.75]GHIJ
+\schemestop
+\bigskip
+
+\schemestart
+ABC\arrow{<=>}DEF\merge v[sur][sous](c1)(c2)--()[0.25,1,0.75]GHIJ
+\schemestop\qquad
+\schemestart
+ABC\arrow{<=>}DEF\merge v[*{45.north west}sur][*{45.south east}sous](c1)(c2)--()[0.25,1,0.75]GHIJ
+\schemestop\qquad
+\schemestart
+ABC\arrow{<=>}DEF\merge v[*{0}sur][*{0}sous](c1)(c2)--()[0.25,1,0.75]GHIJ
+\schemestop/
+
+\section{Le signe +}\label{signe+}
+Entre les commandes \falseverb{\schemestart} et \falseverb{\schemestop}, on dispose de la macro «\falseverb\+» qui affiche un signe ${}+{}$. Elle admet un argument optionnel \emph{entre accolades} contenant 3 dimensions sous cette forme \Verb-{<dim1>,<dim2>,<dim3>}- où :
+\begin{itemize}
+ \item \Verb-<dim1>- et \Verb-<dim2>- sont les dimensions qui vont être insérées avant et après le signe ${}+{}$;
+ \item \Verb-<dim3>- est le décalage vertical que l'on veut faire subir au signe.'
+\end{itemize}
+
+On peut également spécifier ces dimensions pour tous les signes ${}+{}$ à l'aide des \chevrons{clés} \CFkv{+ sep left}{dim}, \CFkv{+ sep right}{dim} et \CFkv{+ vshift}{dim}. Ces dimensions ont pour valeur par défaut 0.5em pour les deux premières et 0pt pour la troisième.
+
+\exemple[50]{La commande \string\+}/\schemestart
+A\+B\+{2em,,5pt}C\+{0pt,0pt,-5pt}D\arrow E\+F
+\schemestop
+
+\setchemfig{+ sep left=1em,+ sep right=1em,+ vshift=0pt}
+\schemestart
+A\+B\+{2em,,5pt}C\+{0pt,0pt,-5pt}D\arrow E\+F
+\schemestop/
+
+Comme on le voit sur l'exemple ci-dessous, il faut comprendre que le signe ${}+{}$ inséré par la commande \falseverb{\+} fait partie du composé :
+\exemple[50]{Les composés et \string\+}/\setchemfig{scheme debug=true}
+\schemestart A\+ B\+{,,5pt}C\arrow D\+ E\schemestop/
+Il devient donc difficile de faire partir une flèche exactement sous la lettre«A» puisque cette lettre n'est pas un composé unique aux yeux de \CF. On peut donc utiliser dans ce cas la commande \falseverb{\subscheme} pour envelopper dans un composé unique la lettre «A», voire même le signe lui même et pouvoir y faire référence par la suite avec le nom qui lui est attribué :
+\exemple[50]{Sous composé et \string\+}/\setchemfig{scheme debug=true}
+\schemestart
+\subscheme{A}\+ B\arrow C
+\arrow(@c2--)[-90]E
+\schemestop
+\medskip
+
+\schemestart
+A\subscheme{\+}BCDEF \arrow G
+\arrow(@c2--)[-90]H
+\schemestop/%
+
+Il peut arriver que l'alignement du signe «+» avec les molécules qui précèdent ou qui suivent pose problème. Voici un exemple :
+\exemple{Alignement du signe +}/\setchemfig{scheme debug=true}
+\schemestart
+ \chemfig{C(<[:40])(<[:160])=[6]C(<[:-130])<[:-20]}
+ \+
+ \chemfig{\lewis{246,Br}-\lewis{026,Br}}
+\schemestop/
+Ce qui se passe est que le signe «+» est sur la même ligne de base que le composé qui précède, et cette ligne de base est celle de l'atome «C» du haut. On pourrait bien sûr décaler le signe «+» mais cela ne changerait pas la position verticale de «\kern0.3333em\chemfig{\lewis{246,Br}-\lewis{026,Br}}\kern0.3333em». En fait, le signe «+» ne stoppe pas la lecture d'un composé pour \CF ce que l'on constate dans l'exemple ci-dessus où tout est englobé dans le composé «c1». On va donc être obligé de stopper le composé après la première molécule avec un \verb-\arrow{0}[,0]- qui produira une flèche invisible de longueur nulle. Pour centrer verticalement le tout, on va également préciser que l'ancre du premier composé doit être «west» (ou «180» qui est un synonyme) avec le deuxième argument optionnel de la commande \verb-\schemestart- :
+\exemple{Alignement du signe +}/\setchemfig{scheme debug=true}
+\schemestart[][west]
+ \chemfig{C(<[:40])(<[:160])=[6]C(<[:-130])<[:-20]}
+ \arrow{0}[,0]\+
+ \chemfig{\lewis{246,Br}-\lewis{026,Br}}
+\schemestop/
+De cette façon, le premier composé «c1» est la première molécule et le second composé est le reste, c'est-à-dire le signe «+» et la seconde molécule. On aurait pû jouer sur les ancres ou les styles via la commande \verb-\arrow- pour placer le second composé à un autre endroit. Ici, par exemple on décale le second composé de 10pt vers le bas dans le premier cas et on fait coïncider l'ancre «south east» du premier composé avec l'ancre «south west» du second dans le deuxième cas :
+\exemple{Alignement du signe +}/\setchemfig{scheme debug=true}
+\schemestart[][west]
+ \chemfig{C(<[:40])(<[:160])=[6]C(<[:-130])<[:-20]}
+ \arrow(--[yshift=-10pt]){0}[,0]\+
+ \chemfig{\lewis{246,Br}-\lewis{026,Br}}
+\schemestop
+\medskip
+
+\schemestart[][west]
+ \chemfig{C(<[:40])(<[:160])=[6]C(<[:-130])<[:-20]}
+ \arrow(.south east--.south west){0}[,0]\+
+ \chemfig{\lewis{246,Br}-\lewis{026,Br}}
+\schemestop/
+\newpage
+
+\part{Liste des commandes}
+Les commandes créées par \CF sont :
+\begin{center}
+\begin{longtable}{>\footnotesize l>\footnotesize p{9cm}}\\\hline
+\hfill\normalsize Commandes\hfill\null &\hfill\normalsize Description\hfill\null\\\hline
+\Verb-\chemfig[<paramètres>]{<code>}-&dessine la molécule dont le dessin est décrit par le \Verb-<code>-\\
+\Verb|\setchemfig{<paramètres>}|&règle les paramètres selon la syntaxe \chevrons{clé}$=$\chevrons{valeur}. En voici la liste avec les valeurs par défaut:
+\begin{itemize}
+ \item \CFkv{chemfig style} {{}}: style passé à \TIKZ
+ \item \CFkv{atom style} {{}}: style des nœuds (atomes)
+ \item \CFkv{bond join} {false}: booléen pour raccord de liaisons
+ \item \CFkv{fixed length} {false}: booléen pour liaisons de longueurs constantes
+ \item \CFkv{cram rectangle} {false}: booléen pour tracé des Liaisons de Cram sous forme de rectangle
+ \item \CFkv{cram width} {1.5ex}: dimension de la base des triangles des liaisons de Cram
+ \item \CFkv{cram dash width} {1pt}: largeur des pointillés des liaisons de Cram
+ \item \CFkv{cram dash sep} {2pt}: espacement des pointillés des liaisons de Cram
+ \item \CFkv{atom sep} {3em}: espacement entre atomes
+ \item \CFkv{bond offset} {2pt}: espacement entre l'atome et la liaison
+ \item \CFkv{double bond sep} {2pt}: espacement entre les traits des liaisons multiples
+ \item \CFkv{angle increment} {45}: incrément de l'angle des liaisons
+ \item \CFkv{node style} {{}}: style des atomes
+ \item \CFkv{bond style} {{}}: style des liaisons
+ \item \CFkv{lewis | width} {0.3ex}: largeur du rectangle pour la décoration | de Lewis
+ \item \CFkv{lewis sep} {0.4ex}: espacement entre l'atome et les décorations de Lewis
+ \item \CFkv{lewis length} {1.5ex}: longueur des décorations de Lewis
+ \item \CFkv{lewis style} {{}}: style des décorations de Lewis
+ \item \CFkv{lewis dist} {0.3em}: espacement entre les disques pour la décoration «\string:»
+ \item \CFkv{lewis radius} {0.15ex}: rayon des disques des décorations de Lewis
+ \item \CFkv{lewis diag coeff} {1}: coefficient multiplicatif de la distance dans les directions impaires
+ \item \CFkv{cycle radius coeff} {0.75}: coefficient du cercle ou de l'arc de cercle tracé dans les cycles
+ \item \CFkv{stack sep} {1.5pt}: espacement vertical pour les arguments des macros \verb-\chemabove- et \verb-\chembelow-
+ \item \CFkv{compound style} {{}}: style des composés
+ \item \CFkv{compound sep} {5em}: espacement entre 2 composés
+ \item \CFkv{arrow offset} {4pt}: espacement entre un composé et la flèche
+ \item \CFkv{arrow angle} {0}: angle par défaut des flèches de réaction
+ \item \CFkv{arrow coeff} {1}: coefficient de longueur des flèches
+ \item \CFkv{arrow style} {{}}: style des flèches
+ \item \CFkv{arrow double sep} {2pt}: espacement entre les flèches doubles
+ \item \CFkv{arrow double coeff} {0.6}: coefficient de réduction de la petite flèche pour les flèches doubles
+ \item \CFkv{arrow double harpoon}{true}: booléen pour le tracé des doubles flèches sous forme de «harpon»
+ \item \CFkv{arrow label sep} {3pt}: espacement entre la flèche et son texte
+ \item \CFkv{arrow head} {-CF}: style des pointes de flèches
+ \item \CFkv{+ sep left} {0.5em}: espacement avant le signe $+$
+ \item \CFkv{+ sep right} {0.5em}: espacement après le signe $+$
+ \item \CFkv{+ vshift} {0pt}: décalage vertical du signe $+$
+\end{itemize}
+\\
+\verb|\resetchemfig|&Restaure les paramètres à leurs valeurs par défaut\\
+\falseverb\printatom & cette macro affiche les atomes dans les molécules. Elle peut être redéfinie pour personnaliser l'affichage, voir page~\pageref{perso.affichage}\\
+\falseverb\hflipnext&la prochaine molécule sera inversée horizontalement\\
+\falseverb\vflipnext&la prochaine molécule sera inversée verticalement\\
+\Verb-\definesubmol{<nom>}<n>[<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}\\
+\falseverb\chemskipalign & Ignore le groupe d'atomes en cours pour le mécanisme d'alignement vertical. Voir page~\pageref{chemskipalign}.\\
+\Verb-\redefinesubmol{<nom>}<n>[<code1>]{<code2>}-& remplace l'alias déjà existant \Verb-!<nom>- par le nouveau \Verb-<code>-. Voir page~\pageref{redefinesubmol}\\[2ex]\hline
+&\\
+\Verb-\lewis[<paramètres>]{<codes>,<atome>}-& affiche l'\Verb-<atome>- et positionne les décorations de Lewis selon ce qui est spécifié dans le \Verb-<code>-. Les décorations dessinées ne modifient pas la boîte englobante de l'\Verb-<atome>-. Voir page~\pageref{lewis}\\
+\Verb-\Lewis[<paramètres>]{<codes>,<atome>}-& affiche l'\Verb-<atome>- et positionne les décorations de Lewis selon ce qui est spécifié dans le \Verb-<code>-. Voir page~\pageref{Lewis}\\
+\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}.\\[2ex]\hline
+&\\
+\Verb-\chemabove[<dim>]{<txt1>}{txt2}- & écrit le \Verb-<txt1>- et positionne le \Verb-<txt2>- au dessus en laissant \Verb-<dim>- d'espacement vertical. Cette commande ne change pas la boîte englobante de \Verb-<txt1>-. Voir page~\pageref{chemabove}\\
+\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-\Chemabove[<dim>]{<txt1>}{txt2}- & écrit le \Verb-<txt1>- et positionne le \Verb-<txt2>- au dessus en laissant \Verb-<dim>- d'espacement vertical. Voir page~\pageref{chemabove}\\
+\Verb-\Chembelow[<dim>]{<txt1>}{txt2}- & écrit le \Verb-{txt1}- et positionne le \Verb-<txt2>- au dessous en laissant \Verb-<dim>- d'espacement vertical. Voir page~\pageref{chembelow}\\
+\Verb-\chemname[<dim>]{<molécule>}{<nom>}- & Affiche le \Verb-<nom>- sous la \Verb-<molécule>-. Voir page~\pageref{chemname}\\
+\falseverb\chemnameinit & initialise la plus grande profondeur des molécules rencontrées pour avoir un alignement correct de leurs noms. Voir page~\pageref{chemnameinit}\\[2ex]\hline
+&\\
+\falseverb\schemestart\dots\falseverb\schemestop& balises entre lesquelles un schéma réactionnel est tracé. Voir page~\pageref{schemestart}.\\
+\falseverb\arrow& trace une flèche dans un schéma réactionnel (la commande n'est définie que dans un schéma réactionnel). Voir page~\pageref{arrow} et suivantes.\\
+\falseverb\+ & affiche un signe $+$ dans un schéma réactionnel (la commande n'est définie que dans un schéma réactionnel). Voir page~\pageref{signe+}.\\
+\Verb-\subscheme{<code>}- & trace un sous schéma réactionnel (la commande n'est définie que dans un schéma réactionnel). Voir page~\pageref{subscheme}.\\
+\falseverb\definearrow & définit une flèche. Voir page~\pageref{definearrow}.\\
+\Verb-\chemleft<car1><matériel>-\falseverb\chemright\Verb-<car1>-& trace des délimiteurs extensibles définis par \Verb-<car1>- et \Verb-<car2>- à gauche et à droite du \Verb-<matériel>-, voir page~\pageref{chemleft}.\\
+\Verb-\chemup<car1><matériel>-\falseverb\chemdown\Verb-<car1>-& trace des délimiteurs extensibles définis par \Verb-<car1>- et \Verb-<car2>- au dessus et au dessous du \Verb-<matériel>-, voir page~\pageref{chemup}.\\
+\Verb|\polymerdelim[<paramètres]{<nœud1>}{nœud2>}|& trace des délimiteurs aux nœuds spécifiés, voir page~\pageref{polymerdelim}\\\hline
+\end{longtable}
+\end{center}
+\newpage
+
+\part{Galerie}
+Ce manuel s'achève avec des dessins de molécules plus ou moins complexes.
+
+L'utilisateur curieux pourra s'intéresser au \Verb-<code>- de chaque molécule, bien que celui-ci devienne parfois rebutant lorsqu'elles deviennent complexes. En effet, au delà d'un certain niveau de complexité, bien qu'il soit est assez facile d'écrire un \Verb-<code>- pour dessiner une molécule, il est assez ardu de relire ce \Verb-<code>- pour l'analyser a posteriori. On atteint rapidement les limites de la lisibilité immédiate du code d'un dessin complexe.
+
+Quoi qu'il en soit, j'espère que cette extension aidera tous les utilisateurs de \LaTeX{} qui souhaitent dessiner des molécules chimiques. Bien que \CF ait été testé de façon approfondie et que le numéro de version soit supérieur à 1.0, j'espère que vous serez indulgent quant aux bugs rencontrés. Un \href{mailto:unbonpetit@netc.fr}{\texttt{\textbf{email}}} pour me signaler tout dysfonctionnement ou toute proposition d'amélioration sera bienvenu.\nobreak
+
+\hfill Christian \textsc{Tellechea}
+\bigskip
+
+\begin{center}
+\parskip0pt
+$\star$\par
+$\star\quad\star$
+\end{center}
+\bigskip
+
+\exemple*{2-methylpentane}/\chemfig{[7]H_3C-CH(-[6]CH_3)-[1]CH_2-CH_2-[1]CH_3}/
+
+\exemple*{3-éthyl-2-méthylhexane}/\chemfig{H_3C-[7]CH(-[6]CH_3)-[1]CH(-[7]C_3H_7)-[2]CH_2-[3]H_3C}/
+
+\exemple*{Stéarine, formule semi développée}/\definesubmol{@}{([0,2]-O-[0,1]C(=[2,1]O)-C_{17}H_{33})}
+\chemfig{[2,2]CH_2!@-CH_{\phantom 2}!@-CH_2!@}/
+
+\exemple*{Stéarine, formule topologique}/\definesubmol{x}{-[:+30,.6]-[:-30,.6]}
+\definesubmol{y}{-O-(=[2,.6]O)-!x!x!x!x!x!x!x!x}
+\chemfig{[2]([0]!y)-[,1.5]([0]!y)-[,1.5]([0]!y)}/
+
+\exemple*{2-méthylpropanoate de méthyl}/\chemfig{H_3C-CH_2(-[2]CH_3)-C(=[1]O)-[7]O-CH_3}/
+
+\exemple*{La vanilline}/\chemfig{HC*6(-C(-OH)=C(-O-[::-60]CH_3)-CH=C(-[,,,2]HC=[::-60]O)-HC=[,,2])} \quad ou \quad
+\chemfig{*6(-(-OH)=(-OCH_3)-=(-=[::-60]O)-=)}/
+
+\exemple*{La caféine}/\chemfig{*6((=O)-N(-CH_3)-*5(-N=-N(-CH_3)-=)--(=O)-N(-H_3C)-)}/
+
+\exemple*{L'aspirine}/\chemfig{*6(-=-(-O-[::-60](=[::-60]O)-[::+60])=(-(=[::+60])-[::-60]OH)-=)}/
+
+\exemple*{Anhydride phtalique}/\chemfig{*6(=*5(-(=O)-O-(=O)-)-=-=-)}/
+
+\exemple*{Camphre}/\chemfig{*6(-(<:[::120](-[::-100,0.7])(-[::100,0.7]))--(=O)-(-)(<:[::120])--)}
+\quad ou \quad
+\setchemfig{cram width=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*{Triphenylméthane}/\chemfig{*6(-=-*6(-(-*6(=-=-=-))-*6(=-=-=-))=-=)}
+\quad ou \quad
+\definesubmol{@}{*6(=-=-=-)}
+\chemfig{(-[:-30]!@)(-[:90]!@)(-[:210]!@)}/
+
+\exemple*{Amygdaline}/\setchemfig{cram width=2pt}
+\definesubmol{c1}{-[:200]-[:120]O-[:190]}
+\definesubmol{c2}{-[:170](-[:200,0.7]HO)<[:300](-[:170,0.6]HO)
+-[:10,,,,line width=2pt](-[:-40,0.6]OH)>[:-10]}
+\definesubmol{csub}{-[:155,0.65]-[:90,0.65]}
+\chemfig{O(!{c1}(!{csub}O(!{c1}(!{csub}OH)!{c2}))!{c2})-[:-30](-[:-90]CN)-[:30]*6(=-=-=-)}/
+
+\exemple*{Adénosine triphosphate}/\setchemfig{cram width=3pt}
+\definesubmol{a}{-P(=[::-90,0.75]O)(-[::90,0.75]HO)-}
+\chemfig{[:-54]*5((--[::60]O([::-60]!aO([::-60]!aO([::60]!aHO))))<(-OH)
+-[,,,,line width=2pt](-OH)>(-N*5(-=N-*6(-(-NH_2)=N-=N-)=_-))-O-)}/
+
+\exemple*{Viagra}/\chemfig{N*6((-H_3C)---N(-S(=[::+120]O)(=[::+0]O)-[::-60]*6(-=-(-O-[::-60]-[::+60]CH_3)
+=(-*6(=N-*5(-(--[::-60]-[::+60]CH_3)=N-N(-CH_3)-=)--(=O)-N(-H)-))-=))---)}/
+
+\exemple*{Ester de cholestérol}/\chemfig{[:30]R-(=[::+60]O)-[::-60]O-*6(--*6(=--*6(-*5(---(-(-[::+60]Me)
+-[::-60]-[::-60]-[::+60]-[::-60](-[::-60]Me)-[::+60]Me)-)-(-[::+0]Me)---)--)-(-[::+0]Me)---)}/
+
+\exemple*{Porphyrine}/\chemfig{?=[::+72]*5(-N=(-=[::-72]*5(-[,,,2]HN-[,,2](=-[::-36]*5(=N-(=-[::-72]*5(-NH-[,,1]?=-=))
+-=-))-=-))-=-)}/
+
+\exemple*{Manganese 5,10,15,20-tétra(N-ethyl-3-carbazolyl) porphyrine}/\definesubmol{A}{*6(=-*5(-*6(-=-=-)--N(--[::-60])-)=-=-)}
+\chemfig{([::+180]-!A)=[::+72]*5(-N=(-(-[::+54]!A)=[::-72]*5(-N(-[::-33,1.5,,,draw=none]Mn)
+-(=(-[::+72]!A)-[::-36]*5(=N-(=(-[::+54]!A)-[::-72]*5(-N-(-)=-=))-=-))-=-))-=-)}/
+
+\exemple*{Pénicilline}/\chemfig{[:-90]HN(-[::-45](-[::-45]R)=[::+45]O)>[::+45]*4(-(=O)-N*5(-(<:(=[::-60]O)
+-[::+60]OH)-(<[::+0])(<:[::-108])-S>)--)}/
+
+\exemple*{LSD}/\chemfig{[:150]?*6(=*6(--*6(-N(-CH_3)--(<(=[::+60]O)-[::-60]N(-[::+60]-[::-60])
+-[::-60]-[::+60])-=)([::-120]<H)---)-*6(-=-=-(-[::-30,1.155]\chembelow{N}{H}?)=))}/
+
+\exemple*{Strychnine}/\chemfig{*6(=-*6(-N*6(-(=O)--([::-120]<:H)*7(-O--=?[0]([::-25.714]-[,2]?[1]))
+-*6(-?[0,{>}]--(<N?[1]?[2])-(<[::-90]-[::-60]?[2]))(<:[::+0]H)-([::+120]<H))--?)=?-=-)}/
+
+\exemple*{Codéïne}/\chemfig{[:-30]**6(-(-OH)-?-*6(-(-[3]-[2,2]-[0,.5])*6(-(<:[:-150,1.155]O?)
+-(<:OH)-=-)-(<:[1]H)-(-[2]NCH_3)--)---)}/
+
+\exemple*{Colorant(rouge)}/\chemfig{**6(--*6(-(-NO_2)=-(-\lewis{26,O}-[0]H)=(-\lewis{4,N}=[0]\lewis{2,N}-[0]Ar)-)----)}/
+
+\exemple*{Menthone}/\chemfig{CH_3-?(-[2]H)(-[::-30,2]-[::+60](=[1]\lewis{20,O})
+-[::-150,1.5](-[:20]CH(-[1]CH_3)(-[7]CH_3))(-[6]H)-[::-90,2]-[::+60]?)}/
+
+\exemple*{Synthèse de Fischer de l'indole}/\schemestart
+ \chemfig{*6(=-*6(-\chembelow{N}{H}-NH_2)=-=-)}
+ \+
+ \chemfig{(=[:-150]O)(-[:-30]R_2)-[2]-[:150]R_1}
+ \arrow(.mid east--.mid west){->[\chemfig{H^+}]}
+ \chemfig{*6(-=*5(-\chembelow{N}{H}-(-R_2)=(-R_1)-)-=-=)}
+\schemestop/
+
+\exemple*{Mécanisme réactionnel : groupement carbonyle}/
+\schemestart
+ \chemfig{C([3]-)([5]-)=[@{db,.5}]@{atoo}\lewis{06,O}}
+ \arrow(.mid east--.mid west){<->}
+ \chemfig{\chemabove{C}{\scriptstyle\oplus}([3]-)([5]-)-\chemabove
+ {\lewis{026,O}}{\hspace{5mm}\scriptstyle\ominus}}
+\schemestop
+\chemmove{\draw[shorten <=2pt, shorten >=2pt](db) ..controls +(up:5mm) and +(up:5mm)..(atoo);}/
+
+\exemple*{Mécanismes réactionnels : dérivés nitrés}/\schemestart
+ \chemfig{R-\chembelow{N}{\hspace{-5mm}\scriptstyle\oplus}([1]=[@{db}]@{atoo1}O)([7]-[@{sb}]@{atoo2}
+ \chemabove{\lewis{157,O}}{\hspace{7mm}\scriptstyle\ominus})}
+ \arrow(.mid east--.mid west){<->}
+ \chemfig{R-\chemabove{N}{\hspace{-5mm}\scriptstyle\oplus}([1]-\chemabove{O}{\scriptstyle\ominus})([7]=O)}
+\schemestop
+\chemmove{
+ \draw[shorten <=2pt, shorten >=2pt](db) ..controls +(120:5mm) and +(120:5mm)..(atoo1);
+ \draw[shorten <=3pt, shorten >=2pt](atoo2) ..controls +(225:10mm) and +(225:10mm)..(sb);
+}/
+
+\exemple*{Addition nucléophile. Amines primaires}/\setchemfig{atom sep=2.5em,compound sep=5em}
+\schemestart
+ \chemfig{R-@{aton}\lewis{2,N}H_2}
+ \+
+ \chemfig{@{atoc}C([3]-CH_3)([5]-CH_3)=[@{atoo1}]O}
+ \chemfig{@{atoo2}\chemabove{H}{\scriptstyle\oplus}}
+ \chemmove[-stealth,shorten <=3pt,dash pattern= on 1pt off 1pt,thin]{
+ \draw[shorten >=2pt](aton) ..controls +(up:10mm) and +(left:5mm)..(atoc);
+ \draw[shorten >=8pt](atoo1) ..controls +(up:10mm) and +(north west:10mm)..(atoo2);}
+ \arrow{<=>[\tiny addition]}
+ \chemfig{R-@{aton}\chembelow{N}{\scriptstyle\oplus}H([2]-[@{sb}]H)-C(-[2]CH_3)(-[6]CH_3)-OH}
+\schemestop
+\chemmove{
+ \draw[-stealth,dash pattern= on 1pt off 1pt,shorten <=3pt, shorten >=2pt]
+ (sb)..controls +(left:5mm) and +(135:2mm)..(aton);}
+\par
+\schemestart
+ \arrow{<=>}
+ \chemfig{R-@{aton}\lewis{2,N}([6]-[@{sbh}]H)-[@{sb}]C(-[2]CH_3)(-[6]CH_3)-[@{sbo}]@{atoo}
+ \chemabove{O}{\scriptstyle\oplus}(-[1]H)(-[7]H)}
+ \chemmove[-stealth,shorten <=3pt,shorten >=2pt,dash pattern= on 1pt off 1pt,thin]{
+ \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);}
+ \arrow{<=>[\tiny élimination]}\chemfig{R-N=C(-[1]CH_3)(-[7]CH_3)}
+ \+
+ \chemfig{H_3\chemabove{O}{\scriptstyle\oplus}}
+\schemestop/
+
+\exemple*{Schéma réactionnel}/\setchemfig{atom sep=2em}
+\schemestart[-90]
+ \chemfig{**6(---(-NH _2)---)}\arrow{0}\chemfig{HNO_2}
+ \merge(c1)(c2)--()
+ \chemfig{**6(---(-N_2|{}^\oplus)---)}\arrow{0}\chemfig{**6(---(-NH _2)---)}
+ \merge(c3)(c4)--()
+ \chemfig{**6(---(-N=[::-30]N-[::-30]**6(---(-NH_2)---))---)}
+\schemestop/
+
+\exemple*{Réaction d'addition}/\setchemfig{atom sep=2.5em}
+\schemestart
+ \chemfig{*6(=-(-)(=[2]O))}
+ \arrow{->[\+\chemfig{H^\oplus}]}
+ \chemleft[\subscheme[90]{%
+ \chemfig{*6((-[2,0.33,,,draw=none]\scriptstyle\oplus)-=(-)-OH)}
+ \arrow{<->}
+ \chemfig{*6(=-(-)(-[6,0.33,,,draw=none]\scriptstyle\oplus)-OH)}}\chemright]
+ \arrow(@c3--)\chemfig{*6((-[2]R)-=(-)-OH)}
+ \arrow(@c4--)\chemfig{*6(=-(-)(-[6]R)-OH)}
+\schemestop/
+
+\exemple*{Substitution aromatique éléctrophile}Z\setchemfig{atom sep=1.5em}%
+\definesubmol{+}{-[,-0.4,,,draw=none]\oplus}%
+\schemestart
+ \arrow{0}[,0]
+ \chemleft[\subscheme{\chemfig{*6(=-=-(-[:120]Br)(-[:60]H)-(!+)-)}
+ \arrow{<->}
+ \chemfig{*6(-(!+)-=-(-[:120]Br)(-[:60]H)-=)}
+ \arrow{<->}
+ \chemfig{*6(-=-(!+)-(-[:120]Br)(-[:60]H)-=)}}\chemright]
+ \arrow(@c2--){<-[*0\chemfig{{-}AlBr_4|^\ominus}][*0\chemfig{Br_2/Al_2Br_3}]}[90,1.5]
+ \chemname{\chemfig{*6(-=-=-=-)}}{Benzène 1}
+ \arrow(@c4--){->[*0\chemfig{{-}H^\oplus}]}[90,1.5]
+ \chemname{\chemfig{*6(-=-=(-Br)-=-)}}{Bromobenzène 2}
+ \arrow(@c5.mid east--@c6.mid west)
+\schemestop
+\chemnameinit{}Z
+
+\exemple*{Mécanismes réactionnels de la chloration}/\scriptsize\setchemfig{bond offset=1pt,atom sep=2em,compound sep=4em}
+\schemestart
+ \chemfig{Cl-[4]@{a0}(=[@{a1}:120]@{a2}O)-[:-120](=[:-60]O)-[4]Cl}\+\chemfig{*6(-=-=(-@{oh1}OH)-=)}\arrow
+ \chemfig{*6((-O-[:150](-[@{o0}:150]@{o1}\lewis{6.,O})(-[@{cl0}:60]@{cl1}Cl)-[:240](-[4]Cl)=[6]O)=-=-=-)}
+ \arrow\chemfig{*6((-O-[:150](=[2]O)-[:-150](=[6]O)-[:150]Cl)=-=-=-)}\+\chemfig{HCl}
+ \arrow(@c1--){0}[-90,0.5]
+ \chemfig{*6(-=*6(-O-*6(-@{o2}(=[@{o3}]@{o4}O)-Cl)=)-=-=)}\+\chemfig{*6(-=-=(-@{oh2}OH)-=)}\arrow
+ \chemfig{*6(-=*6(-O-(-(-[@{cl2}:60]@{cl3}Cl)(-[@{o5}:-120]@{o6}\lewis{6.,O})-O-[::-40]*6(=-=-=-))=)-=-=)}
+ \kern-3em \arrow\chemfig{[:30]*6(=-(-O-[:-60](=O)-[:-120](=[4]O)-[:-60]O-*6(=-=-=-))=-=-)}
+ \kern-3em \+\chemfig{HCl}
+\schemestop
+\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);
+ \draw[shorten <=6pt,shorten >=2pt](o1)..controls+(270:5mm)and+(270:5mm)..(o0);
+ \draw[shorten <=2pt](cl0)..controls+(150:5mm)and+(150:5mm)..(cl1.150);
+ \draw[shorten <=2pt](o3)..controls +(30:3mm) and +(30:5mm)..(o4.east);
+ \draw[shorten >=2pt](oh2.135).. controls +(150:10mm) and +(90:10mm).. (o2);
+ \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}/\schemestart
+ \chemfig{[:-30]*6(=-=(-@{atoc}C([6]=[@{db}]@{atoo1}O)-H)-=-)}
+ \arrow(start.mid east--.mid west){->[\chemfig{@{atoo2}\chemabove{O}{\scriptstyle\ominus}}H]}
+ \chemmove[-stealth,shorten >=2pt,dash pattern=on 1pt off 1pt,thin]{
+ \draw[shorten <=8pt](atoo2) ..controls +(up:10mm) and +(up:10mm)..(atoc);
+ \draw[shorten <=2pt](db) ..controls +(left:5mm) and +(west:5mm)..(atoo1);}
+ \chemfig{[:-30]*6(=-=(-C([6]-[@{sb1}]@{atoo1}\chembelow{O}{\scriptstyle\ominus})([2]-OH)-[@{sb2}]H)-=-)}
+ \hspace{1cm}
+ \chemfig{[:-30]*6((-@{atoc}C([6]=[@{db}]@{atoo2}O)-[2]H)-=-=-=)}
+ \chemmove[-stealth,shorten <=2pt,shorten >=2pt,dash pattern=on 1pt off 1pt,thin]{
+ \draw([yshift=-4pt]atoo1.270) ..controls +(0:5mm) and +(right:10mm)..(sb1);
+ \draw(sb2) ..controls +(up:10mm) and +(north west:10mm)..(atoc);
+ \draw(db) ..controls +(right:5mm) and +(east:5mm)..(atoo2);}
+ \arrow(@start.base west--){0}[-75,2]
+ {}
+ \arrow
+ \chemfig{[:-30]*6(=-=(-C([1]-@{atoo2}O-[@{sb}0]@{atoh}H)([6]=O))-=-)}
+ \arrow{0}
+ \chemfig{[:-30]*6((-C(-[5]H)(-[7]H)-[2]@{atoo1}\chemabove{O}{\scriptstyle\ominus})-=-=-=)}
+ \chemmove[-stealth,shorten >=2pt,dash pattern=on 1pt off 1pt,thin]{
+ \draw[shorten <=7pt](atoo1.90) ..controls +(+90:8mm) and +(up:10mm)..(atoh);
+ \draw[shorten <=2pt](sb) ..controls +(up:5mm) and +(up:5mm)..(atoo2);}
+\schemestop/
+
+\begingroup
+\catcode`;=12
+\exemple*{Réarrangement de Beckmann}/\setchemfig{bond offset=1pt,atom sep=2.5em,compound sep=5em,arrow offset=6pt}
+\schemestart
+ \chemfig{(-[:-150]R')(-[:-30]R)=[2]N-[:30]OH}
+ \arrow{<=>[\chemfig{H^\oplus}]}
+ \chemfig{(-[@{a0}:-150]R')(-[:-30]R)=[2]@{a1}N-[@{b0}:30]@{b1}\chemabove{O}{\scriptstyle\oplus}H_2}
+ \chemmove[red,-stealth,red,shorten <=2pt]{
+ \draw(a0)..controls +(135:2mm) and +(215:4mm).. (a1);
+ \draw(b0)..controls +(120:2mm) and +(180:3mm).. ([yshift=7pt]b1.180);}
+ \arrow{<=>[\chemfig{{-}H_2O}]}[,1.1]
+ \chemleft[\subscheme[90]{%
+ \chemfig{R'-\chemabove{N}{\scriptstyle\oplus}~C-R}
+ \arrow{<->}[,0.75]
+ \chemfig{R'-\lewis{2:,N}=@{a1}\chemabove{C}{\scriptstyle\oplus}-R}}\chemright]
+ \arrow{<=>[\chemfig{H_2@{a0}\lewis{0:2:,O}}]}[,1.1]
+ \chemmove[red,-stealth,red,shorten <=3pt]{
+ \draw(a0)..controls+(90:10mm)and+(45:10mm)..([yshift=6pt]a1.45);}
+ \arrow(@c1--){0}[-90,0.333]
+ \chemfig{*6(R\rlap{$'$}-N=(-R)-\chemabove{O}{\scriptstyle\oplus} H_2)}
+ \arrow{<=>[\chemfig{{-}H^\oplus}]}
+ \chemfig{*6(R\rlap{$'$}-N=(-R)-OH)}
+ \arrow
+ \chemfig{*6(R\rlap{$'$}-\chembelow{N}{H}-(-R)(=[2]O))}
+\schemestop/
+\endgroup
+
+\exemple*{Schéma réactionnel}/\setchemfig{atom sep=1.5em,compound sep=4em}
+\schemestart
+ \chemfig{-[::30]=_[::-60](-[:: -60])-[::60]}
+ \arrow{->[\chemfig{HCl}]}
+ \chemfig{-[::30]-[::-60](-[::120]Cl)(-[::-60])-[::60]}\+\chemfig{-[::30](-[::60]Cl)-[::-60](-[::-60])-[::60]}
+ \arrow(@c1--.north west){->[\chemfig{H_2O}]}[-45,1.7]
+ \chemfig{-[::30]-[::-60](-[::120]OH)(-[::-60])-[::60]}\+\chemfig{-[::30](-[::60]OH)-[::-60](-[::-60])-[::60]}
+\schemestop/
+
+\exemple*{Estérification de l'acide formique}Z\tikzset{obrace/.style={left delimiter={[},inner sep=3pt},
+ cbrace/.style={right delimiter={]},inner sep=3pt},
+ braces/.style={left delimiter={[},right delimiter={]},inner sep=3pt}}
+\setchemfig{atom sep=2em}
+\schemestart
+ \chemfig{H-C(=[:60]O)-[:-60]O-H}
+ \arrow(--M1[obrace]){-U>[\scriptsize\chemfig{H_2SO_4^{}}][\scriptsize\chemfig{HSO_4^\ominus}][][.25]}%
+ [,1.5,shorten >=6pt]
+ \chemfig{H-@{a2}C(-[:60]O-H)(-[:30,.5,,,draw=none]{\scriptstyle\oplus})-[:-60]O-H}
+ \arrow(--[cbrace]){<->}
+ \chemfig{H-C(=[:60]\chemabove{O}{\scriptstyle\oplus}-H)-[:-60]O-H}
+ \arrow(@M1--){<=>[*{0}\scriptsize\chemfig{H-[:120]@{a1}O-[:60]CH_3}][*{0}\tiny addition]}[-90,1.33]
+ \chemfig{H-C(-[2]O-[:30]H)(-\chemabove{O}{\scriptstyle\oplus}(-[:60]CH_3)-[:-60]H)-[6]O-[:-30]H}
+ \arrow{<=>[\tiny protolysis]}[180]
+ \chemfig{H-C(-[2]O-[:30]H)(-O-CH_3)-[@{b1}6]@{a3}\chemabove{O}{\kern-4mm\scriptstyle\oplus}(-[:-150]H)-[:-30]H}
+ \arrow(--[obrace]){<=>[*{0}\scriptsize\chemfig{{-}H_2O}][*{0}\tiny elimination]}[-90,,shorten >=6pt]
+ \chemfig{H-C(-[:60]O-H)(-[,.5,,,draw=none]{\scriptstyle\oplus})-[:-60]O-CH_3}
+ \arrow(--[cbrace]){<->}
+ \chemfig{H-C(=[:60]\chemabove{O}{\scriptstyle\oplus}-H)-[:-60]O-CH_3}
+ \arrow{-U>[\scriptsize\chemfig{HSO_4^\ominus}][\scriptsize\chemfig{H_2SO_4^{}}][][.25]}[,1.5]
+ \chemfig{H-C(=[:60]O)-[:-60]O-CH_3}
+ \arrow(@M1--[yshift=-5pt]){0}[180,.5]{\tiny protolysis}
+ \chemmove[red,shorten <=3pt,shorten >=1pt]{
+ \draw(a1)..controls +(0:1.5cm)and+(0:3cm).. (a2);
+ \draw(b1)..controls +(0:5mm)and+(20:5mm)..(a3);}
+\schemestop Z
+
+\exemple*{Addition électrophile d'halogène sur l'oléfine}/\schemestart
+ \subscheme{%
+ \chemfig{C(<[:40])(<[:160])=[6]C(<[:-130])<[:-20]}
+ \arrow{0}[,0]\+\chemfig{\lewis{246,Br}-\lewis{026,Br}}}
+ \arrow(@c1--olefin){<=>[*{0}rapide]}[-90]
+ \chemfig{>[:-20]C(<[:40])=[@{db}6]C(<[:-130])<[:-20]}
+ \arrow(--bromonium){0}[-90]
+ \chemname{\chemfig{C*3((<)(<:[:-155])-\raise1.5pt\llap{$\scriptstyle\oplus$}\lewis{17,Br}-C(<:)(<[:155])-)}}
+ {bromonium ion}
+ \arrow(--carbeniumA){<<->}[,1.5]
+ \chemname{\chemfig{-[:-30]\chemabove{C}{\scriptstyle\oplus}(-[:30])-[6]C(<:[:-150])(<[:-100])-[:-30]
+ \lewis{157,Br}}}{Xarbenium ion}
+ \arrow(@bromonium--carbeniumB){<<->}[180,1.5]
+ \chemname{\chemfig{-[:-30]\chemabove{C}{\scriptstyle\oplus}(-[:30])-[6]C(<[:-150])
+ (<:[:-100])-[:-30]\lewis{137,Br}}}{carbenium ion}
+ \arrow(@olefin--){0}[,.25]
+ \chemfig{@{Br1}\chemabove[3pt]{\lewis{246,Br}}{\scriptstyle\delta\oplus}-[@{b2}]@{Br2}
+ \chemabove[3pt]{\lewis{026,Br}}{\scriptstyle\delta\ominus}}
+ \arrow(@olefin--[left]){0}[180,0]
+ $\pi$ complexe
+ \arrow(@carbeniumA--@olefin){<=>[lent, \chemfig{{-}Br^\ominus}]}
+ \arrow(@carbeniumB--@olefin){<=>[lent, \chemfig{{-}Br^\ominus}]}
+ \chemmove[-stealth,red,shorten <=3pt,shorten >=2pt]{
+ \draw(db) .. controls +(20:5mm) and +(135:5mm) .. (Br1);
+ \draw(b2) .. controls +(-90:5mm) and +(-120:5mm) .. (Br2);}
+\schemestop
+\chemnameinit{}/
+
+\exemple*{Sulfonation de la naphtalène}/\definesubmol\cycleoplus{-[,0.25,,,draw=none]\oplus}
+\definesubmol{so2oh}{S(=[::90]O)(=[::-90]O)-OH}
+\setchemfig{atom sep=2.5em}
+\schemestart[,1.5]
+ \chemname{\chemfig{*6(=-*6(-=-=-)=-=-)}}{Naphtalène}\+\chemfig{H_2SO_4}
+ \arrow(nph.mid east--.south west){->[80\degres C]}[45]
+ \chemname{\chemfig{*6(=-*6(-=-(!\cycleoplus)-(-SO_3H)-)=-=-)}}{Ion 1-arenium}
+ \arrow(.mid east--.mid west)
+ \chemname{\chemfig{*6(=-*6(-=-=(-!{so2oh})-)=-=-)}}{Acide 1-naphthalenesulfonique}
+ \arrow(@nph.mid east--.north west){->[160\degres C]}[-45]
+ \chemname{\chemfig{*6(=-*6(-=-(-SO_3H)-(!\cycleoplus)-)=-=-)}}{Ion 2-arenium}\kern-4em
+ \arrow(.mid east--.mid west)
+ \chemname{\chemfig{*6(=-*6(-=-(-!{so2oh})=-)=-=-)}}{Acide 2-naphthalenesulfonique}
+\schemestop
+\chemnameinit{}/
+
+\begingroup\catcode`;12
+\exemple*{Schéma explicatif}/\parbox{0.8\linewidth}{%
+ \hspace{10em}
+ \tikz[remember picture]\node(n0){\chemname{}{Attaques\\nucléophiles}};\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{-}}
+ \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
+ \vspace{6ex}\hspace{8em}
+ \chemname{}{Propriétés acides des atomes\tikz[remember picture]\node(n3){};
+ \\d'hydrogène en position $\alpha$}
+ \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);
+ }%
+}
+\chemnameinit{}/
+\endgroup
+
+\exemple*{Taxotère}/\chemfig{-[::-30](-[5])(-[7])-[::+60]-[::-60]O-[::+60](=[::-45]O)-[::+90]HN>:[::-60](-[::+60]**6(------))
+-[::-30](<:[2]OH)-[::-60](=[6]O)-[::+60]O>:[::-60]*7(---?(<[::-120]OH)-(<|[1]CH_3)(<:[::-90]CH_3)
+-(-[1](<[::+80]HO)-[0](=[::+60]O)-[7](<|[::+130]CH_3)(-[::+75](<|[2]OH)-[::-60]-[::-60](<[::+30]O-[::-90])
+-[::-60](<[::+90])(<:[::+30]O-[7](-[6]CH_3)=[0]O)-[::-60])-[6]-[5,1.3]?(<:[7]O-[5](=[::-60]O)
+-[6]**6(------)))=(-[2]CH_3)-)}/
+\end{document} \ No newline at end of file
diff --git a/macros/generic/chemfig/chemfig.sty b/macros/generic/chemfig/chemfig.sty
new file mode 100644
index 0000000000..48e93146eb
--- /dev/null
+++ b/macros/generic/chemfig/chemfig.sty
@@ -0,0 +1,7 @@
+\RequirePackage{tikz}
+\input chemfig.tex
+\ProvidesPackage\CFname[\CFdate\space v\CFver\space Draw molecule with an easy syntax (CT)]
+\def\printatom#1{\ensuremath{\mathrm{#1}}}% \printatom pour LaTeX.
+\expandafter\def\csname CF\string_begintikzpicture\endcsname{\begin{tikzpicture}}%
+\expandafter\def\csname CF\string_endtikzpicture\endcsname{\end{tikzpicture}}%
+\endinput \ No newline at end of file
diff --git a/macros/generic/chemfig/chemfig.tex b/macros/generic/chemfig/chemfig.tex
new file mode 100644
index 0000000000..046428adc6
--- /dev/null
+++ b/macros/generic/chemfig/chemfig.tex
@@ -0,0 +1,2846 @@
+% !TeX encoding = ISO-8859-1
+% Ce fichier contient le code de l'extension "chemfig"
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %
+\def\CFname {chemfig} %
+\def\CFver {1.41} %
+% %
+\def\CFdate {2019/05/21} %
+% %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+%____________________________________________________________________
+% Author : Christian Tellechea |
+% Status : Maintained |
+% Email : unbonpetit@netc.fr |
+% Package URL: https://www.ctan.org/pkg/chemfig |
+% Bug tracker: https://framagit.org/unbonpetit/chemfig/issues |
+% Repository : https://framagit.org/unbonpetit/chemfig/tree/master |
+% Copyright : Christian Tellechea 2010-2019 |
+% Licence : Released under the LaTeX Project Public License v1.3c |
+% or later, see http://www.latex-project.org/lppl.txt |
+% Files : 1) chemfig.tex |
+% 2) chemfig.sty |
+% 3) t-chemfig.tex |
+% 4) README |
+% 5) chemfig_doc_fr.tex |
+% 6) chemfig_doc_fr.pdf |
+% 7) chemfig_doc_en.tex |
+% 8) chemfig_doc_fr.pdf |
+%--------------------------------------------------------------------
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%% P R É A L A B L E %%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%-------------------------- Annonce package --------------------------
+\ifdefined\ProvidesPackage\else
+ \immediate\write -1 {%
+ Package: \CFname\space\CFdate\space\space v\CFver\space\space
+ Draw molecule with an easy syntax (CT)}%
+\fi
+
+%-------------------------- Régime catcodes --------------------------
+\begingroup
+ \def\X#1{\catcode\number`#1=\number\catcode`#1\relax}
+ \xdef\CFrestorecatcode{\X\[\X\]\X\:\X\(\X\)\X\,\X\-\X\=\X\~\X\!\X\?\X\<\X\>\X\;\X\*\X\|\X\@\X\ \X\_}%
+\endgroup
+\catcode`\[12 \catcode`\]12 \catcode`\:12 \catcode`\(12
+\catcode`\)12 \catcode`\,12 \catcode`\-12 \catcode`\=12
+\catcode`\~12 \catcode`\!12 \catcode`\?12 \catcode`\<12
+\catcode`\>12 \catcode`\;12 \catcode`\*12 \catcode`\|12
+\catcode`\@12 \catcode`\#6 \catcode`\ 10 \catcode`\_11
+
+%-------------------- Vérification des prérequis ---------------------
+\def\CF_error#1{\errmessage{Package \CFname\space Error: #1.}}
+\def\CF_checkprimitive#1#2#3{% Vérifie que #1 est une primitive et sinon, émet le message #2 et exécute #3
+ \begingroup
+ \edef\__tempa{\meaning#1}\edef\__tempb{\string#1}\expandafter
+ \endgroup
+ \ifx\__tempa\__tempb\else
+ \CF_error{#2}%
+ \def\CF_temp{#3}%
+ \CFrestorecatcode\expandafter\CF_temp
+ \fi
+}
+\CF_checkprimitive\eTeXversion
+ {You are not using an eTeX engine, \CFname\space cannot work.}
+ {\endinput}%
+\CF_checkprimitive\expanded
+ {the \string\expanded\space primitive is not provided by your TeX engine, \CFname\space v\CFver\space cannot work: loading \CFname\space v1.4}
+ {\input chemfigold.tex\relax\endinput}%
+
+%------------------------ Chargement simplekv ------------------------
+\unless\ifdefined\skvname
+ \begingroup\def\CFtemp{\endgroup\input simplekv.tex\relax}%
+ \expandafter\CFtemp
+\fi
+
+%-------------------------- Chargement tikz --------------------------
+\unless\ifdefined\tikzpicture
+ \begingroup\def\CFtemp{\endgroup\input tikz.tex\relax}%
+ \expandafter\CFtemp
+\fi
+\usetikzlibrary{arrows.meta}
+
+%--------------------------- Allocations -----------------------------
+\newcount\CF_cntatomgroup
+\newcount\CF_cntgroup
+\newcount\CF_cntatom
+\newcount\CF_cntcycle
+\newcount\CF_cntcompound
+
+\newif\ifCF_incycle
+\newif\ifCF_cyclearc
+\newif\ifCF_definesubmol
+\newif\ifCF_adjustnamedp
+\newif\ifCF_macrofixedbondlength
+\newif\ifCF_lewisoverlay
+
+\newdimen\CF_dim
+\newdimen\CF_arrowsize
+\newdimen\CF_zero \CF_zero=0pt
+
+\newbox\CF_boxlewis
+\newbox\CF_box
+\newbox\CF_boxstuff
+
+\newtoks\CF_substtoks
+
+%-------------------------- Petites macros ---------------------------
+\let\CF_begintikzpicture\tikzpicture
+\let\CF_endtikzpicture \endtikzpicture
+\def\CF_quark{\CF_quark}
+\def\CF_execfirst#1#2{#1}
+\def\CF_execsecond#1#2{#2}
+\def\CF_id#1{#1}
+\def\CF_gobarg#1{}
+\def\CF_gobtwoargs#1#2{}
+\def\CF_firsttonil#1#2\_nil{#1}
+\def\CF_sanitizelastitem#1,\empty#2\_nil{#1}
+\def\CF_gobtikzinstruction#1;{}
+\def\CF_makeother#1{\catcode`#1=12\relax}
+\def\CF_lettoken#1#2{\let#1= #2}\CF_lettoken\CF_sptoken{ }
+\def\CF_ifx#1#2{\ifx#1#2\expandafter\CF_execfirst\else\expandafter\CF_execsecond\fi}
+\def\CF_ifempty#1{\ifx\empty#1\empty\expandafter\CF_execfirst\else\expandafter\CF_execsecond\fi}
+\def\CF_ifnum#1{\ifnum#1\expandafter\CF_execfirst\else\expandafter\CF_execsecond\fi}
+\def\CF_doifempty#1{\ifx\empty#1\empty\expandafter\CF_id\else\expandafter\CF_gobarg\fi}
+\def\CF_doifnotempty#1{\ifx\empty#1\empty\expandafter\CF_gobarg\else\expandafter\CF_id\fi}
+\def\CF_gobtonil#1\_nil{}
+\edef\CFhash{\string#}
+\begingroup
+ \catcode`\_8
+ \expandafter\gdef\csname CF\string_underscore\endcsname{_}
+\endgroup
+\def\CF_threeea{\expandafter\expandafter\expandafter}
+\def\CF_exptwomacroargs#1#2#3{\CF_expsecond{\CF_expsecond#1{#2}}{#3}}
+\def\CF_expthreemacroargs#1#2#3#4{\CF_expsecond{\CF_exptwomacroargs#1{#2}{#3}}{#4}}
+\def\CF_swaparg#1#2{#2{#1}}
+\def\CF_expsecond#1#2{\expandafter\CF_swaparg\expandafter{#2}{#1}}% \CF_expsecond<{arg1>}{<arg2>} donne "<arg1>{*<arg2>}"
+\def\CF_eexpsecond#1#2{\expandafter\expandafter\expandafter\CF_swaparg\expandafter\expandafter\expandafter{#2}{#1}}% \CF_eexpsecond{<arg1>}{<arg2>} donne "<arg1>{**<arg2>}"
+\def\CF_swapunbrace#1#2{#2#1}
+\def\CF_expafter#1#2{\expandafter\CF_swapunbrace\expandafter{#2}{#1}}% \CF_expafter{<arg1>}{<arg2>} donne "<arg1>*<arg2>"
+\def\CF_eexpafter#1#2{\expandafter\expandafter\expandafter\CF_swapunbrace\expandafter\expandafter\expandafter{#2}{#1}}% \CF_eexpafter{<arg1>}{<arg2>} donne "<arg1>**<arg2>"
+\def\CF_addtomacro#1#2{\CF_expsecond{\def#1}{#1#2}}
+\def\CF_eaddtomacro#1#2{\CF_expsecond{\CF_addtomacro#1}{#2}}
+\def\CF_preaddtomacro#1#2{\CF_expsecond{\CF_preaddtomacroa#1{#2}}#1}
+\def\CF_preaddtomacroa#1#2#3{\def#1{#2#3}}
+\def\CF_addtotoks#1#2{#1\expandafter{\the#1#2}}
+\def\CF_eaddtotoks#1#2{\expandafter\CF_addtotoks\expandafter#1\expandafter{#2}}
+\def\CF_assigntonil#1#2\_nil{\def#1{#2}}
+\def\CF_edefaddtomacro#1#2{\CF_expsecond{\CF_addtomacro#1}{\expanded{#2}}}
+\def\CF_ifnextchar#1#2#3{%
+ \let\CF_ifnextchartok=#1% <- espace indésirable, bugfix v1.31
+ \def\CF_ifnextcharcodetrue{#2}%
+ \def\CF_ifnextcharcodefalse{#3}%
+ \futurelet\CF_temptok\CF_ifnextchara
+}
+\def\CF_ifnextchara{%
+ \CF_ifx\CF_temptok\CF_sptoken
+ {\CF_ifnextcharb
+ }
+ {\CF_ifx\CF_temptok\CF_ifnextchartok
+ \CF_ifnextcharcodetrue
+ \CF_ifnextcharcodefalse
+ }%
+}
+\expandafter\def\expandafter\CF_ifnextcharb\space{\futurelet\CF_temptok\CF_ifnextchara}
+\def\CF_ifstar#1{\CF_ifnextchar*{\CF_execfirst{#1}}}
+\def\CF_testopt#1#2{\CF_ifnextchar[{#1}{#1[{#2}]}}
+\def\CF_warning#1{\immediate\write-1{Package \CFname\space Warning: #1^^J}}
+\def\CF_ifinteger#1{%
+ \begingroup
+ \afterassignment\CF_afterinteger
+ \CF_cntcycle0#1\relax
+}
+\def\CF_afterinteger#1\relax{%
+ \endgroup
+ \CF_ifempty{#1}%
+}
+\def\CF_iffirsttokmatch#1#2{% est ce que #1 et #2 commencent par les mêmes tokens ?
+ \futurelet\CF_toksa\CF_gobtonil#1\relax\_nil
+ \futurelet\CF_toksb\CF_gobtonil#2\relax\_nil
+ \CF_ifx\CF_toksa\CF_toksb
+}
+\def\CF_iffirsttokin#1{% teste si le token qui commence #1 appartient aux tokens mis dans #2
+ \futurelet\CF_toksa\CF_gobtonil#1\relax\_nil
+ \CF_iffirsttokina
+}
+\def\CF_iffirsttokina#1{%
+ \CF_ifempty{#1}
+ {\CF_execsecond
+ }
+ {\futurelet\CF_toksb\CF_gobtonil#1\relax\_nil
+ \CF_ifx\CF_toksa\CF_toksb
+ {\CF_execfirst}
+ {\CF_expsecond\CF_iffirsttokina{\CF_gobarg#1}}%
+ }%
+}
+\def\CF_ifinstr#1#2{%
+ \def\CF_ifinstra##1#2##2\_nil{%
+ \ifx\empty##2\empty
+ \expandafter\CF_execsecond
+ \else
+ \expandafter\CF_execfirst
+ \fi}%
+ \CF_ifinstra#1\__nil#2\_nil
+}
+\def\CF_afterspace#1 #2\_nil{#2}
+\def\CF_valuetomacro#1[#2]#3{% #1= macro #2=valeur défaut #3=clé
+ \CF_eexpsecond{\def#1}{\useKV[chemfig]{#3}}%
+ \CF_ifx#1\empty
+ {\def#1{#2}}
+ {}%
+}
+
+%--------------------------- Substitution ----------------------------
+\def\CF_ifstartwith#1#2{% #1=<texte> #2=<motif>
+ \CF_ifempty{#1}%
+ {\CF_execsecond
+ }
+ {\def\CF_startwithcode{#1}%
+ \def\CF_startwithpattern{#2}%
+ \CF_ifstartwitha
+ }%
+}
+\def\CF_ifstartwitha{%
+ \CF_grabfirstarg\CF_startwithcode\CF_firstargcode
+ \CF_grabfirstarg\CF_startwithpattern\CF_firstargpattern
+ \CF_ifx\CF_firstargcode\CF_firstargpattern
+ {\CF_expsecond\CF_ifempty\CF_startwithpattern
+ {\CF_execfirst
+ }
+ {\CF_expsecond\CF_ifempty\CF_startwithcode
+ \CF_execsecond
+ \CF_ifstartwitha
+ }%
+ }
+ {\CF_execsecond
+ }%
+}
+\def\CF_grabfirstarg#1#2{%
+ \CF_ifx#1\empty
+ {\let#2\empty
+ }
+ {\def\CF_grabmacro{#2}%
+ \CF_expsecond\CF_ifbracefirst#1%
+ {\expandafter\CF_grabbracearg#1\_nil#1}
+ {\CF_expafter{\futurelet\CF_nexttok\CF_grabfirstarga}#1\_nil#1}%
+ }%
+}
+\def\CF_grabfirstarga{%
+ \CF_ifx\CF_nexttok\CF_sptoken
+ \CF_grabspacearg
+ \CF_grabnormalarg
+}
+\def\CF_grabbracearg#1{%
+ \expandafter\def\CF_grabmacro{{#1}}%
+ \CF_grabargassigntonil\relax
+}
+\expandafter\def\expandafter\CF_grabspacearg\space{%
+ \expandafter\def\CF_grabmacro{ }%
+ \CF_grabargassigntonil\relax
+}
+\def\CF_grabnormalarg#1{%
+ \expandafter\def\CF_grabmacro{#1}%
+ \CF_grabargassigntonil\relax
+}
+\def\CF_grabargassigntonil#1\_nil#2{\CF_expsecond{\def#2}{\CF_gobarg#1}}
+\def\CF_ifbracefirst#1{\CF_ifnum{\catcode\CF_threeea`\expandafter\CF_firsttonil\detokenize{#1.}\_nil=1 }}
+\def\CF_substonly#1#2{% #1=entier maxi>0 #2=macro : dans la sc#1, remplace tous les <motif> par <pattern> sauf lorsque le motif est suivi d'un caractère >#1
+ \def\CF_atendsubstitute{\edef#2{\the\CF_substtoks}}% macro exécutée à la fin
+ \let\CF_substnogroups\CF_substnogrouponly
+ \CF_ifnum{#1>0 }
+ {\let\CF_testifx\empty
+ \foreach\CF_x in {1,...,#1}{\xdef\CF_testifx{\unexpanded\expandafter{\CF_testifx}\unexpanded\expandafter{\expandafter\ifx\CF_x\CF_nexttok1\fi}}}%
+ \let\CF_testif\empty
+ \foreach\CF_x in {1,...,#1}{\xdef\CF_testif{\unexpanded\expandafter{\CF_testif}\unexpanded\expandafter{\expandafter\if\CF_x\CF_nexttok1\fi}}}%
+ \CF_expsecond\CF_substi#2%
+ }
+ {\CF_substall#2%
+ }%
+}
+\def\CF_substnogrouponly{%
+ \CF_exptwomacroargs\CF_ifstartwith\CF_substcode\CF_substsubst
+ {\CF_grabfirstarg\CF_substcode\CF_temp
+ \CF_expafter{\futurelet\CF_nexttok\CF_gobtonil}\CF_substcode\relax\_nil
+ \CF_ifnum{0\CF_testifx=1 }% si le prochain token est \let-égal à 1...#1
+ {\edef\CF_nexttok{\CF_threeea\CF_firsttonil\expandafter\string\CF_substcode\_nil}% le détokéniser
+ \CF_ifnum{0\CF_testif=1 }
+ {\CF_eaddtotoks\CF_substtoks\CF_temp
+ \CF_grabfirstarg\CF_substcode\CF_temp
+ \CF_eaddtotoks\CF_substtoks\CF_temp
+ }
+ {\CF_eaddtotoks\CF_substtoks\CF_substpattern
+ }%
+ }
+ {\CF_eaddtotoks\CF_substtoks\CF_substpattern
+ }%
+ \CF_substgroups
+ }
+ {\CF_expsecond\CF_ifempty\CF_substcode
+ {\CF_atendsubstitute
+ }
+ {\CF_grabfirstarg\CF_substcode\CF_substauxarg
+ \CF_eaddtotoks\CF_substtoks\CF_substauxarg
+ \CF_substgroups
+ }%
+ }%
+}
+\def\CF_substall#1{% #1=macro
+ \def\CF_atendsubstitute{\edef#1{\the\CF_substtoks}}% macro exécutée à la fin
+ \let\CF_substnogroups\CF_substnogroupall
+ \CF_expsecond\CF_substi#1%
+}
+\def\CF_substnogroupall{%
+ \CF_exptwomacroargs\CF_ifstartwith\CF_substcode\CF_substsubst
+ {\CF_eaddtotoks\CF_substtoks\CF_substpattern
+ \CF_grabfirstarg\CF_substcode\CF_temp
+ \CF_substgroups
+ }
+ {\CF_expsecond\CF_ifempty\CF_substcode
+ {\CF_atendsubstitute
+ }
+ {\CF_grabfirstarg\CF_substcode\CF_substauxarg
+ \CF_eaddtotoks\CF_substtoks\CF_substauxarg
+ \CF_substgroups
+ }%
+ }%
+}
+\def\CF_substi#1#2#3{% #1=<texte> #2=<motif> #3=<motif de substi>
+ \def\CF_substcode{#1}\def\CF_substsubst{#2}\def\CF_substpattern{#3}%
+ \CF_substtoks={}%
+ \CF_substgroups
+}
+
+\def\CF_substgroups{%
+ \CF_expsecond\CF_ifbracefirst\CF_substcode
+ {\CF_grabfirstarg\CF_substcode\CF_substauxarg
+ \begingroup
+ \def\CF_atendsubstitute{%
+ \expandafter\endgroup\expandafter\CF_addtotoks\expandafter\CF_substtoks\expandafter{\expandafter{\the\CF_substtoks}}%
+ \CF_substgroups
+ }%
+ \CF_substtoks{}% initialiser à vide
+ \expandafter\def\expandafter\CF_substcode\CF_substauxarg
+ \CF_substgroups
+ }%
+ {\CF_substnogroups
+ }%
+}
+
+%---------------------------- Paramètres -----------------------------
+\def\setchemfig{\setKV[chemfig]}
+\def\resetchemfig{%
+ \setKVdefault[chemfig]{%
+ atom style ={},% code tikz mis à la fin de every node/.style
+ chemfig style ={},% code tikz mis à la fin de l'arugment optionnel de \tikzpicture
+ bond join =false,
+ fixed length =false,
+ cram rectangle =false,
+ cram width =1.5ex,
+ cram dash width =1pt,
+ cram dash sep =2pt,
+ atom sep =3em,
+ bond offset =2pt,
+ double bond sep =2pt,
+ angle increment =45,
+ node style ={},
+ bond style ={},
+ lewis | width =0.3ex,
+ lewis sep =0.4ex,
+ lewis length =1.5ex,
+ lewis style ={},
+ lewis dist =0.3em,
+ lewis radius =0.15ex,
+ lewis diag coeff =1,
+ cycle radius coeff =0.75,
+ stack sep =1.5pt,
+ scheme debug =false,
+ compound style ={},
+ compound sep =5em,
+ arrow offset =4pt,
+ arrow angle =0,
+ arrow coeff =1,
+ arrow style ={},
+ arrow double sep =2pt,
+ arrow double coeff =0.6,
+ arrow double harpoon=true,
+ arrow label sep =3pt,
+ arrow head =-CF,
+ + sep left =0.5em,
+ + sep right =0.5em,
+ + vshift =0pt,
+ }%
+}
+\resetchemfig
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%% D E S S I N M O L É C U L E S %%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\def\CF_sanitizecatcode{%
+ \CF_makeother\[\CF_makeother\]\CF_makeother\:\CF_makeother\(\CF_makeother\)%
+ \CF_makeother\,\CF_makeother\-\CF_makeother\=\CF_makeother\~\CF_makeother\!%
+ \CF_makeother\?\CF_makeother\<\CF_makeother\>\CF_makeother\;\CF_makeother\*%
+ \CF_makeother\|\CF_makeother\#\CF_makeother\@%
+}
+
+\def\CF_nodecontent{\CF_expsecond\printatom{\csname atom_\number\CF_cntatom\endcsname\CF_nodestrut}}
+
+\def\chemskipalign{%
+ \CF_doifempty\CF_bondoutcontentsaved% sauf si un \chemskipalign a été fait à l'atome précédent
+ {\global\let\CF_bondoutcontentsaved\CF_bondoutcontent}% sauvegarder l'atome d'où vient la liaison
+ \let\CF_nodestrut\empty
+}
+
+\def\CF_emptynode{{}}
+
+\def\definesubmol{\CF_definesubmoltrue\def_submol}
+\def\redefinesubmol{\CF_definesubmolfalse\def_submol}
+
+\def\def_submol#1{%
+ \CF_cntatomgroup=0 % nombre d'arguments supposé
+ \def\CF_temp{#1}% nom
+ \futurelet\CF_toksa\CF_submoltestnxttok
+}
+
+\def\CF_submoltestnxttok{%
+ \if[\noexpand\CF_toksa\expandafter\CF_execfirst\else\expandafter\CF_execsecond\fi
+ {\begingroup\CF_sanitizecatcode\CF_expsecond\CF_submolgrabopt{\CF_temp}%
+ }
+ {\afterassignment\CF_submoltestnxttoka% pas d'argument entre crochet
+ \CF_cntatomgroup=0% cherche le nombre d'arguments éventuels
+ }%
+}
+
+\def\CF_submoltestnxttoka{\futurelet\CF_toksa\CF_submoltestnxttokb}
+
+\def\CF_submoltestnxttokb{%
+ \if[\noexpand\CF_toksa\expandafter\CF_execfirst\else\expandafter\CF_execsecond\fi
+ {\begingroup\CF_sanitizecatcode\CF_expsecond\CF_submolgrabopt{\CF_temp}}
+ {\CF_expsecond{\def_submola}\CF_temp{}}%
+}
+
+\def\CF_submolgrabopt#1[#2]#{\endgroup\def_submola{#1}{#2}}
+
+\def\def_submola#1{% #1 nom
+ \CF_ifnum{0\CF_ifnum{\CF_cntatomgroup<0 }1{\CF_ifnum{\CF_cntatomgroup>9 }10}>0 }
+ {\CF_error{Invalid number of arguments in submol \detokenize\expandafter{\string#1}. Defining it with 0 argument}%
+ \CF_cntatomgroup=0
+ }
+ {}%
+ \ifcat\relax\expandafter\noexpand\CF_firsttonil#1\_nil\expandafter\CF_execfirst\else\expandafter\CF_execsecond\fi% si #1 est une séquence de contrôle
+ {\expandafter\ifdefined\CF_firsttonil#1\_nil
+ \ifCF_definesubmol
+ \CF_warning{the submol \expandafter\string\CF_firsttonil#1\_nil\space is already defined, the previous definition is lost}%
+ \fi
+ \fi
+ \begingroup
+ \CF_sanitizecatcode
+ \def_submolb{#1}%
+ }
+ {\ifcsname CF__#1\endcsname
+ \ifCF_definesubmol
+ \CF_warning{the submol "#1" is already defined, the previous definition is lost}%
+ \fi
+ \fi
+ \begingroup
+ \CF_sanitizecatcode
+ \expandafter\def_submolb\csname CF__#1\endcsname
+ }%
+}
+
+\def\def_submolb#1#2#3{% #1 nom sous forme de macro, #2 = code si liaison arrive de droite , #3 = code si liaison arrive de gauche, \CF_cntatomgroup = nombre d'arguments
+ \def\CF_tempa{#2}\CF_doifnotempty{#2}{\CF_expsecond{\CF_expsecond\CF_substonly{\number\CF_cntatomgroup}\CF_tempa}{\CFhash}{\CFhash}}%
+ \def\CF_tempb{#3}\CF_expsecond{\CF_expsecond\CF_substonly{\number\CF_cntatomgroup}\CF_tempb}{\CFhash}{\CFhash}%
+ \CF_expsecond{\CF_expsecond{\def_submolc{#1}}\CF_tempa}\CF_tempb
+}
+
+\def\def_submolc#1#2#3{% #1 nom sous forme de macro, #2 = code si liaison arrive de droite , #3 = code si liaison arrive de gauche, \CF_cntatomgroup = nombre d'arguments
+ \endgroup
+ \begingroup
+ \global\toks0{\gdef\CFthesubmol}%
+ \CF_ifnum{\CF_cntatomgroup>0 }
+ {\foreach\CF_x in {1,...,\CF_cntatomgroup}{%
+ \global\toks0\expandafter{\expanded{\the\toks0\CFhash\CF_x}}%
+ }%
+ }
+ {}%
+ \CF_sanitizecatcode \catcode`\#6 \endlinechar-1 \everyeof{\noexpand}%
+ \CF_ifempty{#2}%
+ {\scantokens\expandafter{\the\toks0{\empty#3}}%
+ }%
+ {\scantokens\expandafter{%
+ \the\toks0{%
+ \csname CF_exec%
+ \ifdim\csname CF_currentangle\endcsname pt>90pt
+ \ifdim\csname CF_currentangle\endcsname pt<270pt
+ first%
+ \else
+ second%
+ \fi
+ \else
+ second%
+ \fi
+ \endcsname
+ {#2}{#3}%
+ }%
+ }%
+ }%
+ \endgroup
+ \let#1\CFthesubmol
+}
+
+\def\CF_seeknode#1#2#3{% cherche un noeud au début de #1 l'assigne dans la sc #2 et met le reste dans #3
+ \let#2\empty
+ \def#3{#1}%
+ \CF_iffirsttokmatch{#1}{ }%
+ {\CF_expsecond\CF_seeknodea{\romannumeral-`\.\noexpand#1}#2#3}% ignore les espaces au début du groupe d'atome
+ {\CF_seeknodea{#1}#2#3}%
+}
+
+\def\CF_seeknodea#1#2#3{%
+ \CF_ifempty{#1}%
+ {\let#3\empty
+ }
+ {\futurelet\CF_toksa\CF_gobtonil#1\relax\_nil
+ \CF_ifx\CF_toksa\CF_sptoken
+ {\CF_addtomacro#2{ }%
+ \CF_expsecond\CF_seeknodea{\CF_afterspace#1\_nil}#2#3%
+ }%
+ {\CF_ifx\CF_toksa\bgroup
+ {\CF_eaddtomacro#2{\expandafter{\CF_firsttonil#1\_nil}}%
+ \CF_expsecond\CF_seeknodea{\CF_gobarg#1}#2#3%
+ }%
+ {\CF_iffirsttokina{-=(*<>!~}%
+ {\def#3{#1}%
+ }%
+ {\CF_eaddtomacro#2{\CF_firsttonil#1\_nil}%
+ \CF_expsecond\CF_seeknodea{\CF_gobarg#1}#2#3%
+ }%
+ }%
+ }%
+ }%
+}
+
+% on sait que #1 commence par -,=,~,<,>. On analyse cette liaison
+% #2 reçoit le type de liaisons (1 pour -, 2 pour =, 3 pour ~)
+\def\CF_assignbondcode#1#2{%
+ \futurelet\CF_toksa\CF_gobtonil#1\_nil
+ \edef#2{%
+ \ifx-\CF_toksa1\else
+ \ifx=\CF_toksa2\else
+ \ifx~\CF_toksa3\else
+ \ifx>\CF_toksa4\else
+ \ifx<\CF_toksa5\else0% si 0 --> il y a une erreur non due à l'utilisateur
+ \fi\fi\fi\fi\fi}%
+ \ifnum#2>3 % si c'est une liaison de Cram
+ \CF_expafter{\futurelet\CF_toksa\CF_gobtonil}{\CF_gobarg#1\_nil}% chope le caractère suivant
+ \CF_ifx:\CF_toksa
+ {\edef#2{\number\numexpr#2+2}% si c 'est un ":", signe du pointillé, ajoute 2
+ }%
+ {\CF_ifx|\CF_toksa% si c 'est un "|", signe du triangle évidé, ajouter 4
+ {\edef#2{\number\numexpr#2+4}}
+ {}%
+ }%
+ \fi
+}
+
+\def\CF_grabbondoffseta#1,#2\_nil{%
+ \def\CF_startoffset{#1}\def\CF_endoffset{#2}%
+}
+
+\def\CF_grabbondoffset#1(#2)#3\_nil{%
+ \CF_doifnotempty{#2}%
+ {\CF_ifinstr{#2},%
+ {\CF_grabbondoffseta#2\_nil}%
+ {\def\CF_startoffset{#2}}%
+ }%
+ \def\CF_remainafterbond{#3}%
+}
+
+\def\CF_analysebond#1#2{%
+ \CF_assignbondcode{#1}#2%
+ \CF_expsecond{\def\CF_remainafterbond}{\CF_gobarg#1}%mange le premier signe de la liaison
+ \let\CF_doublebondtype\CF_zero
+ \ifnum#2=2 % si c'est une double liaison, regarde s'il y a un + ou - derrière
+ \CF_expafter{\futurelet\CF_toksa\CF_gobtonil}{\CF_gobarg#1\_nil}%
+ \CF_ifx^\CF_toksa
+ {\def\CF_doublebondtype{1}%
+ \CF_expsecond{\def\CF_remainafterbond}{\CF_gobtwoargs#1}% mange le "^"
+ }
+ {\expandafter\ifx\CF_underscore\CF_toksa
+ \def\CF_doublebondtype{2}%
+ \CF_expsecond{\def\CF_remainafterbond}{\CF_gobtwoargs#1}% mange le "_"
+ \fi
+ }%
+ \else
+ \ifnum#2>5 % si c'est une laision de Cram pointillée ou triangle évidé
+ \CF_expsecond{\def\CF_remainafterbond}{\CF_gobtwoargs#1}% mange un caractère de plus
+ \fi
+ \fi
+ \CF_expsecond\CF_iffirsttokmatch\CF_remainafterbond\CFhash
+ {\CF_eexpsecond\CF_iffirsttokmatch{\expandafter\CF_gobarg\CF_remainafterbond.}(%si parenthèse juste après
+ {\expandafter\CF_grabbondoffset\CF_remainafterbond\_nil}
+ {}%
+ }%
+ {}%
+ \CF_expsecond\CF_iffirsttokmatch\CF_remainafterbond @%
+ {\expandafter\CF_grabmovearg\CF_remainafterbond\_nil}%
+ {}%
+ \CF_expsecond\CF_iffirsttokmatch{\CF_remainafterbond}[%
+ {\expandafter\CF_analyseoptarg\CF_remainafterbond\_nil\CF_remainafterbond
+ }%
+ {\let\CF_currentstringangle\CF_defaultstringangle
+ \let\CF_currentlength\CF_defaultlength
+ \let\CF_currentfromatom\CF_defaultfromatom
+ \let\CF_currenttoatom\CF_defaulttoatom
+ \let\CF_currenttikz\CF_defaulttikz
+ \let\CF_movebondname\empty
+ }%
+ \ifCF_incycle
+ \pgfmathsetmacro\CF_cycleincrementangle{360/\CF_cyclenum+\CF_initcycleangle}%
+ \edef\CF_currentstringangle{::+\CF_cycleincrementangle}%
+ \def\CF_initcycleangle{0}%
+ \let\CF_currentlength\CF_defaultlength% et on ignore la longueur de liaison spécifiée
+ \fi
+ \CF_expsecond\CF_setbondangle{\CF_currentstringangle}\CF_currentangle
+}
+
+\def\CF_setbondangle#1#2{% le code de la direction est contenu dans #1, en sortie, #2 contient l'angle
+ \CF_ifempty{#1}%
+ {\let#2\CF_defaultangle
+ }
+ {\if:\expandafter\noexpand\CF_firsttonil#1\_nil
+ \if:\CF_threeea\noexpand\expandafter\CF_firsttonil\CF_gobarg#1\_nil
+ \pgfmathsetmacro#2{\CF_previousangle+\expandafter\CF_gobarg\CF_gobarg#1}%
+ \else
+ \pgfmathsetmacro#2{\CF_gobarg#1}%
+ \fi
+ \else
+ \pgfmathsetmacro#2{#1*\CF_angleincrement}%
+ \fi% puis normalise l'angle entre 0 et 360
+ \ifdim\ifdim#2pt<0pt -\fi#2pt>360pt
+ \pgfmathsetmacro#2{#2-360*floor(#2/360)}%
+ \fi% si |#2|>360
+ \ifdim#2pt<0pt
+ \pgfmathsetmacro#2{#2+360}%
+ \fi
+ }%
+}
+
+\def\CF_analysemovearg#1,#2\_nil#3{%
+ \def#3{#1}\def\CF_movebondcoeff{#2}%
+}
+
+% Argument limités légitimes ici car #2 (qui est ce qui suit "@{<nom>}" dans l'argument optionnel) ne DOIT PAS
+% commencer par une accolade.
+\def\CF_grabmovearg @#1#2\_nil{%
+ \CF_ifinstr{#1},%
+ {\CF_analysemovearg#1\_nil\CF_movebondname}%
+ {\def\CF_movebondname{#1}\def\CF_movebondcoeff{0.5}}%
+ \def\CF_remainoptarg{#2}%
+}
+
+\def\CF_testemptyandassign#1#2#3{%
+ \CF_ifempty{#2}
+ {\let#1#3}
+ {\def#1{#2}}%
+}
+
+\def\CF_parseoptlist#1,#2,#3,#4,#5\_nil{%
+ \CF_testemptyandassign\CF_currentstringangle{#1}\CF_defaultstringangle
+ \CF_testemptyandassign\CF_currentlength {#2}\CF_defaultlength
+ \CF_testemptyandassign\CF_currentfromatom {#3}\CF_defaultfromatom
+ \CF_testemptyandassign\CF_currenttoatom {#4}\CF_defaulttoatom
+ \CF_expsecond{\CF_testemptyandassign\CF_currenttikz}{\CF_sanitizelastitem#5,\empty\_nil}\CF_defaulttikz
+}%
+
+\def\CF_analyseoptarg[#1]{%
+ \CF_doifnotempty{#1}%
+ {\CF_iffirsttokmatch{#1}{@}%
+ {\CF_grabmovearg#1\_nil
+ }
+ {\let\CF_movebondname\empty
+ \def\CF_remainoptarg{#1}%
+ }%
+ \expandafter\CF_parseoptlist\CF_remainoptarg,\empty,\empty,\empty,\empty\_nil
+ }%
+ \CF_analyseoptarga\relax
+}
+
+\def\CF_analyseoptarga#1\_nil#2{%
+ \CF_expsecond{\def#2}{\CF_gobarg#1}%
+}
+
+\def\CF_seeksubmol{%
+ \CF_expsecond{\def\CF_molecule}{\romannumeral-`\.\expandafter\noexpand\CF_molecule}%
+ \CF_expsecond\CF_iffirsttokmatch{\CF_molecule}!%
+ {\CF_eexpsecond{\def\CF_molecule}{\expandafter\CF_gobarg\CF_molecule}% enlève le "!"
+ \CF_ifx\empty\CF_molecule
+ {\CF_error{no submol name found after "!"}}
+ {}%
+ \ifcat\relax\CF_threeea\noexpand\expandafter\CF_firsttonil\CF_molecule*\_nil
+ \expandafter\CF_seeksubmola\CF_molecule\_nil
+ \else
+ \expandafter\CF_seeksubmolb\CF_molecule\_nil
+ \fi
+ \CF_seeksubmol
+ }%
+ {}%
+}
+
+\def\CF_seeksubmola#1{\CF_seeksubmolc#1\relax}
+
+\def\CF_seeksubmolb#1{\expandafter\CF_seeksubmolc\csname CF__#1\endcsname\relax}% nom de la sous molécule
+
+\def\CF_seeksubmolc#1#2\_nil{%#1=macro de la sous molécule #2=reste du code commençant par \relax
+ \CF_expsecond{\CF_eexpsecond{\def\CF_molecule}}{\expandafter#1\CF_gobarg#2}% supprime le \relax puis ajoute la macro au début et la 2-développe
+}
+
+\def\CF_insertemptygroup#1{% insère {} au début de la sc #1
+ \CF_expsecond{\def#1}{\expandafter{\expandafter}#1}%
+}
+
+\def\chemfig{\CF_testopt\CF_chemfiga{}}
+
+\def\CF_chemfiga[#1]{%
+ \begingroup
+ \CF_sanitizecatcode
+ \CF_exptwomacroargs\CF_chemfigb\CF_begintikzpicture\CF_endtikzpicture[#1]%
+}
+
+\def\CF_chemfigb#1#2[#3]#4{%
+ \endgroup
+ \begingroup
+ \setchemfig{#3}%
+ \expanded{% début du tikzpicture
+ \unexpanded{#1}[%
+ remember picture,%
+ every node/.style={%
+ anchor=base,%
+ inner sep=0pt,%
+ outer sep=0pt,%
+ minimum size=0pt,%
+ \unexpanded\CF_threeea{\useKV[chemfig]{atom style}}%
+ },%
+ baseline,%
+ \unexpanded\CF_threeea{\useKV[chemfig]{chemfig style}}%
+ ]%
+ }%
+ \begingroup% \endgroup rajouté en sortie de tracé par \CF_chemfigd
+ \let\CF_hooklist\empty
+ \CF_expsecond\setchemfig{#3}%
+ \ifboolKV[chemfig]{fixed length}
+ {\CF_macrofixedbondlengthtrue}
+ {\CF_macrofixedbondlengthfalse}%
+ \ifboolKV[chemfig]{bond join}
+ {\let\CF_drawaxisbond\CF_drawaxisbondjoin}
+ {\let\CF_drawaxisbond\CF_drawaxisbondnojoin}%
+ \ifboolKV[chemfig]{cram rectangle}
+ {\let\CF_clipcramornot\CF_gobtikzinstruction}
+ {\let\CF_clipcramornot\clip}%
+ \CF_valuetomacro\CF_crambasewidth [1.5ex]{cram width}%
+ \CF_valuetomacro\CF_cramdashlength [1pt]{cram dash width}%
+ \CF_valuetomacro\CF_cramdashsep [2pt]{cram dash sep}%
+ \CF_valuetomacro\CF_atomsep [3em]{atom sep}% espacement des atomes liés
+ \CF_valuetomacro\CF_bondoffset [2pt]{bond offset}%
+ \CF_valuetomacro\CF_doublesep [2pt]{double bond sep}%
+ \CF_valuetomacro\CF_angleincrement [45]{angle increment}%
+ \CF_valuetomacro\CF_nodestyle []{node style}%
+ \CF_valuetomacro\CF_bondstyle []{bond style}%
+ \CF_valuetomacro\CF_stacksep [1.5pt]{stack sep}%
+ \CF_valuetomacro\CF_cycleradiuscoeff[0.75]{cycle radius coeff}% coeff multiplicateur du rayon des arcs dans les cycles
+ \CF_incyclefalse
+ \CF_cntgroup0
+ \let\CF_lastaction\CF_zero% 0=début du dessin 1=tracé d'un noeud 2=tracé d'une liaison
+ \let\CF_startoffset\empty
+ \let\CF_endoffset\empty
+ \let\CF_bondoutcontentsaved\empty
+ \def\CF_cycleanglecorrection{180/\CF_cyclenum}%
+ \def\CF_defaultangle{0}%
+ \def\CF_defaultstringangle{:0}% angle pris par défaut si le champ est vide
+ \def\CF_defaultlength{1}%
+ \let\CF_defaultfromatom\empty% numero de l'atome d'où partent les liaisons par défaut
+ \let\CF_defaulttoatom\empty% numéro de l'atome où arrivent les laisons par défaut
+ \let\CF_defaulttikz\empty
+ \let\CF_previousbondangle\empty
+ \let\CF_joinbond\CF_zero
+ \let\CF_previoustikz\empty
+ \everyeof{\_nil}\endlinechar-1
+ \CF_sanitizecatcode
+ \expandafter\CF_assigntonil\expandafter\CF_molecule\scantokens{#4}%
+ \CF_expsecond{\CF_substall\CF_molecule}\CFhash\CFhash
+ \CF_expsecond\CF_chemfigc{\CF_molecule}%
+ %\endgroup <-- rajouté par \CF_chemfigd
+ #2% fin du tikzpicture
+ \endgroup
+ \let\CF_flipstate\CF_zero
+}
+
+\def\CF_chemfigc#1{% #1 est le code de la molécule
+ \ifnum\CF_lastaction=3
+ \ifCF_incycle
+ \def\CF_defaultangle{0}%
+ \else
+ \ifnum\CF_cntcycle=0 % si c'est le début d'un cycle
+ \pgfmathsetmacro\CF_defaultangle{\CF_previousangle+180+\CF_cycleanglecorrection}% on met la liaison à +180° + correction
+ \else
+ \pgfmathsetmacro\CF_defaultangle{\CF_previousangle-90+180/\CF_cyclenum}% sinon à la bissectrice du sommet du cycle
+ \fi
+ \fi
+ \let\CF_defaultstringangle\empty
+ \fi
+ \let\CF_currentangle\CF_defaultangle
+ \def\CF_molecule{#1}%
+ \CF_seeksubmol% alias en premier ?
+ \if[\CF_threeea\noexpand\expandafter\CF_firsttonil\CF_molecule\_nil
+ \expandafter\CF_analyseoptarg\CF_molecule\_nil\CF_molecule
+ \CF_expsecond\CF_setbondangle{\CF_currentstringangle}\CF_currentangle
+ \let\CF_defaultangle\CF_currentangle
+ \let\CF_previousangle\CF_currentangle
+ \CF_doifnotempty\CF_currentstringangle{\let\CF_defaultangle\CF_currentangle}%
+ \CF_doifnotempty\CF_currentlength {\let\CF_defaultlength\CF_currentlength}%
+ \CF_doifnotempty\CF_currentfromatom {\let\CF_defaultfromatom\CF_currentfromatom}%
+ \CF_doifnotempty\CF_currenttoatom {\let\CF_defaulttoatom\CF_currenttoatom}%
+ \CF_doifnotempty\CF_currenttikz {\let\CF_defaulttikz\CF_currenttikz}%
+ \CF_seeksubmol
+ \fi
+ \edef\CF_defaultstringangle{:\CF_defaultangle}%
+ \let\CF_currentlength\CF_defaultlength
+ \let\CF_currentfromatom\CF_defaultfromatom
+ \let\CF_currenttoatom\CF_defaulttoatom
+ \let\CF_currenttikz\CF_defaulttikz
+ \ifCF_incycle% si on commence un cycle
+ \let\CF_currentangle\CF_previousangle
+ \ifCF_cyclearc% on doit tracer l'arc de cercle dans le cycle ?
+ \pgfmathsetmacro\CF_cyclearcradius{\CF_cycleradiuscoeff*\CF_currentlength*\CF_atomsep/(2*tan(180/\CF_cyclenum))}%
+ \pgfmathsetmacro\CF_cyclearcinitangle{\CF_currentangle+\CF_initcycleangle+180/\CF_cyclenum+90}
+ \pgfmathparse{\CF_currentlength*\CF_atomsep/(2*sin(180/\CF_cyclenum))}%
+ \node[at=(\CF_bondoutnode),shift=(\CF_cyclearcinitangle:\pgfmathresult pt)](arccenter){};% le centre de l'arc
+ \node[at=(arccenter),shift=(\CF_cyclearcstartangle:\CF_cyclearcradius pt)](initarc){};% le début de l'arc
+ \CF_expafter{\draw[}\CF_cyclearcdirecttikz](initarc) arc (\CF_cyclearcstartangle:\CF_cyclearcendangle:\CF_cyclearcradius pt);
+ \fi
+ \else
+ \let\CF_currentangle\CF_defaultangle
+ \fi
+ \ifnum\CF_lastaction=0
+ \let\CF_previousangle\CF_defaultangle
+ \node(CF_node){};
+ \CF_expsecond\CF_iffirsttokin{\CF_molecule}{-=(*~?<>}%
+ {\CF_insertemptygroup\CF_molecule}%
+ {}%
+ \fi
+ \CF_chemfigd
+}
+
+\def\CF_chemfigd{%
+ \let\CF_nextaction\CF_chemfigd% à priori, on reboucle
+ \CF_ifx\CF_molecule\empty
+ {\let\CF_nextaction\endgroup
+ }
+ {\CF_seeksubmol
+ \CF_expsecond\CF_seeknode{\CF_molecule}\CF_currentatomgroup\CF_molecule
+ \CF_ifx\empty\CF_currentatomgroup% pas de noeud pour commencer ?
+ {\def\CF_bondoutnode{%
+ n\CF_lastgroupnumber-%
+ \ifx\CF_currentfromatom\empty
+ \ifdim\CF_currentangle pt<90pt
+ \number\CF_cntatomgroup
+ \else
+ \ifdim\CF_currentangle pt>270pt
+ \number\CF_cntatomgroup
+ \else
+ 1%
+ \fi
+ \fi
+ \else
+ \CF_currentfromatom
+ \fi}%
+ \CF_expafter{\futurelet\CF_toksa\CF_gobtonil}{\CF_molecule\relax\_nil}%
+ \CF_iffirsttokina{-=<>~}% la suite est une liaison
+ {\ifnum\CF_lastaction=2 % c'est la deuxième liaison consécutive ?
+ \CF_insertemptygroup\CF_molecule% insère un groupe vide
+ \edef\CF_bondoutnode{\CF_bondoutnode}%
+ \else
+ \ifCF_incycle
+ \advance\CF_cntcycle1
+ \fi
+ \CF_expsecond\CF_analysebond{\CF_molecule}\CF_bondtype
+ \edef\CF_bondoutnode{\CF_bondoutnode}%
+ \let\CF_molecule\CF_remainafterbond
+ \ifCF_incycle
+ \ifnum\CF_cntcycle=\CF_cyclenum\relax
+ \CF_threeea\CF_execfirst
+ \else
+ \ifnum\CF_cntcycle=1
+ \let\CF_cyclefirsttikz\CF_currenttikz
+ \CF_doifnotempty\CF_startoffset{\let\CF_cyclejoinlast\CF_zero}%
+ \fi
+ \CF_threeea\CF_execsecond
+ \fi
+ \else
+ \expandafter\CF_execsecond
+ \fi
+ {\let\CF_nextaction\endgroup
+ \CF_drawbond\CF_bondtype{\CF_bondoutnode}{\CF_hookcycle}\CF_previousatomgroup\CF_hookatomgroup
+ }%
+ {\node[at=(\CF_bondoutnode\ifCF_incycle\else\ifCF_macrofixedbondlength.\CF_currentangle\fi\fi),shift=(\ifcase\CF_flipstate\or180-\or-\fi\CF_currentangle:\CF_currentlength*\CF_atomsep)](CF_node){};
+ \let\CF_previousangle\CF_currentangle
+ \def\CF_lastaction{2}%
+ }%
+ \fi
+ \ifcat\relax\detokenize\expandafter{\romannumeral-`\.\expandafter\noexpand\CF_molecule}\relax
+ % s'il ne reste plus rien après la liaison (sans tenir compte de l'espace devant)-> insère un groupe vide
+ \CF_insertemptygroup\CF_molecule
+ \fi
+ }%
+ {\edef\CF_bondoutnode{\CF_bondoutnode}% évalue le l'atome de départ de liaison
+ \CF_ifx(\CF_toksa% une parenthèse pour commencer ?
+ {\ifnum\CF_lastaction=2 % il y avait une liaison juste avant ?
+ \CF_insertemptygroup\CF_molecule
+ \else
+ \CF_expsecond\CF_grabsubmol{\CF_molecule}%
+ \begingroup
+ \ifCF_incycle\def\CF_lastaction{3}\fi% on était dans un cycle
+ \CF_incyclefalse
+ \aftergroup\CF_chemfigd
+ \def\CF_nextaction{\CF_expsecond\CF_chemfigc{\CF_molinparen}}%
+ \fi
+ }%
+ {\CF_ifx\CF_molecule\empty
+ {\let\CF_nextaction\endgroup
+ }
+ {% ce qui reste après le noeud courant n'est pas vide, ne commence pas par "-=~", ni par une parenthèse
+ \CF_ifx*\CF_toksa% un cycle ?
+ {\ifnum\CF_lastaction=2
+ \CF_insertemptygroup\CF_molecule% insère un groupe vide
+ \else
+ \ifCF_incycle
+ \def\CF_lastaction{3}%
+ \fi% on était dans un cycle
+ \ifnum\CF_lastaction=3
+ \let\CF_lastcyclenum\CF_cyclenum
+ \fi
+ \CF_eexpsecond\CF_iffirsttokmatch{\expandafter\CF_gobarg\CF_molecule}*%
+ {\CF_eexpsecond{\def\CF_molecule}{\expandafter\CF_gobarg\CF_molecule}% enlève la 1er étoile
+ \CF_eexpsecond\CF_iffirsttokmatch{\expandafter\CF_gobarg\CF_molecule}[% un crochet ensuite ?
+ {\expandafter\CF_cycleparsepreamblewithoptarg\CF_molecule\_nil% \begingroup inclus
+ }%
+ {\def\CF_cyclearcstartangle{0}\def\CF_cyclearcendangle{360}%
+ \let\CF_cyclearcdirecttikz\empty
+ \expandafter\CF_cycleparsepreamble\CF_molecule\_nil% \begingroup inclus
+ }%
+ \CF_cyclearctrue
+ }%
+ {\expandafter\CF_cycleparsepreamble\CF_molecule\_nil% \begingroup inclus
+ \CF_cyclearcfalse
+ }%
+ \CF_cntcycle0
+ \edef\CF_hookcycle{\CF_bondoutnode}%
+ \let\CF_hookatomgroup\CF_previousatomgroup
+ \CF_ifx\CF_hookatomgroup\CF_emptynode
+ {\def\CF_cyclejoinlast{1}}% joindre le dernier
+ {\def\CF_cyclejoinlast{0}}
+ \CF_incycletrue
+ \ifnum\CF_lastaction=3
+ \pgfmathsetmacro\CF_initcycleangle{360/\CF_lastcyclenum-180}% c'est un cycle dans un cycle
+ \else
+ \pgfmathsetmacro\CF_initcycleangle{-180/\CF_cyclenum-90+\CF_cycleanglecorrection}%
+ \fi
+ \aftergroup\CF_chemfigd
+ \def\CF_nextaction{\CF_expsecond\CF_chemfigc{\CF_molinparen}}%
+ \fi
+ }%
+ {\CF_error{something went wrong here: \detokenize\expandafter{\CF_molecule}^^JIf you think it's a bug, please, send a Minimal Example to the author}%
+ }%
+ }%
+ }%
+ }%
+ }%
+ {\CF_expthreemacroargs\CF_drawatomgroup\CF_currentangle\CF_currenttoatom\CF_currentatomgroup
+ }%
+ }%
+ \CF_nextaction
+}
+
+\def\CF_cycleparsepreamble*#1#2\_nil{%
+ \ifnum#1<3
+ \CF_error{a cycle must be at least a triangle.^^JThe number following "*" must be 3 or more}%
+ \fi
+ \def\CF_molecule{#2}%
+ \CF_expsecond\CF_grabsubmol{\CF_molecule}%
+ \begingroup
+ \def\CF_cyclenum{#1}%
+}
+
+\def\CF_cycleparsepreamblewithoptarg*[#1]#2#3\_nil{%
+ \CF_cycleparseoptarg#1,\empty,\empty,\empty\_nil
+ \CF_cycleparsepreamble*#2#3\_nil
+}
+
+\def\CF_cycleparseoptarg#1,#2,#3\_nil{%
+ \CF_ifempty{#1}
+ {\def\CF_cyclearcstartangle{0}}
+ {\def\CF_cyclearcstartangle{#1}}%
+ \CF_ifempty{#2}
+ {\def\CF_cyclearcendangle{360}}
+ {\def\CF_cyclearcendangle{#2}}%
+ \CF_expsecond{\def\CF_cyclearcdirecttikz}{\CF_sanitizelastitem#3,\empty\_nil}%
+}
+
+\def\CF_grabsubmol#1{%
+ \begingroup
+ \catcode`(1 \catcode`)2
+ \CF_threeea
+ \endgroup
+ \expandafter\CF_grabsubmola\scantokens{\relax#1}%
+}
+
+\def\CF_grabsubmola#1\_nil{%
+ \expandafter\CF_assigntonil\expandafter\CF_molecule\scantokens\CF_threeea{\expandafter\CF_gobarg \CF_gobarg#1}%
+ \expandafter\CF_assigntonil\expandafter\CF_molinparen\scantokens\CF_threeea{\expandafter\CF_firsttonil\CF_gobarg#1\_nil}%
+}
+
+\def\CF_ifcarisupperletter#1{%
+ \ifcat\relax\noexpand#1%
+ \let\CF_next\CF_execsecond% faux si c'est une sc
+ \else
+ \ifnum`#1<`A
+ \let\CF_next\CF_execsecond
+ \else
+ \ifnum`#1>`Z
+ \let\CF_next\CF_execsecond
+ \else
+ \let\CF_next\CF_execfirst
+ \fi
+ \fi
+ \fi
+ \CF_next
+}
+
+% Créé 4 noeuds au dessus et au dessous des noeuds #1 et #2
+% à une distance de #3 du noeud #1 et #4 du noeud #2
+\def\CF_createnormnodes#1#2#3#4{%
+ \CF_doifnotempty{#3}
+ {\node[shape=coordinate,at=(#1),xshift=#3*\CF_normx,yshift=#3*\CF_normy](#11){};
+ \node[shape=coordinate,at=(#1),xshift=-#3*\CF_normx,yshift=-#3*\CF_normy](#12){};
+ }%
+ \CF_doifnotempty{#4}
+ {\node[shape=coordinate,at=(#2),xshift=#4*\CF_normx,yshift=#4*\CF_normy](#21){};
+ \node[shape=coordinate,at=(#2),xshift=-#4*\CF_normx,yshift=-#4*\CF_normy](#22){};
+ }%
+}
+
+\def\CF_computenodevect#1#2{%
+ \pgfextractx\CF_dim{\pgfpointanchor{#1}{center}}\edef\CF_dimax{\the\CF_dim}%
+ \pgfextracty\CF_dim{\pgfpointanchor{#1}{center}}\edef\CF_dimay{\the\CF_dim}%
+ \pgfextractx\CF_dim{\pgfpointanchor{#2}{center}}\edef\CF_dimbx{\the\CF_dim}%
+ \pgfextracty\CF_dim{\pgfpointanchor{#2}{center}}\edef\CF_dimby{\the\CF_dim}%
+ \pgfmathsetmacro\CF_vectorlen{veclen(\CF_dimbx-\CF_dimax,\CF_dimby-\CF_dimay)}%
+ \pgfmathsetmacro\CF_normx{(\CF_dimay-\CF_dimby)/\CF_vectorlen}%
+ \pgfmathsetmacro\CF_normy{(\CF_dimbx-\CF_dimax)/\CF_vectorlen}%
+}
+
+\def\CF_setoffset#1#2{%
+ \CF_doifempty#1%
+ {\edef#1{%
+ \ifx#2\CF_emptynode
+ 0pt%
+ \else
+ \ifx#2\empty
+ 0pt%
+ \else
+ \CF_bondoffset
+ \fi
+ \fi}%
+ }%
+}
+
+\def\CF_drawbond#1#2#3#4#5{% #1=type de liaison #2 et #3:nom de noeuds de début et fin #4 et #5: contenu des atomes de début et fin
+ \CF_setoffset\CF_startoffset#4%
+ \CF_setoffset\CF_endoffset#5%
+ \let\CF_currentbondstyle\CF_bondstyle
+ \CF_doifnotempty\CF_currenttikz{\CF_eaddtomacro\CF_currentbondstyle{\expandafter,\CF_currenttikz}}%
+ \path(#2)--(#3)coordinate[pos=0](#2@)coordinate[pos=1](#3@);%
+ \CF_computenodevect{#2@}{#3@}%
+ \pgfmathsetmacro\CF_startcoeff{\CF_startoffset/\CF_vectorlen}%
+ \pgfmathsetmacro\CF_endcoeff{1-\CF_endoffset/\CF_vectorlen}%
+ \path(#2@)--(#3@)coordinate[pos=\CF_startcoeff](#2@@)coordinate[pos=\CF_endcoeff](#3@@);%
+ \CF_doifnotempty\CF_movebondname% on doit poser un noeud sur la liaison
+ {\path(#2@@)--(#3@@)coordinate[overlay,pos=\CF_movebondcoeff](\CF_movebondname);
+ \let\CF_movebondname\empty
+ }%
+ \ifcase#1\relax
+ \CF_error{unknown bond type, this error should not occur^^JIf you think it's a bug, send a Minimal Example to the author}%
+ \or% 1 = liaison simple
+ \CF_drawaxisbond{#2}{#3}% trace la liaison simple dans l'axe
+ \or% 2 = liaison double
+ \ifCF_incycle
+ \ifnum\CF_doublebondtype=0
+ \def\CF_doublebondtype{1}%
+ \fi
+ \ifnum\CF_flipstate>0
+ \def\CF_doublebondtype{2}%
+ \fi
+ \pgfmathsetmacro\CF_doublebondlengthcorrection{\CF_doublesep*tan(180/\CF_cyclenum)}%
+ \fi
+ \ifcase\CF_doublebondtype
+ \CF_createnormnodes{#2@@}{#3@@}{\CF_doublesep/2}{\CF_doublesep/2}%
+ \CF_drawbonda(#2@@1)--(#3@@1);
+ \CF_drawbonda(#2@@2)--(#3@@2);
+ \let\CF_joinbond\CF_zero
+ \or
+ \CF_createnormnodes{#2@@}{#3@@}\CF_doublesep\CF_doublesep
+ \CF_drawaxisbond{#2}{#3}% trace la liaison simple dans l'axe\CF_drawbonda(#2@@)--(#3@@);
+ \begingroup% ajuste éventuellement les longueurs des liaisons doubles
+ \ifCF_incycle
+ \ifdim\CF_startoffset=0pt
+ \CF_edefaddtomacro\CF_currentbondstyle{,shorten <=\CF_doublebondlengthcorrection pt}%
+ \fi
+ \ifdim\CF_endoffset=0pt
+ \CF_edefaddtomacro\CF_currentbondstyle{,shorten >=\CF_doublebondlengthcorrection pt}%
+ \fi
+ \fi
+ \CF_drawbonda(#2@@1)--(#3@@1);
+ \endgroup
+ \or
+ \CF_createnormnodes{#2@@}{#3@@}\CF_doublesep\CF_doublesep
+ \CF_drawaxisbond{#2}{#3}% trace la liaison simple dans l'axe\CF_drawbonda(#2@@)--(#3@@);
+ \begingroup% ajuste éventuellement les longueurs des liaisons doubles
+ \ifCF_incycle
+ \ifdim\CF_startoffset=0pt
+ \CF_edefaddtomacro\CF_currentbondstyle{,shorten \ifnum\CF_flipstate=0 <=-\else>=\fi\CF_doublebondlengthcorrection pt}%
+ \fi
+ \ifdim\CF_endoffset=0pt
+ \CF_edefaddtomacro\CF_currentbondstyle{,shorten \ifnum\CF_flipstate=0 >=-\else<=\fi\CF_doublebondlengthcorrection pt}%
+ \fi
+ \fi
+ \CF_drawbonda(#2@@2)--(#3@@2);
+ \endgroup
+ \fi
+ \or% 3 = liaison triple
+ \CF_createnormnodes{#2@@}{#3@@}\CF_doublesep\CF_doublesep
+ \CF_drawaxisbond{#2}{#3}% trace la liaison simple dans l'axe\CF_drawbonda(#2@@)--(#3@@);
+ \CF_drawbonda(#2@@1)--(#3@@1);
+ \CF_drawbonda(#2@@2)--(#3@@2);
+ \or% 4 = liaison Cram pleine de #2 vers #3
+ \CF_createnormnodes{#2@@}{#3@@}{\CF_crambasewidth/2}{}%
+ \CF_expafter{\filldraw[}\CF_currentbondstyle,line join=bevel](#2@@1)--(#2@@2)--(#3@@)--cycle;
+ \let\CF_joinbond\CF_zero
+ \or% 5 = liaison Cram creuse de #3 vers #2
+ \CF_createnormnodes{#3@@}{#2@@}{\CF_crambasewidth/2}{}%
+ \CF_expafter{\filldraw[}\CF_currentbondstyle,line join=bevel](#3@@1)--(#3@@2)--(#2@@)--cycle;
+ \let\CF_joinbond\CF_zero
+ \or% 6 = liaison Cram pointillée de #2 vers #3
+ \scope
+ \CF_createnormnodes{#2@@}{#3@@}{\CF_crambasewidth/2}{}%
+ \CF_clipcramornot(#2@@1)--(#2@@2)--(#3@@)--(#2@@1);
+ \CF_expafter{\draw[}\CF_currentbondstyle,dash pattern=on \CF_cramdashlength off \CF_cramdashsep,line width=\CF_crambasewidth](#2@@)--(#3@@);
+ \endscope
+ \let\CF_joinbond\CF_zero
+ \or% 7 = liaison Cram pointillée de #3 vers #2
+ \scope
+ \CF_createnormnodes{#3@@}{#2@@}{\CF_crambasewidth/2}{}%
+ \CF_clipcramornot(#3@@1)--(#3@@2)--(#2@@)--(#3@@1);
+ \CF_expafter{\draw[}\CF_currentbondstyle,dash pattern=on \CF_cramdashlength off \CF_cramdashsep,line width=\CF_crambasewidth](#3@@)--(#2@@);
+ \endscope
+ \let\CF_joinbond\CF_zero
+ \or% 8 = liaison cram rectangle évidé de #2 vers #3
+ \CF_createnormnodes{#2@@}{#3@@}{\CF_crambasewidth/2}{}%
+ \CF_expafter{\draw[}\CF_currentbondstyle,line join=bevel](#2@@1)--(#2@@2)--(#3@@)--cycle;
+ \let\CF_joinbond\CF_zero
+ \or% 9 = liaison cram rectangle évidé de #3 vers #1
+ \CF_createnormnodes{#3@@}{#2@@}{\CF_crambasewidth/2}{}%
+ \CF_expafter{\draw[}\CF_currentbondstyle,line join=bevel](#3@@1)--(#3@@2)--(#2@@)--cycle;
+ \let\CF_joinbond\CF_zero
+ \else
+ \CF_error{unknown bond type, this error should not occur^^JIf you think it's a bug, send a Minimal Example to the author}%
+ \fi
+ \let\CF_startoffset\empty
+ \let\CF_endoffset\empty
+ \let\CF_previoustikz\CF_currenttikz
+ \let\CF_previousbondangle\CF_previousangle
+ \def\CF_previousbond{#1}%
+}
+
+\def\CF_drawaxisbondnojoin#1#2{\CF_drawbonda(#1@@)--(#2@@);}
+
+\def\CF_drawaxisbondjoin#1#2{% dessine une liaison simple dans l'axe avec raccord rétrograde
+ \ifCF_incycle\ifnum\CF_cntcycle=\CF_cyclenum\relax
+ \let\CF_nexttikz\CF_cyclefirsttikz
+ \fi\fi
+ \ifnum\CF_joinbond=0
+ \ifCF_incycle
+ \ifnum\CF_cntcycle=\CF_cyclenum\relax
+ \ifnum\CF_cyclejoinlast=1
+ \CF_drawbonda(#1@@)--(#2@@)--%
+ ([shift=(\CF_previousbondangle+2*\CF_cycleincrementangle:.5\pgflinewidth)]#2@@);
+ \else
+ \CF_drawbonda(#1@@)--(#2@@);
+ \fi
+ \else
+ \CF_drawbonda(#1@@)--(#2@@);
+ \fi
+ \else
+ \CF_drawbonda(#1@@)--(#2@@);
+ \fi
+ \def\CF_joinbond{1}%
+ \else
+ \CF_ifx\CF_previoustikz\CF_currenttikz
+ {\def\CF_joinbond{1}%
+ \CF_ifx\CF_previousatomgroup\CF_emptynode
+ {\CF_ifx\CF_previousbondangle\empty% si début molécule
+ {\CF_drawbonda(#1@@)--(#2@@);
+ }
+ {\ifdim\CF_startoffset=0pt
+ \ifCF_incycle
+ \ifnum\CF_cntcycle=\CF_cyclenum\relax
+ \ifnum\CF_cyclejoinlast=1
+ \CF_ifx\CF_cyclefirsttikz\CF_currenttikz
+ {\CF_drawbonda([shift=(\CF_previousbondangle:-.5\pgflinewidth)]#1@@)--(#1@@)--(#2@@)--%
+ ([shift=(\CF_previousbondangle+2*\CF_cycleincrementangle:.5\pgflinewidth)]#2@@);
+ }
+ {\CF_drawbonda([shift=(\CF_previousbondangle:-.5\pgflinewidth)]#1@@)--(#1@@)--(#2@@);
+ }%
+ \else
+ \CF_drawbonda([shift=(\CF_previousbondangle:-.5\pgflinewidth)]#1@@)--(#1@@)--(#2@@);
+ \fi
+ \else
+ \CF_drawbonda([shift=(\CF_previousbondangle:-.5\pgflinewidth)]#1@@)--(#1@@)--(#2@@);
+ \fi
+ \else
+ \CF_drawbonda([shift=(\CF_previousbondangle:-.5\pgflinewidth)]#1@@)--(#1@@)--(#2@@);
+ \fi
+ \else
+ \CF_drawbonda(#1@@)--(#2@@);
+ \fi
+ }%
+ }
+ {\CF_drawbonda(#1@@)--(#2@@);}%
+ }
+ {\ifCF_incycle
+ \ifnum\CF_cntcycle=\CF_cyclenum\relax
+ \ifnum\CF_cyclejoinlast=1
+ \CF_ifx\CF_nexttikz\CF_currenttikz
+ {\CF_drawbonda(#1@@)--(#2@@)--([shift=(\CF_previousbondangle+2*\CF_cycleincrementangle:.5\pgflinewidth)]#2@@);}%
+ {\CF_drawbonda(#1@@)--(#2@@);}%
+ \else
+ \CF_drawbonda(#1@@)--(#2@@);
+ \fi
+ \else
+ \CF_drawbonda(#1@@)--(#2@@);
+ \fi
+ \else
+ \CF_drawbonda(#1@@)--(#2@@);
+ \fi
+ }%
+ \fi
+ \ifdim\CF_endoffset=0pt \else
+ \let\CF_joinbond\CF_zero
+ \fi
+}
+
+\def\CF_drawbonda{\CF_expafter{\draw[}\CF_currentbondstyle]}
+
+\def\CF_hookdrawall{% dessine tous les crochets contenus dans la sc \CF_hookdraw
+ \CF_doifnotempty\CF_hookdrawlist
+ {\expandafter\CF_hookdrawfirst\CF_hookdrawlist\_nil% trace un lien de crochet à crochet
+ \CF_hookdrawall
+ }%
+}
+
+\def\CF_hookdrawfirst[#1,#2,#3]#4#5#6#7#8\_nil{%
+ \def\CF_hookdrawlist{#8}%
+ \begingroup
+ \let\CF_joinbond\CF_zero
+ \def\CF_currenttikz{#3}%
+ \def\CF_hookstartcontent{#6}\def\CF_hookendcontent{#7}%
+ \CF_ifinteger{#2}%
+ {\CF_drawbond{#2}{#4}{#5}\CF_hookstartcontent\CF_hookendcontent
+ }%
+ {\CF_assignbondcode{#2}\CF_bondcurrentnum
+ \CF_drawbond\CF_bondcurrentnum{#4}{#5}\CF_hookstartcontent\CF_hookendcontent
+ }%
+ \endgroup
+}
+
+\def\CF_extractatom#1-#2\_nil{#2}% transforme le bound@outnode en n° de l'atome
+
+\def\CF_gobblemovearg @#1#2\_nil#3{%
+ \expandafter\def\csname atom_\number\CF_cntatom\endcsname{#2}%
+ \CF_ifinstr{#1},%
+ {\CF_analysemovearg#1\_nil#3\let\CF_movebondcoeff\empty}%
+ {\def#3{#1}}%
+ \CF_doifempty{#2}{\let\CF_nodestrut\empty}%
+}%
+
+\def\hflipnext{\def\CF_flipstate{1}}
+
+\def\vflipnext{\def\CF_flipstate{2}}
+\let\CF_flipstate\CF_zero
+
+\def\CF_drawatomgroup#1#2#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_bondoutcontent% assigne le contenu de l'atome d'où part la liaison
+ \csname
+ \ifdefined\CF_bondoutnode
+ atom_\expandafter\CF_extractatom\CF_bondoutnode\_nil
+ \else
+ empty%
+ \fi
+ \endcsname
+ \global\advance\CF_cntgroup1
+ \let\CF_currentatom\empty
+ \global\let\CF_hookdrawlist\empty
+ \CF_cntatomgroup0
+ \CF_iffirsttokmatch{#3}?
+ {\CF_drawatomgroupa{{}#3}}
+ {\CF_drawatomgroupa{#3}}%
+ \def\CF_currentatomgroup{#3}%
+ \CF_removemovearg\CF_currentatomgroup% enlève les "@{<nom>}"
+ \CF_ifinstr{#3}?%
+ {\CF_removehook\CF_currentatomgroup
+ \ifcat\relax\detokenize\expandafter{\romannumeral-`\.\expandafter\noexpand\CF_currentatomgroup}\relax
+ \let\CF_currentatomgroup\CF_emptynode
+ \fi
+ }%
+ {}%
+ \CF_doifnotempty{#2}
+ {\ifnum#2<1
+ \CF_warning{no atom found at position #2, pershaps you mispelled the optional argument of the bond.}%
+ \else
+ \ifnum#2>\CF_cntatomgroup
+ \CF_error{no atom found at position #2, pershaps you mispelled the optional argument of the bond.}%
+ \fi
+ \fi
+ }%
+ \edef\CF_hookatomnumber{%
+ \CF_ifempty{#2}
+ {\ifdim#1pt>90pt
+ \ifdim#1pt<270pt
+ \number\CF_cntatomgroup
+ \else
+ 1%
+ \fi
+ \else
+ 1%
+ \fi
+ }
+ {#2%
+ }%
+ }%
+ \CF_cntatom\CF_hookatomnumber
+ \CF_ifx\CF_currentatomgroup\CF_emptynode
+ {\let\CF_nodestrut\empty
+ }
+ {\CF_ifx\empty\CF_bondoutcontentsaved
+ {\def\CF_nodestrut{\vphantom\CF_bondoutcontent}}%
+ {\def\CF_nodestrut{\vphantom\CF_bondoutcontentsaved}}%
+ }%
+ \edef\CF_optstring{anchor=\ifnum\CF_lastaction=0 base\else\ifCF_incycle center\else\ifCF_macrofixedbondlength 180+#1\else center\fi\fi\fi,at=(CF_node),\CF_nodestyle}% premier atome de la molécule affiché
+ \loop
+ \unless\ifnum\CF_cntatom>\CF_cntatomgroup
+ \CF_eexpafter
+ {\futurelet\CF_toksa}
+ {\expandafter\expandafter\expandafter\CF_gobtonil\csname atom_\number\CF_cntatom\endcsname\_nil}%
+ \CF_ifx @\CF_toksa% l'atome courant commence par un "@"
+ {\CF_threeea\CF_gobblemovearg\csname atom_\number\CF_cntatom\endcsname\_nil\CF_moveatomname
+ \CF_expafter{\node[}\CF_optstring,overlay](\CF_moveatomname){\phantom{\CF_nodecontent}};%
+ \let\CF_moveatomname\empty
+ }
+ {}%
+ \CF_expafter{\node[}\CF_optstring](n\number\CF_cntgroup-\number\CF_cntatom){\CF_nodecontent};%
+ \let\CF_nodestrut\empty
+ \advance\CF_cntatom1
+ \edef\CF_optstring{anchor=base \ifnum\CF_flipstate=1 east\else west\fi,at=(n\number\CF_cntgroup-\number\numexpr\CF_cntatom-1.base \ifnum\CF_flipstate=1 west\else east\fi),\CF_nodestyle}%
+ \repeat
+ \CF_cntatom\CF_hookatomnumber
+ \ifnum\CF_lastaction=2 % s'il faut tracer une liaison
+ \gdef\CF_cycleanglecorrection{0}% alors c'est qu'un cycle ne peut pas commencer la molécule : annulation de la correction d'angle
+ \CF_drawbond\CF_bondtype{\CF_bondoutnode}{n\number\CF_cntgroup-\number\CF_cntatom}\CF_previousatomgroup\CF_currentatomgroup
+ \fi
+ \def\CF_lastaction{1}% met la dernière action à 1 : affichage d'un noeud
+ \loop
+ \ifnum\CF_cntatom>1
+ \advance\CF_cntatom-1
+ \edef\CF_optstring{anchor=base \ifnum\CF_flipstate=1 west\else east\fi,at=(n\number\CF_cntgroup-\number\numexpr\CF_cntatom+1.base \ifnum\CF_flipstate=1 east\else west\fi),\CF_nodestyle}%
+ \CF_eexpafter
+ {\futurelet\CF_toksa}
+ {\expandafter\expandafter\expandafter\CF_gobtonil\csname atom_\number\CF_cntatom\endcsname\_nil}%
+ \CF_ifx @\CF_toksa% l'atome courant commence par un "@"
+ {\CF_threeea\CF_gobblemovearg\csname atom_\number\CF_cntatom\endcsname\_nil\CF_moveatomname
+ \CF_expafter{\node[}\CF_optstring,overlay](\CF_moveatomname){\phantom{\CF_nodecontent}};%
+ \let\CF_moveatomname\empty
+ }
+ {}%
+ \CF_expafter{\node[}\CF_optstring](n\number\CF_cntgroup-\number\CF_cntatom){\CF_nodecontent};%
+ \repeat
+ \CF_hookdrawall
+ \edef\CF_lastgroupnumber{\number\CF_cntgroup}%
+ \let\CF_previousatomgroup\CF_currentatomgroup
+}
+
+\def\CF_keepmovearg @#1#2\_nil{\def\CF_currentatom{@{#1}}}
+
+\def\CF_drawatomgroupa#1{% transforme #1 en un groupe d'atomes
+ \CF_ifempty{#1}
+ {\expandafter\let\csname atom_\number\CF_cntatomgroup\endcsname\CF_currentatom
+ }
+ {\advance\CF_cntatomgroup1
+ \futurelet\CF_toksa\CF_gobtonil#1\_nil
+ \CF_ifx @\CF_toksa
+ {\CF_keepmovearg#1\_nil
+ \CF_removemovearga#1\_nil\CF_aftermovearg
+ \CF_expsecond\CF_drawatomgroupb{\CF_aftermovearg}%
+ }%
+ {\let\CF_currentatom\empty
+ \CF_drawatomgroupb{#1}%
+ }%
+ }%
+}
+
+\def\CF_drawatomgroupb#1{%
+ \CF_ifempty{#1}
+ {\expandafter\let\csname atom_\number\CF_cntatomgroup\endcsname\CF_currentatom
+ }
+ {\futurelet\CF_toksa\CF_gobtonil#1\_nil
+ \CF_ifx\bgroup\CF_toksa
+ {\CF_eaddtomacro\CF_currentatom{\expandafter{\CF_firsttonil#1\_nil}}%
+ \CF_expsecond\CF_drawatomgroupba{\CF_gobarg#1}%
+ }%
+ {\CF_ifx\CF_sptoken\CF_toksa
+ {\CF_addtomacro\CF_currentatom{ }%
+ \CF_expsecond\CF_drawatomgroupba{\CF_afterspace#1\_nil}%
+ }%
+ {\CF_eaddtomacro\CF_currentatom{\CF_firsttonil#1\_nil}%
+ \CF_expsecond\CF_drawatomgroupba{\CF_gobarg#1}%
+ }%
+ }%
+ }%
+}
+
+% enlève tous les "@{nom}" de la sc #1
+\def\CF_removemovearg#1{%
+ \CF_expsecond\CF_ifinstr{#1}@%
+ {\expandafter\CF_removemovearga#1\_nil#1%
+ \CF_removemovearg#1%
+ }%
+ {}%
+}
+
+% enlève le premier "@{<nom>}" de l'argument et l'assigne à #2
+\def\CF_removemovearga#1\_nil#2{%
+ \def\CF_removemoveargb##1@{%
+ \CF_expsecond{\def#2}{\CF_gobarg##1}% mange le \relax
+ \CF_removemoveargc\relax
+ }%
+ \def\CF_removemoveargc##1\_nil{\CF_eaddtomacro#2{\CF_gobtwoargs##1}}% mange le \relax et le <nom>
+ \CF_removemoveargb\relax#1\_nil
+}
+
+\def\CF_drawatomgroupba#1{% transforme #1 en un groupe d'atomes
+ \CF_ifempty{#1}
+ {\expandafter\let\csname atom_\number\CF_cntatomgroup\endcsname\CF_currentatom
+ \let\CF_currentatom\empty
+ }
+ {\futurelet\CF_toksa\CF_gobtonil#1\_nil
+ \CF_ifx @\CF_toksa
+ {\expandafter\let\csname atom_\number\CF_cntatomgroup\endcsname\CF_currentatom
+ \let\CF_currentatom\empty
+ \CF_drawatomgroupa{#1}%
+ }%
+ {\CF_ifx|\CF_toksa
+ {\expandafter\let\csname atom_\number\CF_cntatomgroup\endcsname\CF_currentatom
+ \let\CF_currentatom\empty
+ \CF_expsecond\CF_drawatomgroupa{\CF_gobarg#1}%
+ }%
+ {\CF_ifx\CF_sptoken\CF_toksa
+ {\CF_addtomacro\CF_currentatom{ }%
+ \CF_expsecond\CF_drawatomgroupba{\CF_afterspace#1\_nil}%
+ }%
+ {\CF_ifx\bgroup\CF_toksa
+ {\CF_eaddtomacro\CF_currentatom{\expandafter{\CF_firsttonil#1\_nil}}%
+ \CF_expsecond\CF_drawatomgroupba{\CF_gobarg#1}%
+ }%
+ {\CF_expsecond\CF_ifcarisupperletter{\CF_firsttonil#1\_nil}%
+ {\expandafter\let\csname atom_\number\CF_cntatomgroup\endcsname\CF_currentatom
+ \let\CF_currentatom\empty
+ \CF_drawatomgroupa{#1}%
+ }%
+ {\CF_ifx?\CF_toksa
+ {\CF_expsecond\CF_iffirsttokmatch{\CF_gobarg#1}[% un crochet après le "?"
+ {\expandafter\CF_graboptarg\CF_gobarg#1\_nil\CF_afterhook}%
+ {\CF_expafter{\CF_graboptarg[]}{\CF_gobarg#1}\_nil\CF_afterhook}%
+ \CF_exptwomacroargs\CF_ifinstr{\CF_hooklist}{\expandafter(\CF_hookcurrentname)}% crochet déjà défini ?
+ {\CF_expsecond\CF_hookparselist{\CF_hookcurrentname}% chercher les caractéristiques du crochet sauvegardé
+ \CF_edefaddtomacro\CF_hookdrawlist{%
+ [\CF_hookcurrentname,\CF_hookcurrentlink,\CF_hookcurrenttikz]{\CF_hooksavedcoord}{n\number\CF_cntgroup-\number\CF_cntatomgroup}}%
+ \CF_eaddtomacro\CF_hookdrawlist{\expandafter{\CF_hooksavedcontent}}%
+ \CF_eaddtomacro\CF_hookdrawlist{\expandafter{\CF_currentatom}}% ajoute les 4 arguments à la liste des crochets à tracer
+ \global\let\CF_hookdrawlist\CF_hookdrawlist
+ }%
+ {\CF_edefaddtomacro\CF_hooklist{(\CF_hookcurrentname)|n\number\CF_cntgroup-\number\CF_cntatomgroup|}%
+ \CF_eaddtomacro\CF_hooklist{\CF_currentatom|}%
+ \global\let\CF_hooklist\CF_hooklist
+ }%
+ \CF_expsecond\CF_drawatomgroupba{\CF_afterhook}%
+ }%
+ {\CF_eaddtomacro\CF_currentatom{\CF_firsttonil#1\_nil}%
+ \CF_expsecond\CF_drawatomgroupba{\CF_gobarg#1}%
+ }%
+ }%
+ }%
+ }%
+ }%
+ }%
+ }%
+}
+
+\def\CF_kookdefaultname{a}
+\def\CF_hookdefaultlink{-}
+\def\CF_hookdefaulttikz{}
+
+\def\CF_hookparseoptarg#1,#2,#3\_nil{%
+ \CF_testemptyandassign\CF_hookcurrentname{#1}\CF_kookdefaultname
+ \CF_testemptyandassign\CF_hookcurrentlink{#2}\CF_hookdefaultlink
+ \CF_testemptyandassign\CF_hookcurrenttikz{#3}\CF_hookdefaulttikz
+}
+
+\def\CF_graboptarg[#1]#2\_nil#3{%
+ \CF_hookparseoptarg#1,,\_nil
+ \def#3{#2}%
+}
+
+\def\CF_hookparselist#1{% #1 est le nom du noeud à retrouver
+ \def\CF_hookparselista##1(#1)|##2|##3|##4\_nil{\def\CF_hooksavedcoord{##2}\def\CF_hooksavedcontent{##3}}%
+ \expandafter\CF_hookparselista\CF_hooklist\_nil
+}
+
+\def\CF_removehook#1{%
+ \CF_expsecond\CF_ifinstr{#1}?%
+ {\CF_expafter{\CF_removehooka\relax}#1\_nil#1%
+ \CF_removehook#1%
+ }
+ {}%
+}
+
+\def\CF_removehooka#1?#2\_nil#3{%
+ \CF_iffirsttokmatch{#2}[%
+ {\CF_removehookb#1?#2\_nil#3}
+ {\CF_expsecond{\def#3}{\CF_gobarg#1#2}}%
+}
+
+\def\CF_removehookb#1?[#2]#3\_nil#4{\CF_expsecond{\def#4}{\CF_gobarg#1#3}}
+
+\def\Lewis{%
+ \CF_lewisoverlayfalse
+ \CF_testopt\CF_lewisa{}%
+}
+
+\def\lewis{%
+ \CF_lewisoverlaytrue
+ \CF_testopt\CF_lewisa{}%
+}
+
+\def\CF_lewisa[#1]{%
+ \begingroup
+ \CF_doifnotempty{#1}{\setchemfig{#1}}%
+ \CF_valuetomacro\CF_lewiswidthdouble[0.3ex]{lewis | width}%
+ \CF_valuetomacro\CF_lewisoffset [0.4ex]{lewis sep}%
+ \CF_valuetomacro\CF_lewislength [1.5ex]{lewis length}%
+ \CF_valuetomacro\CF_lewisstyle []{lewis style}%
+ \CF_valuetomacro\CF_lewisdist [0.3em]{lewis dist}%
+ \CF_valuetomacro\CF_lewisradius [0.15ex]{lewis radius}%
+ \CF_valuetomacro\CF_lewisdiagcoeff [1]{lewis diag coeff}%
+ \ifCF_lewisoverlay
+ \CF_addtomacro\CF_lewisstyle{,overlay}%
+ \fi
+ \CF_lewisb
+}
+
+\def\CF_lewisb#1{%
+ \CF_lewisc#1\_nil
+ \endgroup
+}
+
+\def\CF_lewisc#1,#2\_nil{%
+ \setbox\CF_boxlewis\hbox{\printatom{#2}}% mettre en dehors de tikzpicture (si \printatom ne passe pas en mode math)
+ \tikzpicture[every node/.style={anchor=base,inner sep=0pt,outer sep=0pt,minimum size=0pt},baseline]%
+ \CF_makeother;\CF_makeother:%
+ \node(CF_lewis@anchor){};
+ \def\CF_lewisremainpos{#1}%
+ \let\CF_lewispreviouspos\empty
+ \loop
+ \unless\ifx\CF_lewisremainpos\empty
+ \edef\CF_lewiscurrentpos{\expandafter\CF_firsttonil\CF_lewisremainpos\_nil}%
+ \edef\CF_lewisremainpos{\expandafter\CF_gobarg\CF_lewisremainpos}%
+ \pgfmathsetmacro\CF_lewisx{\wd\CF_boxlewis/2+\ifcase\CF_lewiscurrentpos\space1\or1\or0\or-1\or-1\or-1\or0\or1\fi*(\wd\CF_boxlewis/2)}%
+ \pgfmathsetmacro\CF_lewisy{\ht\CF_boxlewis/2+\ifcase\CF_lewiscurrentpos\space0\or1\or1\or1\or0\or-1\or-1\or-1\fi*(\ht\CF_boxlewis/2\ifnum\CF_lewiscurrentpos>4 +\dp\CF_boxlewis\fi)}%
+ \edef\CF_lewisxoffset{\ifcase\CF_lewiscurrentpos\space1\or0.70711\or0\or-0.70711\or-1\or-0.70711\or0\or0.70711\fi}%
+ \edef\CF_lewisyoffset{\ifcase\CF_lewiscurrentpos\space0\or0.70711\or1\or0.70711\or0\or-0.70711\or-1\or-0.70711\fi}%
+ \ifodd\CF_lewiscurrentpos\relax
+ \pgfmathsetmacro\CF_lewiscurrentoffset{\CF_lewisoffset*\CF_lewisdiagcoeff}%%
+ \else
+ \let\CF_lewiscurrentoffset\CF_lewisoffset
+ \fi
+ \if.\expandafter\CF_firsttonil\CF_lewisremainpos\relax\_nil
+ \edef\CF_lewisremainpos{\expandafter\CF_gobarg\CF_lewisremainpos}%
+ \CF_expafter{\draw[fill,black,}{\CF_lewisstyle]}%
+ (\CF_lewisx pt+\CF_lewisxoffset*\CF_lewiscurrentoffset,\CF_lewisy pt+\CF_lewisyoffset*\CF_lewiscurrentoffset)circle(\CF_lewisradius);%
+ \else
+ \if|\expandafter\CF_firsttonil\CF_lewisremainpos\relax\_nil
+ \edef\CF_lewisremainpos{\expandafter\CF_gobarg\CF_lewisremainpos}%
+ \pgfmathsetmacro\CF_lewisx{\CF_lewisx pt+\CF_lewisxoffset*\CF_lewiscurrentoffset}%
+ \pgfmathsetmacro\CF_lewisy{\CF_lewisy pt+\CF_lewisyoffset*\CF_lewiscurrentoffset}%
+ \CF_expafter{\draw[}\CF_lewisstyle]%
+ (\CF_lewisx pt+\CF_lewislength*\CF_lewisyoffset/2 pt,\CF_lewisy-\CF_lewislength*\CF_lewisxoffset/2 pt)--
+ (\CF_lewisx pt+\CF_lewislength*\CF_lewisyoffset/2 pt+\CF_lewisxoffset*\CF_lewiswidthdouble,\CF_lewisy-\CF_lewislength*\CF_lewisxoffset/2 pt+\CF_lewisyoffset*\CF_lewiswidthdouble)--
+ (\CF_lewisx pt-\CF_lewislength*\CF_lewisyoffset/2 pt+\CF_lewisxoffset*\CF_lewiswidthdouble,\CF_lewisy+\CF_lewislength*\CF_lewisxoffset/2 pt+\CF_lewisyoffset*\CF_lewiswidthdouble)--
+ (\CF_lewisx pt-\CF_lewislength*\CF_lewisyoffset/2 pt,\CF_lewisy+\CF_lewislength*\CF_lewisxoffset/2 pt)--cycle;%
+ \else
+ \if:\expandafter\CF_firsttonil\CF_lewisremainpos\relax\_nil
+ \edef\CF_lewisremainpos{\expandafter\CF_gobarg\CF_lewisremainpos}%
+ \pgfmathsetmacro\CF_lewisx{\CF_lewisx pt+\CF_lewisxoffset*\CF_lewiscurrentoffset}%
+ \pgfmathsetmacro\CF_lewisy{\CF_lewisy pt+\CF_lewisyoffset*\CF_lewiscurrentoffset}%
+ \CF_expafter{\draw[fill,black,}{\CF_lewisstyle]}%
+ (\CF_lewisx pt+\CF_lewisdist*\CF_lewisyoffset/2 pt,\CF_lewisy-\CF_lewisdist*\CF_lewisxoffset/2 pt)circle(\CF_lewisradius)%
+ (\CF_lewisx pt-\CF_lewisdist*\CF_lewisyoffset/2 pt,\CF_lewisy+\CF_lewisdist*\CF_lewisxoffset/2 pt)circle(\CF_lewisradius);%
+ \else
+ \pgfmathsetmacro\CF_lewisx{\CF_lewisx pt+\CF_lewisxoffset*\CF_lewiscurrentoffset}%
+ \pgfmathsetmacro\CF_lewisy{\CF_lewisy pt+\CF_lewisyoffset*\CF_lewiscurrentoffset}%
+ \CF_expafter{\draw[}\CF_lewisstyle]%
+ (\CF_lewisx pt+\CF_lewislength*\CF_lewisyoffset/2 pt,\CF_lewisy-\CF_lewislength*\CF_lewisxoffset/2 pt)--%
+ (\CF_lewisx pt-\CF_lewislength*\CF_lewisyoffset/2 pt,\CF_lewisy+\CF_lewislength*\CF_lewisxoffset/2 pt);%
+ \fi
+ \fi
+ \fi
+ \repeat
+ \node[anchor=base west]at(CF_lewis@anchor){\box\CF_boxlewis};%
+ \endtikzpicture
+}
+
+\def\Chembelow{\begingroup\let\CF_temp\CF_gobarg\CF_chembelowa}
+
+\def\chembelow{\begingroup\let\CF_temp\CF_id\CF_chembelowa}
+
+\def\CF_chembelowa{\CF_testopt\CF_chembelowb\CF_stacksep}
+
+\def\CF_chembelowb[#1]#2#3{%
+ \setbox\CF_box\hbox{\printatom{#2}}%
+ \expandafter\vtop\CF_temp{to\ht\CF_box}{%
+ \offinterlineskip
+ \hbox{\printatom{#2}}%
+ \kern#1\relax
+ \hbox to\wd\CF_box{\hss\printatom{#3}\hss}%
+ \CF_temp\vss
+ }%
+ \endgroup
+}
+
+\def\Chemabove{\begingroup\let\CF_temp\CF_gobarg\CF_chemabovea}
+
+\def\chemabove{\begingroup\let\CF_temp\CF_id\CF_chemabovea}
+
+\def\CF_chemabovea{\CF_testopt\CF_chemaboveb\CF_stacksep}
+
+\def\CF_chemaboveb[#1]#2#3{%
+ \setbox\CF_box\hbox{\printatom{#2}}%
+ \expandafter\vbox\CF_temp{to\ht\CF_box}{%
+ \offinterlineskip
+ \CF_temp\vss
+ \hbox to\wd\CF_box{\hss\printatom{#3}\hss}%
+ \kern#1\relax
+ \hbox{\printatom{#2}}%
+ }%
+ \endgroup
+}
+
+\def\chemmove{\CF_testopt\CF_chemmove{}}
+
+\def\CF_chemmove[#1]#2{%
+ \CF_doifnotempty{#2}%
+ {\expandafter\tikzpicture\expanded{[overlay,remember picture,-CF\CF_ifempty{#1}{}{,\unexpanded{#1}}]}%
+ #2%
+ \endtikzpicture
+ }%
+}
+
+\def\chemnameinit#1{%
+ \setbox\CF_boxstuff\hbox{#1}%
+ \xdef\CF_dpmax{\the\dp\CF_boxstuff}%
+}
+\let\CF_dpmax\CF_zero
+
+\def\CF_parsemolname#1\\#2\_nil{%
+ \hbox to\CF_wdstuffbox{\hss#1\hss}%
+ \CF_doifnotempty{#2}{\CF_parsemolname#2\_nil}%
+}
+
+\def\chemname{%
+ \CF_ifstar
+ {\CF_adjustnamedpfalse\CF_chemnamea}
+ {\CF_adjustnamedptrue \CF_chemnamea}%
+}
+
+\def\CF_chemnamea{\CF_testopt\CF_chemnameb{1.5ex}}
+
+\def\CF_chemnameb[#1]#2#3{%
+ \setbox\CF_boxstuff\hbox{#2}%
+ \edef\CF_wdstuffbox{\the\wd\CF_boxstuff}\edef\CF_dpstuffbox{\the\dp\CF_boxstuff}%
+ \leavevmode
+ \ifdim\CF_dpmax<\CF_dpstuffbox\global\let\CF_dpmax\CF_dpstuffbox\fi
+ \vtop{%
+ \box\CF_boxstuff
+ \nointerlineskip
+ \kern\dimexpr#1\ifCF_adjustnamedp+\CF_dpmax-\CF_dpstuffbox\fi\relax
+ \CF_parsemolname#3\\\_nil
+ }%
+}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%% S C H É M A S R É A C T I O N N E L S %%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\let\CF_schemenest\CF_zero
+
+\def\CF_subscheme{\CF_testopt\CF_subschemea{}}
+\def\CF_subschemea[#1]{\CF_testopt{\CF_subschemeb[#1]}{text}}
+\def\CF_subschemeb[#1][#2]#3{\schemestart[#1][#2]#3\schemestop}
+
+\def\chemleft#1#2\chemright#3{%
+ \leavevmode
+ \begingroup
+ \setbox0\hbox{$\vcenter{\hbox{}}$}\edef\CF_delimmathht{\the\ht0}%
+ \setbox0\hbox{#2}\edef\CF_delimdim{\the\dimexpr(\ht0+\dp0)/2}%
+ \edef\CF_delimshift{\the\dimexpr(\ht0-\dp0)/2-\CF_delimmathht}%
+ \raise\CF_delimshift\hbox{$\left#1\vrule height\CF_delimdim depth\CF_delimdim width0pt\right.$}\box0
+ \raise\CF_delimshift\hbox{$\left.\vrule height\CF_delimdim depth\CF_delimdim width0pt\right#3$}%
+ \endgroup
+}
+
+\def\chemright#1{%
+ \CF_warning{"\string\chemright\string#1" ignored! No \string\chemleft\space previously found.}%
+}
+
+\def\chemup#1#2\chemdown#3{%
+ \begingroup
+ \setbox0\hbox{\printatom{#2}}\edef\CF_delimdim{\the\dimexpr\wd0/2}%
+ \tikzpicture[every node/.style={inner sep=0pt,outer sep=0pt,minimum size=0pt},baseline]%
+ \node[anchor=base west](chem@stuff){\box0};%
+ \node[at=(chem@stuff.north),anchor=east,rotate=-90]{$\left#1\vrule height\CF_delimdim depth\CF_delimdim width0pt\right.$};%
+ \node[at=(chem@stuff.south),anchor=west,rotate=-90]{$\left.\vrule height\CF_delimdim depth\CF_delimdim width0pt\right#3$};%
+ \endtikzpicture
+ \endgroup
+}
+
+\def\chemdown#1{%
+ \CF_warning{"\string\chemdown\string#1" ignored! No \string\chemup\space previously found.}%
+}
+
+\def\CF_setstyle#1,#2,#3\_nil#4#5#6{%
+ \def#4{#1}\let#5\empty\let#6\empty
+ \CF_iffirsttokmatch\CF_quark{#2\relax}
+ {}%
+ {\def#5{#2}%
+ \CF_iffirsttokmatch\CF_quark{#3\relax}
+ {}%
+ {\CF_setstylea#3\_nil#6}%
+ }%
+}
+\def\CF_setstylea#1,\CF_quark#2\_nil#3{\def#3{#1}}
+
+\def\CF_and{\futurelet\CF_toksa\CF_anda}
+
+\def\CF_anda{%
+ \CF_ifx\CF_toksa\bgroup
+ {\CF_andb}
+ {\CF_andb{}}%
+}
+
+\def\CF_andb#1{%
+ \CF_setstyle#1,\CF_quark,\CF_quark\_nil\CF_signspaceante\CF_signspacepost\CF_signvshift
+ \CF_doifempty\CF_signspaceante{\CF_valuetomacro\CF_signspaceante[0.5em]{+ sep left}}%
+ \CF_doifempty\CF_signspacepost{\CF_valuetomacro\CF_signspacepost[0.5em]{+ sep right}}%
+ \CF_doifempty\CF_signvshift{\CF_valuetomacro\CF_signvshift[0pt]{+ vshift}}%
+ \raise\CF_signvshift\hbox{\kern\CF_signspaceante$+$\kern\CF_signspacepost}%
+}
+
+\def\schemestart{%
+ \begingroup
+ \xdef\CF_schemenest{\number\numexpr\CF_schemenest+1}%
+ \CF_testopt\CF_schemestarta{}%
+}
+
+\def\CF_schemestarta[#1]{%
+ \CF_valuetomacro\CF_defaultcompoundstyle[]{compound style}%
+ \CF_setstyle#1,\CF_quark,\CF_quark\_nil\CF_arrowangle\CF_arrowlength\CF_arrowstyle
+ \CF_doifempty\CF_arrowangle{\CF_valuetomacro\CF_arrowangle[0]{arrow angle}}%
+ \CF_doifempty\CF_arrowlength{\CF_valuetomacro\CF_arrowlength[1]{arrow coeff}}%
+ \CF_valuetomacro\CF_defaultarrowstyle[]{arrow style}%
+ \CF_valuetomacro\CF_arrowoffset[1em]{arrow offset}%
+ \CF_valuetomacro\CF_compoundsep[5em]{compound sep}%
+ \CF_valuetomacro\CF_arrowlabelsep[3pt]{arrow label sep}%
+ \CF_valuetomacro\CF_arrowhead[-CF]{arrow head}%
+ \CF_eexpsecond{\def\CF_arrowtip}{\expandafter\CF_gobarg\CF_arrowhead}%
+ \CF_eexpsecond{\CF_preaddtomacro\CF_defaultarrowstyle}{\useKV[chemfig]{arrow head},}%
+ \CF_ifx\empty\CF_arrowstyle
+ {\let\CF_arrowstyle\CF_defaultarrowstyle}
+ {\CF_expsecond{\CF_preaddtomacro\CF_arrowstyle}{\CF_defaultarrowstyle,}}% se rajoute après le style par défaut
+ \CF_valuetomacro\CF_arrowdoublesep[2pt]{arrow double sep}%
+ \pgfmathsetmacro\CF_arrowdoublesep{\CF_arrowdoublesep/2}%
+ \CF_valuetomacro\CF_arrowdoubleposstart[0.6]{arrow double coeff}%
+ \pgfmathsetmacro\CF_arrowdoubleposstart{(1-\CF_arrowdoubleposstart)/2}%
+ \pgfmathsetmacro\CF_arrowdoubleposend{1-\CF_arrowdoubleposstart}%
+ \ifboolKV[chemfig]{scheme debug}
+ {\tikzpicture[every node/.style={draw,anchor=base,inner sep=0pt,outer sep=0pt,minimum size=1.5pt},baseline,remember picture]}
+ {\tikzpicture[every node/.style={anchor=base,inner sep=0pt,outer sep=0pt,minimum size=0pt},baseline,remember picture]}%
+ \let\merge\CF_merge
+ \expandafter\let\csname+\endcsname\CF_and
+ \let\arrow\CF_arrow
+ \let\schemestop\CF_schemestop
+ \let\subscheme\CF_subscheme
+ \CF_testopt{\CF_schemestartb}{text}%
+}
+
+\def\CF_schemestartb[#1]{%
+ \ifnum\CF_schemenest=1 % la commande n'est pas imbriquée ?
+ \CF_cntcompound0
+ \fi
+ \edef\CF_currentnodename{c\number\CF_cntcompound}%
+ \let\CF_nextnodename\empty
+ \let\CF_nextnodestyle\empty
+ \let\CF_directarrowlist\empty
+ \ifboolKV[chemfig]{scheme debug}
+ {\node[fill,green](\CF_currentnodename){};}
+ {\node(\CF_currentnodename){};}%
+ \def\CF_nextnodeanchor{#1}%
+ \CF_doifempty\CF_nextnodeanchor{\def\CF_nextnodeanchor{text}}%
+ \let\CF_compound\empty
+ \CF_schemestartc
+}
+
+\def\CF_schemestartc{%
+ \futurelet\CF_toksa\CF_schemestarte
+}
+
+\expandafter\def\expandafter\CF_schemestartd\space{\futurelet\CF_toksa\CF_schemestarte}
+
+\def\CF_schemestarte{% ... et l'examine :
+ \CF_iffirsttokina{\arrow\schemestop\merge}%
+ {}
+ {\CF_ifx\CF_toksa\bgroup
+ {\CF_addnextarg
+ }
+ {\CF_ifx\CF_toksa\CF_sptoken
+ {\CF_addtomacro\CF_compound{ }%
+ \CF_schemestartd
+ }
+ {\afterassignment\CF_schemestartc
+ \CF_addtomacro\CF_compound
+ }%
+ }%
+ }%
+}
+
+\def\CF_addnextarg#1{\CF_addtomacro\CF_compound{{#1}}\CF_schemestartc}
+
+\def\CF_displaycompound#1#2{% #1 = nom et #2 = style
+ \CF_doifnotempty\CF_compound
+ {\global\advance\CF_cntcompound1
+ \CF_ifx\CF_defaultcompoundstyle\empty
+ {\let\CF_currentnodestyle\empty}
+ {\CF_expsecond{\def\CF_currentnodestyle}{\CF_defaultcompoundstyle,}}%
+ \CF_addtomacro\CF_currentnodestyle{anchor=\CF_nextnodeanchor,at=(\CF_currentnodename)}%
+ \CF_ifempty{#2}%
+ {\CF_doifnotempty\CF_nextnodestyle
+ {\CF_eaddtomacro\CF_currentnodestyle{\expandafter,\CF_nextnodestyle}}%
+ }
+ {\CF_doifnotempty\CF_nextnodestyle
+ {\CF_warning{two styles for the same node, first style "\CF_nextnodestyle" ignored}%
+ }%
+ \CF_addtomacro\CF_currentnodestyle{,#2}%
+ }%
+ \CF_ifempty{#1}
+ {\edef\CF_temp{%
+ \CF_ifempty\CF_nextnodename
+ {c\number\CF_cntcompound}
+ {\CF_nextnodename}%
+ }%
+ }
+ {\CF_doifnotempty\CF_nextnodename
+ {\CF_warning{two names for the same node, first name "\CF_nextnodename" ignored}%
+ }%
+ \edef\CF_temp{#1}%
+ }%
+ \CF_expafter{\node[}\CF_currentnodestyle](\CF_temp){\CF_compound};%
+ \ifboolKV[chemfig]{scheme debug}%
+ {\node[draw=none,anchor=270,at=(\CF_temp.90),fill=green!60,overlay,opacity=0.5]{\scriptsize\bfseries\CF_temp};%
+ }
+ {}%
+ \let\CF_currentnodename\CF_temp
+ }%
+}
+
+\def\CF_schemestop{%
+ \CF_displaycompound{}{}%
+ \CF_directarrowlist
+ \endtikzpicture
+ \xdef\CF_schemenest{\number\numexpr\CF_schemenest-1}%
+ \endgroup
+}
+
+\def\CF_analysearrowarg#1{\CF_analysearrowarga#1[]\_nil}
+
+\def\CF_analysearrowarga#1[#2]#3\_nil{%
+ \CF_ifinstr{#1}.
+ {\CF_addtomacro\CF_temp{#1[#2]}}
+ {\CF_addtomacro\CF_temp{#1.[#2]}}%
+}
+
+\def\CF_arrow{%
+ \CF_ifnextchar(%
+ {\CF_arrowa
+ }
+ {\CF_ifnextchar\bgroup
+ {\CF_arrowb(.[]--.[])}
+ {\CF_arrowb(.[]--.[]){}}%
+ }%
+}
+
+\def\CF_arrowa(#1--#2){%
+ \def\CF_temp{(}%
+ \CF_analysearrowarg{#1}%
+ \CF_addtomacro\CF_temp{--}%
+ \CF_analysearrowarg{#2}%
+ \CF_addtomacro\CF_temp)%
+ \CF_ifnextchar\bgroup
+ {\expandafter\CF_arrowb\CF_temp}
+ {\expandafter\CF_arrowb\CF_temp{}}%
+}
+
+\def\CF_arrowb(#1.#2[#3]--#4.#5[#6])#7{%
+ \def\CF_currentarrowtype{#7}% nom de la flèche
+ \CF_doifempty\CF_currentarrowtype{\def\CF_currentarrowtype{->}}%
+ \CF_testopt{\CF_arrowc(#1.#2[#3]--#4.#5[#6])}{}%
+}
+
+\def\CF_arrowc(#1.#2[#3]--#4.#5[#6])[#7]{%
+ \def\CF_temp{\CF_arrowe(#1.#2[#3]--#4.#5[#6])}%
+ \CF_arrowd#7,\empty,\empty\_nil
+}
+
+\def\CF_arrowd#1,#2,#3\_nil{%
+ \CF_addtomacro\CF_temp{{#1}}%
+ \CF_eaddtomacro\CF_temp{\expandafter{#2}}%
+ \expandafter\CF_eaddtomacro\expandafter\CF_temp\expandafter{\expandafter\expandafter\expandafter{\expandafter\CF_sanitizelastitem#3,\empty\_nil}}%
+ \CF_temp
+}
+
+% #1, #4 : nom des nodes #2, #5 : ancres des nodes #3, #6 : styles des nodes
+% #7 : angle flèche #8 : longueur flèche #9 : style tikz de la flèche
+\def\CF_arrowe(#1.#2[#3]--#4.#5[#6])#7#8#9{%
+ \let\CF_arrowcurrentstyle\CF_arrowstyle
+ \if @\expandafter\CF_firsttonil\detokenize{#1.}\_nil% si #1 commence par @
+ \if @\expandafter\CF_firsttonil\detokenize{#4.}\_nil
+ \CF_eaddtomacro\CF_directarrowlist{\expandafter\CF_directarrow\expandafter{\CF_currentarrowtype}{#1}{#2}{#4}{#5}{#9}}%
+ \let\CF_nextaction\CF_schemestartc
+ \else
+ \CF_doifnotempty\CF_arrowcurrentstyle{\CF_addtomacro\CF_arrowcurrentstyle,}%
+ \CF_doifnotempty{#9}{\CF_addtomacro\CF_arrowcurrentstyle{#9,}}%
+ \CF_displaycompound{}{#3}%
+ \def\CF_nextnodename{#4}%
+ \CF_expsecond{\def\CF_currentnodename}{\CF_gobarg#1}%
+ \let\CF_arrowstartname\CF_currentnodename
+ \let\CF_arrowendname\CF_nextnodename
+ \CF_arrowf{#7}{#8}{#2}{#5}%
+ \def\CF_nextnodestyle{#6}%
+ \fi
+ \else
+ \CF_doifnotempty\CF_arrowcurrentstyle{\CF_addtomacro\CF_arrowcurrentstyle,}%
+ \CF_doifnotempty{#9}{\CF_addtomacro\CF_arrowcurrentstyle{#9,}}%
+ \if @\expandafter\CF_firsttonil\detokenize{#2.}\_nil
+ \CF_error{syntax "(<name>--@<name>)" is not allowed}%
+ \else
+ \CF_displaycompound{#1}{#3}%
+ \edef\CF_arrowstartname{%
+ \CF_ifempty{#1}
+ \CF_currentnodename
+ {#1}%
+ \CF_doifnotempty{#2}{.#2}%
+ }%
+ \CF_arrowf{#7}{#8}{#2}{#5}%
+ \def\CF_nextnodename{#4}%
+ \def\CF_nextnodestyle{#6}%
+ \fi
+ \fi
+ \CF_arrowgobspaces% mange les espaces puis exécute \CF_nextaction
+}
+
+\def\CF_arrowgobspaces{\futurelet\CF_toksa\CF_arrowgobspacesa}
+
+\def\CF_arrowgobspacesa{%
+ \CF_ifx\CF_sptoken\CF_toksa
+ \CF_arrowgobspacesb
+ \CF_nextaction
+}
+
+\expandafter\def\expandafter\CF_arrowgobspacesb\space{\futurelet\CF_toksa\CF_arrowgobspacesa}
+
+\def\CF_arrowf#1#2#3#4{% #1=angle #2=longueur #3=ancre départ #4=ancre arrivée
+ \def\CF_nextaction{\let\CF_compound\empty\CF_schemestartc}%
+ \def\CF_arrowcurrentangle{#1}\CF_doifempty\CF_arrowcurrentangle{\let\CF_arrowcurrentangle\CF_arrowangle}%
+ \def\CF_currentarrowlength{#2}\CF_doifempty\CF_currentarrowlength{\let\CF_currentarrowlength\CF_arrowlength}%
+ \node[at=(\CF_currentnodename.\CF_ifempty{#3}\CF_arrowcurrentangle{#3}),shift=(\CF_arrowcurrentangle:\CF_currentarrowlength*\CF_compoundsep),cyan,fill](end@arrow@i@\number\CF_schemenest){};%
+ \edef\CF_arrowendname{end@arrow@i@\number\CF_schemenest\CF_doifnotempty{#4}{.#4}}%
+ \ifboolKV[chemfig]{scheme debug}
+ {\node[at=(\CF_currentnodename.\CF_ifempty{#3}\CF_arrowcurrentangle{#3}),shift=(\CF_arrowcurrentangle:\CF_arrowoffset),red,fill](start@arrow){};%
+ \node[at=(\CF_currentnodename.\CF_ifempty{#3}\CF_arrowcurrentangle{#3}),shift=(\CF_arrowcurrentangle:\CF_currentarrowlength*\CF_compoundsep-\CF_arrowoffset),red,fill](end@arrow){};%
+ }
+ {\node[at=(\CF_currentnodename.\CF_ifempty{#3}\CF_arrowcurrentangle{#3}),shift=(\CF_arrowcurrentangle:\CF_arrowoffset)](start@arrow){};%
+ \node[at=(\CF_currentnodename.\CF_ifempty{#3}\CF_arrowcurrentangle{#3}),shift=(\CF_arrowcurrentangle:\CF_currentarrowlength*\CF_compoundsep-\CF_arrowoffset)](end@arrow){};%
+ }%
+ \def\CF_arrowstartnode{start@arrow}\def\CF_arrowendnode{end@arrow}%
+ \csname\expandafter\CF_grabarrowname\CF_currentarrowtype[\_nil\CF_threeea\endcsname
+ \expandafter\CF_grabarrowargs\CF_currentarrowtype[]\_nil[][][][][][][][]\_nil
+ \def\CF_currentnodename{end@arrow@i@\number\CF_schemenest}%
+ \edef\CF_nextnodeanchor{\CF_ifempty{#4}{180+\CF_arrowcurrentangle}{#4}}%
+}
+
+% trace un flèche initiée par (@nom--@nom)
+% #1=type de flèche #2=nom depart #3=ancre départ #4=nom arrivée #5=ancre arrivée #6=style flèche
+\def\CF_directarrow#1#2#3#4#5#6{%
+ \CF_expsecond{\def\CF_arrowstartname}{\CF_gobarg#2}%
+ \CF_expsecond{\def\CF_arrowendname}{\CF_gobarg#4}%
+ \path[sloped,allow upside down](\CF_gobarg#2\ifx\empty#3\empty\else.#3\fi)--(\CF_gobarg#4\ifx\empty#5\empty\else.#5\fi)%
+ coordinate[pos=0,xshift=\CF_arrowoffset](start@direct@arrow)%
+ coordinate[pos=1,xshift=-\CF_arrowoffset](end@direct@arrow);%
+ \def\CF_arrowstartnode{start@direct@arrow}%
+ \def\CF_arrowendnode{end@direct@arrow}%
+ \pgfmathanglebetweenpoints
+ {\pgfpointanchor{\CF_gobarg#2}{\ifx\empty#3\empty center\else#3\fi}}% Ne pas utiliser \CF_ifempty ici !!!
+ {\pgfpointanchor{\CF_gobarg#4}{\ifx\empty#5\empty center\else#5\fi}}%
+ \let\CF_arrowcurrentangle\pgfmathresult
+ \CF_doifnotempty{#6}{\CF_addtomacro\CF_arrowcurrentstyle{#6,}}%
+ \csname\CF_grabarrowname#1[]\_nil\expandafter\endcsname\CF_grabarrowargs#1[]\_nil[][][][][][][][]\_nil
+}
+
+\def\CF_mergegrabchardir#1[#2][#3]#4\_nil{%
+ \CF_expafter{\futurelet\CF_toksa\CF_gobtonil}{\CF_firsttonil#1>\_nil}\_nil
+ \ifx>\CF_toksa
+ \def\CF_mergeangle{0}\def\CF_mergeextreme{xmax}\def\CF_mergesign{+}%
+ \else
+ \ifx<\CF_toksa
+ \def\CF_mergeangle{180}\def\CF_mergeextreme{xmin}\def\CF_mergesign{-}%
+ \else
+ \ifx^\CF_toksa
+ \def\CF_mergeangle{90}\def\CF_mergeextreme{ymax}\def\CF_mergesign{+}%
+ \else
+ \ifx v\CF_toksa
+ \def\CF_mergeangle{-90}\def\CF_mergeextreme{ymin}\def\CF_mergesign{-}%
+ \fi\fi\fi\fi
+ \def\CF_mergelabelup{#2}\def\CF_mergelabeldo{#3}%
+}
+
+\def\CF_merge#1({%
+ \CF_mergegrabchardir#1[][]\_nil
+ \CF_mergea(%
+}
+
+\def\CF_mergea#1--(#2){\CF_testopt{\CF_mergeb#1--(#2)}{}}
+
+\def\CF_mergeb#1--(#2)[#3]{%
+ \CF_displaycompound{}{}%
+ \CF_parsemergeopt#3,\CF_quark,\CF_quark,\CF_quark\_nil
+ \def\CF_mergexmax{-16383.99999pt}\let\CF_mergeymax\CF_mergexmax
+ \def\CF_mergexmin{16383.99999pt}\let\CF_mergeymin\CF_mergexmin
+ \CF_mergeparsenodelist#1(\relax)% calcule les maxi des positions
+ \pgfmathsetmacro\CF_mergeextremeresult{\csname CF_merge\CF_mergeextreme\endcsname\CF_mergesign\CF_mergefromcoeff*\CF_compoundsep}%
+ \CF_mergec#1(\relax)% trace les lignes entre les noeuds précédents et la ligne de jonction
+ \CF_expsecond{\def\CF_temp}{\expandafter[\CF_mergestyle,shorten <=0,shorten >=0,-]}%
+ \if x\expandafter\CF_firsttonil\CF_mergeextreme\_nil
+ \CF_addtomacro\CF_temp{(\CF_mergeextremeresult pt,\CF_mergeymax)--(\CF_mergeextremeresult pt,\CF_mergeymin)}%
+ \else
+ \CF_addtomacro\CF_temp{(\CF_mergexmin,\CF_mergeextremeresult pt)--(\CF_mergexmax,\CF_mergeextremeresult pt)}%
+ \fi
+ \expandafter\draw\CF_temp node[pos=\CF_mergesplitcoeff](merge@point){}% trace la ligne de jonction
+ node[at=(merge@point),shift=(\CF_mergeangle:\CF_compoundsep*\CF_mergetocoeff-\CF_arrowoffset)](end@merge){}%
+ node[at=(merge@point),shift=(\CF_mergeangle:\CF_compoundsep*\CF_mergetocoeff)](end@merge@i){};%
+ \let\CF_arrowcurrentangle\CF_mergeangle
+ \CF_expafter{\draw[}\CF_mergestyle,shorten <=0](merge@point)--(end@merge)%
+ \expandafter\CF_arrowdisplaylabela\expandafter{\CF_mergelabelup}{.5}+\expandafter\CF_arrowdisplaylabela\expandafter{\CF_mergelabeldo}{.5}-;%
+ \def\CF_currentnodename{end@merge@i}%
+ \let\CF_temp\empty
+ \CF_analysearrowarg{#2}%
+ \expandafter\CF_merged\CF_temp\_nil
+}
+
+\def\CF_mergec(#1){%
+ \if\relax\expandafter\noexpand\CF_firsttonil#1\_nil
+ \else
+ \CF_ifdot{#1}%
+ {\edef\merge_currentnodename{\CF_beforedot#1\_nil}%
+ \edef\merge_currentanchor{\CF_afterdot#1\_nil}%
+ }%
+ {\def\merge_currentnodename{#1}%
+ \let\merge_currentanchor\CF_mergeangle
+ }%
+ \if x\expandafter\CF_firsttonil\CF_mergeextreme\_nil
+ \pgfextracty\CF_dim{\pgfpointanchor\merge_currentnodename\merge_currentanchor}%
+ \CF_expafter{\draw[}\CF_mergestyle,shorten >=0,-]([shift=(\CF_mergeangle:\CF_arrowoffset)]\merge_currentnodename.\merge_currentanchor)--(\CF_mergeextremeresult pt,\CF_dim);%
+ \else
+ \pgfextractx\CF_dim{\pgfpointanchor\merge_currentnodename\merge_currentanchor}%
+ \CF_expafter{\draw[}\CF_mergestyle,shorten >=0,-]([shift=(\CF_mergeangle:\CF_arrowoffset)]\merge_currentnodename.\merge_currentanchor)--(\CF_dim,\CF_mergeextremeresult pt);%
+ \fi
+ \expandafter\CF_mergec
+ \fi
+}
+
+\def\CF_merged#1.#2[#3]\_nil{%
+ \def\CF_nextnodename{#1}%
+ \edef\CF_nextnodeanchor{%
+ \CF_ifempty{#2}
+ {180+\CF_mergeangle}
+ {#2}%
+ }%
+ \def\CF_nextnodestyle{#3}%
+ \let\CF_compound\empty
+ \CF_schemestartc
+}
+
+\def\CF_parsemergeopt#1,#2,#3,#4\_nil{%
+ \CF_ifempty{#1}
+ {\def\CF_mergefromcoeff{0.5}}
+ {\def\CF_mergefromcoeff{#1}}%
+ \def\CF_mergetocoeff{0.5}%
+ \def\CF_mergesplitcoeff{0.5}%
+ \CF_eexpsecond{\def\CF_mergestyle}{\useKV[chemfig]{arrow head}}%
+ \CF_iffirsttokmatch\CF_quark{#2\relax}
+ {}
+ {\CF_ifempty{#2}
+ {\def\CF_mergetocoeff{0.5}}
+ {\def\CF_mergetocoeff{#2}}%
+ \CF_iffirsttokmatch\CF_quark{#3\relax}
+ {}
+ {\CF_ifempty{#3}
+ {\def\CF_mergesplitcoeff{0.5}}
+ {\def\CF_mergesplitcoeff{#3}}%
+ \CF_iffirsttokmatch\CF_quark{#4\relax}
+ {}
+ {\CF_parsemergeopta#4\_nil}%
+ }%
+ }%
+}
+
+\def\CF_parsemergeopta#1,\CF_quark#2\_nil{%
+ \CF_ifempty{#1}
+ {}
+ {\CF_addtomacro\CF_mergestyle{,#1}}%
+}
+
+\def\CF_mergeparsenodelist(#1){%
+ \if\relax\expandafter\noexpand\CF_firsttonil#1\_nil
+ \else
+ \CF_ifdot{#1}%
+ {\edef\merge_currentnodename{\CF_beforedot#1\_nil}\edef\merge_currentanchor{\CF_afterdot#1\_nil}}%
+ {\def\merge_currentnodename{#1}\let\merge_currentanchor\CF_mergeangle}%
+ \pgfextractx\CF_dim{\pgfpointanchor\merge_currentnodename\merge_currentanchor}%
+ \ifdim\CF_dim>\CF_mergexmax
+ \edef\CF_mergexmax{\the\CF_dim}%
+ \fi
+ \ifdim\CF_dim<\CF_mergexmin
+ \edef\CF_mergexmin{\the\CF_dim}%
+ \fi
+ \pgfextracty\CF_dim{\pgfpointanchor\merge_currentnodename\merge_currentanchor}%
+ \ifdim\CF_dim>\CF_mergeymax
+ \edef\CF_mergeymax{\the\CF_dim}%
+ \fi
+ \ifdim\CF_dim<\CF_mergeymin
+ \edef\CF_mergeymin{\the\CF_dim}%
+ \fi
+ \expandafter\CF_mergeparsenodelist
+ \fi
+}
+
+\def\CF_grabarrowname#1[#2\_nil{\detokenize{CF_arrow(#1)}}
+\def\CF_grabarrowargs#1[#2\_nil{[#2}
+
+\def\CF_makeparametertext#1{%
+ \toks0{}%
+ \CF_cntgroup#1\relax
+ \CF_makeparametertexta1%
+}
+
+\def\CF_makeparametertexta#1{%
+ \unless\ifnum#1>\CF_cntgroup
+ \toks0\expandafter{\the\toks0[###1]}%
+ \expandafter\CF_makeparametertexta\expandafter{\number\numexpr#1+1\expandafter}%
+ \fi
+}
+
+% #1 est le nombre d'arguments optionnels, #2 est le nom et #3 le code
+\def\definearrow#1#2#3{%
+ \begingroup
+ \CF_makeparametertext{#1}%
+ \expandafter\endgroup
+ \expandafter\def\csname\detokenize{CF_arrow(#2)}\expandafter\endcsname\the\toks0{#3\CF_gobtonil}%
+}
+
+\def\CF_ifdot#1{\CF_ifdota#1.\_nil}
+\def\CF_ifdota#1.#2\_nil{\ifx\empty#2\empty\expandafter\CF_execsecond\else\expandafter\CF_execfirst\fi}
+\def\CF_beforedot#1.#2\_nil{#1}
+\def\CF_afterdot#1.#2\_nil{#2}
+
+\def\CF_rotatenode*#1#2\_nil{%
+ \CF_ifdot{#1}
+ {\CF_beforedot#1\_nil}
+ {#1}%
+}
+\def\CF_anchornode*#1#2\_nil#3{%
+ \CF_ifdot{#1}
+ {\CF_afterdot#1\_nil}
+ {\CF_arrowcurrentangle-#390-#1}%
+}
+
+% #1 = label #2 = position #3 = + ou - (au dessus ou au dessous) #4 : nom du noeud de départ
+% #5 = label #6 = position #7 = + ou - (au dessus ou au dessous) #8 : nom du noeud de fin
+\def\CF_arrowdisplaylabel#1#2#3#4#5#6#7#8{%
+ \CF_doifnotempty{#1#5}
+ {\path(#4)--(#8)\CF_arrowdisplaylabela{#1}{#2}{#3}\CF_arrowdisplaylabela{#5}{#6}{#7};}%
+}
+
+\def\CF_arrowdisplaylabela#1#2#3{%
+ \CF_doifnotempty{#1}
+ {\if*\expandafter\CF_firsttonil\detokenize{#1}\_nil
+ \ifboolKV[chemfig]{scheme debug}
+ {node[pos=#2,sloped,yshift=#3\CF_arrowlabelsep,draw,fill,cyan](shifted@node){}%
+ node[draw,rotate=\CF_rotatenode#1\_nil,anchor=\CF_anchornode#1\_nil#3,at=(shifted@node)]{\expandafter\CF_gobarg\CF_gobarg#1}%
+ }
+ {node[pos=#2,sloped,yshift=#3\CF_arrowlabelsep](shifted@node){}%
+ node[rotate=\CF_rotatenode#1\_nil,anchor=\CF_anchornode#1\_nil#3,at=(shifted@node)]{\expandafter\CF_gobarg\CF_gobarg#1}%
+ }%
+ \else
+ \ifboolKV[chemfig]{scheme debug}
+ {node[pos=#2,sloped,yshift=#3\CF_arrowlabelsep,draw,fill,cyan](shifted@node){}%
+ node[draw,pos=#2,anchor=-#390,sloped,yshift=#3\CF_arrowlabelsep]{#1}%
+ }
+ {node[pos=#2,anchor=-#390,sloped,yshift=#3\CF_arrowlabelsep]{#1}%
+ }
+ \fi
+ }%
+}
+
+% pose des noeuds décalés de la dimension #1 à (\CF_arrowstartnode) et (\CF_arrowendnode)
+\def\CF_arrowshiftnodes#1{%
+ \unless\ifdim\CF_ifempty{#1}\CF_zero{#1}=0pt
+ \expanded{%
+ \noexpand\path(\CF_arrowstartnode)--(\CF_arrowendnode)%
+ node[pos=0,sloped,yshift=#1](\CF_arrowstartnode1){}node[pos=1,sloped,yshift=#1](\CF_arrowendnode1){};}%
+ \edef\CF_arrowstartnode{\CF_arrowstartnode1}\edef\CF_arrowendnode{\CF_arrowendnode1}%
+ \fi
+}
+
+\definearrow3{->}{%
+ \CF_arrowshiftnodes{#3}%
+ \CF_expafter{\draw[}\CF_arrowcurrentstyle](\CF_arrowstartnode)--(\CF_arrowendnode);%
+ \CF_arrowdisplaylabel{#1}{0.5}+\CF_arrowstartnode{#2}{0.5}-\CF_arrowendnode
+}
+
+\definearrow3{<-}{%
+ \CF_arrowshiftnodes{#3}%
+ \CF_expafter{\draw[}\CF_arrowcurrentstyle](\CF_arrowendnode)--(\CF_arrowstartnode);%
+ \CF_arrowdisplaylabel{#1}{0.5}+\CF_arrowstartnode{#2}{0.5}-\CF_arrowendnode
+}
+
+\definearrow5{-/>}{%
+ \CF_arrowshiftnodes{#3}%
+ \CF_expafter{\draw[}\CF_arrowcurrentstyle](\CF_arrowstartnode)--(\CF_arrowendnode)%
+ coordinate[midway,shift=(\CF_arrowcurrentangle:-1pt)](midway@i)%
+ coordinate[midway,shift=(\CF_arrowcurrentangle:1pt)](midway@ii)%
+ coordinate[at=(midway@i),shift=(\CF_ifempty{#4}{225}{#4+180}+\CF_arrowcurrentangle:\CF_ifempty{#5}{5pt}{#5})](line@start)%
+ coordinate[at=(midway@i),shift=(\CF_ifempty{#4}{45}{#4}+\CF_arrowcurrentangle:\CF_ifempty{#5}{5pt}{#5})](line@end)%
+ coordinate[at=(midway@ii),shift=(\CF_ifempty{#4}{225}{#4+180}+\CF_arrowcurrentangle:\CF_ifempty{#5}{5pt}{#5})](line@start@i)%
+ coordinate[at=(midway@ii),shift=(\CF_ifempty{#4}{45}{#4}+\CF_arrowcurrentangle:\CF_ifempty{#5}{5pt}{#5})](line@end@i);
+ \draw(line@start)--(line@end);%
+ \draw(line@start@i)--(line@end@i);%
+ \CF_arrowdisplaylabel{#1}{0.5}+\CF_arrowstartnode{#2}{0.5}-\CF_arrowendnode
+}
+
+\definearrow3{<->}{%
+ \CF_arrowshiftnodes{#3}%
+ \CF_expafter{\draw[}\CF_arrowcurrentstyle,\CF_arrowtip-\CF_arrowtip](\CF_arrowstartnode)--(\CF_arrowendnode);%
+ \CF_arrowdisplaylabel{#1}{0.5}+\CF_arrowstartnode{#2}{0.5}-\CF_arrowendnode
+}
+
+\definearrow3{<=>}{%
+ \CF_arrowshiftnodes{#3}%
+ \path[allow upside down](\CF_arrowstartnode)--(\CF_arrowendnode)%
+ node[pos=0,sloped,yshift=\CF_arrowdoublesep](\CF_arrowstartnode @u0){}%
+ node[pos=0,sloped,yshift=-\CF_arrowdoublesep](\CF_arrowstartnode @d0){}%
+ node[pos=1,sloped,yshift=\CF_arrowdoublesep](\CF_arrowstartnode @u1){}%
+ node[pos=1,sloped,yshift=-\CF_arrowdoublesep](\CF_arrowstartnode @d1){};%
+ \begingroup
+ \ifboolKV[chemfig]{arrow double harpoon}
+ {\pgfarrowharpoontrue}
+ {}%
+ \CF_expafter{\draw[}\CF_arrowcurrentstyle](\CF_arrowstartnode @u0)--(\CF_arrowstartnode @u1);%
+ \CF_expafter{\draw[}\CF_arrowcurrentstyle](\CF_arrowstartnode @d1)--(\CF_arrowstartnode @d0);%
+ \endgroup
+ \CF_arrowdisplaylabel{#1}{0.5}+\CF_arrowstartnode{#2}{0.5}-\CF_arrowendnode%
+}
+
+\definearrow3{<->>}{%
+ \CF_arrowshiftnodes{#3}%
+ \path[allow upside down](\CF_arrowstartnode)--(\CF_arrowendnode)%
+ node[pos=0,sloped,yshift=1pt](\CF_arrowstartnode @u0){}%
+ node[pos=\CF_arrowdoubleposstart,sloped,yshift=-1pt](\CF_arrowstartnode @d0){}%
+ node[pos=1,sloped,yshift=1pt](\CF_arrowstartnode @u1){}%
+ node[pos=\CF_arrowdoubleposend,sloped,yshift=-1pt](\CF_arrowstartnode @d1){};%
+ \begingroup
+ \ifboolKV[chemfig]{arrow double harpoon}
+ {\pgfarrowharpoontrue}
+ {}%
+ \CF_expafter{\draw[}\CF_arrowcurrentstyle](\CF_arrowstartnode @u0)--(\CF_arrowstartnode @u1);%
+ \CF_expafter{\draw[}\CF_arrowcurrentstyle](\CF_arrowstartnode @d1)--(\CF_arrowstartnode @d0);%
+ \endgroup
+ \CF_arrowdisplaylabel{#1}{0.5}+\CF_arrowstartnode{#2}{0.5}-\CF_arrowendnode%
+}
+
+\definearrow3{<<->}{%
+ \path[allow upside down](\CF_arrowstartnode)--(\CF_arrowendnode)%
+ node[pos=\CF_arrowdoubleposstart,sloped,yshift=1pt](\CF_arrowstartnode @u0){}%
+ node[pos=0,sloped,yshift=-1pt](\CF_arrowstartnode @d0){}%
+ node[pos=\CF_arrowdoubleposend,sloped,yshift=1pt](\CF_arrowstartnode @u1){}%
+ node[pos=1,sloped,yshift=-1pt](\CF_arrowstartnode @d1){};%
+ \begingroup
+ \ifboolKV[chemfig]{arrow double harpoon}
+ {\pgfarrowharpoontrue}
+ {}%
+ \CF_expafter{\draw[}\CF_arrowcurrentstyle](\CF_arrowstartnode @u0)--(\CF_arrowstartnode @u1);%
+ \CF_expafter{\draw[}\CF_arrowcurrentstyle](\CF_arrowstartnode @d1)--(\CF_arrowstartnode @d0);%
+ \endgroup
+ \CF_arrowdisplaylabel{#1}{0.5}+\CF_arrowstartnode{#2}{0.5}-\CF_arrowendnode
+}
+
+\definearrow30{%
+ \CF_arrowshiftnodes{#3}%
+ \CF_arrowdisplaylabel{#1}{0.5}+\CF_arrowstartnode{#2}{0.5}-\CF_arrowendnode
+}
+
+\definearrow5{-U>}{%
+ \CF_arrowshiftnodes{#3}%
+ \CF_expafter{\draw[}\CF_arrowcurrentstyle](\CF_arrowstartnode)--(\CF_arrowendnode)node[midway](Uarrow@arctangent){};%
+ \CF_ifempty{#4}
+ {\def\CF_Uarrowradius{0.333}}
+ {\def\CF_Uarrowradius{#4}}%
+ \CF_ifempty{#5}%
+ {\def\CF_Uarrowabsangle{60}}
+ {\pgfmathsetmacro\CF_Uarrowabsangle{abs(#5)}}% ne prendre en compte que la valeur absolue de l'angle
+ \expandafter\draw\expanded{[\CF_ifempty{#1}{draw=none}{\unexpanded\expandafter{\CF_arrowcurrentstyle}},-]}(Uarrow@arctangent)%
+ arc[radius=\CF_compoundsep*\CF_currentarrowlength*\CF_Uarrowradius,start angle=\CF_arrowcurrentangle-90,delta angle=-\CF_Uarrowabsangle]node(Uarrow@start){};
+ \expandafter\draw\expanded{[\CF_ifempty{#2}{draw=none}{\unexpanded\expandafter{\CF_arrowcurrentstyle}}]}(Uarrow@arctangent)%
+ arc[radius=\CF_compoundsep*\CF_currentarrowlength*\CF_Uarrowradius,start angle=\CF_arrowcurrentangle-90,delta angle=\CF_Uarrowabsangle]node(Uarrow@end){};
+ \pgfmathsetmacro\CF_temp{\CF_Uarrowradius*cos(\CF_arrowcurrentangle)<0?"-":"+"}%
+ \ifdim\CF_Uarrowradius pt>0pt
+ \CF_arrowdisplaylabel{#1}{0}\CF_temp{Uarrow@start}{#2}{1}\CF_temp{Uarrow@end}%
+ \else
+ \CF_arrowdisplaylabel{#2}{0}\CF_temp{Uarrow@start}{#1}{1}\CF_temp{Uarrow@end}%
+ \fi
+}
+
+\def\CF_grabdelim#1#2#3\_nil{\def\CF_leftdelim{#1}\def\CF_rightdelim{#2}}
+\def\CF_resetdelim{%
+ \setKVdefault[CFdelimiters]{
+ delimiters = (),
+ height = 10pt,
+ depth = ,
+ open xshift = 0pt,
+ close xshift = ,
+ h align = true,
+ auto rotate = false,
+ rotate = 0,
+ indice = n
+ }%
+}
+
+\CF_resetdelim
+
+\def\polymerdelim{\CF_ifnextchar[{\CF_polymerdelima}{\CF_polymerdelima[]}}
+\def\CF_polymerdelima[#1]#2#3{%
+ \CF_resetdelim
+ \CF_doifnotempty{#1}{\setKV[CFdelimiters]{#1}}%
+ \expandafter\expandafter\expandafter\CF_grabdelim\useKV[CFdelimiters]{delimiters}()\_nil
+ \edef\CF_delimheight{\the\dimexpr\useKV[CFdelimiters]{height}}%
+ \CF_eexpsecond\CF_ifempty{\useKV[CFdelimiters]{depth}}
+ {\let\CF_delimdepth\CF_delimheight}
+ {\edef\CF_delimdepth{\the\dimexpr\useKV[CFdelimiters]{depth}}}%
+ \edef\CF_delimhalfdim{\the\dimexpr(\CF_delimheight+\CF_delimdepth)/2}%
+ \edef\CF_delimvshift {\the\dimexpr(\CF_delimheight-\CF_delimdepth)/2}%
+ \edef\CF_leftdelimxshift{\the\dimexpr\useKV[CFdelimiters]{open xshift}}%
+ \CF_eexpsecond\CF_ifempty{\useKV[CFdelimiters]{close xshift}}
+ {\edef\CF_rightdelimxshift{\the\dimexpr-\useKV[CFdelimiters]{open xshift}}}
+ {\edef\CF_rightdelimxshift{\the\dimexpr-\useKV[CFdelimiters]{close xshift}}}%
+ \chemmove{%
+ \nulldelimiterspace0pt
+ \pgfextractx\CF_dim{\pgfpointanchor{#2}{center}}\edef\CF_leftdelimx{\the\CF_dim}%
+ \pgfextracty\CF_dim{\pgfpointanchor{#2}{center}}\edef\CF_leftdelimy{\the\CF_dim}%
+ \pgfextractx\CF_dim{\pgfpointanchor{#3}{center}}\edef\CF_rightdelimx{\the\CF_dim}%
+ \pgfextracty\CF_dim{\pgfpointanchor{#3}{center}}\edef\CF_rightdelimy{\the\CF_dim}%
+ \def\CF_autorotate{0}%
+ \ifboolKV[CFdelimiters]{h align}
+ {\let\CF_rightdelimy\CF_leftdelimy
+ }
+ {%
+ \ifboolKV[CFdelimiters]{auto rotate}
+ {\pgfmathatantwo{\CF_rightdelimy-\CF_leftdelimy}{\CF_rightdelimx-\CF_leftdelimx}%
+ \let\CF_autorotate\pgfmathresult
+ }
+ {\CF_eexpsecond\CF_ifempty{\useKV[CFdelimiters]{rotate}}
+ {}
+ {\edef\CF_autorotate{\useKV[CFdelimiters]{rotate}}}%
+ }%
+ }%
+ \node[at={(\CF_leftdelimx+\CF_leftdelimxshift,\CF_leftdelimy+\CF_delimvshift)},rotate=\CF_autorotate]
+ {$\left\CF_leftdelim\vrule height\CF_delimhalfdim depth\CF_delimhalfdim width0pt\right.$};%
+ \node[at={(\CF_rightdelimx+\CF_rightdelimxshift,\CF_rightdelimy+\CF_delimvshift)},rotate=\CF_autorotate]
+ {$\left.\vrule height\CF_delimhalfdim depth\CF_delimhalfdim width0pt\right\CF_rightdelim
+ \CF_eexpsecond\CF_doifnotempty{\useKV[CFdelimiters]{indice}}
+ {\CF_underscore{\rlap{$\scriptstyle\useKV[CFdelimiters]{indice}$}}}
+ $};
+ }%
+}
+
+\catcode`\@11
+\pgfdeclarearrow{%
+ name = CF,%
+ defaults = {%
+ length = 3pt 5 1,%
+ width' = 0pt .8,%
+ inset' = 0pt .5,%
+ line width = 0pt 1 1,%
+ round%
+ },%
+ setup code = {%
+ % Cap the line width at 1/4th distance from inset to tip
+ \pgf@x\pgfarrowlength
+ \advance\pgf@x by-\pgfarrowinset
+ \pgf@x.25\pgf@x
+ \ifdim\pgf@x<\pgfarrowlinewidth\pgfarrowlinewidth\pgf@x\fi
+ % Compute front miter length:
+ \pgfmathdivide@{\pgf@sys@tonumber\pgfarrowlength}{\pgf@sys@tonumber\pgfarrowwidth}%
+ \let\pgf@temp@quot\pgfmathresult%
+ \pgf@x\pgfmathresult pt%
+ \pgf@x\pgfmathresult\pgf@x%
+ \pgf@x4\pgf@x%
+ \advance\pgf@x by1pt%
+ \pgfmathsqrt@{\pgf@sys@tonumber\pgf@x}%
+ \pgf@xc\pgfmathresult\pgfarrowlinewidth% xc is front miter
+ \pgf@xc.5\pgf@xc
+ \pgf@xa\pgf@temp@quot\pgfarrowlinewidth% xa is extra harpoon miter
+ % Compute back miter length:
+ \pgf@ya.5\pgfarrowwidth%
+ \csname pgfmathatan2@\endcsname{\pgfmath@tonumber\pgfarrowlength}{\pgfmath@tonumber\pgf@ya}%
+ \pgf@yb\pgfmathresult pt%
+ \csname pgfmathatan2@\endcsname{\pgfmath@tonumber\pgfarrowinset}{\pgfmath@tonumber\pgf@ya}%
+ \pgf@ya\pgfmathresult pt%
+ \advance\pgf@yb by-\pgf@ya%
+ \pgf@yb.5\pgf@yb% half angle in yb
+ \pgfmathtan@{\pgf@sys@tonumber\pgf@yb}%
+ \pgfmathreciprocal@{\pgfmathresult}%
+ \pgf@yc\pgfmathresult\pgfarrowlinewidth%
+ \pgf@yc.5\pgf@yc%
+ \advance\pgf@ya by\pgf@yb%
+ \pgfmathsincos@{\pgf@sys@tonumber\pgf@ya}%
+ \pgf@ya\pgfmathresulty\pgf@yc% ya is the back miter
+ \pgf@yb\pgfmathresultx\pgf@yc% yb is the top miter
+ \ifdim\pgfarrowinset=0pt
+ \pgf@ya.5\pgfarrowlinewidth% easy: back miter is half linewidth
+ \fi
+ % Compute inset miter length:
+ \pgfmathdivide@{\pgf@sys@tonumber\pgfarrowinset}{\pgf@sys@tonumber\pgfarrowwidth}%
+ \let\pgf@temp@quot\pgfmathresult%
+ \pgf@x\pgfmathresult pt%
+ \pgf@x\pgfmathresult\pgf@x%
+ \pgf@x4\pgf@x%\pgf@ya
+ \advance\pgf@x by1pt%
+ \pgfmathsqrt@{\pgf@sys@tonumber\pgf@x}%
+ \pgf@yc\pgfmathresult\pgfarrowlinewidth% yc is inset miter
+ \pgf@yc.5\pgf@yc%
+ % Inner length (pgfutil@tempdima) is now arrowlength - front miter - back miter
+ \pgfutil@tempdima\pgfarrowlength%
+ \advance\pgfutil@tempdima by-\pgf@xc%
+ \advance\pgfutil@tempdima by-\pgf@ya%
+ \pgfutil@tempdimb.5\pgfarrowwidth%
+ \advance\pgfutil@tempdimb by-\pgf@yb%
+ % harpoon miter correction
+ \ifpgfarrowroundjoin
+ \pgfarrowssetbackend{\pgf@ya\advance\pgf@x by-.5\pgfarrowlinewidth}%
+ \else
+ \pgfarrowssetbackend{0pt}
+ \fi
+ \ifpgfarrowharpoon
+ \pgfarrowssetlineend{\pgfarrowinset\advance\pgf@x by\pgf@yc\advance\pgf@x by.5\pgfarrowlinewidth}%
+ \else
+ \pgfarrowssetlineend{\pgfarrowinset\advance\pgf@x by\pgf@yc\advance\pgf@x by-.25\pgfarrowlinewidth}%
+ \ifpgfarrowreversed
+ \ifdim\pgfinnerlinewidth>0pt
+ \pgfarrowssetlineend{\pgfarrowinset}%
+ \else
+ \pgfarrowssetlineend{\pgfutil@tempdima\advance\pgf@x by\pgf@ya\advance\pgf@x by-.25\pgfarrowlinewidth}%
+ \fi
+ \fi
+ \fi
+ \ifpgfarrowroundjoin
+ \pgfarrowssettipend{\pgfutil@tempdima\advance\pgf@x by\pgf@ya\advance\pgf@x by.5\pgfarrowlinewidth}%
+ \else
+ \pgfarrowssettipend{\pgfarrowlength\ifpgfarrowharpoon\advance\pgf@x by\pgf@xa\fi}%
+ \fi
+ % The hull:
+ \pgfarrowshullpoint{\pgfarrowlength\ifpgfarrowroundjoin\else\ifpgfarrowharpoon\advance\pgf@x by\pgf@xa\fi\fi}{\ifpgfarrowharpoon-.5\pgfarrowlinewidth\else0pt\fi}%
+ \pgfarrowsupperhullpoint{0pt}{.5\pgfarrowwidth}%
+ \pgfarrowshullpoint{\pgfarrowinset}{\ifpgfarrowharpoon-.5\pgfarrowlinewidth\else 0pt\fi}%
+ % Adjust inset
+ \pgfarrowssetvisualbackend{\pgfarrowinset}%
+ \advance\pgfarrowinset by\pgf@yc%
+ % The following are needed in the code:
+ \pgfarrowssavethe\pgfutil@tempdima
+ \pgfarrowssavethe\pgfutil@tempdimb
+ \pgfarrowssavethe\pgfarrowlinewidth
+ \pgfarrowssavethe\pgf@ya
+ \pgfarrowssavethe\pgfarrowinset
+ },%
+ drawing code = {%
+ \pgfsetdash{}{0pt}%
+ \ifpgfarrowroundjoin\pgfsetroundjoin\else\pgfsetmiterjoin\fi
+ \ifdim\pgfarrowlinewidth=\pgflinewidth\else\pgfsetlinewidth{\pgfarrowlinewidth}\fi
+ \pgfpathmoveto{\pgfqpoint{\pgfutil@tempdima\advance\pgf@x by\pgf@ya}{0pt}}%
+ \pgfpathlineto{\pgfqpoint{\pgf@ya}{\pgfutil@tempdimb}}%
+ \pgfpathlineto{\pgfqpoint{\pgfarrowinset}{0pt}}%
+ \ifpgfarrowharpoon \else
+ \pgfpathlineto{\pgfqpoint{\pgf@ya}{-\pgfutil@tempdimb}}%
+ \fi
+ \pgfpathclose
+ \ifpgfarrowopen\pgfusepathqstroke\else\ifdim\pgfarrowlinewidth>0pt \pgfusepathqfillstroke\else\pgfusepathqfill\fi\fi
+ },%
+ parameters = {%
+ \the\pgfarrowlinewidth,%
+ \the\pgfarrowlength,%
+ \the\pgfarrowwidth,%
+ \the\pgfarrowinset,%
+ \ifpgfarrowharpoon h\fi%
+ \ifpgfarrowopen o\fi%
+ \ifpgfarrowroundjoin j\fi%
+ }%
+}
+\CFrestorecatcode
+\endinput
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%% H I S T O R I Q U E %%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+v0.1 2010/06/23
+ - Première version publique sur le CTAN
+----------------------------------------------------------------------
+v0.2 2010/08/31
+ - Ajout de la documentation en anglais.
+ - Correction de bugs.
+ - \printatom est désormais une macro publique.
+ - Les espaces sont permis dans les molécules. Ils seront
+ ignorés par défaut puisque les atomes sont composés en
+ mode math par \printatom
+ - Une paire de Lewis peut être représentée ":".
+ - Dans les cycles, une correction de la longueur du trait
+ déporté des liaisons doubles est fait de telle sorte que si
+ l'on écrit \chemfig{*5(=====)}, on obtient deux polygones
+ réguliers concentriques.
+ - La séquence de contrôle \setnodestyle permet de spécifier
+ le style des n?uds dessinés par tikz.
+----------------------------------------------------------------------
+v0.3 2010/11/21
+ - Amélioration de \definesubmol qui accepte les séquences de
+ contrôle. On peut aussi choisir un alias dont la substitution
+ est différente selon l'orientation de la liaison qui lui
+ arrive dessus.
+ - Le caractère "|" force la fin d'un atome. Si on écrit
+ "D|ef" alors, chemfig verra deux atomes "D" et "ef".
+ - Le caractère "#" est reconnu lorsqu'il suit un caractère de
+ liaison. Il doit être suivi d'un argument entre parenthèses
+ qui contient l'offset de début et de fin qui s'appliqueront
+ à cette liaison.
+ - La macro \chemfig admet un argument optionnel qui sera passé
+ à l'environnement tikzpicture dans lequel elle est dessinée
+ - Mise en place de la représentation des mécanismes
+ réactionnels avec la syntaxe "@{<nom>}" devant un atome où
+ "@{<nom>,<coeff>}" au tout début de l'argument d'une liaison.
+ Cette syntaxe permet de placer un n?ud (au sens de tikz) qui
+ deviendra l'extrémité des flèches des mécanismes.
+ Le tracé des flèches est faite par la macro \chemmove dont
+ l'argument optionnel devient celui de l'environnement
+ tikzpicture dans lequel sont faites les flèches.
+ - Pour le mécanisme d'alignement vertical via le \vphantom, la
+ commande \chemskipalign permet d'ignorer le groupe d'atomes
+ dans lequel elle est écrite.
+ - La commande \chemname permet d'afficher un nom sous une
+ molécule. la commande \chemnameinit initialise la plus grande
+ 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.
+----------------------------------------------------------------------
+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.
+----------------------------------------------------------------------
+v0.4 2011/03/07
+ - chemfig est désormais écrit en plain-etex et donc
+ utilisable par d'autres formats que LaTeX.
+ - Un peu plus de rigueur avec les catcodes des caractères
+ spéciaux, notamment lorsque la commande \chemfig se trouve
+ dans l'argument de \chemmove, \chemabove, \chembelow, \chemrel.
+ TODO : faut-il \scantoker l'argument de \chemfig pour être
+ définitivement débarrassé de ces histoires de catcode ???
+ - Correction d'un bug dans le calcul de l'angle des liaisons
+----------------------------------------------------------------------
+v0.4a 2011/04/10
+ - Correction d'un bug concernant l'argument optionnel en début
+ de molécule.
+----------------------------------------------------------------------
+v0.4b 2011/04/24
+ - l'argument de \chemfig est tokénisé avec \scantokens ce qui
+ rend caduc tout souci de code de catégorie, à part #.
+ - la commande \setbondstyle permet de définir le style des
+ liaisons.
+ - correction de l'affichage incorrect des doubles liaisons dans
+ les cycles après les commandes \hflipnext et \vflipnext
+ - correction d'un bug lorsqu'un alias commence une molécule
+----------------------------------------------------------------------
+v1.0 2011/06/15
+ - les schémas réactionnels sont désormais disponibles.
+ - \Chemabove et \Chembelow modifient la boite englobante.
+ - \Lewis modifie la boite englobante
+ - les macros \chemleft, \chemright, \chemup et \chemdown
+ affichent des délimiteurs extensibles à gauche, à droite,
+ au dessus et au dessous d'un matériel.
+----------------------------------------------------------------------
+v1.0a 2011/09/18
+ - les macros \Lewis et \lewis admettent un argument optionnel
+ - la macro \setlewisdist règle la distance entre les 2
+ électrons
+----------------------------------------------------------------------
+v1.0b 2011/11/29
+ - la commande \merge est désormais protégée entre
+ \schemestart et \schemestop contre des définitions par d'autres
+ packages.
+ - \box0 est utilisé au lieu du maladroit \unhbox0
+----------------------------------------------------------------------
+v1.0c 2011/11/30
+ - la macro \+ n'est plus explicitement écrite
+ - vérifie que eTeX est le moteur utilisé
+----------------------------------------------------------------------
+v1.0d 2011/12/19
+ - les cercles des cycles étaient tracés au mauvais moment. La
+ longueur de la liaison qui les précédait influait sur le
+ rayon du cercle : \chemfig{-[,0.5]**6(------)} donnait un bug
+ à l'affichage.
+----------------------------------------------------------------------
+v1.0e 2012/01/13
+ - la gestion des espaces dans les groupes d'atomes est
+ désormais plus rigoureuse. Plusieurs bugs ont été
+ corrigé
+----------------------------------------------------------------------
+v1.0f 2012/02/24
+ - correction d'un bug avec \definesubmol, les catcodes n'étaient
+ pas correctement gérés.
+----------------------------------------------------------------------
+v1.0g 2012/11/16
+ - correction d'un bug dans \CF_directarrow pour faire prendre en
+ compte le style des flèche par défaut
+ - correction d'un bug dans \CF_lewisc : la boite *doit* être
+ composée en dehors de l'environnement tikzpicture pour
+ éviter nullfont si jamais \printatom ne passe pas en mode
+ math.
+ - correction d'un bug dans \CF_chemfigc : si une longueur par
+ défaut est modifiée par [,<l>] au début d'une molécule
+ et si des cycles étaient emboités, cette longueur n'était
+ pas appliquée aux sous-cycles.
+ - ré-écriture des macros \chemabove et \chembemow pour
+ prendre en compte le bug (désormais corrigé) dans luatex.
+ - nouvelle macro \setstacksep qui définit l'espacement par
+ défaut dans les macros \chemabove et \chembelow.
+----------------------------------------------------------------------
+v1.0h 2013/11/28
+ - \chemname admet maintenant une version étoilé qui ne tient
+ pas compte des profondeurs précédentes.
+ - \CF_dpmax est géré globalement.
+ - correction d'un bug dans "-U>" : le style de la flèche
+ n'était pris en compte pour l'arc.
+ - correction d'un bug dans \CF_directarrow : l'angle de la
+ flèche n'était pas calculé
+----------------------------------------------------------------------
+v1.1 2015/02/13
+ - correction d'un bug dans \CF_seeksubmol : la macro
+ \CF_molecule est dépouillé de son éventuel espace
+ en première position.
+ - correction d'un bug dans \CF_arrowf : le nom du prochain
+ n?ud courant "end@arrow@i" était erroné dans le cas où une
+ flèche contenait un sous schéma. Ce nom doit dépendre de
+ \CF_schemenest.
+ - la jonction entre deux liaisons consécutives dans l'axe peut
+ être activé avec \enablebondjoin et désactivé avec
+ \disablebondjoin (préférable, état par défaut).
+ - \chemfig suivi d'une "*" demande à ce que les liaisons aient
+ une longueur invariable : la distance inter-atome devient donc
+ variable. Cette fonctionnalité est désactivé dans les
+ cycles afin que les polygones soient réguliers.
+ \enablefixedbondlength permet cette fonctionnalité pour
+ toutes les macros \chemfig (même non étoilée) tandis que
+ \disablefixedbondlength le désactive.
+----------------------------------------------------------------------
+v1.1a 2015/02/23
+ - correction d'un bug dans \CF_grabbondoffset. Si \chemfig est
+ dans l'argument d'une macro, les # sont doublés par l'action
+ de \scantokens de la macro \CF_chemfigb et il faut un
+ argument délimité avant "(" pour absorber tous les #.
+----------------------------------------------------------------------
+v1.2 2015/10/08
+ - correction d'un bug dans le tracé des liaisons de Cram.
+ - création de \setangleincrement.
+ - chargement de "arrows.meta" et définition de la flèche "CF"
+ basée sur "Stealth" et définie avec \pgfdeclarearrow.
+ Les anciennes flèches "CF_full" et "CF_half" sont
+ abandonnées puisque définies avec \pgfarrowsdeclare.
+ - flèche "-U>" corrigée : le placement des labels est
+ maintenant correct dans tous les cas. Ainsi :
+ -U>[<a>][<b>][<d>][r][a]
+ place le label <a> près du début de la flèche, quels que
+ soient les signes du rayon r et de l'angle a.
+ - \chemrel, \setchemrel et \chemsign sont supprimées.
+ - compatibilité, avec les limitations d'usage, avec la
+ librairie "externalize" : le \begin{tikzpicture} voit
+ désormais le \end{tikzpicture} correspondant dans la macro
+ \CF_chemfigb.
+----------------------------------------------------------------------
+v1.2a 2015/10/21
+ - erreur de copier-coller dans le code: une adresse url était
+ malencontreusement présente en plein milieu d'une ligne de
+ code
+----------------------------------------------------------------------
+v1.2b 2015/11/15
+ - bug dans \CF_seeksubmol qui laissait "*" dans le flux de
+ lecture de TeX. Un message d'erreur est également ajouté
+ en cas de "!" en fin de traitement.
+ - correction d'un bug dans \CF_setbondangle où l'angle [<:a>]
+ n'était pas évalué par \pgfmathsetmacro.
+----------------------------------------------------------------------
+v1.2c 2015/11/20
+ - Correction d'un bug dans \CF_setbondangle : l'angle renvoyé
+ pouvait être négatif
+ - Correction d'un bug dans \CF_directarrow : la macro \CF_ifempty
+ n'est pas correctement développée dans l'argument de
+ \pgfpointanchor
+----------------------------------------------------------------------
+v1.2d 2015/12/01
+ - correction d'un bug dans la flèche "-U"
+ - la version étoilée de \setcrambond dessine les liaisons de
+ Cram en pointillés sous forme de trait large et non pas sous
+ forme de triangle.
+----------------------------------------------------------------------
+v1.2e 2017/05/20
+ - la macro contenant la définition d'une flèche est
+ désormais "\CF_arrow(<nom>)", ainsi la macro \0 n'est plus
+ définie par \definearrow
+ - remerciements rajoutés après une suppression indue, pour ne
+ froisser aucune susceptibilité
+----------------------------------------------------------------------
+v1.3 2018/03/08
+ - tous les paramètres sont désormais passés via \setchemfig qui
+ fait appel à "simplekv". Par conséquent, _toutes_ les macros qui
+ réglaient des paramètres deviennent obsolètes, à savoir :
+ \setcrambond, \setatomsep, \setbondoffset, \setdoublesep,
+ \setangleincrement, \enablefixedbondlength,
+ \disablefixedbondlength, \setnodestyle, \setbondstyle,
+ \setlewis, \setlewisdist, \setstacksep, \setcompoundstyle,
+ \setarrowdefault, \setandsign, \setarrowoffset,
+ \setcompoundsep, \setarrowlabelsep, \enablebondjoin,
+ \disablebondjoin et \schemedebug.
+ et ces macros seront *supprimées* dans une future version.
+ - la version étoilée "\chemfig*" et les deux arguments optionnels
+ de la macro "\chemfig[][]" sont également optionnels et seront
+ *supprimé*s dans une future version afin d'accéder à la syntaxe
+ \chemfig[clés=valeurs]{code}
+ - 6 nouveaux paramètres : "lewis radius", "arrow double sep",
+ "arrow double coeff", "arrow double harpoon", "cycle radius
+ coeff", "arrow head".
+ - correction d'un bug dans \CF_parsemergeopt qui dans certains
+ cas, envoyait vers l'affichage des caractères
+ - petit toilettage du code
+ - macro \polymerdelim (non documentée) expérimentale et encore
+ en phase de tests
+ - suppression d'un registre d'écriture de fichier
+----------------------------------------------------------------------
+v1.31 2018/04/05
+ - correction d'un espace indésirable dans \CF_ifnextchar
+----------------------------------------------------------------------
+v1.32 2018/08/23
+ - définition de \printatom, \CF_begintikzpicture et
+ \CF_endtikzpicture dans le fichier t-chemfig.tex
+----------------------------------------------------------------------
+v1.33 2018/10/31
+ - les macros définies par \definesubmol peuvent désormais avoir un ou
+ plusieurs arguments
+ - macro \polymerdelim documentée
+----------------------------------------------------------------------
+v1.34 2019/02/23
+ - bug dans la flèche "<->" corrigé
+----------------------------------------------------------------------
+v1.4 2019/04/18
+ - corrections de nombreux bugs
+ - caractère privé "_" et non plus "@" -> modifications à prévoir
+ notamment dans la doc avec les codes spécifiques aux flèches, ça
+ risque de couiner sur tex.stackexchange.com
+ - anciennes macros abandonnées et désormais indéfinies :
+ \setcrambond, \setatomsep, \setbondoffset, \setdoublesep,
+ \setangleincrement, \enablefixedbondlength,
+ \disablefixedbondlength, \setnodestyle, \setbondstyle,
+ \setlewis, \setlewisdist, \setstacksep, \setcompoundstyle,
+ \setarrowdefault, \setandsign, \setarrowoffset,
+ \setcompoundsep, \setarrowlabelsep, \enablebondjoin,
+ \disablebondjoin et \schemedebug
+ - l'ancienne syntaxe \chemfig[][]{} est abandonnée et n'est plus
+ acceptée, désormais c'est
+ \chemfig[<clés>=<valeurs>]{<code molécule>}
+ - l'ancienne syntaxe \lewis[<coeff>] ou \Lewis[<coeff>] n'est
+ plus acceptée au profit de \lewis[<clés>=<valeurs>]
+----------------------------------------------------------------------
+v1.41 2019/05/21
+ - utilisation de la nouvelle primitive \expanded
+ - nouvelle clé "h align" (true par défaut) pour les délimiteurs
+ de \polymerdelim. Lorsque à false, les délimiteurs ne sont
+ plus alignés horizontalement mais positionnés aux noeuds demandés
+ - nouvelle clé "auto rotate" qui n'a de sens que si h align=false :
+ les délimiteurs sont automatiquement inclinés
+ - nouvelle clé "rotate" qui n'a de sens que si halign=false ET
+ auto rotate=false : l'inclinaison des délimiteurs peut être
+ choisie \ No newline at end of file
diff --git a/macros/generic/chemfig/chemfigold.tex b/macros/generic/chemfig/chemfigold.tex
new file mode 100644
index 0000000000..a7826763ca
--- /dev/null
+++ b/macros/generic/chemfig/chemfigold.tex
@@ -0,0 +1,2835 @@
+% !TeX encoding = ISO-8859-1
+% Ce fichier contient le code de l'extension "chemfig"
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %
+\def\CFname {chemfig} %
+\def\CFver {1.4} %
+% %
+\def\CFdate {2019/04/18} %
+% %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+%____________________________________________________________________
+% Author : Christian Tellechea |
+% Status : Maintained |
+% Email : unbonpetit@netc.fr |
+% Package URL: https://www.ctan.org/pkg/chemfig |
+% Bug tracker: https://framagit.org/unbonpetit/chemfig/issues |
+% Repository : https://framagit.org/unbonpetit/chemfig/tree/master |
+% Copyright : Christian Tellechea 2010-2019 |
+% Licence : Released under the LaTeX Project Public License v1.3c |
+% or later, see http://www.latex-project.org/lppl.txt |
+% Files : 1) chemfig.tex |
+% 2) chemfig.sty |
+% 3) t-chemfig.tex |
+% 4) README |
+% 5) chemfig_doc_fr.tex |
+% 6) chemfig_doc_fr.pdf |
+% 7) chemfig_doc_en.tex |
+% 8) chemfig_doc_fr.pdf |
+%--------------------------------------------------------------------
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%% P R É A L A B L E %%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%-------------------------- Annonce package --------------------------
+\ifdefined\ProvidesPackage\else
+ \immediate\write -1 {%
+ Package: \CFname\space\CFdate\space\space v\CFver\space\space
+ Draw molecule with an easy syntax (CT)}%
+\fi
+
+%------------------------- Vérification etex -------------------------
+\begingroup
+ \edef\CFtempa{\meaning\eTeXversion}
+ \edef\CFtempb{\string\eTeXversion}
+ \let\CFtemp\endgroup
+ \unless\ifx\CFtempa\CFtempb
+ \errmessage{Package \CFname\space Error: you are not using an eTeX engine, chemfig cannot work.}%
+ \def\CFtemp{\endgroup\endinput}%
+ \fi
+\CFtemp
+
+%------------------------ Chargement simplekv ------------------------
+\unless\ifdefined\skvname
+ \begingroup\def\CFtemp{\endgroup\input simplekv.tex\relax}%
+ \expandafter\CFtemp
+\fi
+
+%-------------------------- Chargement tikz --------------------------
+\unless\ifdefined\tikzpicture
+ \begingroup\def\CFtemp{\endgroup\input tikz.tex\relax}%
+ \expandafter\CFtemp
+\fi
+\usetikzlibrary{arrows.meta}
+
+%-------------------------- Régime catcodes --------------------------
+\begingroup
+ \def\X#1{\catcode\number`#1=\number\catcode`#1\relax}
+ \xdef\CFrestorecatcode{\X\[\X\]\X\:\X\(\X\)\X\,\X\-\X\=\X\~\X\!\X\?\X\<\X\>\X\;\X\*\X\|\X\@\X\ \X\_}%
+\endgroup
+\catcode`\[12 \catcode`\]12 \catcode`\:12 \catcode`\(12
+\catcode`\)12 \catcode`\,12 \catcode`\-12 \catcode`\=12
+\catcode`\~12 \catcode`\!12 \catcode`\?12 \catcode`\<12
+\catcode`\>12 \catcode`\;12 \catcode`\*12 \catcode`\|12
+\catcode`\@12 \catcode`\#6 \catcode`\ 10 \catcode`\_11
+
+%--------------------------- Allocations -----------------------------
+\newcount\CF_cntatomgroup
+\newcount\CF_cntgroup
+\newcount\CF_cntatom
+\newcount\CF_cntcycle
+\newcount\CF_cntcompound
+
+\newif\ifCF_incycle
+\newif\ifCF_cyclearc
+\newif\ifCF_definesubmol
+\newif\ifCF_adjustnamedp
+\newif\ifCF_macrofixedbondlength
+\newif\ifCF_lewisoverlay
+
+\newdimen\CF_dim
+\newdimen\CF_arrowsize
+\newdimen\CF_zero \CF_zero=0pt
+
+\newbox\CF_boxlewis
+\newbox\CF_box
+\newbox\CF_boxstuff
+
+\newtoks\CF_substtoks
+
+%-------------------------- Petites macros ---------------------------
+\let\CF_begintikzpicture\tikzpicture
+\let\CF_endtikzpicture \endtikzpicture
+\def\CF_quark{\CF_quark}
+\def\CF_execfirst#1#2{#1}
+\def\CF_execsecond#1#2{#2}
+\def\CF_id#1{#1}
+\def\CF_gobarg#1{}
+\def\CF_gobtwoargs#1#2{}
+\def\CF_firsttonil#1#2\_nil{#1}
+\def\CF_sanitizelastitem#1,\empty#2\_nil{#1}
+\def\CF_gobtikzinstruction#1;{}
+\def\CF_makeother#1{\catcode`#1=12\relax}
+\def\CF_lettoken#1#2{\let#1= #2}\CF_lettoken\CF_sptoken{ }
+\def\CF_ifx#1#2{\ifx#1#2\expandafter\CF_execfirst\else\expandafter\CF_execsecond\fi}
+\def\CF_ifempty#1{\ifx\empty#1\empty\expandafter\CF_execfirst\else\expandafter\CF_execsecond\fi}
+\def\CF_ifnum#1{\ifnum#1\expandafter\CF_execfirst\else\expandafter\CF_execsecond\fi}
+\def\CF_doifempty#1{\ifx\empty#1\empty\expandafter\CF_id\else\expandafter\CF_gobarg\fi}
+\def\CF_doifnotempty#1{\ifx\empty#1\empty\expandafter\CF_gobarg\else\expandafter\CF_id\fi}
+\def\CF_gobtonil#1\_nil{}
+\edef\CFhash{\string#}
+\begingroup
+ \catcode`\_8
+ \expandafter\gdef\csname CF\string_underscore\endcsname{_}
+\endgroup
+\def\CF_threeea{\expandafter\expandafter\expandafter}
+\def\CF_exptwomacroargs#1#2#3{\CF_expsecond{\CF_expsecond#1{#2}}{#3}}
+\def\CF_expthreemacroargs#1#2#3#4{\CF_expsecond{\CF_exptwomacroargs#1{#2}{#3}}{#4}}
+\def\CF_swaparg#1#2{#2{#1}}
+\def\CF_expsecond#1#2{\expandafter\CF_swaparg\expandafter{#2}{#1}}% \CF_expsecond<{arg1>}{<arg2>} donne "<arg1>{*<arg2>}"
+\def\CF_eexpsecond#1#2{\expandafter\expandafter\expandafter\CF_swaparg\expandafter\expandafter\expandafter{#2}{#1}}% \CF_eexpsecond{<arg1>}{<arg2>} donne "<arg1>{**<arg2>}"
+\def\CF_swapunbrace#1#2{#2#1}
+\def\CF_expafter#1#2{\expandafter\CF_swapunbrace\expandafter{#2}{#1}}% \CF_expafter{<arg1>}{<arg2>} donne "<arg1>*<arg2>"
+\def\CF_eexpafter#1#2{\expandafter\expandafter\expandafter\CF_swapunbrace\expandafter\expandafter\expandafter{#2}{#1}}% \CF_eexpafter{<arg1>}{<arg2>} donne "<arg1>**<arg2>"
+\def\CF_addtomacro#1#2{\CF_expsecond{\def#1}{#1#2}}
+\def\CF_eaddtomacro#1#2{\CF_expsecond{\CF_addtomacro#1}{#2}}
+\def\CF_preaddtomacro#1#2{\CF_expsecond{\CF_preaddtomacroa#1{#2}}#1}
+\def\CF_preaddtomacroa#1#2#3{\def#1{#2#3}}
+\def\CF_addtotoks#1#2{#1\expandafter{\the#1#2}}
+\def\CF_eaddtotoks#1#2{\expandafter\CF_addtotoks\expandafter#1\expandafter{#2}}
+\def\CF_assigntonil#1#2\_nil{\def#1{#2}}
+\def\CF_edefaddtomacro#1#2{%
+ \edef\CF_temp{#2}%
+ \CF_expsecond{\CF_addtomacro#1}{\CF_temp}%
+}
+\def\CF_ifnextchar#1#2#3{%
+ \let\CF_ifnextchartok=#1% <- espace indésirable, bugfix v1.31
+ \def\CF_ifnextcharcodetrue{#2}%
+ \def\CF_ifnextcharcodefalse{#3}%
+ \futurelet\CF_temptok\CF_ifnextchara
+}
+\def\CF_ifnextchara{%
+ \CF_ifx\CF_temptok\CF_sptoken
+ {\CF_ifnextcharb
+ }
+ {\CF_ifx\CF_temptok\CF_ifnextchartok
+ \CF_ifnextcharcodetrue
+ \CF_ifnextcharcodefalse
+ }%
+}
+\expandafter\def\expandafter\CF_ifnextcharb\space{\futurelet\CF_temptok\CF_ifnextchara}
+\def\CF_ifstar#1{\CF_ifnextchar*{\CF_execfirst{#1}}}
+\def\CF_testopt#1#2{\CF_ifnextchar[{#1}{#1[{#2}]}}
+\def\CF_error#1{\errmessage{Package \CFname\space Error: #1.}}
+\def\CF_warning#1{\immediate\write-1{Package \CFname\space Warning: #1^^J}}
+\def\CF_ifinteger#1{%
+ \begingroup
+ \afterassignment\CF_afterinteger
+ \CF_cntcycle0#1\relax
+}
+\def\CF_afterinteger#1\relax{%
+ \endgroup
+ \CF_ifempty{#1}%
+}
+\def\CF_iffirsttokmatch#1#2{% est ce que #1 et #2 commencent par les mêmes tokens ?
+ \futurelet\CF_toksa\CF_gobtonil#1\relax\_nil
+ \futurelet\CF_toksb\CF_gobtonil#2\relax\_nil
+ \CF_ifx\CF_toksa\CF_toksb
+}
+\def\CF_iffirsttokin#1{% teste si le token qui commence #1 appartient aux tokens mis dans #2
+ \futurelet\CF_toksa\CF_gobtonil#1\relax\_nil
+ \CF_iffirsttokina
+}
+\def\CF_iffirsttokina#1{%
+ \CF_ifempty{#1}
+ {\CF_execsecond
+ }
+ {\futurelet\CF_toksb\CF_gobtonil#1\relax\_nil
+ \CF_ifx\CF_toksa\CF_toksb
+ {\CF_execfirst}
+ {\CF_expsecond\CF_iffirsttokina{\CF_gobarg#1}}%
+ }%
+}
+\def\CF_ifinstr#1#2{%
+ \def\CF_ifinstra##1#2##2\_nil{%
+ \ifx\empty##2\empty
+ \expandafter\CF_execsecond
+ \else
+ \expandafter\CF_execfirst
+ \fi}%
+ \CF_ifinstra#1\__nil#2\_nil
+}
+\def\CF_afterspace#1 #2\_nil{#2}
+\def\CF_valuetomacro#1[#2]#3{% #1= macro #2=valeur défaut #3=clé
+ \CF_eexpsecond{\def#1}{\useKV[chemfig]{#3}}%
+ \CF_ifx#1\empty
+ {\def#1{#2}}
+ {}%
+}
+
+%--------------------------- Substitution ----------------------------
+\def\CF_ifstartwith#1#2{% #1=<texte> #2=<motif>
+ \CF_ifempty{#1}%
+ {\CF_execsecond
+ }
+ {\def\CF_startwithcode{#1}%
+ \def\CF_startwithpattern{#2}%
+ \CF_ifstartwitha
+ }%
+}
+\def\CF_ifstartwitha{%
+ \CF_grabfirstarg\CF_startwithcode\CF_firstargcode
+ \CF_grabfirstarg\CF_startwithpattern\CF_firstargpattern
+ \CF_ifx\CF_firstargcode\CF_firstargpattern
+ {\CF_expsecond\CF_ifempty\CF_startwithpattern
+ {\CF_execfirst
+ }
+ {\CF_expsecond\CF_ifempty\CF_startwithcode
+ \CF_execsecond
+ \CF_ifstartwitha
+ }%
+ }
+ {\CF_execsecond
+ }%
+}
+\def\CF_grabfirstarg#1#2{%
+ \CF_ifx#1\empty
+ {\let#2\empty
+ }
+ {\def\CF_grabmacro{#2}%
+ \CF_expsecond\CF_ifbracefirst#1%
+ {\expandafter\CF_grabbracearg#1\_nil#1}
+ {\CF_expafter{\futurelet\CF_nexttok\CF_grabfirstarga}#1\_nil#1}%
+ }%
+}
+\def\CF_grabfirstarga{%
+ \CF_ifx\CF_nexttok\CF_sptoken
+ \CF_grabspacearg
+ \CF_grabnormalarg
+}
+\def\CF_grabbracearg#1{%
+ \expandafter\def\CF_grabmacro{{#1}}%
+ \CF_grabargassigntonil\relax
+}
+\expandafter\def\expandafter\CF_grabspacearg\space{%
+ \expandafter\def\CF_grabmacro{ }%
+ \CF_grabargassigntonil\relax
+}
+\def\CF_grabnormalarg#1{%
+ \expandafter\def\CF_grabmacro{#1}%
+ \CF_grabargassigntonil\relax
+}
+\def\CF_grabargassigntonil#1\_nil#2{\CF_expsecond{\def#2}{\CF_gobarg#1}}
+\def\CF_ifbracefirst#1{\CF_ifnum{\catcode\CF_threeea`\expandafter\CF_firsttonil\detokenize{#1.}\_nil=1 }}
+\def\CF_substonly#1#2{% #1=entier maxi>0 #2=macro : dans la sc#1, remplace tous les <motif> par <pattern> sauf lorsque le motif est suivi d'un caractère >#1
+ \def\CF_atendsubstitute{\edef#2{\the\CF_substtoks}}% macro exécutée à la fin
+ \let\CF_substnogroups\CF_substnogrouponly
+ \CF_ifnum{#1>0 }
+ {\let\CF_testifx\empty
+ \foreach\CF_x in {1,...,#1}{\xdef\CF_testifx{\unexpanded\expandafter{\CF_testifx}\unexpanded\expandafter{\expandafter\ifx\CF_x\CF_nexttok1\fi}}}%
+ \let\CF_testif\empty
+ \foreach\CF_x in {1,...,#1}{\xdef\CF_testif{\unexpanded\expandafter{\CF_testif}\unexpanded\expandafter{\expandafter\if\CF_x\CF_nexttok1\fi}}}%
+ \CF_expsecond\CF_substi#2%
+ }
+ {\CF_substall#2%
+ }%
+}
+\def\CF_substnogrouponly{%
+ \CF_exptwomacroargs\CF_ifstartwith\CF_substcode\CF_substsubst
+ {\CF_grabfirstarg\CF_substcode\CF_temp
+ \CF_expafter{\futurelet\CF_nexttok\CF_gobtonil}\CF_substcode\relax\_nil
+ \CF_ifnum{0\CF_testifx=1 }% si le prochain token est \let-égal à 1...#1
+ {\edef\CF_nexttok{\CF_threeea\CF_firsttonil\expandafter\string\CF_substcode\_nil}% le détokéniser
+ \CF_ifnum{0\CF_testif=1 }
+ {\CF_eaddtotoks\CF_substtoks\CF_temp
+ \CF_grabfirstarg\CF_substcode\CF_temp
+ \CF_eaddtotoks\CF_substtoks\CF_temp
+ }
+ {\CF_eaddtotoks\CF_substtoks\CF_substpattern
+ }%
+ }
+ {\CF_eaddtotoks\CF_substtoks\CF_substpattern
+ }%
+ \CF_substgroups
+ }
+ {\CF_expsecond\CF_ifempty\CF_substcode
+ {\CF_atendsubstitute
+ }
+ {\CF_grabfirstarg\CF_substcode\CF_substauxarg
+ \CF_eaddtotoks\CF_substtoks\CF_substauxarg
+ \CF_substgroups
+ }%
+ }%
+}
+\def\CF_substall#1{% #1=macro
+ \def\CF_atendsubstitute{\edef#1{\the\CF_substtoks}}% macro exécutée à la fin
+ \let\CF_substnogroups\CF_substnogroupall
+ \CF_expsecond\CF_substi#1%
+}
+\def\CF_substnogroupall{%
+ \CF_exptwomacroargs\CF_ifstartwith\CF_substcode\CF_substsubst
+ {\CF_eaddtotoks\CF_substtoks\CF_substpattern
+ \CF_grabfirstarg\CF_substcode\CF_temp
+ \CF_substgroups
+ }
+ {\CF_expsecond\CF_ifempty\CF_substcode
+ {\CF_atendsubstitute
+ }
+ {\CF_grabfirstarg\CF_substcode\CF_substauxarg
+ \CF_eaddtotoks\CF_substtoks\CF_substauxarg
+ \CF_substgroups
+ }%
+ }%
+}
+\def\CF_substi#1#2#3{% #1=<texte> #2=<motif> #3=<motif de substi>
+ \def\CF_substcode{#1}\def\CF_substsubst{#2}\def\CF_substpattern{#3}%
+ \CF_substtoks={}%
+ \CF_substgroups
+}
+
+\def\CF_substgroups{%
+ \CF_expsecond\CF_ifbracefirst\CF_substcode
+ {\CF_grabfirstarg\CF_substcode\CF_substauxarg
+ \begingroup
+ \def\CF_atendsubstitute{%
+ \expandafter\endgroup\expandafter\CF_addtotoks\expandafter\CF_substtoks\expandafter{\expandafter{\the\CF_substtoks}}%
+ \CF_substgroups
+ }%
+ \CF_substtoks{}% initialiser à vide
+ \expandafter\def\expandafter\CF_substcode\CF_substauxarg
+ \CF_substgroups
+ }%
+ {\CF_substnogroups
+ }%
+}
+
+%---------------------------- Paramètres -----------------------------
+\def\setchemfig{\setKV[chemfig]}
+\def\resetchemfig{%
+ \setKVdefault[chemfig]{%
+ atom style ={},% code tikz mis à la fin de every node/.style
+ chemfig style ={},% code tikz mis à la fin de l'arugment optionnel de \tikzpicture
+ bond join =false,
+ fixed length =false,
+ cram rectangle =false,
+ cram width =1.5ex,
+ cram dash width =1pt,
+ cram dash sep =2pt,
+ atom sep =3em,
+ bond offset =2pt,
+ double bond sep =2pt,
+ angle increment =45,
+ node style ={},
+ bond style ={},
+ lewis | width =0.3ex,
+ lewis sep =0.4ex,
+ lewis length =1.5ex,
+ lewis style ={},
+ lewis dist =0.3em,
+ lewis radius =0.15ex,
+ lewis diag coeff =1,
+ cycle radius coeff =0.75,
+ stack sep =1.5pt,
+ scheme debug =false,
+ compound style ={},
+ compound sep =5em,
+ arrow offset =4pt,
+ arrow angle =0,
+ arrow coeff =1,
+ arrow style ={},
+ arrow double sep =2pt,
+ arrow double coeff =0.6,
+ arrow double harpoon=true,
+ arrow label sep =3pt,
+ arrow head =-CF,
+ + sep left =0.5em,
+ + sep right =0.5em,
+ + vshift =0pt,
+ }%
+}
+\resetchemfig
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%% D E S S I N M O L É C U L E S %%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\def\CF_sanitizecatcode{%
+ \CF_makeother\[\CF_makeother\]\CF_makeother\:\CF_makeother\(\CF_makeother\)%
+ \CF_makeother\,\CF_makeother\-\CF_makeother\=\CF_makeother\~\CF_makeother\!%
+ \CF_makeother\?\CF_makeother\<\CF_makeother\>\CF_makeother\;\CF_makeother\*%
+ \CF_makeother\|\CF_makeother\#\CF_makeother\@%
+}
+
+\def\CF_nodecontent{\CF_expsecond\printatom{\csname atom_\number\CF_cntatom\endcsname\CF_nodestrut}}
+
+\def\chemskipalign{%
+ \CF_doifempty\CF_bondoutcontentsaved% sauf si un \chemskipalign a été fait à l'atome précédent
+ {\global\let\CF_bondoutcontentsaved\CF_bondoutcontent}% sauvegarder l'atome d'où vient la liaison
+ \let\CF_nodestrut\empty
+}
+
+\def\CF_emptynode{{}}
+
+\def\definesubmol{\CF_definesubmoltrue\def_submol}
+\def\redefinesubmol{\CF_definesubmolfalse\def_submol}
+
+\def\def_submol#1{%
+ \CF_cntatomgroup=0 % nombre d'arguments supposé
+ \def\CF_temp{#1}% nom
+ \futurelet\CF_toksa\CF_submoltestnxttok
+}
+
+\def\CF_submoltestnxttok{%
+ \if[\noexpand\CF_toksa\expandafter\CF_execfirst\else\expandafter\CF_execsecond\fi
+ {\begingroup\CF_sanitizecatcode\CF_expsecond\CF_submolgrabopt{\CF_temp}%
+ }
+ {\afterassignment\CF_submoltestnxttoka% pas d'argument entre crochet
+ \CF_cntatomgroup=0% cherche le nombre d'arguments éventuels
+ }%
+}
+
+\def\CF_submoltestnxttoka{\futurelet\CF_toksa\CF_submoltestnxttokb}
+
+\def\CF_submoltestnxttokb{%
+ \if[\noexpand\CF_toksa\expandafter\CF_execfirst\else\expandafter\CF_execsecond\fi
+ {\begingroup\CF_sanitizecatcode\CF_expsecond\CF_submolgrabopt{\CF_temp}}
+ {\CF_expsecond{\def_submola}\CF_temp{}}%
+}
+
+\def\CF_submolgrabopt#1[#2]#{\endgroup\def_submola{#1}{#2}}
+
+\def\def_submola#1{% #1 nom
+ \CF_ifnum{0\CF_ifnum{\CF_cntatomgroup<0 }1{\CF_ifnum{\CF_cntatomgroup>9 }10}>0 }
+ {\CF_error{Invalid number of arguments in submol \detokenize\expandafter{\string#1}. Defining it with 0 argument}%
+ \CF_cntatomgroup=0
+ }
+ {}%
+ \ifcat\relax\expandafter\noexpand\CF_firsttonil#1\_nil\expandafter\CF_execfirst\else\expandafter\CF_execsecond\fi% si #1 est une séquence de contrôle
+ {\expandafter\ifdefined\CF_firsttonil#1\_nil
+ \ifCF_definesubmol
+ \CF_warning{the submol \expandafter\string\CF_firsttonil#1\_nil\space is already defined, the previous definition is lost}%
+ \fi
+ \fi
+ \begingroup
+ \CF_sanitizecatcode
+ \def_submolb{#1}%
+ }
+ {\ifcsname CF__#1\endcsname
+ \ifCF_definesubmol
+ \CF_warning{the submol "#1" is already defined, the previous definition is lost}%
+ \fi
+ \fi
+ \begingroup
+ \CF_sanitizecatcode
+ \expandafter\def_submolb\csname CF__#1\endcsname
+ }%
+}
+
+\def\def_submolb#1#2#3{% #1 nom sous forme de macro, #2 = code si liaison arrive de droite , #3 = code si liaison arrive de gauche, \CF_cntatomgroup = nombre d'arguments
+ \def\CF_tempa{#2}\CF_doifnotempty{#2}{\CF_expsecond{\CF_expsecond\CF_substonly{\number\CF_cntatomgroup}\CF_tempa}{\CFhash}{\CFhash}}%
+ \def\CF_tempb{#3}\CF_expsecond{\CF_expsecond\CF_substonly{\number\CF_cntatomgroup}\CF_tempb}{\CFhash}{\CFhash}%
+ \CF_expsecond{\CF_expsecond{\def_submolc{#1}}\CF_tempa}\CF_tempb
+}
+
+\def\def_submolc#1#2#3{% #1 nom sous forme de macro, #2 = code si liaison arrive de droite , #3 = code si liaison arrive de gauche, \CF_cntatomgroup = nombre d'arguments
+ \endgroup
+ \begingroup
+ \global\toks0{\gdef\CFthesubmol}%
+ \CF_ifnum{\CF_cntatomgroup>0 }
+ {\foreach\CF_x in {1,...,\CF_cntatomgroup}{%
+ \edef\CF_temp{\CFhash\CF_x}%
+ \global\toks0\expandafter\expandafter\expandafter{\expandafter\the\expandafter\toks\expandafter0\CF_temp}%
+ }%
+ }
+ {}%
+ \CF_sanitizecatcode \catcode`\#6 \endlinechar-1 \everyeof{\noexpand}%
+ \CF_ifempty{#2}%
+ {\scantokens\expandafter{\the\toks0{\empty#3}}%
+ }%
+ {\scantokens\expandafter{%
+ \the\toks0{%
+ \romannumeral
+ \csname CF_exec%
+ \ifdim\csname CF_currentangle\endcsname pt>90pt
+ \ifdim\csname CF_currentangle\endcsname pt<270pt
+ first%
+ \else
+ second%
+ \fi
+ \else
+ second%
+ \fi
+ \endcsname
+ {0 #2}{0 #3}%
+ }%
+ }%
+ }%
+ \endgroup
+ \let#1\CFthesubmol
+}
+
+\def\CF_seeknode#1#2#3{% cherche un noeud au début de #1 l'assigne dans la sc #2 et met le reste dans #3
+ \let#2\empty
+ \def#3{#1}%
+ \CF_iffirsttokmatch{#1}{ }%
+ {\CF_expsecond\CF_seeknodea{\romannumeral-`\.\noexpand#1}#2#3}% ignore les espaces au début du groupe d'atome
+ {\CF_seeknodea{#1}#2#3}%
+}
+
+\def\CF_seeknodea#1#2#3{%
+ \CF_ifempty{#1}%
+ {\let#3\empty
+ }
+ {\futurelet\CF_toksa\CF_gobtonil#1\relax\_nil
+ \CF_ifx\CF_toksa\CF_sptoken
+ {\CF_addtomacro#2{ }%
+ \CF_expsecond\CF_seeknodea{\CF_afterspace#1\_nil}#2#3%
+ }%
+ {\CF_ifx\CF_toksa\bgroup
+ {\CF_eaddtomacro#2{\expandafter{\CF_firsttonil#1\_nil}}%
+ \CF_expsecond\CF_seeknodea{\CF_gobarg#1}#2#3%
+ }%
+ {\CF_iffirsttokina{-=(*<>!~}%
+ {\def#3{#1}%
+ }%
+ {\CF_eaddtomacro#2{\CF_firsttonil#1\_nil}%
+ \CF_expsecond\CF_seeknodea{\CF_gobarg#1}#2#3%
+ }%
+ }%
+ }%
+ }%
+}
+
+% on sait que #1 commence par -,=,~,<,>. On analyse cette liaison
+% #2 reçoit le type de liaisons (1 pour -, 2 pour =, 3 pour ~)
+\def\CF_assignbondcode#1#2{%
+ \futurelet\CF_toksa\CF_gobtonil#1\_nil
+ \edef#2{%
+ \ifx-\CF_toksa1\else
+ \ifx=\CF_toksa2\else
+ \ifx~\CF_toksa3\else
+ \ifx>\CF_toksa4\else
+ \ifx<\CF_toksa5\else0% si 0 --> il y a une erreur non due à l'utilisateur
+ \fi\fi\fi\fi\fi}%
+ \ifnum#2>3 % si c'est une liaison de Cram
+ \CF_expafter{\futurelet\CF_toksa\CF_gobtonil}{\CF_gobarg#1\_nil}% chope le caractère suivant
+ \CF_ifx:\CF_toksa
+ {\edef#2{\number\numexpr#2+2}% si c 'est un ":", signe du pointillé, ajoute 2
+ }%
+ {\CF_ifx|\CF_toksa% si c 'est un "|", signe du triangle évidé, ajouter 4
+ {\edef#2{\number\numexpr#2+4}}
+ {}%
+ }%
+ \fi
+}
+
+\def\CF_grabbondoffseta#1,#2\_nil{%
+ \def\CF_startoffset{#1}\def\CF_endoffset{#2}%
+}
+
+\def\CF_grabbondoffset#1(#2)#3\_nil{%
+ \CF_doifnotempty{#2}%
+ {\CF_ifinstr{#2},%
+ {\CF_grabbondoffseta#2\_nil}%
+ {\def\CF_startoffset{#2}}%
+ }%
+ \def\CF_remainafterbond{#3}%
+}
+
+\def\CF_analysebond#1#2{%
+ \CF_assignbondcode{#1}#2%
+ \CF_expsecond{\def\CF_remainafterbond}{\CF_gobarg#1}%mange le premier signe de la liaison
+ \let\CF_doublebondtype\CF_zero
+ \ifnum#2=2 % si c'est une double liaison, regarde s'il y a un + ou - derrière
+ \CF_expafter{\futurelet\CF_toksa\CF_gobtonil}{\CF_gobarg#1\_nil}%
+ \CF_ifx^\CF_toksa
+ {\def\CF_doublebondtype{1}%
+ \CF_expsecond{\def\CF_remainafterbond}{\CF_gobtwoargs#1}% mange le "^"
+ }
+ {\expandafter\ifx\CF_underscore\CF_toksa
+ \def\CF_doublebondtype{2}%
+ \CF_expsecond{\def\CF_remainafterbond}{\CF_gobtwoargs#1}% mange le "_"
+ \fi
+ }%
+ \else
+ \ifnum#2>5 % si c'est une laision de Cram pointillée ou triangle évidé
+ \CF_expsecond{\def\CF_remainafterbond}{\CF_gobtwoargs#1}% mange un caractère de plus
+ \fi
+ \fi
+ \CF_expsecond\CF_iffirsttokmatch\CF_remainafterbond\CFhash
+ {\CF_eexpsecond\CF_iffirsttokmatch{\expandafter\CF_gobarg\CF_remainafterbond.}(%si parenthèse juste après
+ {\expandafter\CF_grabbondoffset\CF_remainafterbond\_nil}
+ {}%
+ }%
+ {}%
+ \CF_expsecond\CF_iffirsttokmatch\CF_remainafterbond @%
+ {\expandafter\CF_grabmovearg\CF_remainafterbond\_nil}%
+ {}%
+ \CF_expsecond\CF_iffirsttokmatch{\CF_remainafterbond}[%
+ {\expandafter\CF_analyseoptarg\CF_remainafterbond\_nil\CF_remainafterbond
+ }%
+ {\let\CF_currentstringangle\CF_defaultstringangle
+ \let\CF_currentlength\CF_defaultlength
+ \let\CF_currentfromatom\CF_defaultfromatom
+ \let\CF_currenttoatom\CF_defaulttoatom
+ \let\CF_currenttikz\CF_defaulttikz
+ \let\CF_movebondname\empty
+ }%
+ \ifCF_incycle
+ \pgfmathsetmacro\CF_cycleincrementangle{360/\CF_cyclenum+\CF_initcycleangle}%
+ \edef\CF_currentstringangle{::+\CF_cycleincrementangle}%
+ \def\CF_initcycleangle{0}%
+ \let\CF_currentlength\CF_defaultlength% et on ignore la longueur de liaison spécifiée
+ \fi
+ \CF_expsecond\CF_setbondangle{\CF_currentstringangle}\CF_currentangle
+}
+
+\def\CF_setbondangle#1#2{% le code de la direction est contenu dans #1, en sortie, #2 contient l'angle
+ \CF_ifempty{#1}%
+ {\let#2\CF_defaultangle
+ }
+ {\if:\expandafter\noexpand\CF_firsttonil#1\_nil
+ \if:\CF_threeea\noexpand\expandafter\CF_firsttonil\CF_gobarg#1\_nil
+ \pgfmathsetmacro#2{\CF_previousangle+\expandafter\CF_gobarg\CF_gobarg#1}%
+ \else
+ \pgfmathsetmacro#2{\CF_gobarg#1}%
+ \fi
+ \else
+ \pgfmathsetmacro#2{#1*\CF_angleincrement}%
+ \fi% puis normalise l'angle entre 0 et 360
+ \ifdim\ifdim#2pt<0pt -\fi#2pt>360pt
+ \pgfmathsetmacro#2{#2-360*floor(#2/360)}%
+ \fi% si |#2|>360
+ \ifdim#2pt<0pt
+ \pgfmathsetmacro#2{#2+360}%
+ \fi
+ }%
+}
+
+\def\CF_analysemovearg#1,#2\_nil#3{%
+ \def#3{#1}\def\CF_movebondcoeff{#2}%
+}
+
+% Argument limités légitimes ici car #2 (qui est ce qui suit "@{<nom>}" dans l'argument optionnel) ne DOIT PAS
+% commencer par une accolade.
+\def\CF_grabmovearg @#1#2\_nil{%
+ \CF_ifinstr{#1},%
+ {\CF_analysemovearg#1\_nil\CF_movebondname}%
+ {\def\CF_movebondname{#1}\def\CF_movebondcoeff{0.5}}%
+ \def\CF_remainoptarg{#2}%
+}
+
+\def\CF_testemptyandassign#1#2#3{%
+ \CF_ifempty{#2}
+ {\let#1#3}
+ {\def#1{#2}}%
+}
+
+\def\CF_parseoptlist#1,#2,#3,#4,#5\_nil{%
+ \CF_testemptyandassign\CF_currentstringangle{#1}\CF_defaultstringangle
+ \CF_testemptyandassign\CF_currentlength {#2}\CF_defaultlength
+ \CF_testemptyandassign\CF_currentfromatom {#3}\CF_defaultfromatom
+ \CF_testemptyandassign\CF_currenttoatom {#4}\CF_defaulttoatom
+ \CF_expsecond{\CF_testemptyandassign\CF_currenttikz}{\CF_sanitizelastitem#5,\empty\_nil}\CF_defaulttikz
+}%
+
+\def\CF_analyseoptarg[#1]{%
+ \CF_doifnotempty{#1}%
+ {\CF_iffirsttokmatch{#1}{@}%
+ {\CF_grabmovearg#1\_nil
+ }
+ {\let\CF_movebondname\empty
+ \def\CF_remainoptarg{#1}%
+ }%
+ \expandafter\CF_parseoptlist\CF_remainoptarg,\empty,\empty,\empty,\empty\_nil
+ }%
+ \CF_analyseoptarga\relax
+}
+
+\def\CF_analyseoptarga#1\_nil#2{%
+ \CF_expsecond{\def#2}{\CF_gobarg#1}%
+}
+
+\def\CF_seeksubmol{%
+ \CF_expsecond{\def\CF_molecule}{\romannumeral-`\.\expandafter\noexpand\CF_molecule}%
+ \CF_expsecond\CF_iffirsttokmatch{\CF_molecule}!%
+ {\CF_eexpsecond{\def\CF_molecule}{\expandafter\CF_gobarg\CF_molecule}% enlève le "!"
+ \CF_ifx\empty\CF_molecule
+ {\CF_error{no submol name found after "!"}}
+ {}%
+ \ifcat\relax\CF_threeea\noexpand\expandafter\CF_firsttonil\CF_molecule*\_nil
+ \expandafter\CF_seeksubmola\CF_molecule\_nil
+ \else
+ \expandafter\CF_seeksubmolb\CF_molecule\_nil
+ \fi
+ \CF_seeksubmol
+ }%
+ {}%
+}
+
+\def\CF_seeksubmola#1{\CF_seeksubmolc#1\relax}
+
+\def\CF_seeksubmolb#1{\expandafter\CF_seeksubmolc\csname CF__#1\endcsname\relax}% nom de la sous molécule
+
+\def\CF_seeksubmolc#1#2\_nil{%#1=macro de la sous molécule #2=reste du code commençant par \relax
+ \CF_expsecond{\CF_eexpsecond{\def\CF_molecule}}{\expandafter#1\CF_gobarg#2}% supprime le \relax puis ajoute la macro au début et la 2-développe
+}
+
+\def\CF_insertemptygroup#1{% insère {} au début de la sc #1
+ \CF_expsecond{\def#1}{\expandafter{\expandafter}#1}%
+}
+
+\def\chemfig{\CF_testopt\CF_chemfiga{}}
+
+\def\CF_chemfiga[#1]{%
+ \begingroup
+ \edef\CF_temp{%
+ \unexpanded\expandafter{\CF_begintikzpicture}%
+ [remember picture,%
+ every node/.style={%
+ anchor=base,%
+ inner sep=0pt,%
+ outer sep=0pt,%
+ minimum size=0pt,%
+ \unexpanded\CF_threeea{\useKV[chemfig]{atom style}}%
+ },%
+ baseline,%
+ \unexpanded\CF_threeea{\useKV[chemfig]{chemfig style}}%
+ ]%
+ }%
+ \CF_sanitizecatcode
+ \CF_exptwomacroargs\CF_chemfigb\CF_begintikzpicture\CF_endtikzpicture[#1]%
+}
+
+\def\CF_chemfigb#1#2[#3]#4{%
+ \endgroup
+ \begingroup
+ \setchemfig{#3}%
+ \edef\CF_temp{%
+ \unexpanded{#1}[%
+ remember picture,%
+ every node/.style={%
+ anchor=base,%
+ inner sep=0pt,%
+ outer sep=0pt,%
+ minimum size=0pt,%
+ \unexpanded\CF_threeea{\useKV[chemfig]{atom style}}%
+ },%
+ baseline,%
+ \unexpanded\CF_threeea{\useKV[chemfig]{chemfig style}}%
+ ]%
+ }%
+ \CF_temp% début du tikzpicture
+ \begingroup% \endgroup rajouté en sortie de tracé par \CF_chemfigd
+ \let\CF_hooklist\empty
+ \CF_expsecond\setchemfig{#3}%
+ \ifboolKV[chemfig]{fixed length}
+ {\CF_macrofixedbondlengthtrue}
+ {\CF_macrofixedbondlengthfalse}%
+ \ifboolKV[chemfig]{bond join}
+ {\let\CF_drawaxisbond\CF_drawaxisbondjoin}
+ {\let\CF_drawaxisbond\CF_drawaxisbondnojoin}%
+ \ifboolKV[chemfig]{cram rectangle}
+ {\let\CF_clipcramornot\CF_gobtikzinstruction}
+ {\let\CF_clipcramornot\clip}%
+ \CF_valuetomacro\CF_crambasewidth [1.5ex]{cram width}%
+ \CF_valuetomacro\CF_cramdashlength [1pt]{cram dash width}%
+ \CF_valuetomacro\CF_cramdashsep [2pt]{cram dash sep}%
+ \CF_valuetomacro\CF_atomsep [3em]{atom sep}% espacement des atomes liés
+ \CF_valuetomacro\CF_bondoffset [2pt]{bond offset}%
+ \CF_valuetomacro\CF_doublesep [2pt]{double bond sep}%
+ \CF_valuetomacro\CF_angleincrement [45]{angle increment}%
+ \CF_valuetomacro\CF_nodestyle []{node style}%
+ \CF_valuetomacro\CF_bondstyle []{bond style}%
+ \CF_valuetomacro\CF_stacksep [1.5pt]{stack sep}%
+ \CF_valuetomacro\CF_cycleradiuscoeff[0.75]{cycle radius coeff}% coeff multiplicateur du rayon des arcs dans les cycles
+ \CF_incyclefalse
+ \CF_cntgroup0
+ \let\CF_lastaction\CF_zero% 0=début du dessin 1=tracé d'un noeud 2=tracé d'une liaison
+ \let\CF_startoffset\empty
+ \let\CF_endoffset\empty
+ \let\CF_bondoutcontentsaved\empty
+ \def\CF_cycleanglecorrection{180/\CF_cyclenum}%
+ \def\CF_defaultangle{0}%
+ \def\CF_defaultstringangle{:0}% angle pris par défaut si le champ est vide
+ \def\CF_defaultlength{1}%
+ \let\CF_defaultfromatom\empty% numero de l'atome d'où partent les liaisons par défaut
+ \let\CF_defaulttoatom\empty% numéro de l'atome où arrivent les laisons par défaut
+ \let\CF_defaulttikz\empty
+ \let\CF_previousbondangle\empty
+ \let\CF_joinbond\CF_zero
+ \let\CF_previoustikz\empty
+ \everyeof{\_nil}\endlinechar-1
+ \CF_sanitizecatcode
+ \expandafter\CF_assigntonil\expandafter\CF_molecule\scantokens{#4}%
+ \CF_expsecond{\CF_substall\CF_molecule}\CFhash\CFhash
+ \CF_expsecond\CF_chemfigc{\CF_molecule}%
+ %\endgroup <-- rajouté par \CF_chemfigd
+ #2% fin du tikzpicture
+ \endgroup
+ \let\CF_flipstate\CF_zero
+}
+
+\def\CF_chemfigc#1{% #1 est le code de la molécule
+ \ifnum\CF_lastaction=3
+ \ifCF_incycle
+ \def\CF_defaultangle{0}%
+ \else
+ \ifnum\CF_cntcycle=0 % si c'est le début d'un cycle
+ \pgfmathsetmacro\CF_defaultangle{\CF_previousangle+180+\CF_cycleanglecorrection}% on met la liaison à +180° + correction
+ \else
+ \pgfmathsetmacro\CF_defaultangle{\CF_previousangle-90+180/\CF_cyclenum}% sinon à la bissectrice du sommet du cycle
+ \fi
+ \fi
+ \let\CF_defaultstringangle\empty
+ \fi
+ \let\CF_currentangle\CF_defaultangle
+ \def\CF_molecule{#1}%
+ \CF_seeksubmol% alias en premier ?
+ \if[\CF_threeea\noexpand\expandafter\CF_firsttonil\CF_molecule\_nil
+ \expandafter\CF_analyseoptarg\CF_molecule\_nil\CF_molecule
+ \CF_expsecond\CF_setbondangle{\CF_currentstringangle}\CF_currentangle
+ \let\CF_defaultangle\CF_currentangle
+ \let\CF_previousangle\CF_currentangle
+ \CF_doifnotempty\CF_currentstringangle{\let\CF_defaultangle\CF_currentangle}%
+ \CF_doifnotempty\CF_currentlength {\let\CF_defaultlength\CF_currentlength}%
+ \CF_doifnotempty\CF_currentfromatom {\let\CF_defaultfromatom\CF_currentfromatom}%
+ \CF_doifnotempty\CF_currenttoatom {\let\CF_defaulttoatom\CF_currenttoatom}%
+ \CF_doifnotempty\CF_currenttikz {\let\CF_defaulttikz\CF_currenttikz}%
+ \CF_seeksubmol
+ \fi
+ \edef\CF_defaultstringangle{:\CF_defaultangle}%
+ \let\CF_currentlength\CF_defaultlength
+ \let\CF_currentfromatom\CF_defaultfromatom
+ \let\CF_currenttoatom\CF_defaulttoatom
+ \let\CF_currenttikz\CF_defaulttikz
+ \ifCF_incycle% si on commence un cycle
+ \let\CF_currentangle\CF_previousangle
+ \ifCF_cyclearc% on doit tracer l'arc de cercle dans le cycle ?
+ \pgfmathsetmacro\CF_cyclearcradius{\CF_cycleradiuscoeff*\CF_currentlength*\CF_atomsep/(2*tan(180/\CF_cyclenum))}%
+ \pgfmathsetmacro\CF_cyclearcinitangle{\CF_currentangle+\CF_initcycleangle+180/\CF_cyclenum+90}
+ \pgfmathparse{\CF_currentlength*\CF_atomsep/(2*sin(180/\CF_cyclenum))}%
+ \node[at=(\CF_bondoutnode),shift=(\CF_cyclearcinitangle:\pgfmathresult pt)](arccenter){};% le centre de l'arc
+ \node[at=(arccenter),shift=(\CF_cyclearcstartangle:\CF_cyclearcradius pt)](initarc){};% le début de l'arc
+ \CF_expafter{\draw[}\CF_cyclearcdirecttikz](initarc) arc (\CF_cyclearcstartangle:\CF_cyclearcendangle:\CF_cyclearcradius pt);
+ \fi
+ \else
+ \let\CF_currentangle\CF_defaultangle
+ \fi
+ \ifnum\CF_lastaction=0
+ \let\CF_previousangle\CF_defaultangle
+ \node(CF_node){};
+ \CF_expsecond\CF_iffirsttokin{\CF_molecule}{-=(*~?<>}%
+ {\CF_insertemptygroup\CF_molecule}%
+ {}%
+ \fi
+ \CF_chemfigd
+}
+
+\def\CF_chemfigd{%
+ \let\CF_nextaction\CF_chemfigd% à priori, on reboucle
+ \CF_ifx\CF_molecule\empty
+ {\let\CF_nextaction\endgroup
+ }
+ {\CF_seeksubmol
+ \CF_expsecond\CF_seeknode{\CF_molecule}\CF_currentatomgroup\CF_molecule
+ \CF_ifx\empty\CF_currentatomgroup% pas de noeud pour commencer ?
+ {\def\CF_bondoutnode{%
+ n\CF_lastgroupnumber-%
+ \ifx\CF_currentfromatom\empty
+ \ifdim\CF_currentangle pt<90pt
+ \number\CF_cntatomgroup
+ \else
+ \ifdim\CF_currentangle pt>270pt
+ \number\CF_cntatomgroup
+ \else
+ 1%
+ \fi
+ \fi
+ \else
+ \CF_currentfromatom
+ \fi}%
+ \CF_expafter{\futurelet\CF_toksa\CF_gobtonil}{\CF_molecule\relax\_nil}%
+ \CF_iffirsttokina{-=<>~}% la suite est une liaison
+ {\ifnum\CF_lastaction=2 % c'est la deuxième liaison consécutive ?
+ \CF_insertemptygroup\CF_molecule% insère un groupe vide
+ \edef\CF_bondoutnode{\CF_bondoutnode}%
+ \else
+ \ifCF_incycle
+ \advance\CF_cntcycle1
+ \fi
+ \CF_expsecond\CF_analysebond{\CF_molecule}\CF_bondtype
+ \edef\CF_bondoutnode{\CF_bondoutnode}%
+ \let\CF_molecule\CF_remainafterbond
+ \ifCF_incycle
+ \ifnum\CF_cntcycle=\CF_cyclenum\relax
+ \CF_threeea\CF_execfirst
+ \else
+ \ifnum\CF_cntcycle=1
+ \let\CF_cyclefirsttikz\CF_currenttikz
+ \CF_doifnotempty\CF_startoffset{\let\CF_cyclejoinlast\CF_zero}%
+ \fi
+ \CF_threeea\CF_execsecond
+ \fi
+ \else
+ \expandafter\CF_execsecond
+ \fi
+ {\let\CF_nextaction\endgroup
+ \CF_drawbond\CF_bondtype{\CF_bondoutnode}{\CF_hookcycle}\CF_previousatomgroup\CF_hookatomgroup
+ }%
+ {\node[at=(\CF_bondoutnode\ifCF_incycle\else\ifCF_macrofixedbondlength.\CF_currentangle\fi\fi),shift=(\ifcase\CF_flipstate\or180-\or-\fi\CF_currentangle:\CF_currentlength*\CF_atomsep)](CF_node){};
+ \let\CF_previousangle\CF_currentangle
+ \def\CF_lastaction{2}%
+ }%
+ \fi
+ \ifcat\relax\detokenize\expandafter{\romannumeral-`\.\expandafter\noexpand\CF_molecule}\relax
+ % s'il ne reste plus rien après la liaison (sans tenir compte de l'espace devant)-> insère un groupe vide
+ \CF_insertemptygroup\CF_molecule
+ \fi
+ }%
+ {\edef\CF_bondoutnode{\CF_bondoutnode}% évalue le l'atome de départ de liaison
+ \CF_ifx(\CF_toksa% une parenthèse pour commencer ?
+ {\ifnum\CF_lastaction=2 % il y avait une liaison juste avant ?
+ \CF_insertemptygroup\CF_molecule
+ \else
+ \CF_expsecond\CF_grabsubmol{\CF_molecule}%
+ \begingroup
+ \ifCF_incycle\def\CF_lastaction{3}\fi% on était dans un cycle
+ \CF_incyclefalse
+ \aftergroup\CF_chemfigd
+ \def\CF_nextaction{\CF_expsecond\CF_chemfigc{\CF_molinparen}}%
+ \fi
+ }%
+ {\CF_ifx\CF_molecule\empty
+ {\let\CF_nextaction\endgroup
+ }
+ {% ce qui reste après le noeud courant n'est pas vide, ne commence pas par "-=~", ni par une parenthèse
+ \CF_ifx*\CF_toksa% un cycle ?
+ {\ifnum\CF_lastaction=2
+ \CF_insertemptygroup\CF_molecule% insère un groupe vide
+ \else
+ \ifCF_incycle
+ \def\CF_lastaction{3}%
+ \fi% on était dans un cycle
+ \ifnum\CF_lastaction=3
+ \let\CF_lastcyclenum\CF_cyclenum
+ \fi
+ \CF_eexpsecond\CF_iffirsttokmatch{\expandafter\CF_gobarg\CF_molecule}*%
+ {\CF_eexpsecond{\def\CF_molecule}{\expandafter\CF_gobarg\CF_molecule}% enlève la 1er étoile
+ \CF_eexpsecond\CF_iffirsttokmatch{\expandafter\CF_gobarg\CF_molecule}[% un crochet ensuite ?
+ {\expandafter\CF_cycleparsepreamblewithoptarg\CF_molecule\_nil% \begingroup inclus
+ }%
+ {\def\CF_cyclearcstartangle{0}\def\CF_cyclearcendangle{360}%
+ \let\CF_cyclearcdirecttikz\empty
+ \expandafter\CF_cycleparsepreamble\CF_molecule\_nil% \begingroup inclus
+ }%
+ \CF_cyclearctrue
+ }%
+ {\expandafter\CF_cycleparsepreamble\CF_molecule\_nil% \begingroup inclus
+ \CF_cyclearcfalse
+ }%
+ \CF_cntcycle0
+ \edef\CF_hookcycle{\CF_bondoutnode}%
+ \let\CF_hookatomgroup\CF_previousatomgroup
+ \CF_ifx\CF_hookatomgroup\CF_emptynode
+ {\def\CF_cyclejoinlast{1}}% joindre le dernier
+ {\def\CF_cyclejoinlast{0}}
+ \CF_incycletrue
+ \ifnum\CF_lastaction=3
+ \pgfmathsetmacro\CF_initcycleangle{360/\CF_lastcyclenum-180}% c'est un cycle dans un cycle
+ \else
+ \pgfmathsetmacro\CF_initcycleangle{-180/\CF_cyclenum-90+\CF_cycleanglecorrection}%
+ \fi
+ \aftergroup\CF_chemfigd
+ \def\CF_nextaction{\CF_expsecond\CF_chemfigc{\CF_molinparen}}%
+ \fi
+ }%
+ {\CF_error{something went wrong here: \detokenize\expandafter{\CF_molecule}^^JIf you think it's a bug, please, send a Minimal Example to the author}%
+ }%
+ }%
+ }%
+ }%
+ }%
+ {\CF_expthreemacroargs\CF_drawatomgroup\CF_currentangle\CF_currenttoatom\CF_currentatomgroup
+ }%
+ }%
+ \CF_nextaction
+}
+
+\def\CF_cycleparsepreamble*#1#2\_nil{%
+ \ifnum#1<3
+ \CF_error{a cycle must be at least a triangle.^^JThe number following "*" must be 3 or more}%
+ \fi
+ \def\CF_molecule{#2}%
+ \CF_expsecond\CF_grabsubmol{\CF_molecule}%
+ \begingroup
+ \def\CF_cyclenum{#1}%
+}
+
+\def\CF_cycleparsepreamblewithoptarg*[#1]#2#3\_nil{%
+ \CF_cycleparseoptarg#1,\empty,\empty,\empty\_nil
+ \CF_cycleparsepreamble*#2#3\_nil
+}
+
+\def\CF_cycleparseoptarg#1,#2,#3\_nil{%
+ \CF_ifempty{#1}
+ {\def\CF_cyclearcstartangle{0}}
+ {\def\CF_cyclearcstartangle{#1}}%
+ \CF_ifempty{#2}
+ {\def\CF_cyclearcendangle{360}}
+ {\def\CF_cyclearcendangle{#2}}%
+ \CF_expsecond{\def\CF_cyclearcdirecttikz}{\CF_sanitizelastitem#3,\empty\_nil}%
+}
+
+\def\CF_grabsubmol#1{%
+ \begingroup
+ \catcode`(1 \catcode`)2
+ \CF_threeea
+ \endgroup
+ \expandafter\CF_grabsubmola\scantokens{\relax#1}%
+}
+
+\def\CF_grabsubmola#1\_nil{%
+ \expandafter\CF_assigntonil\expandafter\CF_molecule\scantokens\CF_threeea{\expandafter\CF_gobarg \CF_gobarg#1}%
+ \expandafter\CF_assigntonil\expandafter\CF_molinparen\scantokens\CF_threeea{\expandafter\CF_firsttonil\CF_gobarg#1\_nil}%
+}
+
+\def\CF_ifcarisupperletter#1{%
+ \ifcat\relax\noexpand#1%
+ \let\CF_next\CF_execsecond% faux si c'est une sc
+ \else
+ \ifnum`#1<`A
+ \let\CF_next\CF_execsecond
+ \else
+ \ifnum`#1>`Z
+ \let\CF_next\CF_execsecond
+ \else
+ \let\CF_next\CF_execfirst
+ \fi
+ \fi
+ \fi
+ \CF_next
+}
+
+% Créé 4 noeuds au dessus et au dessous des noeuds #1 et #2
+% à une distance de #3 du noeud #1 et #4 du noeud #2
+\def\CF_createnormnodes#1#2#3#4{%
+ \CF_doifnotempty{#3}
+ {\node[shape=coordinate,at=(#1),xshift=#3*\CF_normx,yshift=#3*\CF_normy](#11){};
+ \node[shape=coordinate,at=(#1),xshift=-#3*\CF_normx,yshift=-#3*\CF_normy](#12){};
+ }%
+ \CF_doifnotempty{#4}
+ {\node[shape=coordinate,at=(#2),xshift=#4*\CF_normx,yshift=#4*\CF_normy](#21){};
+ \node[shape=coordinate,at=(#2),xshift=-#4*\CF_normx,yshift=-#4*\CF_normy](#22){};
+ }%
+}
+
+\def\CF_computenodevect#1#2{%
+ \pgfextractx\CF_dim{\pgfpointanchor{#1}{center}}\edef\CF_dimax{\the\CF_dim}%
+ \pgfextracty\CF_dim{\pgfpointanchor{#1}{center}}\edef\CF_dimay{\the\CF_dim}%
+ \pgfextractx\CF_dim{\pgfpointanchor{#2}{center}}\edef\CF_dimbx{\the\CF_dim}%
+ \pgfextracty\CF_dim{\pgfpointanchor{#2}{center}}\edef\CF_dimby{\the\CF_dim}%
+ \pgfmathsetmacro\CF_vectorlen{veclen(\CF_dimbx-\CF_dimax,\CF_dimby-\CF_dimay)}%
+ \pgfmathsetmacro\CF_normx{(\CF_dimay-\CF_dimby)/\CF_vectorlen}%
+ \pgfmathsetmacro\CF_normy{(\CF_dimbx-\CF_dimax)/\CF_vectorlen}%
+}
+
+\def\CF_setoffset#1#2{%
+ \CF_doifempty#1%
+ {\edef#1{%
+ \ifx#2\CF_emptynode
+ 0pt%
+ \else
+ \ifx#2\empty
+ 0pt%
+ \else
+ \CF_bondoffset
+ \fi
+ \fi}%
+ }%
+}
+
+\def\CF_drawbond#1#2#3#4#5{% #1=type de liaison #2 et #3:nom de noeuds de début et fin #4 et #5: contenu des atomes de début et fin
+ \CF_setoffset\CF_startoffset#4%
+ \CF_setoffset\CF_endoffset#5%
+ \let\CF_currentbondstyle\CF_bondstyle
+ \CF_doifnotempty\CF_currenttikz{\CF_eaddtomacro\CF_currentbondstyle{\expandafter,\CF_currenttikz}}%
+ \path(#2)--(#3)coordinate[pos=0](#2@)coordinate[pos=1](#3@);%
+ \CF_computenodevect{#2@}{#3@}%
+ \pgfmathsetmacro\CF_startcoeff{\CF_startoffset/\CF_vectorlen}%
+ \pgfmathsetmacro\CF_endcoeff{1-\CF_endoffset/\CF_vectorlen}%
+ \path(#2@)--(#3@)coordinate[pos=\CF_startcoeff](#2@@)coordinate[pos=\CF_endcoeff](#3@@);%
+ \CF_doifnotempty\CF_movebondname% on doit poser un noeud sur la liaison
+ {\path(#2@@)--(#3@@)coordinate[overlay,pos=\CF_movebondcoeff](\CF_movebondname);
+ \let\CF_movebondname\empty
+ }%
+ \ifcase#1\relax
+ \CF_error{unknown bond type, this error should not occur^^JIf you think it's a bug, send a Minimal Example to the author}%
+ \or% 1 = liaison simple
+ \CF_drawaxisbond{#2}{#3}% trace la liaison simple dans l'axe
+ \or% 2 = liaison double
+ \ifCF_incycle
+ \ifnum\CF_doublebondtype=0
+ \def\CF_doublebondtype{1}%
+ \fi
+ \ifnum\CF_flipstate>0
+ \def\CF_doublebondtype{2}%
+ \fi
+ \pgfmathsetmacro\CF_doublebondlengthcorrection{\CF_doublesep*tan(180/\CF_cyclenum)}%
+ \fi
+ \ifcase\CF_doublebondtype
+ \CF_createnormnodes{#2@@}{#3@@}{\CF_doublesep/2}{\CF_doublesep/2}%
+ \CF_drawbonda(#2@@1)--(#3@@1);
+ \CF_drawbonda(#2@@2)--(#3@@2);
+ \let\CF_joinbond\CF_zero
+ \or
+ \CF_createnormnodes{#2@@}{#3@@}\CF_doublesep\CF_doublesep
+ \CF_drawaxisbond{#2}{#3}% trace la liaison simple dans l'axe\CF_drawbonda(#2@@)--(#3@@);
+ \begingroup% ajuste éventuellement les longueurs des liaisons doubles
+ \ifCF_incycle
+ \ifdim\CF_startoffset=0pt
+ \CF_edefaddtomacro\CF_currentbondstyle{,shorten <=\CF_doublebondlengthcorrection pt}%
+ \fi
+ \ifdim\CF_endoffset=0pt
+ \CF_edefaddtomacro\CF_currentbondstyle{,shorten >=\CF_doublebondlengthcorrection pt}%
+ \fi
+ \fi
+ \CF_drawbonda(#2@@1)--(#3@@1);
+ \endgroup
+ \or
+ \CF_createnormnodes{#2@@}{#3@@}\CF_doublesep\CF_doublesep
+ \CF_drawaxisbond{#2}{#3}% trace la liaison simple dans l'axe\CF_drawbonda(#2@@)--(#3@@);
+ \begingroup% ajuste éventuellement les longueurs des liaisons doubles
+ \ifCF_incycle
+ \ifdim\CF_startoffset=0pt
+ \CF_edefaddtomacro\CF_currentbondstyle{,shorten \ifnum\CF_flipstate=0 <=-\else>=\fi\CF_doublebondlengthcorrection pt}%
+ \fi
+ \ifdim\CF_endoffset=0pt
+ \CF_edefaddtomacro\CF_currentbondstyle{,shorten \ifnum\CF_flipstate=0 >=-\else<=\fi\CF_doublebondlengthcorrection pt}%
+ \fi
+ \fi
+ \CF_drawbonda(#2@@2)--(#3@@2);
+ \endgroup
+ \fi
+ \or% 3 = liaison triple
+ \CF_createnormnodes{#2@@}{#3@@}\CF_doublesep\CF_doublesep
+ \CF_drawaxisbond{#2}{#3}% trace la liaison simple dans l'axe\CF_drawbonda(#2@@)--(#3@@);
+ \CF_drawbonda(#2@@1)--(#3@@1);
+ \CF_drawbonda(#2@@2)--(#3@@2);
+ \or% 4 = liaison Cram pleine de #2 vers #3
+ \CF_createnormnodes{#2@@}{#3@@}{\CF_crambasewidth/2}{}%
+ \CF_expafter{\filldraw[}\CF_currentbondstyle,line join=bevel](#2@@1)--(#2@@2)--(#3@@)--cycle;
+ \let\CF_joinbond\CF_zero
+ \or% 5 = liaison Cram creuse de #3 vers #2
+ \CF_createnormnodes{#3@@}{#2@@}{\CF_crambasewidth/2}{}%
+ \CF_expafter{\filldraw[}\CF_currentbondstyle,line join=bevel](#3@@1)--(#3@@2)--(#2@@)--cycle;
+ \let\CF_joinbond\CF_zero
+ \or% 6 = liaison Cram pointillée de #2 vers #3
+ \scope
+ \CF_createnormnodes{#2@@}{#3@@}{\CF_crambasewidth/2}{}%
+ \CF_clipcramornot(#2@@1)--(#2@@2)--(#3@@)--(#2@@1);
+ \CF_expafter{\draw[}\CF_currentbondstyle,dash pattern=on \CF_cramdashlength off \CF_cramdashsep,line width=\CF_crambasewidth](#2@@)--(#3@@);
+ \endscope
+ \let\CF_joinbond\CF_zero
+ \or% 7 = liaison Cram pointillée de #3 vers #2
+ \scope
+ \CF_createnormnodes{#3@@}{#2@@}{\CF_crambasewidth/2}{}%
+ \CF_clipcramornot(#3@@1)--(#3@@2)--(#2@@)--(#3@@1);
+ \CF_expafter{\draw[}\CF_currentbondstyle,dash pattern=on \CF_cramdashlength off \CF_cramdashsep,line width=\CF_crambasewidth](#3@@)--(#2@@);
+ \endscope
+ \let\CF_joinbond\CF_zero
+ \or% 8 = liaison cram rectangle évidé de #2 vers #3
+ \CF_createnormnodes{#2@@}{#3@@}{\CF_crambasewidth/2}{}%
+ \CF_expafter{\draw[}\CF_currentbondstyle,line join=bevel](#2@@1)--(#2@@2)--(#3@@)--cycle;
+ \let\CF_joinbond\CF_zero
+ \or% 9 = liaison cram rectangle évidé de #3 vers #1
+ \CF_createnormnodes{#3@@}{#2@@}{\CF_crambasewidth/2}{}%
+ \CF_expafter{\draw[}\CF_currentbondstyle,line join=bevel](#3@@1)--(#3@@2)--(#2@@)--cycle;
+ \let\CF_joinbond\CF_zero
+ \else
+ \CF_error{unknown bond type, this error should not occur^^JIf you think it's a bug, send a Minimal Example to the author}%
+ \fi
+ \let\CF_startoffset\empty
+ \let\CF_endoffset\empty
+ \let\CF_previoustikz\CF_currenttikz
+ \let\CF_previousbondangle\CF_previousangle
+ \def\CF_previousbond{#1}%
+}
+
+\def\CF_drawaxisbondnojoin#1#2{\CF_drawbonda(#1@@)--(#2@@);}
+
+\def\CF_drawaxisbondjoin#1#2{% dessine une liaison simple dans l'axe avec raccord rétrograde
+ \ifCF_incycle\ifnum\CF_cntcycle=\CF_cyclenum\relax
+ \let\CF_nexttikz\CF_cyclefirsttikz
+ \fi\fi
+ \ifnum\CF_joinbond=0
+ \ifCF_incycle
+ \ifnum\CF_cntcycle=\CF_cyclenum\relax
+ \ifnum\CF_cyclejoinlast=1
+ \CF_drawbonda(#1@@)--(#2@@)--%
+ ([shift=(\CF_previousbondangle+2*\CF_cycleincrementangle:.5\pgflinewidth)]#2@@);
+ \else
+ \CF_drawbonda(#1@@)--(#2@@);
+ \fi
+ \else
+ \CF_drawbonda(#1@@)--(#2@@);
+ \fi
+ \else
+ \CF_drawbonda(#1@@)--(#2@@);
+ \fi
+ \def\CF_joinbond{1}%
+ \else
+ \CF_ifx\CF_previoustikz\CF_currenttikz
+ {\def\CF_joinbond{1}%
+ \CF_ifx\CF_previousatomgroup\CF_emptynode
+ {\CF_ifx\CF_previousbondangle\empty% si début molécule
+ {\CF_drawbonda(#1@@)--(#2@@);
+ }
+ {\ifdim\CF_startoffset=0pt
+ \ifCF_incycle
+ \ifnum\CF_cntcycle=\CF_cyclenum\relax
+ \ifnum\CF_cyclejoinlast=1
+ \CF_ifx\CF_cyclefirsttikz\CF_currenttikz
+ {\CF_drawbonda([shift=(\CF_previousbondangle:-.5\pgflinewidth)]#1@@)--(#1@@)--(#2@@)--%
+ ([shift=(\CF_previousbondangle+2*\CF_cycleincrementangle:.5\pgflinewidth)]#2@@);
+ }
+ {\CF_drawbonda([shift=(\CF_previousbondangle:-.5\pgflinewidth)]#1@@)--(#1@@)--(#2@@);
+ }%
+ \else
+ \CF_drawbonda([shift=(\CF_previousbondangle:-.5\pgflinewidth)]#1@@)--(#1@@)--(#2@@);
+ \fi
+ \else
+ \CF_drawbonda([shift=(\CF_previousbondangle:-.5\pgflinewidth)]#1@@)--(#1@@)--(#2@@);
+ \fi
+ \else
+ \CF_drawbonda([shift=(\CF_previousbondangle:-.5\pgflinewidth)]#1@@)--(#1@@)--(#2@@);
+ \fi
+ \else
+ \CF_drawbonda(#1@@)--(#2@@);
+ \fi
+ }%
+ }
+ {\CF_drawbonda(#1@@)--(#2@@);}%
+ }
+ {\ifCF_incycle
+ \ifnum\CF_cntcycle=\CF_cyclenum\relax
+ \ifnum\CF_cyclejoinlast=1
+ \CF_ifx\CF_nexttikz\CF_currenttikz
+ {\CF_drawbonda(#1@@)--(#2@@)--([shift=(\CF_previousbondangle+2*\CF_cycleincrementangle:.5\pgflinewidth)]#2@@);}%
+ {\CF_drawbonda(#1@@)--(#2@@);}%
+ \else
+ \CF_drawbonda(#1@@)--(#2@@);
+ \fi
+ \else
+ \CF_drawbonda(#1@@)--(#2@@);
+ \fi
+ \else
+ \CF_drawbonda(#1@@)--(#2@@);
+ \fi
+ }%
+ \fi
+ \ifdim\CF_endoffset=0pt \else
+ \let\CF_joinbond\CF_zero
+ \fi
+}
+
+\def\CF_drawbonda{\CF_expafter{\draw[}\CF_currentbondstyle]}
+
+\def\CF_hookdrawall{% dessine tous les crochets contenus dans la sc \CF_hookdraw
+ \CF_doifnotempty\CF_hookdrawlist
+ {\expandafter\CF_hookdrawfirst\CF_hookdrawlist\_nil% trace un lien de crochet à crochet
+ \CF_hookdrawall
+ }%
+}
+
+\def\CF_hookdrawfirst[#1,#2,#3]#4#5#6#7#8\_nil{%
+ \def\CF_hookdrawlist{#8}%
+ \begingroup
+ \let\CF_joinbond\CF_zero
+ \def\CF_currenttikz{#3}%
+ \def\CF_hookstartcontent{#6}\def\CF_hookendcontent{#7}%
+ \CF_ifinteger{#2}%
+ {\CF_drawbond{#2}{#4}{#5}\CF_hookstartcontent\CF_hookendcontent
+ }%
+ {\CF_assignbondcode{#2}\CF_bondcurrentnum
+ \CF_drawbond\CF_bondcurrentnum{#4}{#5}\CF_hookstartcontent\CF_hookendcontent
+ }%
+ \endgroup
+}
+
+\def\CF_extractatom#1-#2\_nil{#2}% transforme le bound@outnode en n° de l'atome
+
+\def\CF_gobblemovearg @#1#2\_nil#3{%
+ \expandafter\def\csname atom_\number\CF_cntatom\endcsname{#2}%
+ \CF_ifinstr{#1},%
+ {\CF_analysemovearg#1\_nil#3\let\CF_movebondcoeff\empty}%
+ {\def#3{#1}}%
+ \CF_doifempty{#2}{\let\CF_nodestrut\empty}%
+}%
+
+\def\hflipnext{\def\CF_flipstate{1}}
+
+\def\vflipnext{\def\CF_flipstate{2}}
+\let\CF_flipstate\CF_zero
+
+\def\CF_drawatomgroup#1#2#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_bondoutcontent% assigne le contenu de l'atome d'où part la liaison
+ \csname
+ \ifdefined\CF_bondoutnode
+ atom_\expandafter\CF_extractatom\CF_bondoutnode\_nil
+ \else
+ empty%
+ \fi
+ \endcsname
+ \global\advance\CF_cntgroup1
+ \let\CF_currentatom\empty
+ \global\let\CF_hookdrawlist\empty
+ \CF_cntatomgroup0
+ \CF_iffirsttokmatch{#3}?
+ {\CF_drawatomgroupa{{}#3}}
+ {\CF_drawatomgroupa{#3}}%
+ \def\CF_currentatomgroup{#3}%
+ \CF_removemovearg\CF_currentatomgroup% enlève les "@{<nom>}"
+ \CF_ifinstr{#3}?%
+ {\CF_removehook\CF_currentatomgroup
+ \ifcat\relax\detokenize\expandafter{\romannumeral-`\.\expandafter\noexpand\CF_currentatomgroup}\relax
+ \let\CF_currentatomgroup\CF_emptynode
+ \fi
+ }%
+ {}%
+ \CF_doifnotempty{#2}
+ {\ifnum#2<1
+ \CF_warning{no atom found at position #2, pershaps you mispelled the optional argument of the bond.}%
+ \else
+ \ifnum#2>\CF_cntatomgroup
+ \CF_error{no atom found at position #2, pershaps you mispelled the optional argument of the bond.}%
+ \fi
+ \fi
+ }%
+ \edef\CF_hookatomnumber{%
+ \CF_ifempty{#2}
+ {\ifdim#1pt>90pt
+ \ifdim#1pt<270pt
+ \number\CF_cntatomgroup
+ \else
+ 1%
+ \fi
+ \else
+ 1%
+ \fi
+ }
+ {#2%
+ }%
+ }%
+ \CF_cntatom\CF_hookatomnumber
+ \CF_ifx\CF_currentatomgroup\CF_emptynode
+ {\let\CF_nodestrut\empty
+ }
+ {\CF_ifx\empty\CF_bondoutcontentsaved
+ {\def\CF_nodestrut{\vphantom\CF_bondoutcontent}}%
+ {\def\CF_nodestrut{\vphantom\CF_bondoutcontentsaved}}%
+ }%
+ \edef\CF_optstring{anchor=\ifnum\CF_lastaction=0 base\else\ifCF_incycle center\else\ifCF_macrofixedbondlength 180+#1\else center\fi\fi\fi,at=(CF_node),\CF_nodestyle}% premier atome de la molécule affiché
+ \loop
+ \unless\ifnum\CF_cntatom>\CF_cntatomgroup
+ \CF_eexpafter
+ {\futurelet\CF_toksa}
+ {\expandafter\expandafter\expandafter\CF_gobtonil\csname atom_\number\CF_cntatom\endcsname\_nil}%
+ \CF_ifx @\CF_toksa% l'atome courant commence par un "@"
+ {\CF_threeea\CF_gobblemovearg\csname atom_\number\CF_cntatom\endcsname\_nil\CF_moveatomname
+ \CF_expafter{\node[}\CF_optstring,overlay](\CF_moveatomname){\phantom{\CF_nodecontent}};%
+ \let\CF_moveatomname\empty
+ }
+ {}%
+ \CF_expafter{\node[}\CF_optstring](n\number\CF_cntgroup-\number\CF_cntatom){\CF_nodecontent};%
+ \let\CF_nodestrut\empty
+ \advance\CF_cntatom1
+ \edef\CF_optstring{anchor=base \ifnum\CF_flipstate=1 east\else west\fi,at=(n\number\CF_cntgroup-\number\numexpr\CF_cntatom-1.base \ifnum\CF_flipstate=1 west\else east\fi),\CF_nodestyle}%
+ \repeat
+ \CF_cntatom\CF_hookatomnumber
+ \ifnum\CF_lastaction=2 % s'il faut tracer une liaison
+ \gdef\CF_cycleanglecorrection{0}% alors c'est qu'un cycle ne peut pas commencer la molécule : annulation de la correction d'angle
+ \CF_drawbond\CF_bondtype{\CF_bondoutnode}{n\number\CF_cntgroup-\number\CF_cntatom}\CF_previousatomgroup\CF_currentatomgroup
+ \fi
+ \def\CF_lastaction{1}% met la dernière action à 1 : affichage d'un noeud
+ \loop
+ \ifnum\CF_cntatom>1
+ \advance\CF_cntatom-1
+ \edef\CF_optstring{anchor=base \ifnum\CF_flipstate=1 west\else east\fi,at=(n\number\CF_cntgroup-\number\numexpr\CF_cntatom+1.base \ifnum\CF_flipstate=1 east\else west\fi),\CF_nodestyle}%
+ \CF_eexpafter
+ {\futurelet\CF_toksa}
+ {\expandafter\expandafter\expandafter\CF_gobtonil\csname atom_\number\CF_cntatom\endcsname\_nil}%
+ \CF_ifx @\CF_toksa% l'atome courant commence par un "@"
+ {\CF_threeea\CF_gobblemovearg\csname atom_\number\CF_cntatom\endcsname\_nil\CF_moveatomname
+ \CF_expafter{\node[}\CF_optstring,overlay](\CF_moveatomname){\phantom{\CF_nodecontent}};%
+ \let\CF_moveatomname\empty
+ }
+ {}%
+ \CF_expafter{\node[}\CF_optstring](n\number\CF_cntgroup-\number\CF_cntatom){\CF_nodecontent};%
+ \repeat
+ \CF_hookdrawall
+ \edef\CF_lastgroupnumber{\number\CF_cntgroup}%
+ \let\CF_previousatomgroup\CF_currentatomgroup
+}
+
+\def\CF_keepmovearg @#1#2\_nil{\def\CF_currentatom{@{#1}}}
+
+\def\CF_drawatomgroupa#1{% transforme #1 en un groupe d'atomes
+ \CF_ifempty{#1}
+ {\expandafter\let\csname atom_\number\CF_cntatomgroup\endcsname\CF_currentatom
+ }
+ {\advance\CF_cntatomgroup1
+ \futurelet\CF_toksa\CF_gobtonil#1\_nil
+ \CF_ifx @\CF_toksa
+ {\CF_keepmovearg#1\_nil
+ \CF_removemovearga#1\_nil\CF_aftermovearg
+ \CF_expsecond\CF_drawatomgroupb{\CF_aftermovearg}%
+ }%
+ {\let\CF_currentatom\empty
+ \CF_drawatomgroupb{#1}%
+ }%
+ }%
+}
+
+\def\CF_drawatomgroupb#1{%
+ \CF_ifempty{#1}
+ {\expandafter\let\csname atom_\number\CF_cntatomgroup\endcsname\CF_currentatom
+ }
+ {\futurelet\CF_toksa\CF_gobtonil#1\_nil
+ \CF_ifx\bgroup\CF_toksa
+ {\CF_eaddtomacro\CF_currentatom{\expandafter{\CF_firsttonil#1\_nil}}%
+ \CF_expsecond\CF_drawatomgroupba{\CF_gobarg#1}%
+ }%
+ {\CF_ifx\CF_sptoken\CF_toksa
+ {\CF_addtomacro\CF_currentatom{ }%
+ \CF_expsecond\CF_drawatomgroupba{\CF_afterspace#1\_nil}%
+ }%
+ {\CF_eaddtomacro\CF_currentatom{\CF_firsttonil#1\_nil}%
+ \CF_expsecond\CF_drawatomgroupba{\CF_gobarg#1}%
+ }%
+ }%
+ }%
+}
+
+% enlève tous les "@{nom}" de la sc #1
+\def\CF_removemovearg#1{%
+ \CF_expsecond\CF_ifinstr{#1}@%
+ {\expandafter\CF_removemovearga#1\_nil#1%
+ \CF_removemovearg#1%
+ }%
+ {}%
+}
+
+% enlève le premier "@{<nom>}" de l'argument et l'assigne à #2
+\def\CF_removemovearga#1\_nil#2{%
+ \def\CF_removemoveargb##1@{%
+ \CF_expsecond{\def#2}{\CF_gobarg##1}% mange le \relax
+ \CF_removemoveargc\relax
+ }%
+ \def\CF_removemoveargc##1\_nil{\CF_eaddtomacro#2{\CF_gobtwoargs##1}}% mange le \relax et le <nom>
+ \CF_removemoveargb\relax#1\_nil
+}
+
+\def\CF_drawatomgroupba#1{% transforme #1 en un groupe d'atomes
+ \CF_ifempty{#1}
+ {\expandafter\let\csname atom_\number\CF_cntatomgroup\endcsname\CF_currentatom
+ \let\CF_currentatom\empty
+ }
+ {\futurelet\CF_toksa\CF_gobtonil#1\_nil
+ \CF_ifx @\CF_toksa
+ {\expandafter\let\csname atom_\number\CF_cntatomgroup\endcsname\CF_currentatom
+ \let\CF_currentatom\empty
+ \CF_drawatomgroupa{#1}%
+ }%
+ {\CF_ifx|\CF_toksa
+ {\expandafter\let\csname atom_\number\CF_cntatomgroup\endcsname\CF_currentatom
+ \let\CF_currentatom\empty
+ \CF_expsecond\CF_drawatomgroupa{\CF_gobarg#1}%
+ }%
+ {\CF_ifx\CF_sptoken\CF_toksa
+ {\CF_addtomacro\CF_currentatom{ }%
+ \CF_expsecond\CF_drawatomgroupba{\CF_afterspace#1\_nil}%
+ }%
+ {\CF_ifx\bgroup\CF_toksa
+ {\CF_eaddtomacro\CF_currentatom{\expandafter{\CF_firsttonil#1\_nil}}%
+ \CF_expsecond\CF_drawatomgroupba{\CF_gobarg#1}%
+ }%
+ {\CF_expsecond\CF_ifcarisupperletter{\CF_firsttonil#1\_nil}%
+ {\expandafter\let\csname atom_\number\CF_cntatomgroup\endcsname\CF_currentatom
+ \let\CF_currentatom\empty
+ \CF_drawatomgroupa{#1}%
+ }%
+ {\CF_ifx?\CF_toksa
+ {\CF_expsecond\CF_iffirsttokmatch{\CF_gobarg#1}[% un crochet après le "?"
+ {\expandafter\CF_graboptarg\CF_gobarg#1\_nil\CF_afterhook}%
+ {\CF_expafter{\CF_graboptarg[]}{\CF_gobarg#1}\_nil\CF_afterhook}%
+ \CF_exptwomacroargs\CF_ifinstr{\CF_hooklist}{\expandafter(\CF_hookcurrentname)}% crochet déjà défini ?
+ {\CF_expsecond\CF_hookparselist{\CF_hookcurrentname}% chercher les caractéristiques du crochet sauvegardé
+ \CF_edefaddtomacro\CF_hookdrawlist{%
+ [\CF_hookcurrentname,\CF_hookcurrentlink,\CF_hookcurrenttikz]{\CF_hooksavedcoord}{n\number\CF_cntgroup-\number\CF_cntatomgroup}}%
+ \CF_eaddtomacro\CF_hookdrawlist{\expandafter{\CF_hooksavedcontent}}%
+ \CF_eaddtomacro\CF_hookdrawlist{\expandafter{\CF_currentatom}}% ajoute les 4 arguments à la liste des crochets à tracer
+ \global\let\CF_hookdrawlist\CF_hookdrawlist
+ }%
+ {\CF_edefaddtomacro\CF_hooklist{(\CF_hookcurrentname)|n\number\CF_cntgroup-\number\CF_cntatomgroup|}%
+ \CF_eaddtomacro\CF_hooklist{\CF_currentatom|}%
+ \global\let\CF_hooklist\CF_hooklist
+ }%
+ \CF_expsecond\CF_drawatomgroupba{\CF_afterhook}%
+ }%
+ {\CF_eaddtomacro\CF_currentatom{\CF_firsttonil#1\_nil}%
+ \CF_expsecond\CF_drawatomgroupba{\CF_gobarg#1}%
+ }%
+ }%
+ }%
+ }%
+ }%
+ }%
+ }%
+}
+
+\def\CF_kookdefaultname{a}
+\def\CF_hookdefaultlink{-}
+\def\CF_hookdefaulttikz{}
+
+\def\CF_hookparseoptarg#1,#2,#3\_nil{%
+ \CF_testemptyandassign\CF_hookcurrentname{#1}\CF_kookdefaultname
+ \CF_testemptyandassign\CF_hookcurrentlink{#2}\CF_hookdefaultlink
+ \CF_testemptyandassign\CF_hookcurrenttikz{#3}\CF_hookdefaulttikz
+}
+
+\def\CF_graboptarg[#1]#2\_nil#3{%
+ \CF_hookparseoptarg#1,,\_nil
+ \def#3{#2}%
+}
+
+\def\CF_hookparselist#1{% #1 est le nom du noeud à retrouver
+ \def\CF_hookparselista##1(#1)|##2|##3|##4\_nil{\def\CF_hooksavedcoord{##2}\def\CF_hooksavedcontent{##3}}%
+ \expandafter\CF_hookparselista\CF_hooklist\_nil
+}
+
+\def\CF_removehook#1{%
+ \CF_expsecond\CF_ifinstr{#1}?%
+ {\CF_expafter{\CF_removehooka\relax}#1\_nil#1%
+ \CF_removehook#1%
+ }
+ {}%
+}
+
+\def\CF_removehooka#1?#2\_nil#3{%
+ \CF_iffirsttokmatch{#2}[%
+ {\CF_removehookb#1?#2\_nil#3}
+ {\CF_expsecond{\def#3}{\CF_gobarg#1#2}}%
+}
+
+\def\CF_removehookb#1?[#2]#3\_nil#4{\CF_expsecond{\def#4}{\CF_gobarg#1#3}}
+
+\def\Lewis{%
+ \CF_lewisoverlayfalse
+ \CF_testopt\CF_lewisa{}%
+}
+
+\def\lewis{%
+ \CF_lewisoverlaytrue
+ \CF_testopt\CF_lewisa{}%
+}
+
+\def\CF_lewisa[#1]{%
+ \begingroup
+ \CF_doifnotempty{#1}{\setchemfig{#1}}%
+ \CF_valuetomacro\CF_lewiswidthdouble[0.3ex]{lewis | width}%
+ \CF_valuetomacro\CF_lewisoffset [0.4ex]{lewis sep}%
+ \CF_valuetomacro\CF_lewislength [1.5ex]{lewis length}%
+ \CF_valuetomacro\CF_lewisstyle []{lewis style}%
+ \CF_valuetomacro\CF_lewisdist [0.3em]{lewis dist}%
+ \CF_valuetomacro\CF_lewisradius [0.15ex]{lewis radius}%
+ \CF_valuetomacro\CF_lewisdiagcoeff [1]{lewis diag coeff}%
+ \ifCF_lewisoverlay
+ \CF_addtomacro\CF_lewisstyle{,overlay}%
+ \fi
+ \CF_lewisb
+}
+
+\def\CF_lewisb#1{%
+ \CF_lewisc#1\_nil
+ \endgroup
+}
+
+\def\CF_lewisc#1,#2\_nil{%
+ \setbox\CF_boxlewis\hbox{\printatom{#2}}% mettre en dehors de tikzpicture (si \printatom ne passe pas en mode math)
+ \tikzpicture[every node/.style={anchor=base,inner sep=0pt,outer sep=0pt,minimum size=0pt},baseline]%
+ \CF_makeother;\CF_makeother:%
+ \node(CF_lewis@anchor){};
+ \def\CF_lewisremainpos{#1}%
+ \let\CF_lewispreviouspos\empty
+ \loop
+ \unless\ifx\CF_lewisremainpos\empty
+ \edef\CF_lewiscurrentpos{\expandafter\CF_firsttonil\CF_lewisremainpos\_nil}%
+ \edef\CF_lewisremainpos{\expandafter\CF_gobarg\CF_lewisremainpos}%
+ \pgfmathsetmacro\CF_lewisx{\wd\CF_boxlewis/2+\ifcase\CF_lewiscurrentpos\space1\or1\or0\or-1\or-1\or-1\or0\or1\fi*(\wd\CF_boxlewis/2)}%
+ \pgfmathsetmacro\CF_lewisy{\ht\CF_boxlewis/2+\ifcase\CF_lewiscurrentpos\space0\or1\or1\or1\or0\or-1\or-1\or-1\fi*(\ht\CF_boxlewis/2\ifnum\CF_lewiscurrentpos>4 +\dp\CF_boxlewis\fi)}%
+ \edef\CF_lewisxoffset{\ifcase\CF_lewiscurrentpos\space1\or0.70711\or0\or-0.70711\or-1\or-0.70711\or0\or0.70711\fi}%
+ \edef\CF_lewisyoffset{\ifcase\CF_lewiscurrentpos\space0\or0.70711\or1\or0.70711\or0\or-0.70711\or-1\or-0.70711\fi}%
+ \ifodd\CF_lewiscurrentpos\relax
+ \pgfmathsetmacro\CF_lewiscurrentoffset{\CF_lewisoffset*\CF_lewisdiagcoeff}%%
+ \else
+ \let\CF_lewiscurrentoffset\CF_lewisoffset
+ \fi
+ \if.\expandafter\CF_firsttonil\CF_lewisremainpos\relax\_nil
+ \edef\CF_lewisremainpos{\expandafter\CF_gobarg\CF_lewisremainpos}%
+ \CF_expafter{\draw[fill,black,}{\CF_lewisstyle]}%
+ (\CF_lewisx pt+\CF_lewisxoffset*\CF_lewiscurrentoffset,\CF_lewisy pt+\CF_lewisyoffset*\CF_lewiscurrentoffset)circle(\CF_lewisradius);%
+ \else
+ \if|\expandafter\CF_firsttonil\CF_lewisremainpos\relax\_nil
+ \edef\CF_lewisremainpos{\expandafter\CF_gobarg\CF_lewisremainpos}%
+ \pgfmathsetmacro\CF_lewisx{\CF_lewisx pt+\CF_lewisxoffset*\CF_lewiscurrentoffset}%
+ \pgfmathsetmacro\CF_lewisy{\CF_lewisy pt+\CF_lewisyoffset*\CF_lewiscurrentoffset}%
+ \CF_expafter{\draw[}\CF_lewisstyle]%
+ (\CF_lewisx pt+\CF_lewislength*\CF_lewisyoffset/2 pt,\CF_lewisy-\CF_lewislength*\CF_lewisxoffset/2 pt)--
+ (\CF_lewisx pt+\CF_lewislength*\CF_lewisyoffset/2 pt+\CF_lewisxoffset*\CF_lewiswidthdouble,\CF_lewisy-\CF_lewislength*\CF_lewisxoffset/2 pt+\CF_lewisyoffset*\CF_lewiswidthdouble)--
+ (\CF_lewisx pt-\CF_lewislength*\CF_lewisyoffset/2 pt+\CF_lewisxoffset*\CF_lewiswidthdouble,\CF_lewisy+\CF_lewislength*\CF_lewisxoffset/2 pt+\CF_lewisyoffset*\CF_lewiswidthdouble)--
+ (\CF_lewisx pt-\CF_lewislength*\CF_lewisyoffset/2 pt,\CF_lewisy+\CF_lewislength*\CF_lewisxoffset/2 pt)--cycle;%
+ \else
+ \if:\expandafter\CF_firsttonil\CF_lewisremainpos\relax\_nil
+ \edef\CF_lewisremainpos{\expandafter\CF_gobarg\CF_lewisremainpos}%
+ \pgfmathsetmacro\CF_lewisx{\CF_lewisx pt+\CF_lewisxoffset*\CF_lewiscurrentoffset}%
+ \pgfmathsetmacro\CF_lewisy{\CF_lewisy pt+\CF_lewisyoffset*\CF_lewiscurrentoffset}%
+ \CF_expafter{\draw[fill,black,}{\CF_lewisstyle]}%
+ (\CF_lewisx pt+\CF_lewisdist*\CF_lewisyoffset/2 pt,\CF_lewisy-\CF_lewisdist*\CF_lewisxoffset/2 pt)circle(\CF_lewisradius)%
+ (\CF_lewisx pt-\CF_lewisdist*\CF_lewisyoffset/2 pt,\CF_lewisy+\CF_lewisdist*\CF_lewisxoffset/2 pt)circle(\CF_lewisradius);%
+ \else
+ \pgfmathsetmacro\CF_lewisx{\CF_lewisx pt+\CF_lewisxoffset*\CF_lewiscurrentoffset}%
+ \pgfmathsetmacro\CF_lewisy{\CF_lewisy pt+\CF_lewisyoffset*\CF_lewiscurrentoffset}%
+ \CF_expafter{\draw[}\CF_lewisstyle]%
+ (\CF_lewisx pt+\CF_lewislength*\CF_lewisyoffset/2 pt,\CF_lewisy-\CF_lewislength*\CF_lewisxoffset/2 pt)--%
+ (\CF_lewisx pt-\CF_lewislength*\CF_lewisyoffset/2 pt,\CF_lewisy+\CF_lewislength*\CF_lewisxoffset/2 pt);%
+ \fi
+ \fi
+ \fi
+ \repeat
+ \node[anchor=base west]at(CF_lewis@anchor){\box\CF_boxlewis};%
+ \endtikzpicture
+}
+
+\def\Chembelow{\begingroup\let\CF_temp\CF_gobarg\CF_chembelowa}
+
+\def\chembelow{\begingroup\let\CF_temp\CF_id\CF_chembelowa}
+
+\def\CF_chembelowa{\CF_testopt\CF_chembelowb\CF_stacksep}
+
+\def\CF_chembelowb[#1]#2#3{%
+ \setbox\CF_box\hbox{\printatom{#2}}%
+ \expandafter\vtop\CF_temp{to\ht\CF_box}{%
+ \offinterlineskip
+ \hbox{\printatom{#2}}%
+ \kern#1\relax
+ \hbox to\wd\CF_box{\hss\printatom{#3}\hss}%
+ \CF_temp\vss
+ }%
+ \endgroup
+}
+
+\def\Chemabove{\begingroup\let\CF_temp\CF_gobarg\CF_chemabovea}
+
+\def\chemabove{\begingroup\let\CF_temp\CF_id\CF_chemabovea}
+
+\def\CF_chemabovea{\CF_testopt\CF_chemaboveb\CF_stacksep}
+
+\def\CF_chemaboveb[#1]#2#3{%
+ \setbox\CF_box\hbox{\printatom{#2}}%
+ \expandafter\vbox\CF_temp{to\ht\CF_box}{%
+ \offinterlineskip
+ \CF_temp\vss
+ \hbox to\wd\CF_box{\hss\printatom{#3}\hss}%
+ \kern#1\relax
+ \hbox{\printatom{#2}}%
+ }%
+ \endgroup
+}
+
+\def\chemmove{\CF_testopt\CF_chemmove{}}
+
+\def\CF_chemmove[#1]#2{%
+ \CF_doifnotempty{#2}%
+ {\expandafter\tikzpicture\romannumeral
+ \CF_ifempty{#1}%
+ {\CF_zero[overlay,remember picture,-CF]}
+ {\CF_zero[overlay,remember picture,-CF,#1]}%
+ #2
+ \endtikzpicture
+ }%
+}
+
+\def\chemnameinit#1{%
+ \setbox\CF_boxstuff\hbox{#1}%
+ \xdef\CF_dpmax{\the\dp\CF_boxstuff}%
+}
+\let\CF_dpmax\CF_zero
+
+\def\CF_parsemolname#1\\#2\_nil{%
+ \hbox to\CF_wdstuffbox{\hss#1\hss}%
+ \CF_doifnotempty{#2}{\CF_parsemolname#2\_nil}%
+}
+
+\def\chemname{%
+ \CF_ifstar
+ {\CF_adjustnamedpfalse\CF_chemnamea}
+ {\CF_adjustnamedptrue \CF_chemnamea}%
+}
+
+\def\CF_chemnamea{\CF_testopt\CF_chemnameb{1.5ex}}
+
+\def\CF_chemnameb[#1]#2#3{%
+ \setbox\CF_boxstuff\hbox{#2}%
+ \edef\CF_wdstuffbox{\the\wd\CF_boxstuff}\edef\CF_dpstuffbox{\the\dp\CF_boxstuff}%
+ \leavevmode
+ \ifdim\CF_dpmax<\CF_dpstuffbox\global\let\CF_dpmax\CF_dpstuffbox\fi
+ \vtop{%
+ \box\CF_boxstuff
+ \nointerlineskip
+ \kern\dimexpr#1\ifCF_adjustnamedp+\CF_dpmax-\CF_dpstuffbox\fi\relax
+ \CF_parsemolname#3\\\_nil
+ }%
+}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%% S C H É M A S R É A C T I O N N E L S %%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\let\CF_schemenest\CF_zero
+
+\def\CF_subscheme{\CF_testopt\CF_subschemea{}}
+\def\CF_subschemea[#1]{\CF_testopt{\CF_subschemeb[#1]}{text}}
+\def\CF_subschemeb[#1][#2]#3{\schemestart[#1][#2]#3\schemestop}
+
+\def\chemleft#1#2\chemright#3{%
+ \leavevmode
+ \begingroup
+ \setbox0\hbox{$\vcenter{\hbox{}}$}\edef\CF_delimmathht{\the\ht0}%
+ \setbox0\hbox{#2}\edef\CF_delimdim{\the\dimexpr(\ht0+\dp0)/2}%
+ \edef\CF_delimshift{\the\dimexpr(\ht0-\dp0)/2-\CF_delimmathht}%
+ \raise\CF_delimshift\hbox{$\left#1\vrule height\CF_delimdim depth\CF_delimdim width0pt\right.$}\box0
+ \raise\CF_delimshift\hbox{$\left.\vrule height\CF_delimdim depth\CF_delimdim width0pt\right#3$}%
+ \endgroup
+}
+
+\def\chemright#1{%
+ \CF_warning{"\string\chemright\string#1" ignored! No \string\chemleft\space previously found.}%
+}
+
+\def\chemup#1#2\chemdown#3{%
+ \begingroup
+ \setbox0\hbox{\printatom{#2}}\edef\CF_delimdim{\the\dimexpr\wd0/2}%
+ \tikzpicture[every node/.style={inner sep=0pt,outer sep=0pt,minimum size=0pt},baseline]%
+ \node[anchor=base west](chem@stuff){\box0};%
+ \node[at=(chem@stuff.north),anchor=east,rotate=-90]{$\left#1\vrule height\CF_delimdim depth\CF_delimdim width0pt\right.$};%
+ \node[at=(chem@stuff.south),anchor=west,rotate=-90]{$\left.\vrule height\CF_delimdim depth\CF_delimdim width0pt\right#3$};%
+ \endtikzpicture
+ \endgroup
+}
+
+\def\chemdown#1{%
+ \CF_warning{"\string\chemdown\string#1" ignored! No \string\chemup\space previously found.}%
+}
+
+\def\CF_setstyle#1,#2,#3\_nil#4#5#6{%
+ \def#4{#1}\let#5\empty\let#6\empty
+ \CF_iffirsttokmatch\CF_quark{#2\relax}
+ {}%
+ {\def#5{#2}%
+ \CF_iffirsttokmatch\CF_quark{#3\relax}
+ {}%
+ {\CF_setstylea#3\_nil#6}%
+ }%
+}
+\def\CF_setstylea#1,\CF_quark#2\_nil#3{\def#3{#1}}
+
+\def\CF_and{\futurelet\CF_toksa\CF_anda}
+
+\def\CF_anda{%
+ \CF_ifx\CF_toksa\bgroup
+ {\CF_andb}
+ {\CF_andb{}}%
+}
+
+\def\CF_andb#1{%
+ \CF_setstyle#1,\CF_quark,\CF_quark\_nil\CF_signspaceante\CF_signspacepost\CF_signvshift
+ \CF_doifempty\CF_signspaceante{\CF_valuetomacro\CF_signspaceante[0.5em]{+ sep left}}%
+ \CF_doifempty\CF_signspacepost{\CF_valuetomacro\CF_signspacepost[0.5em]{+ sep right}}%
+ \CF_doifempty\CF_signvshift{\CF_valuetomacro\CF_signvshift[0pt]{+ vshift}}%
+ \raise\CF_signvshift\hbox{\kern\CF_signspaceante$+$\kern\CF_signspacepost}%
+}
+
+\def\schemestart{%
+ \begingroup
+ \xdef\CF_schemenest{\number\numexpr\CF_schemenest+1}%
+ \CF_testopt\CF_schemestarta{}%
+}
+
+\def\CF_schemestarta[#1]{%
+ \CF_valuetomacro\CF_defaultcompoundstyle[]{compound style}%
+ \CF_setstyle#1,\CF_quark,\CF_quark\_nil\CF_arrowangle\CF_arrowlength\CF_arrowstyle
+ \CF_doifempty\CF_arrowangle{\CF_valuetomacro\CF_arrowangle[0]{arrow angle}}%
+ \CF_doifempty\CF_arrowlength{\CF_valuetomacro\CF_arrowlength[1]{arrow coeff}}%
+ \CF_valuetomacro\CF_defaultarrowstyle[]{arrow style}%
+ \CF_valuetomacro\CF_arrowoffset[1em]{arrow offset}%
+ \CF_valuetomacro\CF_compoundsep[5em]{compound sep}%
+ \CF_valuetomacro\CF_arrowlabelsep[3pt]{arrow label sep}%
+ \CF_valuetomacro\CF_arrowhead[-CF]{arrow head}%
+ \CF_eexpsecond{\def\CF_arrowtip}{\expandafter\CF_gobarg\CF_arrowhead}%
+ \CF_eexpsecond{\CF_preaddtomacro\CF_defaultarrowstyle}{\useKV[chemfig]{arrow head},}%
+ \CF_ifx\empty\CF_arrowstyle
+ {\let\CF_arrowstyle\CF_defaultarrowstyle}
+ {\CF_expsecond{\CF_preaddtomacro\CF_arrowstyle}{\CF_defaultarrowstyle,}}% se rajoute après le style par défaut
+ \CF_valuetomacro\CF_arrowdoublesep[2pt]{arrow double sep}%
+ \pgfmathsetmacro\CF_arrowdoublesep{\CF_arrowdoublesep/2}%
+ \CF_valuetomacro\CF_arrowdoubleposstart[0.6]{arrow double coeff}%
+ \pgfmathsetmacro\CF_arrowdoubleposstart{(1-\CF_arrowdoubleposstart)/2}%
+ \pgfmathsetmacro\CF_arrowdoubleposend{1-\CF_arrowdoubleposstart}%
+ \ifboolKV[chemfig]{scheme debug}
+ {\tikzpicture[every node/.style={draw,anchor=base,inner sep=0pt,outer sep=0pt,minimum size=1.5pt},baseline,remember picture]}
+ {\tikzpicture[every node/.style={anchor=base,inner sep=0pt,outer sep=0pt,minimum size=0pt},baseline,remember picture]}%
+ \let\merge\CF_merge
+ \expandafter\let\csname+\endcsname\CF_and
+ \let\arrow\CF_arrow
+ \let\schemestop\CF_schemestop
+ \let\subscheme\CF_subscheme
+ \CF_testopt{\CF_schemestartb}{text}%
+}
+
+\def\CF_schemestartb[#1]{%
+ \ifnum\CF_schemenest=1 % la commande n'est pas imbriquée ?
+ \CF_cntcompound0
+ \fi
+ \edef\CF_currentnodename{c\number\CF_cntcompound}%
+ \let\CF_nextnodename\empty
+ \let\CF_nextnodestyle\empty
+ \let\CF_directarrowlist\empty
+ \ifboolKV[chemfig]{scheme debug}
+ {\node[fill,green](\CF_currentnodename){};}
+ {\node(\CF_currentnodename){};}%
+ \def\CF_nextnodeanchor{#1}%
+ \CF_doifempty\CF_nextnodeanchor{\def\CF_nextnodeanchor{text}}%
+ \let\CF_compound\empty
+ \CF_schemestartc
+}
+
+\def\CF_schemestartc{%
+ \futurelet\CF_toksa\CF_schemestarte
+}
+
+\expandafter\def\expandafter\CF_schemestartd\space{\futurelet\CF_toksa\CF_schemestarte}
+
+\def\CF_schemestarte{% ... et l'examine :
+ \CF_iffirsttokina{\arrow\schemestop\merge}%
+ {}
+ {\CF_ifx\CF_toksa\bgroup
+ {\CF_addnextarg
+ }
+ {\CF_ifx\CF_toksa\CF_sptoken
+ {\CF_addtomacro\CF_compound{ }%
+ \CF_schemestartd
+ }
+ {\afterassignment\CF_schemestartc
+ \CF_addtomacro\CF_compound
+ }%
+ }%
+ }%
+}
+
+\def\CF_addnextarg#1{\CF_addtomacro\CF_compound{{#1}}\CF_schemestartc}
+
+\def\CF_displaycompound#1#2{% #1 = nom et #2 = style
+ \CF_doifnotempty\CF_compound
+ {\global\advance\CF_cntcompound1
+ \CF_ifx\CF_defaultcompoundstyle\empty
+ {\let\CF_currentnodestyle\empty}
+ {\CF_expsecond{\def\CF_currentnodestyle}{\CF_defaultcompoundstyle,}}%
+ \CF_addtomacro\CF_currentnodestyle{anchor=\CF_nextnodeanchor,at=(\CF_currentnodename)}%
+ \CF_ifempty{#2}%
+ {\CF_doifnotempty\CF_nextnodestyle
+ {\CF_eaddtomacro\CF_currentnodestyle{\expandafter,\CF_nextnodestyle}}%
+ }
+ {\CF_doifnotempty\CF_nextnodestyle
+ {\CF_warning{two styles for the same node, first style "\CF_nextnodestyle" ignored}%
+ }%
+ \CF_addtomacro\CF_currentnodestyle{,#2}%
+ }%
+ \CF_ifempty{#1}
+ {\edef\CF_temp{%
+ \CF_ifempty\CF_nextnodename
+ {c\number\CF_cntcompound}
+ {\CF_nextnodename}%
+ }%
+ }
+ {\CF_doifnotempty\CF_nextnodename
+ {\CF_warning{two names for the same node, first name "\CF_nextnodename" ignored}%
+ }%
+ \edef\CF_temp{#1}%
+ }%
+ \CF_expafter{\node[}\CF_currentnodestyle](\CF_temp){\CF_compound};%
+ \ifboolKV[chemfig]{scheme debug}%
+ {\node[draw=none,anchor=270,at=(\CF_temp.90),fill=green!60,overlay,opacity=0.5]{\scriptsize\bfseries\CF_temp};%
+ }
+ {}%
+ \let\CF_currentnodename\CF_temp
+ }%
+}
+
+\def\CF_schemestop{%
+ \CF_displaycompound{}{}%
+ \CF_directarrowlist
+ \endtikzpicture
+ \xdef\CF_schemenest{\number\numexpr\CF_schemenest-1}%
+ \endgroup
+}
+
+\def\CF_analysearrowarg#1{\CF_analysearrowarga#1[]\_nil}
+
+\def\CF_analysearrowarga#1[#2]#3\_nil{%
+ \CF_ifinstr{#1}.
+ {\CF_addtomacro\CF_temp{#1[#2]}}
+ {\CF_addtomacro\CF_temp{#1.[#2]}}%
+}
+
+\def\CF_arrow{%
+ \CF_ifnextchar(%
+ {\CF_arrowa
+ }
+ {\CF_ifnextchar\bgroup
+ {\CF_arrowb(.[]--.[])}
+ {\CF_arrowb(.[]--.[]){}}%
+ }%
+}
+
+\def\CF_arrowa(#1--#2){%
+ \def\CF_temp{(}%
+ \CF_analysearrowarg{#1}%
+ \CF_addtomacro\CF_temp{--}%
+ \CF_analysearrowarg{#2}%
+ \CF_addtomacro\CF_temp)%
+ \CF_ifnextchar\bgroup
+ {\expandafter\CF_arrowb\CF_temp}
+ {\expandafter\CF_arrowb\CF_temp{}}%
+}
+
+\def\CF_arrowb(#1.#2[#3]--#4.#5[#6])#7{%
+ \def\CF_currentarrowtype{#7}% nom de la flèche
+ \CF_doifempty\CF_currentarrowtype{\def\CF_currentarrowtype{->}}%
+ \CF_testopt{\CF_arrowc(#1.#2[#3]--#4.#5[#6])}{}%
+}
+
+\def\CF_arrowc(#1.#2[#3]--#4.#5[#6])[#7]{%
+ \def\CF_temp{\CF_arrowe(#1.#2[#3]--#4.#5[#6])}%
+ \CF_arrowd#7,\empty,\empty\_nil
+}
+
+\def\CF_arrowd#1,#2,#3\_nil{%
+ \CF_addtomacro\CF_temp{{#1}}%
+ \CF_eaddtomacro\CF_temp{\expandafter{#2}}%
+ \expandafter\CF_eaddtomacro\expandafter\CF_temp\expandafter{\expandafter\expandafter\expandafter{\expandafter\CF_sanitizelastitem#3,\empty\_nil}}%
+ \CF_temp
+}
+
+% #1, #4 : nom des nodes #2, #5 : ancres des nodes #3, #6 : styles des nodes
+% #7 : angle flèche #8 : longueur flèche #9 : style tikz de la flèche
+\def\CF_arrowe(#1.#2[#3]--#4.#5[#6])#7#8#9{%
+ \let\CF_arrowcurrentstyle\CF_arrowstyle
+ \if @\expandafter\CF_firsttonil\detokenize{#1.}\_nil% si #1 commence par @
+ \if @\expandafter\CF_firsttonil\detokenize{#4.}\_nil
+ \CF_eaddtomacro\CF_directarrowlist{\expandafter\CF_directarrow\expandafter{\CF_currentarrowtype}{#1}{#2}{#4}{#5}{#9}}%
+ \let\CF_nextaction\CF_schemestartc
+ \else
+ \CF_doifnotempty\CF_arrowcurrentstyle{\CF_addtomacro\CF_arrowcurrentstyle,}%
+ \CF_doifnotempty{#9}{\CF_addtomacro\CF_arrowcurrentstyle{#9,}}%
+ \CF_displaycompound{}{#3}%
+ \def\CF_nextnodename{#4}%
+ \CF_expsecond{\def\CF_currentnodename}{\CF_gobarg#1}%
+ \let\CF_arrowstartname\CF_currentnodename
+ \let\CF_arrowendname\CF_nextnodename
+ \CF_arrowf{#7}{#8}{#2}{#5}%
+ \def\CF_nextnodestyle{#6}%
+ \fi
+ \else
+ \CF_doifnotempty\CF_arrowcurrentstyle{\CF_addtomacro\CF_arrowcurrentstyle,}%
+ \CF_doifnotempty{#9}{\CF_addtomacro\CF_arrowcurrentstyle{#9,}}%
+ \if @\expandafter\CF_firsttonil\detokenize{#2.}\_nil
+ \CF_error{syntax "(<name>--@<name>)" is not allowed}%
+ \else
+ \CF_displaycompound{#1}{#3}%
+ \edef\CF_arrowstartname{%
+ \CF_ifempty{#1}
+ \CF_currentnodename
+ {#1}%
+ \CF_doifnotempty{#2}{.#2}%
+ }%
+ \CF_arrowf{#7}{#8}{#2}{#5}%
+ \def\CF_nextnodename{#4}%
+ \def\CF_nextnodestyle{#6}%
+ \fi
+ \fi
+ \CF_arrowgobspaces% mange les espaces puis exécute \CF_nextaction
+}
+
+\def\CF_arrowgobspaces{\futurelet\CF_toksa\CF_arrowgobspacesa}
+
+\def\CF_arrowgobspacesa{%
+ \CF_ifx\CF_sptoken\CF_toksa
+ \CF_arrowgobspacesb
+ \CF_nextaction
+}
+
+\expandafter\def\expandafter\CF_arrowgobspacesb\space{\futurelet\CF_toksa\CF_arrowgobspacesa}
+
+\def\CF_arrowf#1#2#3#4{% #1=angle #2=longueur #3=ancre départ #4=ancre arrivée
+ \def\CF_nextaction{\let\CF_compound\empty\CF_schemestartc}%
+ \def\CF_arrowcurrentangle{#1}\CF_doifempty\CF_arrowcurrentangle{\let\CF_arrowcurrentangle\CF_arrowangle}%
+ \def\CF_currentarrowlength{#2}\CF_doifempty\CF_currentarrowlength{\let\CF_currentarrowlength\CF_arrowlength}%
+ \node[at=(\CF_currentnodename.\CF_ifempty{#3}\CF_arrowcurrentangle{#3}),shift=(\CF_arrowcurrentangle:\CF_currentarrowlength*\CF_compoundsep),cyan,fill](end@arrow@i@\number\CF_schemenest){};%
+ \edef\CF_arrowendname{end@arrow@i@\number\CF_schemenest\CF_doifnotempty{#4}{.#4}}%
+ \ifboolKV[chemfig]{scheme debug}
+ {\node[at=(\CF_currentnodename.\CF_ifempty{#3}\CF_arrowcurrentangle{#3}),shift=(\CF_arrowcurrentangle:\CF_arrowoffset),red,fill](start@arrow){};%
+ \node[at=(\CF_currentnodename.\CF_ifempty{#3}\CF_arrowcurrentangle{#3}),shift=(\CF_arrowcurrentangle:\CF_currentarrowlength*\CF_compoundsep-\CF_arrowoffset),red,fill](end@arrow){};%
+ }
+ {\node[at=(\CF_currentnodename.\CF_ifempty{#3}\CF_arrowcurrentangle{#3}),shift=(\CF_arrowcurrentangle:\CF_arrowoffset)](start@arrow){};%
+ \node[at=(\CF_currentnodename.\CF_ifempty{#3}\CF_arrowcurrentangle{#3}),shift=(\CF_arrowcurrentangle:\CF_currentarrowlength*\CF_compoundsep-\CF_arrowoffset)](end@arrow){};%
+ }%
+ \def\CF_arrowstartnode{start@arrow}\def\CF_arrowendnode{end@arrow}%
+ \csname\expandafter\CF_grabarrowname\CF_currentarrowtype[\_nil\CF_threeea\endcsname
+ \expandafter\CF_grabarrowargs\CF_currentarrowtype[]\_nil[][][][][][][][]\_nil
+ \def\CF_currentnodename{end@arrow@i@\number\CF_schemenest}%
+ \edef\CF_nextnodeanchor{\CF_ifempty{#4}{180+\CF_arrowcurrentangle}{#4}}%
+}
+
+% trace un flèche initiée par (@nom--@nom)
+% #1=type de flèche #2=nom depart #3=ancre départ #4=nom arrivée #5=ancre arrivée #6=style flèche
+\def\CF_directarrow#1#2#3#4#5#6{%
+ \CF_expsecond{\def\CF_arrowstartname}{\CF_gobarg#2}%
+ \CF_expsecond{\def\CF_arrowendname}{\CF_gobarg#4}%
+ \path[sloped,allow upside down](\CF_gobarg#2\ifx\empty#3\empty\else.#3\fi)--(\CF_gobarg#4\ifx\empty#5\empty\else.#5\fi)%
+ coordinate[pos=0,xshift=\CF_arrowoffset](start@direct@arrow)%
+ coordinate[pos=1,xshift=-\CF_arrowoffset](end@direct@arrow);%
+ \def\CF_arrowstartnode{start@direct@arrow}%
+ \def\CF_arrowendnode{end@direct@arrow}%
+ \pgfmathanglebetweenpoints
+ {\pgfpointanchor{\CF_gobarg#2}{\ifx\empty#3\empty center\else#3\fi}}% Ne pas utiliser \CF_ifempty ici !!!
+ {\pgfpointanchor{\CF_gobarg#4}{\ifx\empty#5\empty center\else#5\fi}}%
+ \let\CF_arrowcurrentangle\pgfmathresult
+ \CF_doifnotempty{#6}{\CF_addtomacro\CF_arrowcurrentstyle{#6,}}%
+ \csname\CF_grabarrowname#1[]\_nil\expandafter\endcsname\CF_grabarrowargs#1[]\_nil[][][][][][][][]\_nil
+}
+
+\def\CF_mergegrabchardir#1[#2][#3]#4\_nil{%
+ \CF_expafter{\futurelet\CF_toksa\CF_gobtonil}{\CF_firsttonil#1>\_nil}\_nil
+ \ifx>\CF_toksa
+ \def\CF_mergeangle{0}\def\CF_mergeextreme{xmax}\def\CF_mergesign{+}%
+ \else
+ \ifx<\CF_toksa
+ \def\CF_mergeangle{180}\def\CF_mergeextreme{xmin}\def\CF_mergesign{-}%
+ \else
+ \ifx^\CF_toksa
+ \def\CF_mergeangle{90}\def\CF_mergeextreme{ymax}\def\CF_mergesign{+}%
+ \else
+ \ifx v\CF_toksa
+ \def\CF_mergeangle{-90}\def\CF_mergeextreme{ymin}\def\CF_mergesign{-}%
+ \fi\fi\fi\fi
+ \def\CF_mergelabelup{#2}\def\CF_mergelabeldo{#3}%
+}
+
+\def\CF_merge#1({%
+ \CF_mergegrabchardir#1[][]\_nil
+ \CF_mergea(%
+}
+
+\def\CF_mergea#1--(#2){\CF_testopt{\CF_mergeb#1--(#2)}{}}
+
+\def\CF_mergeb#1--(#2)[#3]{%
+ \CF_displaycompound{}{}%
+ \CF_parsemergeopt#3,\CF_quark,\CF_quark,\CF_quark\_nil
+ \def\CF_mergexmax{-16383.99999pt}\let\CF_mergeymax\CF_mergexmax
+ \def\CF_mergexmin{16383.99999pt}\let\CF_mergeymin\CF_mergexmin
+ \CF_mergeparsenodelist#1(\relax)% calcule les maxi des positions
+ \pgfmathsetmacro\CF_mergeextremeresult{\csname CF_merge\CF_mergeextreme\endcsname\CF_mergesign\CF_mergefromcoeff*\CF_compoundsep}%
+ \CF_mergec#1(\relax)% trace les lignes entre les noeuds précédents et la ligne de jonction
+ \CF_expsecond{\def\CF_temp}{\expandafter[\CF_mergestyle,shorten <=0,shorten >=0,-]}%
+ \if x\expandafter\CF_firsttonil\CF_mergeextreme\_nil
+ \CF_addtomacro\CF_temp{(\CF_mergeextremeresult pt,\CF_mergeymax)--(\CF_mergeextremeresult pt,\CF_mergeymin)}%
+ \else
+ \CF_addtomacro\CF_temp{(\CF_mergexmin,\CF_mergeextremeresult pt)--(\CF_mergexmax,\CF_mergeextremeresult pt)}%
+ \fi
+ \expandafter\draw\CF_temp node[pos=\CF_mergesplitcoeff](merge@point){}% trace la ligne de jonction
+ node[at=(merge@point),shift=(\CF_mergeangle:\CF_compoundsep*\CF_mergetocoeff-\CF_arrowoffset)](end@merge){}%
+ node[at=(merge@point),shift=(\CF_mergeangle:\CF_compoundsep*\CF_mergetocoeff)](end@merge@i){};%
+ \let\CF_arrowcurrentangle\CF_mergeangle
+ \CF_expafter{\draw[}\CF_mergestyle,shorten <=0](merge@point)--(end@merge)%
+ \expandafter\CF_arrowdisplaylabela\expandafter{\CF_mergelabelup}{.5}+\expandafter\CF_arrowdisplaylabela\expandafter{\CF_mergelabeldo}{.5}-;%
+ \def\CF_currentnodename{end@merge@i}%
+ \let\CF_temp\empty
+ \CF_analysearrowarg{#2}%
+ \expandafter\CF_merged\CF_temp\_nil
+}
+
+\def\CF_mergec(#1){%
+ \if\relax\expandafter\noexpand\CF_firsttonil#1\_nil
+ \else
+ \CF_ifdot{#1}%
+ {\edef\merge_currentnodename{\CF_beforedot#1\_nil}%
+ \edef\merge_currentanchor{\CF_afterdot#1\_nil}%
+ }%
+ {\def\merge_currentnodename{#1}%
+ \let\merge_currentanchor\CF_mergeangle
+ }%
+ \if x\expandafter\CF_firsttonil\CF_mergeextreme\_nil
+ \pgfextracty\CF_dim{\pgfpointanchor\merge_currentnodename\merge_currentanchor}%
+ \CF_expafter{\draw[}\CF_mergestyle,shorten >=0,-]([shift=(\CF_mergeangle:\CF_arrowoffset)]\merge_currentnodename.\merge_currentanchor)--(\CF_mergeextremeresult pt,\CF_dim);%
+ \else
+ \pgfextractx\CF_dim{\pgfpointanchor\merge_currentnodename\merge_currentanchor}%
+ \CF_expafter{\draw[}\CF_mergestyle,shorten >=0,-]([shift=(\CF_mergeangle:\CF_arrowoffset)]\merge_currentnodename.\merge_currentanchor)--(\CF_dim,\CF_mergeextremeresult pt);%
+ \fi
+ \expandafter\CF_mergec
+ \fi
+}
+
+\def\CF_merged#1.#2[#3]\_nil{%
+ \def\CF_nextnodename{#1}%
+ \edef\CF_nextnodeanchor{%
+ \CF_ifempty{#2}
+ {180+\CF_mergeangle}
+ {#2}%
+ }%
+ \def\CF_nextnodestyle{#3}%
+ \let\CF_compound\empty
+ \CF_schemestartc
+}
+
+\def\CF_parsemergeopt#1,#2,#3,#4\_nil{%
+ \CF_ifempty{#1}
+ {\def\CF_mergefromcoeff{0.5}}
+ {\def\CF_mergefromcoeff{#1}}%
+ \def\CF_mergetocoeff{0.5}%
+ \def\CF_mergesplitcoeff{0.5}%
+ \CF_eexpsecond{\def\CF_mergestyle}{\useKV[chemfig]{arrow head}}%
+ \CF_iffirsttokmatch\CF_quark{#2\relax}
+ {}
+ {\CF_ifempty{#2}
+ {\def\CF_mergetocoeff{0.5}}
+ {\def\CF_mergetocoeff{#2}}%
+ \CF_iffirsttokmatch\CF_quark{#3\relax}
+ {}
+ {\CF_ifempty{#3}
+ {\def\CF_mergesplitcoeff{0.5}}
+ {\def\CF_mergesplitcoeff{#3}}%
+ \CF_iffirsttokmatch\CF_quark{#4\relax}
+ {}
+ {\CF_parsemergeopta#4\_nil}%
+ }%
+ }%
+}
+
+\def\CF_parsemergeopta#1,\CF_quark#2\_nil{%
+ \CF_ifempty{#1}
+ {}
+ {\CF_addtomacro\CF_mergestyle{,#1}}%
+}
+
+\def\CF_mergeparsenodelist(#1){%
+ \if\relax\expandafter\noexpand\CF_firsttonil#1\_nil
+ \else
+ \CF_ifdot{#1}%
+ {\edef\merge_currentnodename{\CF_beforedot#1\_nil}\edef\merge_currentanchor{\CF_afterdot#1\_nil}}%
+ {\def\merge_currentnodename{#1}\let\merge_currentanchor\CF_mergeangle}%
+ \pgfextractx\CF_dim{\pgfpointanchor\merge_currentnodename\merge_currentanchor}%
+ \ifdim\CF_dim>\CF_mergexmax
+ \edef\CF_mergexmax{\the\CF_dim}%
+ \fi
+ \ifdim\CF_dim<\CF_mergexmin
+ \edef\CF_mergexmin{\the\CF_dim}%
+ \fi
+ \pgfextracty\CF_dim{\pgfpointanchor\merge_currentnodename\merge_currentanchor}%
+ \ifdim\CF_dim>\CF_mergeymax
+ \edef\CF_mergeymax{\the\CF_dim}%
+ \fi
+ \ifdim\CF_dim<\CF_mergeymin
+ \edef\CF_mergeymin{\the\CF_dim}%
+ \fi
+ \expandafter\CF_mergeparsenodelist
+ \fi
+}
+
+\def\CF_grabarrowname#1[#2\_nil{\detokenize{CF_arrow(#1)}}
+\def\CF_grabarrowargs#1[#2\_nil{[#2}
+
+\def\CF_makeparametertext#1{%
+ \toks0{}%
+ \CF_cntgroup#1\relax
+ \CF_makeparametertexta1%
+}
+
+\def\CF_makeparametertexta#1{%
+ \unless\ifnum#1>\CF_cntgroup
+ \toks0\expandafter{\the\toks0[###1]}%
+ \expandafter\CF_makeparametertexta\expandafter{\number\numexpr#1+1\expandafter}%
+ \fi
+}
+
+% #1 est le nombre d'arguments optionnels, #2 est le nom et #3 le code
+\def\definearrow#1#2#3{%
+ \begingroup
+ \CF_makeparametertext{#1}%
+ \expandafter\endgroup
+ \expandafter\def\csname\detokenize{CF_arrow(#2)}\expandafter\endcsname\the\toks0{#3\CF_gobtonil}%
+}
+
+\def\CF_ifdot#1{\CF_ifdota#1.\_nil}
+\def\CF_ifdota#1.#2\_nil{\ifx\empty#2\empty\expandafter\CF_execsecond\else\expandafter\CF_execfirst\fi}
+\def\CF_beforedot#1.#2\_nil{#1}
+\def\CF_afterdot#1.#2\_nil{#2}
+
+\def\CF_rotatenode*#1#2\_nil{%
+ \CF_ifdot{#1}
+ {\CF_beforedot#1\_nil}
+ {#1}%
+}
+\def\CF_anchornode*#1#2\_nil#3{%
+ \CF_ifdot{#1}
+ {\CF_afterdot#1\_nil}
+ {\CF_arrowcurrentangle-#390-#1}%
+}
+
+% #1 = label #2 = position #3 = + ou - (au dessus ou au dessous) #4 : nom du noeud de départ
+% #5 = label #6 = position #7 = + ou - (au dessus ou au dessous) #8 : nom du noeud de fin
+\def\CF_arrowdisplaylabel#1#2#3#4#5#6#7#8{%
+ \CF_doifnotempty{#1#5}
+ {\path(#4)--(#8)\CF_arrowdisplaylabela{#1}{#2}{#3}\CF_arrowdisplaylabela{#5}{#6}{#7};}%
+}
+
+\def\CF_arrowdisplaylabela#1#2#3{%
+ \CF_doifnotempty{#1}
+ {\if*\expandafter\CF_firsttonil\detokenize{#1}\_nil
+ \ifboolKV[chemfig]{scheme debug}
+ {node[pos=#2,sloped,yshift=#3\CF_arrowlabelsep,draw,fill,cyan](shifted@node){}%
+ node[draw,rotate=\CF_rotatenode#1\_nil,anchor=\CF_anchornode#1\_nil#3,at=(shifted@node)]{\expandafter\CF_gobarg\CF_gobarg#1}%
+ }
+ {node[pos=#2,sloped,yshift=#3\CF_arrowlabelsep](shifted@node){}%
+ node[rotate=\CF_rotatenode#1\_nil,anchor=\CF_anchornode#1\_nil#3,at=(shifted@node)]{\expandafter\CF_gobarg\CF_gobarg#1}%
+ }%
+ \else
+ \ifboolKV[chemfig]{scheme debug}
+ {node[pos=#2,sloped,yshift=#3\CF_arrowlabelsep,draw,fill,cyan](shifted@node){}%
+ node[draw,pos=#2,anchor=-#390,sloped,yshift=#3\CF_arrowlabelsep]{#1}%
+ }
+ {node[pos=#2,anchor=-#390,sloped,yshift=#3\CF_arrowlabelsep]{#1}%
+ }
+ \fi
+ }%
+}
+
+% pose des noeuds décalés de la dimension #1 à (\CF_arrowstartnode) et (\CF_arrowendnode)
+\def\CF_arrowshiftnodes#1{%
+ \unless\ifdim\CF_ifempty{#1}\CF_zero{#1}=0pt
+ \edef\CF_temp{%
+ \noexpand\path(\CF_arrowstartnode)--(\CF_arrowendnode)%
+ node[pos=0,sloped,yshift=#1](\CF_arrowstartnode1){}node[pos=1,sloped,yshift=#1](\CF_arrowendnode1){};}%
+ \CF_temp
+ \edef\CF_arrowstartnode{\CF_arrowstartnode1}\edef\CF_arrowendnode{\CF_arrowendnode1}%
+ \fi
+}
+
+\definearrow3{->}{%
+ \CF_arrowshiftnodes{#3}%
+ \CF_expafter{\draw[}\CF_arrowcurrentstyle](\CF_arrowstartnode)--(\CF_arrowendnode);%
+ \CF_arrowdisplaylabel{#1}{0.5}+\CF_arrowstartnode{#2}{0.5}-\CF_arrowendnode
+}
+
+\definearrow3{<-}{%
+ \CF_arrowshiftnodes{#3}%
+ \CF_expafter{\draw[}\CF_arrowcurrentstyle](\CF_arrowendnode)--(\CF_arrowstartnode);%
+ \CF_arrowdisplaylabel{#1}{0.5}+\CF_arrowstartnode{#2}{0.5}-\CF_arrowendnode
+}
+
+\definearrow5{-/>}{%
+ \CF_arrowshiftnodes{#3}%
+ \CF_expafter{\draw[}\CF_arrowcurrentstyle](\CF_arrowstartnode)--(\CF_arrowendnode)%
+ coordinate[midway,shift=(\CF_arrowcurrentangle:-1pt)](midway@i)%
+ coordinate[midway,shift=(\CF_arrowcurrentangle:1pt)](midway@ii)%
+ coordinate[at=(midway@i),shift=(\CF_ifempty{#4}{225}{#4+180}+\CF_arrowcurrentangle:\CF_ifempty{#5}{5pt}{#5})](line@start)%
+ coordinate[at=(midway@i),shift=(\CF_ifempty{#4}{45}{#4}+\CF_arrowcurrentangle:\CF_ifempty{#5}{5pt}{#5})](line@end)%
+ coordinate[at=(midway@ii),shift=(\CF_ifempty{#4}{225}{#4+180}+\CF_arrowcurrentangle:\CF_ifempty{#5}{5pt}{#5})](line@start@i)%
+ coordinate[at=(midway@ii),shift=(\CF_ifempty{#4}{45}{#4}+\CF_arrowcurrentangle:\CF_ifempty{#5}{5pt}{#5})](line@end@i);
+ \draw(line@start)--(line@end);%
+ \draw(line@start@i)--(line@end@i);%
+ \CF_arrowdisplaylabel{#1}{0.5}+\CF_arrowstartnode{#2}{0.5}-\CF_arrowendnode
+}
+
+\definearrow3{<->}{%
+ \CF_arrowshiftnodes{#3}%
+ \CF_expafter{\draw[}\CF_arrowcurrentstyle,\CF_arrowtip-\CF_arrowtip](\CF_arrowstartnode)--(\CF_arrowendnode);%
+ \CF_arrowdisplaylabel{#1}{0.5}+\CF_arrowstartnode{#2}{0.5}-\CF_arrowendnode
+}
+
+\definearrow3{<=>}{%
+ \CF_arrowshiftnodes{#3}%
+ \path[allow upside down](\CF_arrowstartnode)--(\CF_arrowendnode)%
+ node[pos=0,sloped,yshift=\CF_arrowdoublesep](\CF_arrowstartnode @u0){}%
+ node[pos=0,sloped,yshift=-\CF_arrowdoublesep](\CF_arrowstartnode @d0){}%
+ node[pos=1,sloped,yshift=\CF_arrowdoublesep](\CF_arrowstartnode @u1){}%
+ node[pos=1,sloped,yshift=-\CF_arrowdoublesep](\CF_arrowstartnode @d1){};%
+ \begingroup
+ \ifboolKV[chemfig]{arrow double harpoon}
+ {\pgfarrowharpoontrue}
+ {}%
+ \CF_expafter{\draw[}\CF_arrowcurrentstyle](\CF_arrowstartnode @u0)--(\CF_arrowstartnode @u1);%
+ \CF_expafter{\draw[}\CF_arrowcurrentstyle](\CF_arrowstartnode @d1)--(\CF_arrowstartnode @d0);%
+ \endgroup
+ \CF_arrowdisplaylabel{#1}{0.5}+\CF_arrowstartnode{#2}{0.5}-\CF_arrowendnode%
+}
+
+\definearrow3{<->>}{%
+ \CF_arrowshiftnodes{#3}%
+ \path[allow upside down](\CF_arrowstartnode)--(\CF_arrowendnode)%
+ node[pos=0,sloped,yshift=1pt](\CF_arrowstartnode @u0){}%
+ node[pos=\CF_arrowdoubleposstart,sloped,yshift=-1pt](\CF_arrowstartnode @d0){}%
+ node[pos=1,sloped,yshift=1pt](\CF_arrowstartnode @u1){}%
+ node[pos=\CF_arrowdoubleposend,sloped,yshift=-1pt](\CF_arrowstartnode @d1){};%
+ \begingroup
+ \ifboolKV[chemfig]{arrow double harpoon}
+ {\pgfarrowharpoontrue}
+ {}%
+ \CF_expafter{\draw[}\CF_arrowcurrentstyle](\CF_arrowstartnode @u0)--(\CF_arrowstartnode @u1);%
+ \CF_expafter{\draw[}\CF_arrowcurrentstyle](\CF_arrowstartnode @d1)--(\CF_arrowstartnode @d0);%
+ \endgroup
+ \CF_arrowdisplaylabel{#1}{0.5}+\CF_arrowstartnode{#2}{0.5}-\CF_arrowendnode%
+}
+
+\definearrow3{<<->}{%
+ \path[allow upside down](\CF_arrowstartnode)--(\CF_arrowendnode)%
+ node[pos=\CF_arrowdoubleposstart,sloped,yshift=1pt](\CF_arrowstartnode @u0){}%
+ node[pos=0,sloped,yshift=-1pt](\CF_arrowstartnode @d0){}%
+ node[pos=\CF_arrowdoubleposend,sloped,yshift=1pt](\CF_arrowstartnode @u1){}%
+ node[pos=1,sloped,yshift=-1pt](\CF_arrowstartnode @d1){};%
+ \begingroup
+ \ifboolKV[chemfig]{arrow double harpoon}
+ {\pgfarrowharpoontrue}
+ {}%
+ \CF_expafter{\draw[}\CF_arrowcurrentstyle](\CF_arrowstartnode @u0)--(\CF_arrowstartnode @u1);%
+ \CF_expafter{\draw[}\CF_arrowcurrentstyle](\CF_arrowstartnode @d1)--(\CF_arrowstartnode @d0);%
+ \endgroup
+ \CF_arrowdisplaylabel{#1}{0.5}+\CF_arrowstartnode{#2}{0.5}-\CF_arrowendnode
+}
+
+\definearrow30{%
+ \CF_arrowshiftnodes{#3}%
+ \CF_arrowdisplaylabel{#1}{0.5}+\CF_arrowstartnode{#2}{0.5}-\CF_arrowendnode
+}
+
+\definearrow5{-U>}{%
+ \CF_arrowshiftnodes{#3}%
+ \CF_expafter{\draw[}\CF_arrowcurrentstyle](\CF_arrowstartnode)--(\CF_arrowendnode)node[midway](Uarrow@arctangent){};%
+ \CF_ifempty{#4}
+ {\def\CF_Uarrowradius{0.333}}
+ {\def\CF_Uarrowradius{#4}}%
+ \CF_ifempty{#5}%
+ {\def\CF_Uarrowabsangle{60}}
+ {\pgfmathsetmacro\CF_Uarrowabsangle{abs(#5)}}% ne prendre en compte que la valeur absolue de l'angle
+ \edef\CF_temp{[\CF_ifempty{#1}{draw=none}{\unexpanded\expandafter{\CF_arrowcurrentstyle}},-]}%
+ \expandafter\draw\CF_temp (Uarrow@arctangent)%
+ arc[radius=\CF_compoundsep*\CF_currentarrowlength*\CF_Uarrowradius,start angle=\CF_arrowcurrentangle-90,delta angle=-\CF_Uarrowabsangle]node(Uarrow@start){};
+ \edef\CF_temp{[\CF_ifempty{#2}{draw=none}{\unexpanded\expandafter{\CF_arrowcurrentstyle}}]}%
+ \expandafter\draw\CF_temp (Uarrow@arctangent)%
+ arc[radius=\CF_compoundsep*\CF_currentarrowlength*\CF_Uarrowradius,start angle=\CF_arrowcurrentangle-90,delta angle=\CF_Uarrowabsangle]node(Uarrow@end){};
+ \pgfmathsetmacro\CF_temp{\CF_Uarrowradius*cos(\CF_arrowcurrentangle)<0?"-":"+"}%
+ \ifdim\CF_Uarrowradius pt>0pt
+ \CF_arrowdisplaylabel{#1}{0}\CF_temp{Uarrow@start}{#2}{1}\CF_temp{Uarrow@end}%
+ \else
+ \CF_arrowdisplaylabel{#2}{0}\CF_temp{Uarrow@start}{#1}{1}\CF_temp{Uarrow@end}%
+ \fi
+}
+
+\def\CF_grabdelim#1#2#3\_nil{\def\CF_leftdelim{#1}\def\CF_rightdelim{#2}}
+\def\CF_resetdelim{%
+ \setKVdefault[CFdelimiters]
+ {delimiters =(),
+ height =10pt,
+ depth =,
+ open xshift =0pt,
+ close xshift=,
+ indice =n}%
+}
+
+\CF_resetdelim
+
+\def\polymerdelim{\CF_ifnextchar[{\CF_polymerdelima}{\CF_polymerdelima[]}}
+\def\CF_polymerdelima[#1]#2#3{%
+ \CF_resetdelim
+ \CF_doifnotempty{#1}{\setKV[CFdelimiters]{#1}}%
+ \expandafter\expandafter\expandafter\CF_grabdelim\useKV[CFdelimiters]{delimiters}()\_nil
+ \edef\CF_delimheight{\the\dimexpr\useKV[CFdelimiters]{height}}%
+ \CF_eexpsecond\CF_ifempty{\useKV[CFdelimiters]{depth}}
+ {\let\CF_delimdepth\CF_delimheight}
+ {\edef\CF_delimdepth{\the\dimexpr\useKV[CFdelimiters]{depth}}}%
+ \edef\CF_delimhalfdim{\the\dimexpr(\CF_delimheight+\CF_delimdepth)/2}%
+ \edef\CF_delimvshift {\the\dimexpr(\CF_delimheight-\CF_delimdepth)/2}%
+ \edef\CF_leftdelimxshift{\the\dimexpr\useKV[CFdelimiters]{open xshift}}%
+ \CF_eexpsecond\CF_ifempty{\useKV[CFdelimiters]{close xshift}}
+ {\edef\CF_rightdelimxshift{\the\dimexpr-\useKV[CFdelimiters]{open xshift}}}
+ {\edef\CF_rightdelimxshift{\the\dimexpr-\useKV[CFdelimiters]{close xshift}}}%
+ \chemmove{%
+ \nulldelimiterspace0pt
+ \pgfextractx\CF_dim{\pgfpointanchor{#2}{center}}\edef\CF_leftdelimx{\the\CF_dim}%
+ \pgfextracty\CF_dim{\pgfpointanchor{#2}{center}}\edef\CF_leftdelimy{\the\CF_dim}%
+ \pgfextractx\CF_dim{\pgfpointanchor{#3}{center}}\edef\CF_rightdelimx{\the\CF_dim}%
+ \node[at={(\CF_leftdelimx+\CF_leftdelimxshift,\CF_leftdelimy+\CF_delimvshift)}]
+ {$\left\CF_leftdelim\vrule height\CF_delimhalfdim depth\CF_delimhalfdim width0pt\right.$};%
+ \node[at={(\CF_rightdelimx+\CF_rightdelimxshift,\CF_leftdelimy+\CF_delimvshift)}]
+ {$\left.\vrule height\CF_delimhalfdim depth\CF_delimhalfdim width0pt\right\CF_rightdelim
+ \CF_eexpsecond\CF_doifnotempty{\useKV[CFdelimiters]{indice}}
+ {\CF_underscore{\rlap{$\scriptstyle\useKV[CFdelimiters]{indice}$}}}
+ $};
+ }%
+}
+
+\catcode`\@11
+\pgfdeclarearrow{%
+ name = CF,%
+ defaults = {%
+ length = 3pt 5 1,%
+ width' = 0pt .8,%
+ inset' = 0pt .5,%
+ line width = 0pt 1 1,%
+ round%
+ },%
+ setup code = {%
+ % Cap the line width at 1/4th distance from inset to tip
+ \pgf@x\pgfarrowlength
+ \advance\pgf@x by-\pgfarrowinset
+ \pgf@x.25\pgf@x
+ \ifdim\pgf@x<\pgfarrowlinewidth\pgfarrowlinewidth\pgf@x\fi
+ % Compute front miter length:
+ \pgfmathdivide@{\pgf@sys@tonumber\pgfarrowlength}{\pgf@sys@tonumber\pgfarrowwidth}%
+ \let\pgf@temp@quot\pgfmathresult%
+ \pgf@x\pgfmathresult pt%
+ \pgf@x\pgfmathresult\pgf@x%
+ \pgf@x4\pgf@x%
+ \advance\pgf@x by1pt%
+ \pgfmathsqrt@{\pgf@sys@tonumber\pgf@x}%
+ \pgf@xc\pgfmathresult\pgfarrowlinewidth% xc is front miter
+ \pgf@xc.5\pgf@xc
+ \pgf@xa\pgf@temp@quot\pgfarrowlinewidth% xa is extra harpoon miter
+ % Compute back miter length:
+ \pgf@ya.5\pgfarrowwidth%
+ \csname pgfmathatan2@\endcsname{\pgfmath@tonumber\pgfarrowlength}{\pgfmath@tonumber\pgf@ya}%
+ \pgf@yb\pgfmathresult pt%
+ \csname pgfmathatan2@\endcsname{\pgfmath@tonumber\pgfarrowinset}{\pgfmath@tonumber\pgf@ya}%
+ \pgf@ya\pgfmathresult pt%
+ \advance\pgf@yb by-\pgf@ya%
+ \pgf@yb.5\pgf@yb% half angle in yb
+ \pgfmathtan@{\pgf@sys@tonumber\pgf@yb}%
+ \pgfmathreciprocal@{\pgfmathresult}%
+ \pgf@yc\pgfmathresult\pgfarrowlinewidth%
+ \pgf@yc.5\pgf@yc%
+ \advance\pgf@ya by\pgf@yb%
+ \pgfmathsincos@{\pgf@sys@tonumber\pgf@ya}%
+ \pgf@ya\pgfmathresulty\pgf@yc% ya is the back miter
+ \pgf@yb\pgfmathresultx\pgf@yc% yb is the top miter
+ \ifdim\pgfarrowinset=0pt
+ \pgf@ya.5\pgfarrowlinewidth% easy: back miter is half linewidth
+ \fi
+ % Compute inset miter length:
+ \pgfmathdivide@{\pgf@sys@tonumber\pgfarrowinset}{\pgf@sys@tonumber\pgfarrowwidth}%
+ \let\pgf@temp@quot\pgfmathresult%
+ \pgf@x\pgfmathresult pt%
+ \pgf@x\pgfmathresult\pgf@x%
+ \pgf@x4\pgf@x%\pgf@ya
+ \advance\pgf@x by1pt%
+ \pgfmathsqrt@{\pgf@sys@tonumber\pgf@x}%
+ \pgf@yc\pgfmathresult\pgfarrowlinewidth% yc is inset miter
+ \pgf@yc.5\pgf@yc%
+ % Inner length (pgfutil@tempdima) is now arrowlength - front miter - back miter
+ \pgfutil@tempdima\pgfarrowlength%
+ \advance\pgfutil@tempdima by-\pgf@xc%
+ \advance\pgfutil@tempdima by-\pgf@ya%
+ \pgfutil@tempdimb.5\pgfarrowwidth%
+ \advance\pgfutil@tempdimb by-\pgf@yb%
+ % harpoon miter correction
+ \ifpgfarrowroundjoin
+ \pgfarrowssetbackend{\pgf@ya\advance\pgf@x by-.5\pgfarrowlinewidth}%
+ \else
+ \pgfarrowssetbackend{0pt}
+ \fi
+ \ifpgfarrowharpoon
+ \pgfarrowssetlineend{\pgfarrowinset\advance\pgf@x by\pgf@yc\advance\pgf@x by.5\pgfarrowlinewidth}%
+ \else
+ \pgfarrowssetlineend{\pgfarrowinset\advance\pgf@x by\pgf@yc\advance\pgf@x by-.25\pgfarrowlinewidth}%
+ \ifpgfarrowreversed
+ \ifdim\pgfinnerlinewidth>0pt
+ \pgfarrowssetlineend{\pgfarrowinset}%
+ \else
+ \pgfarrowssetlineend{\pgfutil@tempdima\advance\pgf@x by\pgf@ya\advance\pgf@x by-.25\pgfarrowlinewidth}%
+ \fi
+ \fi
+ \fi
+ \ifpgfarrowroundjoin
+ \pgfarrowssettipend{\pgfutil@tempdima\advance\pgf@x by\pgf@ya\advance\pgf@x by.5\pgfarrowlinewidth}%
+ \else
+ \pgfarrowssettipend{\pgfarrowlength\ifpgfarrowharpoon\advance\pgf@x by\pgf@xa\fi}%
+ \fi
+ % The hull:
+ \pgfarrowshullpoint{\pgfarrowlength\ifpgfarrowroundjoin\else\ifpgfarrowharpoon\advance\pgf@x by\pgf@xa\fi\fi}{\ifpgfarrowharpoon-.5\pgfarrowlinewidth\else0pt\fi}%
+ \pgfarrowsupperhullpoint{0pt}{.5\pgfarrowwidth}%
+ \pgfarrowshullpoint{\pgfarrowinset}{\ifpgfarrowharpoon-.5\pgfarrowlinewidth\else 0pt\fi}%
+ % Adjust inset
+ \pgfarrowssetvisualbackend{\pgfarrowinset}%
+ \advance\pgfarrowinset by\pgf@yc%
+ % The following are needed in the code:
+ \pgfarrowssavethe\pgfutil@tempdima
+ \pgfarrowssavethe\pgfutil@tempdimb
+ \pgfarrowssavethe\pgfarrowlinewidth
+ \pgfarrowssavethe\pgf@ya
+ \pgfarrowssavethe\pgfarrowinset
+ },%
+ drawing code = {%
+ \pgfsetdash{}{0pt}%
+ \ifpgfarrowroundjoin\pgfsetroundjoin\else\pgfsetmiterjoin\fi
+ \ifdim\pgfarrowlinewidth=\pgflinewidth\else\pgfsetlinewidth{\pgfarrowlinewidth}\fi
+ \pgfpathmoveto{\pgfqpoint{\pgfutil@tempdima\advance\pgf@x by\pgf@ya}{0pt}}%
+ \pgfpathlineto{\pgfqpoint{\pgf@ya}{\pgfutil@tempdimb}}%
+ \pgfpathlineto{\pgfqpoint{\pgfarrowinset}{0pt}}%
+ \ifpgfarrowharpoon \else
+ \pgfpathlineto{\pgfqpoint{\pgf@ya}{-\pgfutil@tempdimb}}%
+ \fi
+ \pgfpathclose
+ \ifpgfarrowopen\pgfusepathqstroke\else\ifdim\pgfarrowlinewidth>0pt \pgfusepathqfillstroke\else\pgfusepathqfill\fi\fi
+ },%
+ parameters = {%
+ \the\pgfarrowlinewidth,%
+ \the\pgfarrowlength,%
+ \the\pgfarrowwidth,%
+ \the\pgfarrowinset,%
+ \ifpgfarrowharpoon h\fi%
+ \ifpgfarrowopen o\fi%
+ \ifpgfarrowroundjoin j\fi%
+ }%
+}
+\CFrestorecatcode
+\endinput
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%% H I S T O R I Q U E %%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+v0.1 2010/06/23
+ - Première version publique sur le CTAN
+----------------------------------------------------------------------
+v0.2 2010/08/31
+ - Ajout de la documentation en anglais.
+ - Correction de bugs.
+ - \printatom est désormais une macro publique.
+ - Les espaces sont permis dans les molécules. Ils seront
+ ignorés par défaut puisque les atomes sont composés en
+ mode math par \printatom
+ - Une paire de Lewis peut être représentée ":".
+ - Dans les cycles, une correction de la longueur du trait
+ déporté des liaisons doubles est fait de telle sorte que si
+ l'on écrit \chemfig{*5(=====)}, on obtient deux polygones
+ réguliers concentriques.
+ - La séquence de contrôle \setnodestyle permet de spécifier
+ le style des n?uds dessinés par tikz.
+----------------------------------------------------------------------
+v0.3 2010/11/21
+ - Amélioration de \definesubmol qui accepte les séquences de
+ contrôle. On peut aussi choisir un alias dont la substitution
+ est différente selon l'orientation de la liaison qui lui
+ arrive dessus.
+ - Le caractère "|" force la fin d'un atome. Si on écrit
+ "D|ef" alors, chemfig verra deux atomes "D" et "ef".
+ - Le caractère "#" est reconnu lorsqu'il suit un caractère de
+ liaison. Il doit être suivi d'un argument entre parenthèses
+ qui contient l'offset de début et de fin qui s'appliqueront
+ à cette liaison.
+ - La macro \chemfig admet un argument optionnel qui sera passé
+ à l'environnement tikzpicture dans lequel elle est dessinée
+ - Mise en place de la représentation des mécanismes
+ réactionnels avec la syntaxe "@{<nom>}" devant un atome où
+ "@{<nom>,<coeff>}" au tout début de l'argument d'une liaison.
+ Cette syntaxe permet de placer un n?ud (au sens de tikz) qui
+ deviendra l'extrémité des flèches des mécanismes.
+ Le tracé des flèches est faite par la macro \chemmove dont
+ l'argument optionnel devient celui de l'environnement
+ tikzpicture dans lequel sont faites les flèches.
+ - Pour le mécanisme d'alignement vertical via le \vphantom, la
+ commande \chemskipalign permet d'ignorer le groupe d'atomes
+ dans lequel elle est écrite.
+ - La commande \chemname permet d'afficher un nom sous une
+ molécule. la commande \chemnameinit initialise la plus grande
+ 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.
+----------------------------------------------------------------------
+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.
+----------------------------------------------------------------------
+v0.4 2011/03/07
+ - chemfig est désormais écrit en plain-etex et donc
+ utilisable par d'autres formats que LaTeX.
+ - Un peu plus de rigueur avec les catcodes des caractères
+ spéciaux, notamment lorsque la commande \chemfig se trouve
+ dans l'argument de \chemmove, \chemabove, \chembelow, \chemrel.
+ TODO : faut-il \scantoker l'argument de \chemfig pour être
+ définitivement débarrassé de ces histoires de catcode ???
+ - Correction d'un bug dans le calcul de l'angle des liaisons
+----------------------------------------------------------------------
+v0.4a 2011/04/10
+ - Correction d'un bug concernant l'argument optionnel en début
+ de molécule.
+----------------------------------------------------------------------
+v0.4b 2011/04/24
+ - l'argument de \chemfig est tokénisé avec \scantokens ce qui
+ rend caduc tout souci de code de catégorie, à part #.
+ - la commande \setbondstyle permet de définir le style des
+ liaisons.
+ - correction de l'affichage incorrect des doubles liaisons dans
+ les cycles après les commandes \hflipnext et \vflipnext
+ - correction d'un bug lorsqu'un alias commence une molécule
+----------------------------------------------------------------------
+v1.0 2011/06/15
+ - les schémas réactionnels sont désormais disponibles.
+ - \Chemabove et \Chembelow modifient la boite englobante.
+ - \Lewis modifie la boite englobante
+ - les macros \chemleft, \chemright, \chemup et \chemdown
+ affichent des délimiteurs extensibles à gauche, à droite,
+ au dessus et au dessous d'un matériel.
+----------------------------------------------------------------------
+v1.0a 2011/09/18
+ - les macros \Lewis et \lewis admettent un argument optionnel
+ - la macro \setlewisdist règle la distance entre les 2
+ électrons
+----------------------------------------------------------------------
+v1.0b 2011/11/29
+ - la commande \merge est désormais protégée entre
+ \schemestart et \schemestop contre des définitions par d'autres
+ packages.
+ - \box0 est utilisé au lieu du maladroit \unhbox0
+----------------------------------------------------------------------
+v1.0c 2011/11/30
+ - la macro \+ n'est plus explicitement écrite
+ - vérifie que eTeX est le moteur utilisé
+----------------------------------------------------------------------
+v1.0d 2011/12/19
+ - les cercles des cycles étaient tracés au mauvais moment. La
+ longueur de la liaison qui les précédait influait sur le
+ rayon du cercle : \chemfig{-[,0.5]**6(------)} donnait un bug
+ à l'affichage.
+----------------------------------------------------------------------
+v1.0e 2012/01/13
+ - la gestion des espaces dans les groupes d'atomes est
+ désormais plus rigoureuse. Plusieurs bugs ont été
+ corrigé
+----------------------------------------------------------------------
+v1.0f 2012/02/24
+ - correction d'un bug avec \definesubmol, les catcodes n'étaient
+ pas correctement gérés.
+----------------------------------------------------------------------
+v1.0g 2012/11/16
+ - correction d'un bug dans \CF_directarrow pour faire prendre en
+ compte le style des flèche par défaut
+ - correction d'un bug dans \CF_lewisc : la boite *doit* être
+ composée en dehors de l'environnement tikzpicture pour
+ éviter nullfont si jamais \printatom ne passe pas en mode
+ math.
+ - correction d'un bug dans \CF_chemfigc : si une longueur par
+ défaut est modifiée par [,<l>] au début d'une molécule
+ et si des cycles étaient emboités, cette longueur n'était
+ pas appliquée aux sous-cycles.
+ - ré-écriture des macros \chemabove et \chembemow pour
+ prendre en compte le bug (désormais corrigé) dans luatex.
+ - nouvelle macro \setstacksep qui définit l'espacement par
+ défaut dans les macros \chemabove et \chembelow.
+----------------------------------------------------------------------
+v1.0h 2013/11/28
+ - \chemname admet maintenant une version étoilé qui ne tient
+ pas compte des profondeurs précédentes.
+ - \CF_dpmax est géré globalement.
+ - correction d'un bug dans "-U>" : le style de la flèche
+ n'était pris en compte pour l'arc.
+ - correction d'un bug dans \CF_directarrow : l'angle de la
+ flèche n'était pas calculé
+----------------------------------------------------------------------
+v1.1 2015/02/13
+ - correction d'un bug dans \CF_seeksubmol : la macro
+ \CF_molecule est dépouillé de son éventuel espace
+ en première position.
+ - correction d'un bug dans \CF_arrowf : le nom du prochain
+ n?ud courant "end@arrow@i" était erroné dans le cas où une
+ flèche contenait un sous schéma. Ce nom doit dépendre de
+ \CF_schemenest.
+ - la jonction entre deux liaisons consécutives dans l'axe peut
+ être activé avec \enablebondjoin et désactivé avec
+ \disablebondjoin (préférable, état par défaut).
+ - \chemfig suivi d'une "*" demande à ce que les liaisons aient
+ une longueur invariable : la distance inter-atome devient donc
+ variable. Cette fonctionnalité est désactivé dans les
+ cycles afin que les polygones soient réguliers.
+ \enablefixedbondlength permet cette fonctionnalité pour
+ toutes les macros \chemfig (même non étoilée) tandis que
+ \disablefixedbondlength le désactive.
+----------------------------------------------------------------------
+v1.1a 2015/02/23
+ - correction d'un bug dans \CF_grabbondoffset. Si \chemfig est
+ dans l'argument d'une macro, les # sont doublés par l'action
+ de \scantokens de la macro \CF_chemfigb et il faut un
+ argument délimité avant "(" pour absorber tous les #.
+----------------------------------------------------------------------
+v1.2 2015/10/08
+ - correction d'un bug dans le tracé des liaisons de Cram.
+ - création de \setangleincrement.
+ - chargement de "arrows.meta" et définition de la flèche "CF"
+ basée sur "Stealth" et définie avec \pgfdeclarearrow.
+ Les anciennes flèches "CF_full" et "CF_half" sont
+ abandonnées puisque définies avec \pgfarrowsdeclare.
+ - flèche "-U>" corrigée : le placement des labels est
+ maintenant correct dans tous les cas. Ainsi :
+ -U>[<a>][<b>][<d>][r][a]
+ place le label <a> près du début de la flèche, quels que
+ soient les signes du rayon r et de l'angle a.
+ - \chemrel, \setchemrel et \chemsign sont supprimées.
+ - compatibilité, avec les limitations d'usage, avec la
+ librairie "externalize" : le \begin{tikzpicture} voit
+ désormais le \end{tikzpicture} correspondant dans la macro
+ \CF_chemfigb.
+----------------------------------------------------------------------
+v1.2a 2015/10/21
+ - erreur de copier-coller dans le code: une adresse url était
+ malencontreusement présente en plein milieu d'une ligne de
+ code
+----------------------------------------------------------------------
+v1.2b 2015/11/15
+ - bug dans \CF_seeksubmol qui laissait "*" dans le flux de
+ lecture de TeX. Un message d'erreur est également ajouté
+ en cas de "!" en fin de traitement.
+ - correction d'un bug dans \CF_setbondangle où l'angle [<:a>]
+ n'était pas évalué par \pgfmathsetmacro.
+----------------------------------------------------------------------
+v1.2c 2015/11/20
+ - Correction d'un bug dans \CF_setbondangle : l'angle renvoyé
+ pouvait être négatif
+ - Correction d'un bug dans \CF_directarrow : la macro \CF_ifempty
+ n'est pas correctement développée dans l'argument de
+ \pgfpointanchor
+----------------------------------------------------------------------
+v1.2d 2015/12/01
+ - correction d'un bug dans la flèche "-U"
+ - la version étoilée de \setcrambond dessine les liaisons de
+ Cram en pointillés sous forme de trait large et non pas sous
+ forme de triangle.
+----------------------------------------------------------------------
+v1.2e 2017/05/20
+ - la macro contenant la définition d'une flèche est
+ désormais "\CF_arrow(<nom>)", ainsi la macro \0 n'est plus
+ définie par \definearrow
+ - remerciements rajoutés après une suppression indue, pour ne
+ froisser aucune susceptibilité
+----------------------------------------------------------------------
+v1.3 2018/03/08
+ - tous les paramètres sont désormais passés via \setchemfig qui
+ fait appel à "simplekv". Par conséquent, _toutes_ les macros qui
+ réglaient des paramètres deviennent obsolètes, à savoir :
+ \setcrambond, \setatomsep, \setbondoffset, \setdoublesep,
+ \setangleincrement, \enablefixedbondlength,
+ \disablefixedbondlength, \setnodestyle, \setbondstyle,
+ \setlewis, \setlewisdist, \setstacksep, \setcompoundstyle,
+ \setarrowdefault, \setandsign, \setarrowoffset,
+ \setcompoundsep, \setarrowlabelsep, \enablebondjoin,
+ \disablebondjoin et \schemedebug.
+ et ces macros seront *supprimées* dans une future version.
+ - la version étoilée "\chemfig*" et les deux arguments optionnels
+ de la macro "\chemfig[][]" sont également optionnels et seront
+ *supprimé*s dans une future version afin d'accéder à la syntaxe
+ \chemfig[clés=valeurs]{code}
+ - 6 nouveaux paramètres : "lewis radius", "arrow double sep",
+ "arrow double coeff", "arrow double harpoon", "cycle radius
+ coeff", "arrow head".
+ - correction d'un bug dans \CF_parsemergeopt qui dans certains
+ cas, envoyait vers l'affichage des caractères
+ - petit toilettage du code
+ - macro \polymerdelim (non documentée) expérimentale et encore
+ en phase de tests
+ - suppression d'un registre d'écriture de fichier
+----------------------------------------------------------------------
+v1.31 2018/04/05
+ - correction d'un espace indésirable dans \CF_ifnextchar
+----------------------------------------------------------------------
+v1.32 2018/08/23
+ - définition de \printatom, \CF_begintikzpicture et
+ \CF_endtikzpicture dans le fichier t-chemfig.tex
+----------------------------------------------------------------------
+v1.33 2018/10/31
+ - les macros définies par \definesubmol peuvent désormais avoir un ou
+ plusieurs arguments
+ - macro \polymerdelim documentée
+----------------------------------------------------------------------
+v1.34 2019/02/23
+ - bug dans la flèche "<->" corrigé
+----------------------------------------------------------------------
+v1.4 2019/04/18
+ - corrections de nombreux bugs
+ - caractère privé "_" et non plus "@" -> modifications à prévoir
+ notamment dans la doc avec les codes spécifiques aux flèches, ça
+ risque de couiner sur tex.stackexchange.com
+ - anciennes macros abandonnées et désormais indéfinies :
+ \setcrambond, \setatomsep, \setbondoffset, \setdoublesep,
+ \setangleincrement, \enablefixedbondlength,
+ \disablefixedbondlength, \setnodestyle, \setbondstyle,
+ \setlewis, \setlewisdist, \setstacksep, \setcompoundstyle,
+ \setarrowdefault, \setandsign, \setarrowoffset,
+ \setcompoundsep, \setarrowlabelsep, \enablebondjoin,
+ \disablebondjoin et \schemedebug
+ - l'ancienne syntaxe \chemfig[][]{} est abandonnée et n'est plus
+ acceptée, désormais c'est
+ \chemfig[<clés>=<valeurs>]{<code molécule>}
+ - l'ancienne syntaxe \lewis[<coeff>] ou \Lewis[<coeff>] n'est
+ plus acceptée au profit de \lewis[<clés>=<valeurs>] \ No newline at end of file
diff --git a/macros/generic/chemfig/t-chemfig.tex b/macros/generic/chemfig/t-chemfig.tex
new file mode 100644
index 0000000000..5fc262beae
--- /dev/null
+++ b/macros/generic/chemfig/t-chemfig.tex
@@ -0,0 +1,5 @@
+\usemodule[tikz]%
+\input chemfig.tex
+\expandafter\let\csname CF\string_begintikzpicture\endcsname\starttikzpicture
+\expandafter\let\csname CF\string_endtikzpicture\endcsname\stoptikzpicture
+\endinput