summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/generic/chemfig
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2011-03-20 22:15:59 +0000
committerKarl Berry <karl@freefriends.org>2011-03-20 22:15:59 +0000
commit96a91aa58dd86768415a3328add7113d85b4a7e3 (patch)
tree3aef8663340f28145459b454286e81627a19bd11 /Master/texmf-dist/doc/generic/chemfig
parent24c374f45330336f673cbaa3bb08401d0957489a (diff)
chemfig .tex in runtime (Alan Munn report, 20 Mar 2011 09:09:24)
git-svn-id: svn://tug.org/texlive/trunk@21773 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/generic/chemfig')
-rw-r--r--Master/texmf-dist/doc/generic/chemfig/README34
-rw-r--r--Master/texmf-dist/doc/generic/chemfig/chemfig_doc_en.pdfbin0 -> 1115478 bytes
-rw-r--r--Master/texmf-dist/doc/generic/chemfig/chemfig_doc_en.tex2082
-rw-r--r--Master/texmf-dist/doc/generic/chemfig/chemfig_doc_fr.pdfbin0 -> 1138588 bytes
-rw-r--r--Master/texmf-dist/doc/generic/chemfig/chemfig_doc_fr.tex2082
5 files changed, 4198 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/generic/chemfig/README b/Master/texmf-dist/doc/generic/chemfig/README
new file mode 100644
index 00000000000..836ecaee061
--- /dev/null
+++ b/Master/texmf-dist/doc/generic/chemfig/README
@@ -0,0 +1,34 @@
+___________________________________
+
+ The
+ ChemFig package
+ v0.4
+
+ 2011/03/07
+___________________________________
+
+Maintainer: Christian Tellechea
+E-mail : unbonpetit@gmail.com
+ 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ésentation en 2D d'une molécule chimique. Le <code> décrit 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.
+
+ Christian Tellechea \ No newline at end of file
diff --git a/Master/texmf-dist/doc/generic/chemfig/chemfig_doc_en.pdf b/Master/texmf-dist/doc/generic/chemfig/chemfig_doc_en.pdf
new file mode 100644
index 00000000000..57180796859
--- /dev/null
+++ b/Master/texmf-dist/doc/generic/chemfig/chemfig_doc_en.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/generic/chemfig/chemfig_doc_en.tex b/Master/texmf-dist/doc/generic/chemfig/chemfig_doc_en.tex
new file mode 100644
index 00000000000..f6747ab5e0f
--- /dev/null
+++ b/Master/texmf-dist/doc/generic/chemfig/chemfig_doc_en.tex
@@ -0,0 +1,2082 @@
+% _________________________________________________________________
+% | |
+% | |
+% | ChemFig Documentation |
+% | |
+% | March 7, 2011 |
+% | |
+% |_________________________________________________________________|
+%
+% This is chemfig_doc_en.tex, the LaTeX code of the chemfig English
+% documentation. Translation by Theo Hopman (hopman.theo@gmail.com).
+%
+% Maintainer: Christian Tellechea
+% E-mail : unbonpetit@gmail.com
+% Comments, bug reports and suggestions are welcome.
+% Licence : Released under the LaTeX Project Public License v1.3c or
+% later, see http://www.latex-project.org/lppl.txt
+% Copyright : Christian Tellechea 2010-2011
+%
+% The "chemfig" package consists of the 8 following files:
+% chemfig.tex (the code of the package)
+% chemfig.sty (the file for LaTeX)
+% t-chemfig.tex (the file for ConTeXt)
+% README
+% chemfig_doc_fr.tex, chemfig_doc_fr.pdf (french manual)
+% chemfig_doc_en.tex, chemfig_doc_en.pdf (english manual)
+%
+% -------------------------------------------------------------------
+% This work may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either version 1.3
+% of this license or (at your option) any later version.
+% The latest version of this license is in
+%
+% http://www.latex-project.org/lppl.txt
+%
+% and version 1.3 or later is part of all distributions of LaTeX
+% version 2005/12/01 or later.
+% -------------------------------------------------------------------
+% This work has the LPPL maintenance status `maintained'.
+%
+% The Current Maintainer of this work is Christian Tellechea
+% -------------------------------------------------------------------
+\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}
+\renewcommand*\oldstylenums[1]{{\fontfamily{fxlj}\selectfont #1}}
+\usepackage[scaled=0.8]{luximono}
+\usepackage{amsmath}
+\usepackage{array}
+\usepackage{longtable}
+\usepackage{xspace}
+\usepackage{fancybox}
+\usepackage{boites}
+\usepackage{textcomp}
+\usepackage{enumitem}
+\usepackage{chemfig}
+\usepackage{siunitx}
+\usetikzlibrary{decorations.pathmorphing}
+\usepackage{emerald}
+\usepackage[protrusion=true,expansion,final,babel=true]{microtype}
+\usepackage{fancyhdr}
+\fancypagestyle{plain}{%
+ \fancyhead[L]{\colorbox{gray!40}{\rlap{\small\bfseries\CF}\kern\dimexpr\linewidth-2\fboxsep}}
+ \fancyhead[C]{}
+ \fancyhead[R]{\scriptsize\slshape\leftmark\kern0.5em}
+ \fancyfoot[l]{\tiny\LaTeX ed by Christian \textsc{Tellechea}, the \today.}
+ \fancyfoot[c]{}
+ \fancyfoot[r]{\thepage}}
+\renewcommand\headrulewidth{0pt}
+
+\makeatletter
+\let\gobble\@gobble
+\newcommand\idx{\@ifstar{\let\print@or@not\@gobble\idx@}{\let\print@or@not\@firstofone\idx@}}
+\newcommand\idx@[1]{%
+ \ifcat\expandafter\noexpand\@car#1\@nil\relax% si sc
+ \expandafter\ifx\@car#1\@nil\protect
+ \index{#1}%
+ \print@or@not{#1}%
+ \else
+ \expandafter\index\expandafter{\expandafter\@gobble\string#1@\protect\texttt{\protect\string\protect#1}}%
+ \print@or@not{\texttt{\string#1}}%
+ \fi
+ \else
+ \index{#1}%
+ \print@or@not{#1}%
+ \fi
+}
+
+\newcommand\make@car@active[2]{%
+ \catcode`#1\active
+ \begingroup
+ \lccode`\~`#1\relax
+ \lowercase{\endgroup\def~{#2}}%
+}
+
+\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\,{\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
+ \ECFAugie
+ \fboxsep\z@
+ \colorbox{black}{\kern0.25em\color{white}\footnotesize\lower0.5ex\hbox{\strut#2}\kern0.25em}%
+ \leaders\bkvz@bottom\hfill
+ \vrule\@width\fboxrule\@height\fboxrule}}%
+ \breakbox
+ \kern.5ex\relax
+ \ttfamily\footnotesize\the@code\par
+ \normalfont
+ \kern3pt
+ \hrule height0.1pt width\linewidth depth0.1pt
+ \vskip5pt
+ \rightskip0pt plus 1fill
+ \everypar{{\color{lightgray}\rlap{\vrule height0.1pt width\linewidth depth0.1pt}}\hskip0pt plus 1fill}%
+ \newlinechar`\^^M\everyeof{\noexpand}\scantokens{#3}\par
+ \endbreakbox
+ \endgroup
+ \else
+ \vskip0.5ex
+ \boxput*(0,1)
+ {\fboxsep\z@
+ \hbox{\ECFAugie\colorbox{black}{\leavevmode\kern0.25em{\color{white}\footnotesize\strut#2}\kern0.25em}}%
+ }%
+ {\fboxsep5pt
+ \fbox{%
+ $\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
+}
+
+\newcommand\falseverb[1]{{\ttfamily\detokenize{#1}}}
+
+\long\def\centerverb#1{%
+ \def\centerverb@i##1#1{##1\hfill\null\par\egroup}
+ \bgroup
+ \ttfamily\@noligs
+ \parskip3.5pt\par\hfill
+ \let\do\@makeother\dospecials
+ \@vobeyspaces
+ \centerverb@i}
+
+\makeatother
+
+\usepackage[english]{babel}
+\def\degres{\ensuremath{{}^\circ}}
+
+\newcommand\CF{{\ECFAugie ChemFig}\xspace}
+\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}}}}
+
+\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\Large\filcenter\sffamily\bfseries}%
+ {\LARGE\MakeUppercase{\partname~\thepart}}%
+ {1pc}%
+ {\titlerule\vspace{1pc}\Huge}
+
+\begin{filecontents*}{chemfig_doc_en.ist}
+% Fichier de style makeindex
+heading_prefix "{\\bfseries\\hfill "
+heading_suffix "\\hfill\\null}\\nopagebreak\n"
+headings_flag 1
+symhead_positive "Symbols"
+symhead_negative "Symbols"
+delim_0 "\\dotfill"
+delim_1 "\\dotfill"
+delim_2 "\\dotfill"
+\end{filecontents*}
+
+\usepackage{makeidx}
+\makeindex
+\begin{document}
+\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}\ECFAugie\fontsize{50pt}{50pt}\selectfont\CF\par
+ \Large v\csname CF@ver\endcsname\par\bigskip
+ \footnotesize\csname CF@en@date\endcsname\par
+ \normalsize Christian Tellechea\par\vskip1.5cm
+ \huge A \TeX{} package for drawing molecules%
+ \end{center}
+ \vskip4cm
+ \begin{center}
+ \scriptsize
+ \setatomsep{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
+ {\ECFAugie\small Taxotere}%
+ \end{center}
+ \vskip1.5cm
+ \hfill
+ \hbox to 0pt{\hss
+ \scriptsize
+ \setbondoffset{1pt}
+ \setatomsep{2em}
+ \chemfig{(-[:-150]R')(-[:-30]R)=[2]N-[:30]OH}%
+ \kern-1em
+ \chemrel[\chemfig{\chemabove{H}{\kern10pt\scriptstyle\oplus}}]{<>}%
+ \kern-0.5em
+ \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);
+ }
+ \kern-1.5em
+ \chemrel[\chemfig{{-}H_2O}]{<>}%
+ $\left[\begin{tabular}{c}
+ \chemfig{R'-\lewis{2:,N}=@{a1}\chemabove{C}{\scriptstyle\oplus}-R}\\
+ \tikz\draw[stealth-stealth](0,3mm)--(0,-3mm);\\
+ \chemfig{R'-\chemabove{N}{\scriptstyle\oplus}~C-R}
+ \end{tabular}\right]$%
+ \chemrel[\chemfig{H_2@{a0}\lewis{0:2:,O}}]{<>}%
+ \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)}%
+ \chemrel[\chemfig{{-}\chemabove{H}{\kern10pt\scriptstyle\oplus}}]{<>}%
+ \chemfig{*6(R\rlap{$'$}-N=(-R)-OH)}%
+ \chemrel{-stealth}%
+ \chemfig{*6(R\rlap{$'$}-\chembelow{N}{H}-(-R)(=[2]O))}\par\bigskip
+ \hss}\hfill\null
+ \begin{center}
+ \ECFAugie\small The Beckmann rearrangement%
+ \end{center}
+\end{titlepage}
+\parindent0pt\pagestyle{plain}
+\tableofcontents
+\parskip\medskipamount
+\vspace{2cm}
+
+\setitemize{leftmargin=3em,topsep=0pt,parsep=0pt,itemsep=0pt}
+\part{Introduction}
+\section{New in version 0.3}
+Here's what's new in version 0.4:
+\begin{enumerate}
+ \item The code is now written in plain $\varepsilon$\TeX\idx*{etex@$\protect\varepsilon$\protect\TeX}. Therefore, the package may be used with \LaTeX{}\idx*{Latex@\protect\LaTeX} or Con\TeX{}t\idx*{ConTeXt@Con\protect\TeX{}t}.
+ \item Bugfixes.
+\end{enumerate}
+
+\section{Foreword}
+This package has seen the light of day thanks to the assistance of Christophe \textsc{Casseau}, who had the idea after being confronted with the complexity of the syntax of the \href{http://www.ctan.org/tex-archive/help/Catalogue/entries/ppchtex.html}{\texttt{\textbf{ppchtex}}} package.
+
+Throughout the writing of the code, he helped me find interesting features. He always encouraged me to write more advanced features even though I was sometimes (nearly always?) reluctant; if \CF has the features it does, it is in large part thanks to him. I thank him as well for his testing of beta versions of this package, and for his contributions to the writing of this manual.\medskip
+
+\begingroup
+\leftskip0.1\linewidth
+\rightskip0.1\linewidth
+\itshape\small
+Experience shows that is it has been difficult to combine drawing of molecules with the typographic quality of a program like \LaTeX, leaving little choice for the user who wishes to have a vector format for these drawings. After having abandoned the \emph{ppchtex} package (developed for con\TeX t and available under \LaTeX) because of the complexity of its syntax, I turned to the world of programs outside \LaTeX. The difficulty in this case is finding a compromise between quality and price. After many unsuccessful attempts I found the only option was a new package, and I would like to thank Christian \textsc{Tellechea} for bringing it to life. To meet my requirements, \CF needed to be easy to use but still have advanced features, something well nigh impossible. Yet he was able to put together a very flexible \TeX{} code which makes it a pleasure for me to write my molecules. I hope it will be the same for you readers looking for a package useful in the field of chemistry.\smallskip
+
+\hfill Christophe \textsc{Casseau}\kern0.1\linewidth
+\endgroup\medskip
+
+Finally, I wish to warmly thank Theo \textsc{Hopman} for offering to translate this manual into English.
+
+\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\idx*\input;
+ \item {\color{blue}\verb-\usepackage{chemfig}-} with \LaTeX\idx*{Latex@\protect\LaTeX}\idx*\usepackage;
+ \item {\color{blue}\verb-\usemodule[chemfig]-} with Con\TeX t\idx*{ConTeXt@Con\protect\TeX{}t}\idx*\usemodule.
+\end{itemize}
+
+In all cases, the \TIKZ\idx*{tikz} package, if not loaded before, is loaded by \CF.
+
+The most important command for drawing molecules is \verb|\chemfig{<code>}|\idx*\chemfig. 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\idx*{tikz} package, placed inside a \verb|tikzpicture|\idx*{tikzpicture} environment. The choice of \TIKZ implies that:
+\begin{itemize}
+\item the user has a choice of compilation method\idx*{compilation method}: pdf\LaTeX{} can be used equally well in \idx{dvi mode} (tex $\longrightarrow$ dvi $\longrightarrow$ ps $\longrightarrow$ pdf) or in \idx{pdf mode} (tex $\longrightarrow$ pdf). In effect \TIKZ, via the underlying \idx{pgf}, gives identical graphical results in the two modes;
+\item the \idx{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 \idx{bounding box} for the molecule: {\fboxsep0pt \fbox{\chemfig{H_3C-C(-[:-30]OH)=[:30]O}}}. \CF always places the first atom of the molecule on the \idx{baseline} of the preceding code.
+\end{itemize}
+\newpage
+
+\part{\protect\CF for the impatient}
+This part is a non-exhaustive overview of the features of \CF. The goal is to introduce the basic ideas, allowing the user to get started drawing molecules as quickly as possible. This part does not go into detail; advanced use and a more formal approach to \CF commands will be discussed in the following parts.
+
+\section{Syntax}
+The command \verb|\chemfig|\idx*{\chemfig} is used in the following way:
+\centerverb/\chemfig{<atom1><bond type>[<angle>,<coeff>,<n1>,<n2>,<tikz code>]<atom2>}/
+
+\begin{itemize}
+\item \verb-<angle>- is the bond angle\idx*{bond!angle} between the two atoms;
+\item \verb-<coeff>- is a coefficient multiplying the default bond length\idx*{bond!length};
+\item \verb-<n1>- and \verb-<n2>- are the numbers of the departure and arrival atoms of the bond\idx*{bond!departure and arrival atoms};
+\item \verb-<tikz code>- is additional options concerning the colour or style of a bond\idx*{bond!customization}.
+\end{itemize}
+\medskip
+Each bond takes optional arguments\idx*{bond!optional argument} which are placed in square brackets. These arguments can adjust everything one needs for the bond. Each argument has a default value, so one can simply write:
+\exemple{The water molecule}|\chemfig{H-O-H}|
+
+In all the examples, the grey line represents the \idx{baseline}.
+
+\section{The different types of bonds}
+\idx*{bond!types}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{setdoublesep}The command \verb-\setdoublesep{<dim>}-\idx*{\setdoublesep} adjusts the spacing between the lines in double or triple bonds. This spacing is 2pt by default.
+
+\section{Different types of diagrams}
+\subsection{Complete structural diagram}
+\exemple{Ethane}|\chemfig{C(-[2]H)(-[4]H)(-[6]H)-C(-[2]H)(-[6]H)-H}|
+
+Each bond takes several optional arguments\idx*{bond!optional argument}. The first optional argument defines the \verb-<angle>- of the bond\idx*{bond!angle}. Angles increase counterclockwise. If no angle is give then its default value is 0\degres.
+
+Note: the parentheses allow multiple bonds from the same atom; see ``Branched molecules''\idx*{branched molecule}, page~\pageref{molecules.ramifiees}.
+
+There are many ways of specifying the angle of a bond.
+\begin{description}
+\item[Predefined angles] \idx*{bond!angle!predefined}When the optional argument contains a whole number, this represents the angle that the bond makes with the horizontal, in multiples of 45\degres.
+
+\exemple{Predefined angles}|\chemfig{(-[1]1)(-[2]2)(-[3]3)(-[4]4)(-[5]5)(-[6]6)(-[7]7)-0}|
+
+\item[Absolute angle] \idx*{bond!angle!absolute}To give an angle in degrees relative to the horizontal, the optional argument must take this form: \verb-[:<absolute angle>]-. The \verb-<absolute angle>- may be positive or negative, and may have decimal places. It is reduced to the interval $[0,360)$.
+\item[Relative angle] \idx*{bond!angle!relative}It is often useful to give the bond angle relative to the preceding bond. In this case, the following syntax must be used:\verb-[::<relative angle>]-. The \verb-<relative angle>- may be positive or negative, and may have decimal places.
+\end{description}
+
+\subsection{Condensed structural diagram}
+\exemple{Hex-1-ene}|\chemfig{H_3C-{{(CH_2)}_3}-CH=CH_2}|
+
+It is sometimes useful to change the length of a bond\idx*{bond!length}. In the preceding example, the first two bonds need to be lengthened; they are too short compared to the double bond. To do this, the \verb|<coeff>| is needed in the optional arguments\idx*{bond!optional argument}.
+
+\exemple{Hex-1-ene}|\chemfig{H_3C-[,1.5]{{(CH_2)}_3}-[,1.5]CH=CH_2}|
+
+Notes:
+\begin{itemize}
+ \item in the notation \verb|[,1.5]|, the comma indicates that the value placed in brackets corresponds to the second argument (\verb|coeff|). To give a value for the fourth argument one would write \verb|[,,,2]|;
+ \item characters between braces are not interpreted by \CF, which allows (for example) groupings of atoms to be written inside parentheses without having them treated as part of a branched molecule (see page~\pageref{molecules.ramifiees}).
+\end{itemize}
+
+\subsection{Cram representation}
+\idx*{Cram representation}Another way of showing the bond angle between two atoms.
+\exemple{Methane}|\chemfig{C(-[5]H)(-[2]H)(<[:-70]H)(<:[:-20]H)}|
+
+\subsection{Skeleton diagram}
+\idx*{skeleton diagram}The simplest input, only covalent bonds are listed with their possible settings.
+\exemple{But-2-ene}|\chemfig{-[:30]=[:-30,,,,red]-[:30]}|
+
+The double bond lines are drawn on either side of where the single bond line would be. To keep graphical consistency between skeleton diagrams of various compounds it is useful to shift the second double bond line above or below the single bond line\idx*{bond!shifted}. Just follow the \verb-=- symbol with \verb-^- or \verb-_-, as shown below:
+\exemple{Comparison between double bonds and shifted double bonds}/\chemfig{-[:-30]=[:30]-[:-30]} \chemfig{-[:-30]=^[:30]-[:-30]}\par
+\chemfig{=[:-30]-[:30]=[:-30]} \chemfig{=_[:-30]-[:30]=^[:-30]}/
+
+\subsection{Lewis diagrams}
+\idx*{Lewis diagram}The syntax is as follows:
+\centerverb/\lewis{<position index><electron state>,<atom>}/
+\smallskip
+
+The electron states can be a lone pair, an empty electron slot, or a single electron. By default the electron state is a lone pair. A single electron is represented by the character \boxedfalseverb. and an empty slot by \boxedfalseverb|.
+
+\exemple{Chloromethane and water}|\chemfig{C(-[2]H)(-[4]H)(-[6]H)-\lewis{260,Cl}}\hspace{1cm}
+\chemfig{[:40]H-\lewis{13,O}-[::-80]H}|
+
+Note: the positions take whole number values between 0 and 7.
+\exemple{Positions}/\lewis{0.2.4.6.,C}\hspace{1cm}
+\lewis{0|2.46.,C}\hspace{1cm}
+\lewis{1357,Ar}/
+
+\section{Branched molecules}\label{molecules.ramifiees}
+\idx*{branched molecule}To indicate a branch, simply follow the atom holding the branch with a \verb-<code>- in parentheses. This \verb-<code>- is the code of the submolecule which will be attached to the atom. Multiple branches can be attached to the same atom, and these can be nested.
+
+\exemple{Alkanes}|\chemfig{H_3C-CH(-[2]CH_3)-CH_3}
+\hspace{.5cm}\chemfig{-(-[2])(-[6])-}|
+
+In this type of representation it is sometimes necessary to connect to distant atoms\idx*{bond!distant atoms}. To do this, the character \verb|?| is used, which creates a hook between two atoms. The function
+\centerverb/?[<name>,<bond>,<tikz>]/
+takes three arguments: the name of the hook, the bond type, and tikz code. The following example shows how to make two different hooks.
+
+\exemple*{Cocaine}|\chemfig{H_2C(-C?[a]H-[:-30]CH_2-[:30]C?[b]H-O-CO-C_6H_5)
+-[2]CH_2-[,1.7]CH(-[3]N?[a]-[3]H_3C)(-[,1.35]C?[b]H-CO-OCH_3)}|
+
+\section{Rings}
+\idx*{ring}\CF can easily draw regular polygons. The syntax is the following:
+\centerverb/\chemfig{*n(<code for the molecule>)}/
+\smallskip
+
+\exemple{Some rings}|
+\chemfig{*3(---)}\hspace{.5cm}
+\chemfig{*5(-=-=-)}\hspace{.5cm}
+\chemfig{*6(-=-=-=)}|
+
+\idx*{ring!branch}Branches are used in the same way as before.
+
+\exemple{Rings and branches}|\chemfig{*4(-(--[1]*4(----))---)}|
+
+Note: a ring does not start or finish with the atom or group of atoms with which one wants to close the ring. The chemical entity on which the ring is based must be outside the ring definition.
+
+\exemple{Proper coding}|\chemfig{A*4(-B-C-D-)}|
+
+\exemple{Bad coding}|\chemfig{*4(A-B-C-D-)}\hspace{1cm}
+ \chemfig{*4(-B-C-D-A)}|
+
+\section{Ions}
+The \verb|chemfig| commands enters the \idx{math mode}\footnote{There is a problem with the placement of groups of atoms containing exponents or subscripts. See page~\pageref{alignement.vertical}.} of \TeX, so it is very simple to write an ion. A negative charge ($-$) must always be enclosed in braces to avoid \CF confusing it with the symbol for a single bond.
+
+\exemple{Acetate ion}|\chemfig{-(-[1]O^{-})=[7]O}|
+
+For purists it is possible to circle the charge of an ion by using the commands \verb|\ominus| and \verb|\oplus|\idx*{charge!\protect\texttt{\protect\string\protect\oplus}}\idx*{charge!\protect\texttt{\protect\string\protect\ominus}}.
+
+To meet all requirements, there are two other commands \idx{\chemabove} and \idx{\chembelow} which allow placement of charges above or below the current atom\idx*\lewis.
+
+\exemple{Some ions}|\chemfig{-(-[1]O^{\ominus})=[7]O}
+\hspace{1cm}
+\chemfig{\lewis{35,O}=\lewis{26,Cl}-\chemabove
+{\lewis{026,O}}{\ominus}}
+\vskip5pt
+\chemfig{-\chemabove{N}{\scriptstyle\oplus}(=[1]O)-[7]O^{\ominus}}|
+
+For those who are extremely picky, the commands \idx{\chemabove} and \idx{\chembelow} accept an optional argument which sets the distance between the charge and the atom\idx*\lewis.
+\exemple{Charge position}|\chemfig{\lewis{35,O}=C-\chemabove
+[3pt]{\lewis{246,O}}{\hspace{.5cm}\ominus}}|
+
+\section{Chemical equations}
+Here is an example of a \idx{chemical reaction}:
+\exemple*{Chemical reaction}/\chemfig{**6(------)} \hspace{.5cm} + \hspace{.5cm} \chemfig{H_3C-Cl}
+\hspace{.5cm} $\xrightarrow{catalyst}$ \hspace{.5cm}
+\chemfig{**6(---(-)---)} \hspace{.5cm} + \hspace{.5cm} \chemfig{H-Cl}/
+
+\CF adds two new commands \idx{\chemsign} and \idx{\chemrel} which slightly simplify the preceding syntax.
+
+\exemple*{Using the \CF commands}|\setchemrel{0pt}{1.2em}{6em}
+\chemfig{**6(------)}\chemsign[0.5cm]+\chemfig{H_3C-Cl}
+\chemrel[\itshape\tiny Catalyst]{->}
+\chemfig{**6(---(-)---)}\chemsign[0.5cm]+\chemfig{H-Cl}|
+\newpage
+
+\part{Operation of \protect\CF}
+This part is devoted to describing the most common features of \CF. The outline of this description far exceeds that of ``\CF for the impatient``, but 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{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\idx*{separating atom mechanism}.
+
+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-[,1.75]C(=[:30,1.5]O)(-[:-30,1.5]OH)}}
+
+\section{Different types of bonds}
+\idx*{bond!types}As we have already seen (see page~\pageref{types.liaisons}), bonds can be one of nine types, each corresponding to the characters \boxedfalseverb-, \boxedfalseverb=, \boxedfalseverb~, \boxedfalseverb>, \boxedfalseverb<, \boxedfalseverb{>:}, \boxedfalseverb{<:}, \boxedfalseverb{>|} and \boxedfalseverb{<|}.
+
+\label{longueur.liaison}\idx*{bond!length}We must understand that when a bond is made between two atoms, these atoms are contained within invisible rectangular boxes. The centres 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 <=5pt,shorten >=5pt,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=5pt]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=-5pt]bl){};
+ \draw[blue,dash pattern=on 1pt off 1pt](bl)--([yshift=0.7cm]bl);
+ \draw[blue,dash pattern=on 1pt off 1pt]([xshift=-5pt]bl)--([xshift=-5pt,yshift=0.7cm]bl);
+ \draw[<->]([yshift=0.6cm]bl.center)--([xshift=-5pt,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=5pt]al)--([xshift=5pt,yshift=0.7cm]al);
+ \draw[<->]([yshift=0.6cm]al.center)--([xshift=5pt,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[<->]([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{setatomsep}The macro \verb-\setatomsep{<dimension>}-\idx*{\setatomsep} adjusts the interatomic distance $\Delta$. If the \verb-<dimension>- is empty, it takes the default value of 3em. This command, like all other settings commands, affects all the following molecules.
+
+\exemple{Interatomic distance}|\setatomsep{2em}\chemfig{A-B}\par
+\setatomsep{50pt}\chemfig{A-B}|
+
+\label{setbondoffset}\idx*{\setbondoffset}The command \verb-\setbondoffset{<dimension>}- sets the spacing $\delta$ between the bond line and the atom. If the \verb-<dimension>- is empty, $\delta$ takes the default value of 2pt.
+\exemple{Trimming bonds}|\setbondoffset{0pt}\chemfig{A-B}\par
+ \setbondoffset{5pt}\chemfig{A-B}|
+
+If one bond is followed immediately by another, then \CF inserts an empty group \verb-{}-. Around this empty group the separation $\delta$ is zero:
+\exemple{Empty groups}/\chemfig{A-B=-=C}/
+
+\label{modif.retrait} The spacing $\delta$ for just one bond can be specified with the character \verb-#-\idx*{\protect\symbol{'043}@\protect\texttt{\protect\symbol{'043}}}. 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}/\setbondoffset{4pt}
+\chemfig{A-B-C}\par
+\chemfig{A-#(,0pt)B-C}\par
+\chemfig{A-B-#(0pt)C}\par
+\chemfig{A-#(,0pt)B-#(0pt)C}/
+\endgroup
+
+By default, all atoms within groups of atoms are typeset in \idx{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\idx*{Cram representation}\idx*\setcrambond. This syntax is used: \label{setcrambond}
+\centerverb/\setcrambond{<dim1>}{<dim2>}{<dim3>}/
+\smallskip
+
+Any empty argument takes its default value. The three arguments are:
+\begin{itemize}
+ \item \verb-<dim1>- is the size of the base of the triangle, and is 1.5pt by default;
+ \item \verb-<dim2>- is the thickness of the dots, and is 1pt by default;
+ \item \verb-<dim3>- 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}-\setcrambond{10pt}{0.4pt}{1pt}
+ \chemfig{A>B>:C>|D}-
+
+\section{Bond angle}
+\idx*{bond!angle}\idx*{bond!optional argument|(}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}
+\idx*{bond!angle!predefined}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 up to \verb-[7]- which specifies an angle of 315\degres. The integer may lie outside the interval $[0,7]$, in which case the angle is reduced to the interval $[0,360)$.
+
+\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]}|
+
+\subsection{Absolute angles}
+\idx*{bond!angle!absolute}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}
+\idx*{bond!angle!relative}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}
+\idx*{bond!length}Rather than speaking of length of a bond, we should use the term interatomic spacing. If effect, only the interatomic spacing is adjustable with \idx{\setatomsep} 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.
+
+We see in the example above that is it sometimes necessary to increase (or perhaps reduce) the interatomic distance associated with a bond. 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\idx*{bond!length}.
+\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 \idx{size of molecules} by altering the font size or the argument of \idx{\setatomsep}, possibly on both \footnote{You can also use the second optional argument of \texttt{\string\chemfig}, see page~\pageref{arguments.optionnels}.}, being careful to confine these changes within a group if we want to limit the scope:
+\exemple{How to modify the size of molecule}/\normalsize \chemfig{H-[:30]O-[:-30]H}\par
+\setatomsep{2.5em}\chemfig{H-[:30]O-[:-30]H}\par
+\small \chemfig{H-[:30]O-[:-30]H}\par
+\footnotesize \chemfig{H-[:30]O-[:-30]H}\par
+\scriptsize \chemfig{H-[:30]O-[:-30]H}\par
+\tiny \chemfig{H-[:30]O-[:-30]H}/
+
+\section{Departure and arrival atoms}
+\idx*{bond!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:
+\centerverb/[,,<integer 1>,<integer 2>]/
+\smallskip
+
+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}
+\idx*{bond!customization}There is a fifth and last optional argument for bonds which is found after the fourth comma:
+\centerverb/[,,,,<tikz code>]/
+\smallskip
+
+\idx*{tikz}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-''\idx*{bond!invisible}. 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}
+\idx*{chemfig@\protect\texttt{\protect\string\protect\chemfig}}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
+\centerverb/[<angle>,<coeff>,<n1>,<n2>,<tikz code]/
+\smallskip
+
+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}|\idx*{bond!optional argument|)}
+
+\section{Branches}\idx*{branched molecule}
+\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 submolecule 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}
+\idx*{bond!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:
+\centerverb/?[<name>,<bond>,<tikz>]/
+\smallskip
+
+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}\idx*{ring|(}
+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:
+\centerverb/<atom>*<n>(<code>)/
+\smallskip
+
+\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\idx*{ring!unfinished}:
+\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\idx*{ring!inside arc}. To do so, the following syntax is used:
+\centerverb/<atom>**[<angle 1>,<angle 2>,<tikz>]<n>(<code>)/
+\smallskip
+
+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}
+\idx*{ring!angular position}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}
+\idx*{ring!branch}To have branches attached to the vertices of a ring, we use the syntax we have already seen:
+\centerverb/<atom>(<code>)/
+\smallskip
+
+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}
+\idx*{ring!nested}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 centre 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\idx*{bond!departure and arrival atoms}. Here, \verb/C-F/ and \verb/F-G/ must be connected by using the optional argument\idx*{bond!optional argument} of these bonds:
+\exemple{Forced departure and arrival atoms}|\chemfig{AB*5(-CDE-[,,1]F-[,,,1]GH-I-)}|\idx*{ring|)}
+
+\section{Representing electron movements}\label{mecanismes-reactionnels}\idx*{electron movements|(}
+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>}-''\idx*{"@}. 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 ``\idx{tikzpicture}'' environments. It is assumed that the viewer supports ``\idx{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 \idx{\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-\idx*{chemmove@\protect\texttt{\protect\string\protect\chemmove}|(}\footnote{Actually, the \texttt{\string\chemmove} command puts its argument in a ``\idx{tikzpicture}'' environment with the options ``\texttt{remember picture, overlay}''.} and has the following syntax if (for example) we need to connect a node named ``\verb-<name1>-'' to the node named ``\verb-<name2>-'':
+\centerverb|\chemmove[<opt>]{\draw[<tikz opt>](<name1>)<tikz link>(<name2>);}|
+\smallskip
+
+The optional argument \verb-<opt>- of the \verb-\chemmove- command will be added to the argument of the \idx{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.
+
+\exemple{Mesomeric effect 1}/\chemfig{@{a1}=_[@{db}::30]-[::-60]\lewis{2,X}}
+\chemrel{<->}
+\chemfig{\chemabove{\vphantom{X}}{\ominus}-[::30]=_[::-60]
+\chemabove{X}{\scriptstyle\oplus}}
+\chemmove{\draw[->](db).. controls +(80:8mm) and +(145:8mm).. (a1);}/
+
+As noted above, there is no comma after the node placed in the optional arguments of a bond; we write ``\verb|=_[@{db}::30]|'' and not ``\verb|=_[@{db},::30]|'' as one might be tempted to do.
+
+To link the nodes ``db'' and ``a1'' we have used the following syntax:
+\centerverb|\chemmove{\draw[->](db)..controls +(80:8mm) and +(145:8mm)..(a1);}|
+\medskip
+
+In this example we ask for an arrow (\verb/[->]/) and we use two \idx{control points}\footnote{To find all the ways of connecting two nodes with \TIKZ, read the documentation for that package.}. These will be located using polar coordinates at 80\degres{} and 8~mm from ``db'' for the first and at 145\degres{} and 8~mm from ``a1'' for the second. Though this syntax may seem complicated at first reading, one need not be alarmed because its use will usually be a matter of copying and pasting. Only the names and coordinates of the control points need be changed, as can be verified from the example below, where an arrow has been added from the lone pair (node ``dnl'' to the single bond (node ``sb'').
+\exemple{Mesomeric effect 2}/\chemfig{@{a1}=_[@{db}::30]-[@{sb}::-60]@{dnl}\lewis{2,X}}
+\chemrel{<->}
+\chemfig{\chemabove{\vphantom{X}}{\ominus}-[::30]=_[::-60]
+\chemabove{X}{\scriptstyle\oplus}}
+\chemmove{
+ \draw[->](db)..controls +(100:5mm) and +(145:5mm)..(a1);
+ \draw[->](dnl)..controls +(90:4mm) and +(45:4mm)..(sb);}/
+
+For our new arrow we have set the \idx{control points} as follows: 4~mm at an angle of 90\degres{} from ``dnl'' and 4~mm at an angle of 45\degres{} from ``sb''. But we are not completely satisfied, since we would like the arrow not to touch the line segment representing the lone pair. To do this we will add some options to our arrow.
+\exemple{Mesomeric effect 3}/\chemfig{@{a1}=_[@{db}::30]-[@{sb}::-60]@{dnl}\lewis{2,X}}
+\chemrel{<->}
+\chemfig{\chemabove{\vphantom{X}}{\ominus}-[::30]=_[::-60]
+\chemabove{X}{\scriptstyle\oplus}}
+\chemmove[->]{
+ \draw(db).. controls +(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, writing ``\verb|-stealth|'' instead of ``\verb|->|'', and we draw the arrow with a fine dashed red line. We also add the letter $\pi$ above the middle of the arrow:
+\exemple{Mesomeric effect 4}/\chemfig{@{a1}=_[@{db}::30]-[@{sb}::-60]@{dnl}\lewis{2,X}}
+\chemrel{<->}
+\chemfig{\chemabove{\vphantom{X}}{\ominus}-[::30]=_[::-60]
+\chemabove{X}{\scriptstyle\oplus}}
+\chemmove{
+ \draw[-stealth,thin,dash pattern= on 2pt off 2pt,red]
+ (db).. controls +(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 centre of node ``x1'' at a 90\degres{} angle relative to the horizontal and of the edge of the rectangular node. To get the arrow departure angle that we want, we must specify its position. After some trial and error, it is ``x1.57'':
+\exemple{Departure or arrival anchor point 2}/\chemfig{@{x1}\lewis{1:,X}}
+\hspace{2cm}
+\chemfig{@{x2}\lewis{2|,X}}
+\chemmove{\draw[->,shorten <=4pt,shorten >=4pt]
+ (x1.57).. controls +(60:1cm) and +(120:1cm).. (x2);}/
+
+In some cases it will be easier to use Cartesian coordinated for the \idx{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\idx*{charge!\protect\texttt{\protect\string\protect\oplus}}.
+\exemple{Esterification: step 1}/\setatomsep{7mm}
+\setchemrel{}{}{5mm}
+\chemfig{R-@{dnl}\lewis{26,O}-H}
+\chemsign{+}
+\chemfig{R-@{atoc}C([6]-OH)=[@{db}]O}
+\chemrel[\chemfig{@{atoh}\chemabove{H}{\scriptstyle\oplus}}]{<>}
+\chemmove[->,shorten <=2pt]{
+ \draw[shorten >=2pt](dnl)..controls +(90:1cm)and+(north:1cm)..(atoc);
+ \draw[shorten >=6pt](db)..controls +(north:5mm)and+(100:1cm)..(atoh);}/
+
+The use of the \verb|\chemabove{<code>}{<materiel>}|\idx*{\chemabove} command does not change the dimensions of the \idx{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\idx*{control points} with an angle of 110\degres{} at 1~cm from ``atoh'' and to shorten the arrow by 6pt. In the following example, the second step of the esterification reaction, we can see that the arrow can take more complicated forms without complicating the code.
+\exemple{Esterification: step 2}/\setatomsep{7mm}
+\setchemrel{}{}{5mm}
+\chemfig{R-O-C(-[2]R)(-[6]OH)-@{dnl}\lewis{26,O}H}\hspace{1cm}
+\chemfig{@{atoh}\chemabove{H}{\scriptstyle\oplus}}
+\chemmove{
+ \draw[->,shorten <=2pt, shorten >=7pt]
+ (dnl).. controls +(south:1cm) and +(north:1.5cm).. (atoh);}/
+
+The rest is left as an exercise to the reader\idx*{chemmove@\protect\texttt{\protect\string\protect\chemmove}|)}\idx*{electron movements|)}\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\idx*\chemname
+\centerverb/\chemname[<dim>]{\chemfig{<code of the molecule>}}{<name>}/
+\smallskip
+
+The \verb-<dim>-, which is 1.5ex by default, will be inserted between the \idx{baseline} of the molecule and the top of the letters of the \verb-<name>-. The \verb-<name>- will be centred relative to the molecule, but the \verb-<name>- may not contain multiple paragraphs. As we see in this example: \chemname{\chemfig{H-O-H}}{\scriptsize\bfseries The water molecule: $\mathrm{\mathbf{H_2O}}$}, the \verb-<name>- which is displayed under the molecule is taken into account only for the vertical size of the bounding box. The horizontal size of \verb-<name>- is always zero.
+
+Here is a reaction with the names under the molecules\idx*{chemical reaction}:
+\exemple*{Displaying names of molecules}/
+\chemname{\chemfig{R-C(-[:-30]OH)=[:30]O}}{Carboxylic acid}
+\chemsign{+}
+\chemname{\chemfig{R'OH}}{Alcohol}
+\chemrel{->}
+\chemname{\chemfig{R-C(-[:-30]OR')=[:30]O}}{Ester}
+\chemsign{+}
+\chemname{\chemfig{H_2O}}{Water}/
+
+There are some limitations to this command. Suppose we switch the acid and the alcohol on the left side:
+\exemple*{Name alignment 1}/
+\chemname{\chemfig{R'OH}}{Alcohol}
+\chemsign{+}
+\chemname{\chemfig{R-C(-[:-30]OH)=[:30]O}}{Carboxylic acid}
+\chemrel{->}
+\chemname{\chemfig{R-C(-[:-30]OR')=[:30]O}}{Ester}
+\chemsign{+}
+\chemname{\chemfig{H_2O}}{Water}/
+
+In fact, to draw the \verb-<name>- the command \idx{\chemname} inserts 1.5ex${}+{}$\emph{the largest of the depths\footnote{In \TeX{} terms, the depth is the dimension which extends vertically below the baseline.} of the molecules thus far} below the baseline of each molecule (light grey for the examples in this manual). The command \idx{\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 \idx{\chemnameinit} before and after the reaction:
+\exemple*{Name alignment 2}/
+\chemnameinit{\chemfig{R-C(-[:-30]OH)=[:30]O}}
+\chemname{\chemfig{R'OH}}{Alcohol}
+\chemsign{+}
+\chemname{\chemfig{R-C(-[:-30]OH)=[:30]O}}{Carboxylic acid}
+\chemrel{->}
+\chemname{\chemfig{R-C(-[:-30]OR')=[:30]O}}{Ester}
+\chemsign{+}
+\chemname{\chemfig{H_2O}}{Water}
+\chemnameinit{}/
+
+Finally, to write a name on multiple lines, the command \verb-\\-\idx*{\protect\symbol{'134}\protect\symbol{'134}@\protect\texttt{\protect\symbol{'134}\protect\symbol{'134}}} encountered in a \verb-<name>- causes a line break\footnote{Conversely, the command \texttt{\textbackslash par} is forbidden and causes a compilation error.}:
+\exemple*{Name on 2 lines}/
+\chemname{\chemfig{R-C(-[:-30]OH)=[:30]O}}{Carboxylic\\acid}
+\chemsign{+}
+\chemname{\chemfig{R'OH}}{Alcohol}
+\chemrel{->}
+\chemname{\chemfig{R-C(-[:-30]OR')=[:30]O}}{Ester}
+\chemsign{+}
+\chemname{\chemfig{H_2O}}{Water}
+\chemnameinit{}/
+\newpage
+
+\part{Advanced usage}\label{utilisation.avancee}
+\section{Separating atoms}\label{decoupage.atomes}
+The \idx{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\idx*{separating atom mechanism} 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 \idx{\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 \idx{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{}\idx*{Latex@\protect\LaTeX}
+ \item \verb|\def\printatom#1{\ifmmode\rm#1\else$\rm#1$\fi}|\qquad when compiling with $\varepsilon$\TeX{}\idx*{etex@$\protect\varepsilon$\protect\TeX} ou Con\TeX tX\idx*{ConTeXt@Con\protect\TeX{}t}.
+\end{itemize}
+
+One can modify the code of this macro to customize how atoms are displayed. In the following example, we redefine \idx{\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{Optional arguments}\label{arguments.optionnels}
+The \idx{\chemfig} command takes two optional arguments\idx*{chemfig@\protect\texttt{\protect\string\protect\chemfig}!optional arguments}; their syntax is as follows:
+\centerverb|\chemfig[<opt1>][<opt2>]{<molecule code>}|
+\smallskip
+
+The first optional argument \verb-<opt1>- contains \TIKZ instructions which will be passed to the \idx{tikzpicture} environment in which the molecule is drawn. The second optional argument \verb-<opt2>- contains \TIKZ instructions which will be executed when each node\footnote{These instructions are added to the end of the argument of \texttt{every node/.style\{<argument>\}}. This argument contains by default the following instructions: ``{\ttfamily anchor=base,inner sep=0pt,outer sep=0pt,minimum size=0pt}''.} is drawn.
+
+With the use of the first optional argument one can, for example, choose the global colour or thickness of lines:
+\exemple{Style choice}/\chemfig{A-B-[2]C}\par\medskip
+\chemfig[line width=1.5pt]{A-B-[2]C}\par\medskip
+\chemfig[red]{A-B-[2]C}/
+
+With the second optional argument, one can choose the colour of nodes drawn by \TIKZ, change the angle of the drawing or its scale\idx*{size of molecules}:
+\exemple{Style choices}/\chemfig{A-B-[2]C}\par\medskip
+\chemfig[][red]{A-B-[2]C}\par\medskip
+\chemfig[dash pattern=on 1pt off 2pt][red]{A-B-[2]C}\par\medskip
+\chemfig[][rotate=20]{A-B-[2]C}\par\medskip
+\chemfig[][scale=0.5]{A-B-[2]C}/
+
+\section{Vertical alignment}\label{alignement.vertical}
+\idx*{vertical alignment}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 \idx{baseline}:
+\exemple*{Vertical placement}/\Huge\setatomsep{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 \idx{\vphantom} of the departure atom, but does not include it in the contents of the arrival atom; this \idx{\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 \idx{\vphantom}. For the atoms ``\verb-C-'' and ``\verb-F-'', the heights of the immediately preceding atoms are taken into account, but those of the atoms ``\verb-A^1-'' and ``\verb-E_1-'' are ignored! It follows that these atoms are a little too high or too low, depending on the height of these bonds.
+
+We can show this by making visible the bounding boxes of the atoms; one sees clearly that the atoms ``\verb-B-'' and ``\verb-F-'' have bounding boxes that reflect the heights of the immediately preceding atoms:
+\exemple*{Vertical placement and bounding boxes}/\Huge\setatomsep{2em}
+\fboxsep=0pt
+\renewcommand\printatom[1]{\fbox{\ensuremath{\mathrm#1}}}
+\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 \idx{\vphantom} having the same height as the first, so that the height affects the following atoms:
+\exemple*{Vertical placement workaround}/\Huge\setatomsep{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 \idx{\vphantom}. Simply place the \idx{\chemskipalign} command in the group of atoms; the alignment will resume in the following group of atoms as if the group of atoms containing \idx{\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 \idx{\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 \idx{\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-#-''\idx*{\protect\symbol{'043}@\protect\texttt{\protect\symbol{'043}}} character, a feature seen on page~\pageref{modif.retrait}.
+\begingroup\catcode`;12 \catcode`#12
+\exemple{Use of \string\chemskipalign\ and #}/
+\begingroup
+\def\emptydisk{\chemskipalign\tikz\draw(0,0)circle(2pt);}
+\def\fulldisk{\chemskipalign\tikz\fill(0,0)circle(2pt);}
+\chemfig{A-\emptydisk-\fulldisk-B}\par
+\chemfig{A-#(,0pt)\emptydisk-#(0pt,0pt)\fulldisk-#(0pt)B}
+\endgroup/\endgroup
+
+\section{Shifted double bonds}
+\idx*{bond!shifted}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}
+\idx*{bond!delocalized}It is sometimes necessary to draw a double bond so that one line segment is dashed while the other is solid\footnote{Thanks to Andreas \textsc{Bröermann} who suggested this feature and who gave me the solution to this problem.}. This feature is not hard-coded into \CF; instead \TIKZ, its ``decorations'' library and its programmable styles make it possible.
+
+First of all, after having loaded the ``decorations'' library by putting \verb-\usetikzlibrary{decorations}- in the preamble, a decoration named ``ddbond'' (for Dashed Double Bond) is defined (lines 1 to 14) and then two \TIKZ styles called ``lddbond'' and ``rddbond'' (lines 15 and 16). For the former, the dashed line segment is on the left of the solid middle segment; for the latter it is on the right. These styles can be called with the fifth optional argument of bonds:
+\exemple*{Custom decorations}|\pgfdeclaredecoration{ddbond}{initial}
+{
+ \state{initial}[width=4pt]
+ {
+ \pgfpathlineto{\pgfpoint{4pt}{0pt}}
+ \pgfpathmoveto{\pgfpoint{2pt}{2pt}}
+ \pgfpathlineto{\pgfpoint{4pt}{2pt}}
+ \pgfpathmoveto{\pgfpoint{4pt}{0pt}}
+ }
+ \state{final}
+ {
+ \pgfpathlineto{\pgfpointdecoratedpathlast}
+ }
+}
+\tikzset{lddbond/.style={decorate,decoration=ddbond}}
+\tikzset{rddbond/.style={decorate,decoration={ddbond,mirror}}}
+\setatomsep{4em}
+\chemfig{[:-30]R-C-[::60]C(-[::60,,,,rddbond]O)-[,,,,lddbond]N(-[::-60]H)-[::60]C-R}|
+
+\section{Saving a sub-molecule}\label{definesubmol}
+\idx*{save a molecule}\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\idx*{\definesubmol}
+\centerverb|\definesubmol{<name>}{<code>}|
+\smallskip
+
+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 \idx{\definesubmol}. A warning will be issued to the user that the old alias will be overwritten by the new one. To override the definition of an alias made previously, use:\label{redefinesubmol}
+\centerverb|\redefinesubmol{<name>}{<code>}|\idx*{\redefinesubmol}
+\smallskip
+
+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\idx*{bond!angle!relative}, 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 \idx{\definesubmol} command takes an optional argument; its syntax is as follows:
+\centerverb/\definesubmol{<name>}[<code1>]{code2}/
+\medskip
+
+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\idx*{\definesubmol}:
+\exemple{Dual alias}/\definesubmol\Me[H_3C]{CH_3}
+\chemfig{*6((-!\Me)=(-!\Me)-(-!\Me)=(-!\Me)-(-!\Me)=(-!\Me)-)}/\idx*{save a molecule}
+
+\section{Decorations}
+\subsection{Lewis diagrams}\label{lewis}
+\idx*{Lewis diagram}The macro \idx{\lewis} allows placement of pairs of electrons, of single electrons, or of empty slots. This syntax is used:
+\centerverb|\lewis{<n1><n2>...<ni>,<atom>}|
+\smallskip
+
+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-\idx*{\lewis}:
+\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-|-''\idx*{\lewis}:
+\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 \idx{\lewis} are not included in the \idx{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.
+
+This can be seen more clearly by drawing an \verb-\fbox- around decorated atoms\idx*{\lewis}:
+\exemple{Bounding box and the \string\lewis\ macro}*\fboxsep0pt
+ \fbox{\lewis{0.2.4.6.,A}}\par\medskip
+ \fbox{\lewis{13,B}}*
+
+\label{setlewis}Several parameters can be set with the help of the macro\idx*{\setlewis}
+\centerverb|\setlewis[dim1]{<dim2>}{<dim3>}{<tikz code>}|
+\smallskip
+
+If an argument is empty, it takes its default value.
+\begin{itemize}
+ \item \verb-<dim1>- is the width of the rectangle which represents the empty slot obtained whith the character ``|'';
+ \item \verb-<dim2>- is the distance between the bounding box and the decoration. It is 0.2ex by default;
+ \item \verb-<dim3>- is the length of the line segment representing a pair of electrons. It is 1.5ex by default;
+ \item \verb-<code tikz>- is code which is passed directly to \TIKZ. This code is empty by default.
+\end{itemize}
+
+\idx*{\lewis}\exemple{Parameters for the \string\lewis\ macro}*\setlewis{4pt}{1.5em}{red}
+ \chemfig{A-\lewis{26,B}-C}\par\bigskip
+ \setlewis{}{}{line width=0.4pt}
+ \chemfig{A-\lewis{2|,B}-C}*
+
+\subsection{Stacking characters}
+The macros\label{chemabove}\idx*{\chemabove}
+\centerverb|\chemabove[<dim>]{<code>}{<stuff>}|
+and\idx*{\chembelow}
+\centerverb|\chembelow[<dim>]{<code>}{<stuff>}|
+\smallskip
+
+place the \verb-<stuff>- above and below the \verb-<code>- respectively at a vertical distance \verb-<dim>-, without changing the \idx{bounding box} of \verb-<code>-. The length \verb-<dim>- is 1.5pt by default.
+
+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\idx{ring!charge} 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}*
+
+\subsection{Chemical reactions}\idx*{chemical reaction}
+To write chemical reactions, \CF provides a command for the signs and a command for the arrows.
+
+\label{chemsign}The command \verb-\chemsign[<dim>]<sign>-\idx*{\chemsign} typesets the \verb-<sign>-, which is surrounded on both sides by an unbreakable horizontal space \verb-<dim>- defaulting to 0.5em.
+
+\label{chemrel}The command \verb-\chemrel[<arg1>][<arg2>]{<arrow code>}-\idx*{\chemrel} draws an arrow where the optional arguments \verb-<arg1>- and \verb-<arg2>- are placed above and below the arrow respectively, without modifying its bounding box. The \verb-<arrow code>- is passed directly to \TIKZ except when it involves ``\verb/<>/'', which allows two arrows to be drawn one above the other.
+\exemple{Types of arrows}*A\chemrel{->}B\par
+A\chemrel{<-}B\par
+A\chemrel{<->}B\par
+A\chemrel{<>}B\par
+A\chemrel{->,red,thick}B*
+
+\label{setchemrel}The command \verb-\setchemrel{<dim1>}{<dim2>}{<dim3>}-\idx*{\setchemrel} allows settings of the dimensions used in drawing the arrow:
+\begin{itemize}
+ \item \verb-<dim1>- is the vertical spacing between the arrow and the optional text above and/or below it. If the argument is empty, it defaults to 2pt;
+ \item \verb-<dim2>- is the unbreakable horizontal space inserted before and after the arrow. If the argument is empty, it defaults to 0.7em;
+ \item \verb-<dim3>- is the length of the arrow. If the argument is empty, if defaults to 4em.
+\end{itemize}
+
+\exemple{Text above arrows}*\setchemrel{1pt}{}{6em}
+A\chemrel[\footnotesize above][\tiny below]{<->}B*
+
+Here is an example of a chemical reaction:
+\exemple*{Chemical reaction}|\setchemrel{0pt}{1.2em}{6em}
+\chemfig{**6(------)}\chemsign+\chemfig{H_3C-Cl}
+\chemrel[\itshape\footnotesize Catalyst]{->}
+\chemfig{**6(---(-)---)}\chemsign+\chemfig{H-Cl}|
+
+And another:
+\exemple*{Synthesis of phenylacetylene}/\chemfig{*6(-=*6(-(-Br)-(-Br))-=-=)}
+\chemrel[\chemfig{NaNH_2}][\chemfig{NH_3}]{->}
+\chemfig{*6(-=(-~)-=-=)}/
+
+\section{Using {\protect\ttfamily\protect\textbackslash chemfig} in the {\protect\ttfamily tikzpicture} environment}
+It is possible to call the \idx{\chemfig} inside a {\ttfamily\idx{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 macro \idx{\setnodestyle}, 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 \verb-\setbondoffset{0pt}-\idx{\setbondoffset} so that the bonds touch the edges of the nodes. The interatomic spacing is increased to 75pt. Finally, the command \idx{\printatom} is made as simple as possible so that math mode is no longer used and spaces are thus preserved.
+\exemple*{An organization chart}/\setnodestyle{draw,inner sep=2pt}
+\setbondoffset{0pt}
+\setatomsep{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\idx*{\printatom}:
+\exemple*{Family diagram}/\setnodestyle{draw,circle,fill=cyan,minimum size=30pt}
+\setbondoffset{0pt}
+\setatomsep{80pt}
+\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\idx*{bond!angle!predefined}:
+\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\idx*{bond!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}
+\idx*{bond!angle!absolute}We will first of all draw the central chain with absolute angles. We set the default angle to $+30\degres$ with the optional argument\idx*{chemfig@\protect\texttt{\protect\string\protect\chemfig}!optional arguments}, 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\idx*{bond!branch} ``\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}
+\idx*{bond!angle!relative}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\idx*{ring!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)}|
+
+\idx*{ring!branch}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}
+\idx*{ring!nested}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}
+\idx*{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}
+\idx*{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}-''\idx*{\definesubmol}:
+\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}
+\idx*{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}
+\idx*{Haworth projection}The goal is to depict this D-glucopyranose molecule:
+{\setcrambond{2pt}{}{}
+\chemfig{HO-[2,0.5,2]?<[7,0.7](-[2,0.5]OH)-[,,,,line width=2pt](-[6,0.5]OH)>[1,0.7](-[6,0.5]OH)-[3,0.7]O-[4]?(-[2,0.3]-[3,0.5]OH)}}
+
+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\idx*{chemfig@\protect\texttt{\protect\string\protect\chemfig}!optional arguments} 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\idx*{\setcrambond}:
+\exemple{Structure}|\setcrambond{2pt}{}{}
+\chemfig{HO-[2,0.5,2]?<[7,0.7]-[,,,,
+line width=2pt]>[1,0.7]-[3,0.7]O-[4]?}|
+
+All that needs to be done now is to add the branches at the correct places, giving the right absolute angles and sometimes reducing the length to better give the illusion of perspective\idx*{\setcrambond}:
+\exemple{Haworth projection}|\setcrambond{2pt}{}{}
+\chemfig{HO-[2,0.5,2]?<[7,0.7](-[2,0.5]OH)-[,,,,
+line width=2pt](-[6,0.5]OH)>[1,0.7](-[6,0.5]OH)-[3,0.7]
+O-[4]?(-[2,0.3]-[3,0.5]OH)}|
+
+\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\idx*{ring!branch} 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\idx*{chemfig@\protect\texttt{\protect\string\protect\chemfig}!optional arguments}:
+\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\idx*{bond!invisible}.
+
+We could improve this code by considering that the drawing of the adrenaline molecule is made of two 6-rings adjacent\idx*{ring!nested} 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\idx*{\definesubmol}:
+\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\idx*{\definesubmol}:
+\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-''\idx*{\definesubmol}:
+\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\idx*{ring!nested}, 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\idx*{\chembelow}:
+\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}
+\idx*{color (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 \idx{\color} and \idx\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\idx*{separating atom mechanism}: here, the first atom sarts at ``\verb-C-'' and spreads to the next uppercase letter. Therefore, this atom is ``\verb-C\color{blue}-'' and the color change occurs at the end of atom and has no effect. We need to force \CF to cut the first atom just after ``\verb-C-'' with the character ``\verb-|-'' and then include \verb-\color{blue}H_3- between braces so that \CF does not stop the atom 2 before the uppercase ``\verb-H-'' which would leave the color change alone and therefore ineffective in an atom:
+
+\exemple{Colors}/\chemfig{C|{\color{blue}H_3}-C(=[1]O)-[7]O|{\color{red}H}}/
+
+The same effect can be obtained with \verb-\textcolor-:
+
+\exemple{Colors}/\chemfig{C|\textcolor{blue}{H_3}-C(=[1]O)-[7]O|\textcolor{red}{H}}/
+
+The main disadvantage is that we have to do the same for every atom that need to be colored, even if they are contiguous.
+
+\subsection{Add a superscript without modifying a bond}
+Adding a \idx{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 \idx\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 \idx\rlap, the \idx{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$''\idx*{charge!\protect\texttt{\protect\string\protect\oplus}}, some could find that the charge is too low: $\mathrm{A^\oplus}$. In that case, why not use \idx{\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 \idx{\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 \idx*{charge}, the best method is to attach an invisible bond \idx*{bond!invisible} to this vertex, which is done here with \idx{\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\idx*{bond!wavy}:
+
+\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-@-''\idx*{"@} and reuse these nodes after the molecule has been drawn to connect them with a curved line using \idx\chemmove:
+
+\exemple{Curved bonds}/\chemfig{@{a}A-[,,,,draw=none]@{b}B}
+\chemmove{\draw[-](a)..controls +(45:7mm) and +(225:7mm)..(b);}
+\bigskip
+
+\chemfig{*6(@{a}---@{b}---)}
+\chemmove{\draw[-](a)..controls +(60:3em) and +(240:3em)..(b);}
+\quad
+\chemfig{*6(@{a}---@{b}---)}
+\chemmove{\draw[-](a)..controls +(60:3em) and +(30:1em)..
+ ++(20:2em) ..controls +(210:3em) and +(-120:4em) ..(b);}/
+
+\subsection{Modify the size of a molecule}
+\idx{size of molecules}Two parameters determine the default size of a molecule: the font size and the parameter of \idx{\setatomsep} which is 3em the default. We can modify independently these two parameters to change the size of a molecule:
+
+\exemple{Change the size}/\definesubmol\hho{H-[:30]O-[:-30]H}
+\chemfig{!\hho}
+
+\setatomsep{2.5em}\chemfig{!\hho}
+
+\scriptsize\chemfig{!\hho}
+
+\tiny\chemfig{!\hho}\setatomsep{5em}\chemfig{!\hho}/
+
+You can use the optional second argument of \verb-\chemfig-\idx*{chemfig@\protect\texttt{\protect\string\protect\chemfig}!optional arguments} to \emph{globally} enlarge or reduce a molecule, i.e. the text and links will be reduced by the same ratio:
+
+\exemple{Global change of the size}/\definesubmol\hho{H-[:30]O-[:-30]H}
+\chemfig{!\hho}
+
+\chemfig[][scale=0.75]{!\hho}
+
+\chemfig[][scale=0.5]{!\hho}
+
+\chemfig[][scale=0.33]{!\hho}/
+
+\subsection{Draw a ploymer element}
+\idx*{polymer}The difficulty lies in the display of delimiters (parentheses or brackets) on bond. For this, we will again use the character ``\verb-@-''\idx*{"@} to define global nodes that will be used later as anchors for delimiters. We will assume that the node for the location of the opening delimiter is called ``opbr'' and the one of the closing delimiter ``clbr''.
+
+We will write a simple macro \verb-\setpolymerbracket-, followed by two characters which define the opening delimiter and closing delimiter.
+
+Then, the macro \verb-\makebraces- has an optional argument of the form ``\verb-<dim up>,<dim down>-''. These two dimensions are the height and depth of the delimiters from the baseline. The mandatory argument of \verb-\makebraces- is the subscript located at the right bottom of the closing delimiter.
+
+\exemple*{Polymers}|\newcommand\setpolymerdelim[2]{%
+ \def\delimleft{#1}\def\delimright{#2}}
+
+\def\definedelimdim#1,#2\enddefinedelim{\def\delimht{#1}\def\delimdp{#2}}
+
+\newcommand\makebraces[2][0pt,0pt]{%
+ \definedelimdim#1\enddefinedelim
+ \chemmove{%
+ \node[at=(opbr),yshift=(\delimht-\delimdp)/2]
+ {\llap{$\left\delimleft\strut\vrule height\delimht depth\delimdp width0pt \right.$}};%
+ \node[at=(clbr),yshift=(\delimht-\delimdp)/2]
+ {\rlap{$\left.\strut\vrule height\delimht depth\delimdp width0pt \right\delimright_{#2}$}};%
+ }%
+}
+\setpolymerdelim()
+Polyethylen:
+\chemfig{\vphantom{CH_2}-[@{opbr,1}]CH_2-CH_2-[@{clbr,0}]}\makebraces{n}
+\bigskip
+
+Polyvinyl chloride:
+\chemfig{\vphantom{CH_2}-[@{opbr,1}]CH_2-CH(-[6]Cl)-[@{clbr,0}]}
+\makebraces[0pt,15pt]{\!\!\!n}
+\bigskip
+
+Nylon 6:
+\chemfig{\phantom{N}-[@{opbr,1}]{N}(-[2]H)-C(=[2]O)-{(}CH_2{)_5}-[@{clbr,0}]}
+\makebraces[20pt,0pt]{}
+\bigskip
+
+Polycaprolactame:\setatomsep{2em}
+\chemfig{[:-30]-[@{opbr,1}]N(-[6]H)-[:30](=[2]O)--[:30]--[:30]--[@{clbr,0}:30]}
+\makebraces[5pt,5pt]{n}
+
+\setpolymerdelim[]
+Polyphenylen sulfide:
+\chemfig{\vphantom{S}-[@{opbr,1}]S-(**6(---(-[@{clbr,0}])---))}
+\makebraces[15pt,15pt]{}|
+
+\subsection{Draw the symmetrical of a molecule}\label{retournement}
+\idx*{symmetrical of a molecule}The two commands \idx{\hflipnext} and \idx{\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}
+\idx*{bond!with text}Once we have understood that the character ``\verb-@-''\idx*{"@} 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 \footnote{The \texttt{\string\si} command is provided by the \href{http://www.ctan.org / tex-archive/help/Catalogue/entries/siunitx.html}{\texttt{\textbf{siunitx }}} package.}.
+
+\idx*{bond!angle!arc}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\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\si\angstrom}
+\medskip
+
+Horizontal water molecule: \chemfig{@{1}H-[::37.775,2]@{2}O-[::-75.55,2]@{3}H}.
+\namebond{1}{2}{\footnotesize0.9584\si\angstrom}
+\namebond{2}{3}{\footnotesize0.9584\si\angstrom}
+\arclabel{0.5cm}{1}{2}{3}{\footnotesize104.45\si\degree}
+\qquad
+Water molecule rorated 30\si\degree: \chemfig{[:30]@1H-[::37.775,2]@2O-[::-75.55,2]@3H}
+\namebond12{\footnotesize0.9584\si\angstrom}
+\namebond23{\footnotesize0.9584\si\angstrom}
+\arclabel{0.5cm}{1}{2}{3}{\footnotesize104.45\si\degree}|
+
+\section{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<code>-\idx*\chemfig& draws the molecule whose design is described by the \verb-<code>-\\
+\verb-\printatom-\idx*\printatom& displays the atoms within the molecules. It can be redefined to customize the output. See page~\pageref{perso.affichage}\\
+\verb-\setnodestyle{<style tikz>}-\idx*\setnodestyle& using \TIKZ syntax, this macro defines the style of nodes containing the atoms. See page~\pageref{style.noeuds}\\
+\idx\hflipnext&the next molecule will be horizontally flipped\\
+\idx\vflipnext&the next molecule will be vertically flipped\\
+\verb-\definesubmol{<name>}[code1]{<code2>}-\idx*\definesubmol& creates an alias \verb-!<nom>- which can be put in the code of molecules to be drawn, and which will be replaced with \verb-<code1>- or \verb-<code2>- depending on the angle of the last bond. See page~\pageref{definesubmol}\\
+\idx\chemskipalign& tells the vertical alignment mechanism to ignore the current group of atoms. See page~\pageref{chemskipalign}.\\
+\verb-\redefinesubmol{<name>}{<code>}-\idx*\redefinesubmol & replaces a preexisting alias \verb-!<name>- with the new \verb-<code>-. See page~\pageref{redefinesubmol}\\[2ex]\hline
+&\\
+\verb-\setcrambond{<dim1>}{<dim2>}{<dim3>}-\idx*\setcrambond & sets the dimensions of the triangles representing Cram bonds: \verb-<dim1>- is the size of the base, \verb-<dim2>- is the spacing between the dashes and \verb-<dim3>- is the side of the dashes. See page~\pageref{setcrambond}\\
+\verb-\setatomsep{<dim>}>-\idx*\setatomsep & sets the interatomic distance. See page~\pageref{setatomsep}\\
+\verb-\setbondoffset{<dim>}-\idx*\setbondoffset & sets the space between bonded atoms and the bond. See page~\pageref{setbondoffset}\\
+\verb-\setdoublesep{<dim>}-\idx*\setdoublesep & sets the spacing between the two lines of a double bond. See page~\pageref{setdoublesep}\\[2ex]\hline
+&\\
+\verb-\lewis{<codes>,<atom>}-\idx*\lewis & displays the \verb-<atom>- and places Lewis dot decorations as specified in the \verb-<code>-. The dots drawn do not change the bounding box. See page~\pageref{lewis}\\
+\verb-\setlewis{<dim1>}{<dim2>}{<tikz code>}-\idx*\setlewis & sets the Lewis dot parameters; \verb-<dim1>- is the distance between the atoms and the decoration, \verb-<dim2>- is the length of the line representing the pair of electrons and \verb-<tikz code>- is code which is passed directly to \TIKZ. See page~\pageref{setlewis}\\[2ex]\hline
+&\\
+\verb-\chemmove[<tikz options>]<tikz code>-\idx*\chemmove & Makes a \verb-tikzpicture- environment, adding to it the \verb-<tikz options>-. Uses the \verb-<tikz code>- to join the nodes specified in the molecules with the help pf the ``\verb-@-'' character. See page~\pageref{mecanismes-reactionnels}.\\
+\verb-\chemsign[<dim>]<sign>-\idx*\chemsign & draws the \verb-<sign>-, placing before and after it an unbreakable space of length \verb-<dim>-. See page~\pageref{chemsign}\\
+\verb-\chemrel[<txt1>][<txt2>]{<arrow code>}-\idx*\chemrel & draws an arrow described by its \verb-<arrow code>- and places the optional text \verb-<txt1>- and \verb-<txt2>- above and below the arrow respectively. See page~\pageref{chemrel}\\
+\verb-\setchemrel{<dim1>}{<dim2>}{<dim3>}-\idx*\setchemrel & sets the dimensions of the arrow drawn with the command \verb-\chemrel-: \verb-<dim1>- is the vertical space between the arrow and the optional text, \verb-<dim2>- is the unbreakable horizontal space inserted before and after the arrow and \verb-<dim3>- is the length of the arrow. See page~\pageref{setchemrel}\\[2ex]\hline
+&\\
+\verb-\chemabove[<dim>]{<txt1>}{txt2}-\idx*\chemabove & 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}-\idx*\chembelow & writes \verb-{txt1}- and places \verb-<txt2>- below, leaving \verb-<dim>- of vertical space. This command does not change the bounding box of \verb-<txt1>-. See page~\pageref{chemabove}\\
+\verb-\chemname[<dim>]{<molecule>}{<name>}-\idx*\chemname & Places \verb-<name>- under the \verb-<molecule>-\\
+\verb-\chemnameinit-\idx*\chemnameinit & Initializes the greatest molecule depth to ensure correct alignment of the names of the following molecules.\\\hline
+\end{longtable}
+\end{center}
+\newpage
+
+\part{Gallery}
+This manual concludes with drawings of molecules of varying complexity.
+
+The curious user can look at the \verb-<code>- of each molecule, though it does become less attractive the more complex the molecule gets. Indeed, beyond a certain level of complexity, though it it is fairly easy to write \verb-<code>-, it becomes much harder to read the \verb-<code>- to analyze it afterwards. We quickly reached the limits of immediate readability of the code of a complex drawing.
+
+Anyway, I hope that this package will help all \LaTeX{} users wishing to draw molecules. Given the newness of this package, I hope that you will be forgiving with bugs you encounter and send me an \href{mailto:unbonpetit@gmail.com}{\texttt{\textbf{email}}} to let me know of any malfunctions or suggestions for improvement.\nobreak
+
+\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}/
+
+\idx*\definesubmol
+\idx*\phantom
+\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!@}/
+
+\idx*\definesubmol
+\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](!y)-[,1.5](!y)-[,1.5](!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)-)-=-=-)}/
+
+\idx*\setcrambond
+\exemple*{Camphor}/\chemfig{*6(-(<:[::120](-[::-100,0.7])(-[::100,0.7]))--(=O)-(-)(<:[::120])--)}
+\quad or \quad
+\setcrambond{3pt}{}{}
+\chemfig{<[:10](>[:85,1.8]?(-[:160,0.6])-[:20,0.6])
+>[:-10]-[:60](=[:30,0.6]O)-[:170]?(-[:30,0.6])-[:190]-[:240]}/
+
+\idx*\definesubmol
+\exemple*{Triphenylmethane}/\chemfig{*6(-=-*6(-(-*6(=-=-=-))-*6(=-=-=-))=-=)}
+\quad or \quad
+\definesubmol{@}{*6(=-=-=-)}
+\chemfig{(-[:-30]!@)(-[:90]!@)(-[:210]!@)}/
+
+\idx*\setcrambond
+\idx*\definesubmol
+\exemple*{Amygdalin}/\setcrambond{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(=-=-=-)}/
+
+\idx*\setcrambond
+\idx*\definesubmol
+\exemple*{Adenosine triphosphate}/\setcrambond{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]?=-=))
+-=-))-=-))-=-)}/
+
+\idx*\definesubmol
+\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>)--)}/
+
+\idx*\chembelow
+\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)--)---)}/
+
+\idx*\lewis
+\exemple*{A dye (red)}/\chemfig{**6(--*6(-(-NO_2)=-(-\lewis{26,O}-[0]H)=(-\lewis{4,N}=[0]\lewis{2,N}-[0]Ar)-)----)}/
+
+\idx*\lewis
+\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]?)}/
+
+\idx*\chembelow
+\idx*\chemsign
+\idx*\chemrel
+\exemple*{Fischer indole synthesis}/\chemfig{*6(=-*6(-\chembelow{N}{H}-NH_2)=-=-)}
+\chemsign+
+\chemfig{(=[:-150]O)(-[:-30]R_2)-[2]-[:150]R_1}
+\chemrel[$\mathrm{H^+}$]{-stealth}
+\chemfig{*6(-=*5(-\chembelow{N}{H}-(-R_2)=(-R_1)-)-=-=)}/
+
+\idx*\chemabove
+\idx*\chemrel
+\idx*\lewis
+\idx*{"@}
+\idx*\chemmove
+\idx*{charge!\protect\texttt{\protect\string\protect\oplus}}
+\idx*{charge!\protect\texttt{\protect\string\protect\ominus}}
+\exemple*{Reaction mechanisms: carbonyl group}/
+\chemfig{C([3]-)([5]-)=[@{db,.5}]@{atoo}\lewis{06,O}}
+\chemrel{<>}
+\chemfig{\chemabove{C}{\scriptstyle\oplus}([3]-)([5]-)-\chemabove
+ {\lewis{026,O}}{\hspace{5mm}\scriptstyle\ominus}}
+\chemmove{\draw[->,shorten <=2pt, shorten >=2pt](db) ..controls +(up:5mm) and +(up:5mm)..(atoo);}/
+
+\idx*\chembelow
+\idx*\lewis
+\idx*\chemabove
+\idx*{"@}
+\idx*\chemrel
+\idx*\chemmove
+\exemple*{Reaction mechanisms: nitro group}/
+\chemfig{R-\chembelow{N}{\hspace{-5mm}\scriptstyle\oplus}([1]=[@{db}]@{atoo1}O)([7]-[@{sb}]@{atoo2}
+ \chemabove{\lewis{157,O}}{\hspace{7mm}\scriptstyle\ominus})}
+\chemrel{<->}
+\chemfig{R-\chemabove{N}{\hspace{-5mm}\scriptstyle\oplus}([1]-\chemabove{O}{\scriptstyle\ominus})([7]=O)}
+\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);
+}/
+
+\idx*\lewis
+\idx*\chemsign
+\idx*\chemabove
+\idx*\chemmove
+\idx*\chemrel
+\idx*{"@}
+\idx*\chembelow
+\idx*{charge!\protect\texttt{\protect\string\protect\oplus}}
+\exemple*{Nucleophilic addition. Primary amines}/\chemfig{R-@{aton}\lewis{2,N}H_2}
+\chemsign{+}
+\chemfig{@{atoc}C([3]-CH_3)([5]-CH_3)=[@{atoo1}]O}
+\hspace{1cm}
+\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);}
+\chemrel[\tiny addition]{<>}
+\chemfig{R-@{aton}\chembelow{N}{\scriptstyle\oplus}H([2]-[@{sb}]H)-C(-[2]CH_3)(-[6]CH_3)-OH}
+\par
+\chemmove{
+ \draw[-stealth,dash pattern= on 1pt off 1pt,shorten <=3pt, shorten >=2pt]
+ (sb)..controls +(left:5mm) and +(135:2mm)..(aton);}
+\chemrel{<>}
+\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);}
+\chemrel[\tiny elimination]{<>}
+\chemfig{R-N=C(-[1]CH_3)(-[7]CH_3)}
+\chemsign{+}
+\chemfig{H_3\chemabove{O}{\scriptstyle\oplus}}/
+
+\idx*\setbondoffset
+\idx*\setatomsep
+\idx*\lewis
+\idx*\chemrel
+\idx*\chemsign
+\idx*\chemmove
+\idx*{"@}
+\exemple*{Reaction mechanism of chlorination}/\scriptsize
+\setbondoffset{1pt}\setatomsep{2em}
+\chemfig{Cl-[4]@{a0}(=[@{a1}:120]@{a2}O)-[:-120](=[:-60]O)-[4]Cl}\chemsign{+}
+\chemfig{*6(-=-=(-@{oh1}OH)-=)}\chemrel{-stealth}
+\chemfig{*6((-O-[:150](-[@{o0}:150]@{o1}\lewis{6.,O})(-[@{cl0}:60]@{cl1}Cl)-[:240](-[4]Cl)=[6]O)=-=-=-)}
+\chemrel{-stealth}\chemfig{*6((-O-[:150](=[2]O)-[:-150](=[6]O)-[:150]Cl)=-=-=-)}\chemsign{+}
+\chemfig{HCl}\par
+\chemfig{*6(-=*6(-O-*6(-@{o2}(=[@{o3}]@{o4}O)-Cl)=)-=-=)}\chemsign{+}
+\chemfig{*6(-=-=(-@{oh2}OH)-=)}\chemrel{-stealth}
+\chemfig{*6(-=*6(-O-(-(-[@{cl2}:60]@{cl3}Cl)(-[@{o5}:-120]@{o6}\lewis{6.,O})-O-[::-40]*6(=-=-=-))=)-=-=)}
+\kern-3em \chemrel{-stealth}\chemfig{[:30]*6(=-(-O-[:-60](=O)-[:-120](=[4]O)-[:-60]O-*6(=-=-=-))=-=-)}
+\kern-3em \chemsign{+}\chemfig{HCl}
+\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);}/
+
+\idx*\chemrel
+\idx*\chemabove
+\idx*\chembelow
+\idx*{"@}
+\idx*\chemmove
+\idx*{charge!\protect\texttt{\protect\string\protect\ominus}}
+\exemple*{Cannizzaro reaction}/\chemfig{[:-30]*6(=-=(-@{atoc}C([6]=[@{db}]@{atoo1}O)-H)-=-)}
+\chemrel[\chemfig{@{atoo2}\chemabove{O}{\scriptstyle\ominus}}H]{-stealth}
+\chemmove[-stealth,shorten >=2pt,dash pattern=on 1pt off 1pt,thin]{
+ \draw[shorten <=8pt](atoo2) ..controls +(up:10mm) and +(up:10mm)..(atoc);
+ \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);}
+\vspace{1cm}
+\par
+\chemrel{-stealth}
+\chemfig{[:-30]*6(=-=(-C([1]-@{atoo2}O-[@{sb}0]@{atoh}H)([6]=O))-=-)} \hspace{1cm}
+\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);}/
+
+\begingroup
+\catcode`;=12
+\idx*\setbondoffset
+\idx*\setatomsep
+\idx*\chemrel
+\idx*{"@}
+\idx*\chemabove
+\idx*\chemmove
+\idx*\lewis
+\idx*{charge!\protect\texttt{\protect\string\protect\oplus}}
+\exemple*{Beckmann rearrangement}/
+\setbondoffset{1pt}
+\setatomsep{2.5em}
+\chemfig{(-[:-150]R')(-[:-30]R)=[2]N-[:30]OH}
+\kern-1em
+\chemrel[\chemfig{\chemabove{H}{\kern10pt\scriptstyle\oplus}}]{<>}
+\kern-0.5em
+\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);
+}
+\kern-1.5em
+\chemrel[\chemfig{{-}H_2O}]{<>}
+$\left[\begin{tabular}{c}
+ \chemfig{R'-\lewis{2:,N}=@{a1}\chemabove{C}{\scriptstyle\oplus}-R}\\
+ \tikz\draw[stealth-stealth](0,3mm)--(0,-3mm);\\
+ \chemfig{R'-\chemabove{N}{\scriptstyle\oplus}~C-R}
+\end{tabular}\right]$
+\chemrel[\chemfig{H_2@{a0}\lewis{0:2:,O}}]{<>}\par
+\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)}
+\chemrel[\chemfig{{-}\chemabove{H}{\kern10pt\scriptstyle\oplus}}]{<>}
+\chemfig{*6(R\rlap{$'$}-N=(-R)-OH)}
+\chemrel{-stealth}
+\chemfig{*6(R\rlap{$'$}-\chembelow{N}{H}-(-R)(=[2]O))}
+/
+\endgroup
+
+\idx*\definesubmol
+\idx*\setatomsep
+\idx*\chemname
+\idx*\chemsign
+\idx*\chemrel
+\idx*\chemmove
+\idx*{charge!\protect\texttt{\protect\string\protect\oplus}}
+\exemple*{Sulfonation of naphthalene}/\newcommand\putchemnode[1]{\begin{tikzpicture}[remember picture]\node(#1){};\end{tikzpicture}}
+\definesubmol\cycleoplus{-[,0.25,,,draw=none]\oplus}
+\definesubmol{so2oh}{S(=[::90]O)(=[::-90]O)-OH}
+\footnotesize
+\setatomsep{2.5em}
+\begin{tabular}{ll}
+&\putchemnode{l1}\chemname{\chemfig{*6(=-*6(-=-(!\cycleoplus)-(-SO_3H)-)=-=-)}}{1-arenium ion}
+\chemrel{-stealth}
+\chemname{\chemfig{*6(=-*6(-=-=(-!{so2oh})-)=-=-)}}{1-naphthalenesulfonic acid}\\
+\chemname{\chemfig{*6(=-*6(-=-=-)=-=-)}}{Naphthalene}
+\chemsign{+}
+\chemfig{H_2SO_4}\putchemnode{a}\kern1cm&\\[-5ex]
+&\putchemnode{l2}\chemname{\chemfig{*6(=-*6(-=-(-SO_3H)-(!\cycleoplus)-)=-=-)}}{2-arenium ion}\kern-3em
+\chemrel{-stealth}
+\chemname{\chemfig{*6(=-*6(-=-(-!{so2oh})=-)=-=-)}}{2-naphthalenesulfonic acid}
+\end{tabular}
+\chemmove[-stealth,yshift=1cm]{
+ \draw(a)--node[sloped,above]{80\degres C}(l1);\draw(a)--node[sloped,above]{160\degres C}(l2);}/
+
+\begingroup\catcode`;12
+\idx*\chemname
+\idx*\color
+\idx*\lewis
+\idx*{"@}
+\idx*\chemmove
+\idx*{charge!\protect\texttt{\protect\string\protect\delta}}
+\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);
+}}/
+\endgroup
+
+\idx*\setatomsep
+\idx*\printatom
+\idx*\setbondoffset
+\idx*\definesubmol
+\idx*\redefinesubmol
+\exemple*{Crystallography}/\newcommand\disk{\tikz\draw[fill=black,overlay](0,0)circle(2pt);}
+\setatomsep{20pt}
+\renewcommand\printatom[1]{#1}
+\setbondoffset{2pt}
+\definesubmol{hat}{-[:40,1.5]\disk-[::-30,2]\disk-[::-30,2]\disk-[::-120,2]\disk-[::-30,2]\disk}
+\definesubmol{motif}{-[:40,1.5]\disk(-[2,3])-[::-30,2]\disk
+(-[2,3])-[::-30,2]\disk(-[2,3])-[::-120,2]\disk(-[2,3])-[::-30,2]\disk}
+\chemfig{\disk?[a](-[2,3]\disk?[b](-[2,3]\disk?[c]!{hat}?[c])!{motif}?[b](-[2,3]))!{motif}?[a](-[2,3])}
+\qquad
+\redefinesubmol{motif}{\disk(-[2,3])(-[:42,3.6,,,draw=none]\disk)-[:30,2.6]\disk
+(-[2,3])-[0,3]\disk(-[2,3])-[:-150,2.6]\disk(-[4,3])-[2,3]-[4,3]}
+\redefinesubmol{hat}{\disk-[:30,2.6]\disk-[0,3]\disk-[:-150,2.6]\disk-[4,3]}
+\chemfig{!{motif}!{motif}!{hat}}
+\qquad
+\redefinesubmol{motif}{(-[2,3])(-[:25,2.75,,,white]-[2,1.5,,,white]\disk)-[:50,3]\disk
+(-[2,3])-[::-50,3]\disk(-[2,3])-[::-130,3]\disk-[2,3]-[4,3]\disk}
+\redefinesubmol{hat}{-[:50,3]\disk-[::-50,3]\disk-[::-130,3]\disk}
+\chemfig{-[4,3]\disk!{motif}(-[:25,2.75,,,draw=none]\disk?[uat]?[dat](-[::0,2.75]?[uat1]?[dat1]
+-[::-90,1.3]\disk?[uat2]?[dat2])-[::-90,1.3]-[:25,2.75])!{hat}?[uat3]?[dat3]-[:50,1.5]
+(-[6,1.5,,,draw=none]\disk?[dat,,,blue]?[dat1,,,blue]?[dat2,,,blue]?[dat3,,,blue])
+-[2,1.5,,,draw=none]\disk?[uat,,,red]?[uat1,,,red]?[uat2,,,red]?[uat3,,,red]}/
+
+\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)-)}/
+
+\idx*{(\kern1cm)|see{branched molecule}}
+\idx*{?@\protect\texttt{?}|see{bond/distant atoms}}
+\idx*{interatom length|see{bond/length}}
+\idx*{*|see{ring}}
+\idx*{**|see{ring/inside arc}}
+\idx*{\protect\symbol{'0174}@\protect\texttt{\protect\symbol{'0174}}|see{separating atom mechanism}}
+\idx*{>, <, >\protect\symbol{'0174}, <\protect\symbol{'0174}, >:, <:@\protect\texttt>, \protect\texttt<, \protect\texttt{>\protect\symbol{'0174}}, \protect\texttt{<\protect\symbol{'0174}}, >\protect\string:, <\protect\string:|see{Cram diagram}}
+\idx*{-, =, \protect\string\protect~@\protect\texttt-, \protect\texttt=, \protect\texttt{\protect\string~}|see{bond/types}}
+\idx*{=\protect\string_, =\protect\string^@\protect\texttt{=\protect\string_}, \protect\texttt{=\protect\string^}|see{bond/shifted}}
+\idx*{"!|see{save a molecule}}
+%
+%
+\clearpage
+\phantomsection
+\addcontentsline{toc}{part}{Index}
+\printindex
+\end{document} \ No newline at end of file
diff --git a/Master/texmf-dist/doc/generic/chemfig/chemfig_doc_fr.pdf b/Master/texmf-dist/doc/generic/chemfig/chemfig_doc_fr.pdf
new file mode 100644
index 00000000000..44ce3e02a9f
--- /dev/null
+++ b/Master/texmf-dist/doc/generic/chemfig/chemfig_doc_fr.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/generic/chemfig/chemfig_doc_fr.tex b/Master/texmf-dist/doc/generic/chemfig/chemfig_doc_fr.tex
new file mode 100644
index 00000000000..292d37847e0
--- /dev/null
+++ b/Master/texmf-dist/doc/generic/chemfig/chemfig_doc_fr.tex
@@ -0,0 +1,2082 @@
+% _________________________________________________________________
+% | |
+% | |
+% | Documentation de ChemFig |
+% | |
+% | 7 mars 2011 |
+% | |
+% |_________________________________________________________________|
+%
+% Ceci est chemfig_doc_fr.tex, le code LaTeX de la documentation en
+% français de chemfig.
+%
+% Maintainer: Christian Tellechea
+% E-mail : unbonpetit@gmail.com
+% Comments, bug reports and suggestions are welcome.
+% Licence : Released under the LaTeX Project Public License v1.3c or
+% later, see http://www.latex-project.org/lppl.txt
+% Copyright : Christian Tellechea 2010-2011
+%
+% L'extension "chemfig" est constituée de ces 8 fichiers :
+% chemfig.tex (le code de l'extention)
+% chemfig.sty (le fichier pour LaTeX)
+% t-chemfig.tex (le fichier pour ConTeXt)
+% README
+% chemfig_doc_fr.tex, chemfig_doc_fr.pdf (documentation en français)
+% chemfig_doc_en.tex, chemfig_doc_en.pdf (documentation en anglais)
+%
+% -------------------------------------------------------------------
+% This work may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either version 1.3
+% of this license or (at your option) any later version.
+% The latest version of this license is in
+%
+% http://www.latex-project.org/lppl.txt
+%
+% and version 1.3 or later is part of all distributions of LaTeX
+% version 2005/12/01 or later.
+% -------------------------------------------------------------------
+% This work has the LPPL maintenance status `maintained'.
+%
+% The Current Maintainer of this work is Christian Tellechea
+% -------------------------------------------------------------------
+\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}
+\renewcommand*\oldstylenums[1]{{\fontfamily{fxlj}\selectfont #1}}
+\usepackage[scaled=0.8]{luximono}
+\usepackage{amsmath}
+\usepackage{array}
+\usepackage{longtable}
+\usepackage{xspace}
+\usepackage{fancybox}
+\usepackage{boites}
+\usepackage{textcomp}
+\usepackage{enumitem}
+\usepackage{chemfig}
+\usepackage{siunitx}
+\usetikzlibrary{decorations.pathmorphing}
+\usepackage{emerald}
+\usepackage[protrusion=true,expansion,final,babel=true]{microtype}
+\usepackage{fancyhdr}
+\fancypagestyle{plain}{%
+ \fancyhead[L]{\colorbox{gray!40}{\rlap{\small\bfseries\CF}\kern\dimexpr\linewidth-2\fboxsep}}
+ \fancyhead[C]{}
+ \fancyhead[R]{\scriptsize\slshape\leftmark\kern0.5em}
+ \fancyfoot[l]{\tiny Compilé par Christian \textsc{Tellechea}, le \today.}
+ \fancyfoot[c]{}
+ \fancyfoot[r]{\thepage}}
+\renewcommand\headrulewidth{0pt}
+
+\makeatletter
+\let\gobble\@gobble
+\newcommand\idx{\@ifstar{\let\print@or@not\@gobble\idx@}{\let\print@or@not\@firstofone\idx@}}
+\newcommand\idx@[1]{%
+ \ifcat\expandafter\noexpand\@car#1\@nil\relax% si sc
+ \expandafter\ifx\@car#1\@nil\protect
+ \index{#1}%
+ \print@or@not{#1}%
+ \else
+ \expandafter\index\expandafter{\expandafter\@gobble\string#1@\protect\texttt{\protect\string\protect#1}}%
+ \print@or@not{\texttt{\string#1}}%
+ \fi
+ \else
+ \index{#1}%
+ \print@or@not{#1}%
+ \fi
+}
+
+\newcommand\make@car@active[2]{%
+ \catcode`#1\active
+ \begingroup
+ \lccode`\~`#1\relax
+ \lowercase{\endgroup\def~{#2}}%
+}
+
+\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\,{\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
+ \ECFAugie
+ \fboxsep\z@
+ \colorbox{black}{\kern0.25em\color{white}\footnotesize\lower0.5ex\hbox{\strut#2}\kern0.25em}%
+ \leaders\bkvz@bottom\hfill
+ \vrule\@width\fboxrule\@height\fboxrule}}%
+ \breakbox
+ \kern.5ex\relax
+ \ttfamily\footnotesize\the@code\par
+ \normalfont
+ \kern3pt
+ \hrule height0.1pt width\linewidth depth0.1pt
+ \vskip5pt
+ \rightskip0pt plus 1fill
+ \everypar{{\color{lightgray}\rlap{\vrule height0.1pt width\linewidth depth0.1pt}}\hskip0pt plus 1fill}%
+ \newlinechar`\^^M\everyeof{\noexpand}\scantokens{#3}\par
+ \endbreakbox
+ \endgroup
+ \else
+ \vskip0.5ex
+ \boxput*(0,1)
+ {\fboxsep\z@
+ \hbox{\ECFAugie\colorbox{black}{\leavevmode\kern0.25em{\color{white}\footnotesize\strut#2}\kern0.25em}}%
+ }%
+ {\fboxsep5pt
+ \fbox{%
+ $\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
+}
+
+\newcommand\falseverb[1]{{\ttfamily\detokenize{#1}}}
+
+\long\def\centerverb#1{%
+ \def\centerverb@i##1#1{##1\hfill\null\par\egroup}
+ \bgroup
+ \ttfamily\@noligs
+ \parskip3.5pt\par\hfill
+ \let\do\@makeother\dospecials
+ \@vobeyspaces
+ \centerverb@i}
+
+\makeatother
+
+\usepackage[frenchb]{babel}
+\frenchbsetup{StandardLists=true}
+
+\newcommand\CF{{\ECFAugie ChemFig}\xspace}
+\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}}}}
+
+\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\Large\filcenter\sffamily\bfseries}%
+ {\LARGE\MakeUppercase{\partname}}%
+ {1pc}%
+ {\titlerule\vspace{1pc}\Huge}
+
+\begin{filecontents*}{chemfig_doc_fr.ist}
+% Fichier de style makeindex
+heading_prefix "{\\bfseries\\hfill "
+heading_suffix "\\hfill\\null}\\nopagebreak\n"
+headings_flag 1
+symhead_positive "Symboles"
+symhead_negative "Symboles"
+delim_0 "\\dotfill"
+delim_1 "\\dotfill"
+delim_2 "\\dotfill"
+\end{filecontents*}
+
+\usepackage{makeidx}
+\makeindex
+\begin{document}
+\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}\ECFAugie\fontsize{50pt}{50pt}\selectfont\CF\par
+ \Large v\csname CF@ver\endcsname\par\bigskip
+ \footnotesize\csname CF@fr@date\endcsname\par
+ \normalsize Christian Tellechea\par\vskip1.5cm
+ \huge Une extension \TeX{} pour dessiner des molécules%
+ \end{center}
+ \vskip4cm
+ \begin{center}
+ \scriptsize
+ \setatomsep{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
+ {\ECFAugie\small Le taxotère}%
+ \end{center}
+ \vskip1.5cm
+ \hfill
+ \hbox to 0pt{\hss
+ \scriptsize
+ \setbondoffset{1pt}
+ \setatomsep{2em}
+ \chemfig{(-[:-150]R')(-[:-30]R)=[2]N-[:30]OH}%
+ \kern-1em
+ \chemrel[\chemfig{\chemabove{H}{\kern10pt\scriptstyle\oplus}}]{<>}%
+ \kern-0.5em
+ \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);
+ }
+ \kern-1.5em
+ \chemrel[\chemfig{{-}H_2O}]{<>}%
+ $\left[\begin{tabular}{c}
+ \chemfig{R'-\lewis{2:,N}=@{a1}\chemabove{C}{\scriptstyle\oplus}-R}\\
+ \tikz\draw[stealth-stealth](0,3mm)--(0,-3mm);\\
+ \chemfig{R'-\chemabove{N}{\scriptstyle\oplus}~C-R}
+ \end{tabular}\right]$%
+ \chemrel[\chemfig{H_2@{a0}\lewis{0:2:,O}}]{<>}%
+ \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)}%
+ \chemrel[\chemfig{{-}\chemabove{H}{\kern10pt\scriptstyle\oplus}}]{<>}%
+ \chemfig{*6(R\rlap{$'$}-N=(-R)-OH)}%
+ \chemrel{-stealth}%
+ \chemfig{*6(R\rlap{$'$}-\chembelow{N}{H}-(-R)(=[2]O))}\par\bigskip
+ \hss}\hfill\null
+ \begin{center}
+ \ECFAugie\small RĂ©arrangement de Beckmann%
+ \end{center}
+\end{titlepage}
+\parindent0pt\pagestyle{plain}
+\tableofcontents
+\parskip\medskipamount
+\vspace{2cm}
+
+\setitemize{leftmargin=3em,topsep=0pt,parsep=0pt,itemsep=0pt,label=--}
+\part{Introduction}
+\section{Nouveautés de la version 0.4}
+Voici les nouveautés de la version 0.4 :
+\begin{enumerate}
+ \item Le code a été ré-écrit en plain $\varepsilon$\TeX\idx*{etex@$\protect\varepsilon$\protect\TeX}. L'extention est donc utilisable avec \LaTeX{}\idx*{Latex@\protect\LaTeX} et avec Con\TeX{}t\idx*{ConTeXt@Con\protect\TeX{}t}.;
+ \item Corrections de bugs.
+\end{enumerate}
+
+\section{Avant propos}
+Cette extension a pu voir le jour grâce à l'aide de Christophe \textsc{Casseau} qui en a eu l'idée après s'être confronté à la complexité de la syntaxe de l'extension \href{http://www.ctan.org/tex-archive/help/Catalogue/entries/ppchtex.html}{\texttt{\textbf{ppchtex}}}.
+
+Il m'a aidé tout au long de l'écriture du code à trouver des fonctionnalités intéressantes. Il m'a souvent encouragé à coder des fonctionnalités plus avancées alors que j'étais parfois (presque toujours ?) réticent et donc, si \CF a les fonctionnalités qu'il a, c'est en grande partie grâce à lui. Je lui adresse également mes remerciements pour les tests qu'il a effectués lors des versions beta de cette extension et pour sa contribution à l'écriture de ce manuel.\medskip
+
+\begingroup
+\leftskip0.1\linewidth
+\rightskip0.1\linewidth
+\itshape\small
+L'expérience montre qu'il est toujours difficile d'associer le dessin des molécules à la qualité typographique d'un logiciel comme \LaTeX, de ce fait l'utilisateur exigeant et désireux d'avoir un format vectoriel pour ses molécules n'a que peu de choix. Après avoir abandonné en raison de sa complexité le package \emph{ppchtex} développé pour con\TeX t et disponible sous \LaTeX, je me suis tourné vers le monde des logiciels extérieurs à \LaTeX. La difficulté est dans ce cas de trouver un compromis entre qualité et gratuité. Après de nombreux essais infructueux le seule alternative était qu'un nouveau package pour les molécules voit le jour et je remercie vivement Christian \textsc{Tellechea} pour la réalisation de \CF. Il a su être attentif à toutes mes exigences, \CF devait être simple d'utilisation mais posséder des fonctionnalités étendues autant dire que ce n'était pas gagné. Il a pourtant su composer un code \TeX{} d'une grande souplesse avec lequel je prends beaucoup de plaisir à écrire mes molécules. J'espère qu'il en sera de même pour vous lecteur à la recherche d'un package efficace dans ce domaine de la chimie.\smallskip
+
+\hfill Christophe \textsc{Casseau}\kern0.1\linewidth
+\endgroup\medskip
+
+Enfin, je tiens à chaleureusement remercier Theo \textsc{Hopman} qui m'a spontanément proposé d'effectuer la traduction de ce manuel en anglais.
+
+\section{Présentation}
+Pour charger \CF, il faut Ă©crire :
+\begin{itemize}
+ \item {\color{blue}\verb-\input chemfig.tex-} avec $\varepsilon$\TeX\idx*\input;
+ \item {\color{blue}\verb-\usepackage{chemfig}-} avec \LaTeX\idx*{Latex@\protect\LaTeX}\idx*\usepackage;
+ \item {\color{blue}\verb-\usemodule[chemfig]-} avec Con\TeX t\idx*{ConTeXt@Con\protect\TeX{}t}\idx*\usemodule.
+\end{itemize}
+
+Dans tous les cas, le package \TIKZ\idx*{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>}|\idx*\chemfig. 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\idx*{tikz}, placées à l'intérieur de l'environnement \verb|tikzpicture|\idx*{tikzpicture}. Le choix de \TIKZ implique que:
+\begin{itemize}
+\item l'utilisateur a le choix pour le moteur de compilation\idx*{mode de compilation} : pdf\LaTeX{} peut indifféremment être utilisé en mode dvi\idx*{dvi (mode)} (tex $\longrightarrow$ dvi $\longrightarrow$ ps $\longrightarrow$ pdf) ou en mode pdf\idx*{pdf (mode)} (tex $\longrightarrow$ pdf). En effet, \TIKZ, via la sous-couche \idx{pgf}, donne des résultats graphiques identiques dans les deux modes;
+\item la boîte englobante\idx*{boite englobante@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\idx*{boite englobante@boîte englobante} pour cette molécule : {\fboxsep0pt \fbox{\chemfig{H_3C-C(-[:-30]OH)=[:30]O}}}. \CF placera toujours le premier atome de la molécule sur la \idx{ligne de base} du code qui précède.
+\end{itemize}
+\newpage
+
+\part{\protect\CF pour l'impatient}
+Cette partie est un condensé non exhaustif des fonctionnalités de \CF. L'objectif est d'introduire les notions de base permettant au lecteur de dessiner ses premières molécules le plus vite possible. Cette partie ne donne pas de connaissance approfondie. Une utilisation plus avancée et une approche nettement plus formelle des commandes de \CF sera abordée dans les parties suivantes.
+
+\section{Syntaxe}
+La commande \idx{\chemfig} s'utilise de la manière suivante :
+\centerverb/\chemfig{<atome1><type de liaison>[<angle>,<coeff>,<n1>,<n2>,<code tikz>]<atome2>}/
+
+\begin{itemize}
+\item \verb-<angle>- est l'angle de la liaison\idx*{liaison!angle} entre deux atomes;
+\item \verb-<coeff>- est le coefficient multiplicateur de la longueur de liaison\idx*{liaison!longueur} par défaut;
+\item \verb-<n1>- et \verb-<n2>- sont les numéros de l'atome de départ et de l'atome d'arrivée de la liaison\idx*{liaison!atome de départ et d'arrivée};
+\item \verb-<code tikz>- est l'option supplémentaire de couleurs ou de formes pour une liaison\idx*{liaison!personnalisation}.
+\end{itemize}
+\medskip
+Chaque liaison\idx*{liaison!argument optionnel} admet des arguments optionnels qui se mettent entre crochets. Ces arguments permettent de régler tout ce dont on a besoin pour la liaison. Chaque argument possède une valeur par défaut. On peut écrire très simplement :
+\exemple{La molécule d'eau}|\chemfig{H-O-H}|
+
+Pour cet exemple comme pour tous les autres, la ligne grise représente la \idx{ligne de base}.
+
+\section{Les différents types de liaisons}
+\idx*{liaison!types}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{setdoublesep}La commande \verb-\setdoublesep{<dim>}-\idx*{\setdoublesep} permet de régler l'espacement entre les traits des liaisons doubles ou triples. Cet espacement vaut 2pt par défaut.
+
+\section{Les différents types de formules}
+\subsection{Formule développée}
+\exemple{L'Ă©thane}|\chemfig{C(-[2]H)(-[4]H)(-[6]H)-C(-[2]H)(-[6]H)-H}|
+
+Chaque liaison admet des arguments optionnels\idx*{liaison!argument optionnel}. Le premier des arguments optionnels définit l'\verb-<angle>- de la liaison\idx*{liaison!angle}. Les angles vont croissant dans le sens trigonométrique. Si l'angle n'est pas indiqué, alors sa valeur par défaut vaut 0\degres.
+
+Remarque : les parenthèses permettent d'autoriser plusieurs liaisons à partir d'un même atome, voir ``Molécules ramifiées''\idx*{ramification}, page~\pageref{molecules.ramifiees}.
+
+Il y a plusieurs façons de spécifier l'angle d'une liaison.
+\begin{description}
+\item[Angles prédéfinis] \idx*{liaison!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.
+
+\exemple{Angles prédéfinis}|\chemfig{(-[1]1)(-[2]2)(-[3]3)(-[4]4)(-[5]5)(-[6]6)(-[7]7)-0}|
+
+\item[Angle absolu] \idx*{liaison!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>]-. L'\verb-<angle absolu>- peut être positif, négatif, décimal. Il est ramené dans l'intervalle $[0\;;360]$.
+\item[Angle relatif]\idx*{liaison!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>]-. L'\verb-<angle relatif>- peut être positif, négatif, décimal.
+\end{description}
+
+\subsection{Formule semi-développée}
+\exemple{L'hex-1-ène}|\chemfig{H_3C-{{(CH_2)}_3}-CH=CH_2}|
+
+Il peut-être utile dans certains cas de pouvoir modifier la longueur d'une liaison\idx*{liaison!longueur}. Dans l'exemple précédent, il nécessaire d'allonger les deux premières liaisons, beaucoup trop courtes par rapport à la double liaison. Pour cela il faut utiliser l'argument \verb|<coeff>| des arguments optionnels\idx*{liaison!argument optionnel} :
+
+\exemple{L'hex-1-ène}|\chemfig{H_3C-[,1.5]{{(CH_2)}_3}-[,1.5]CH=CH_2}|
+
+Remarques :
+\begin{itemize}
+ \item dans la notation \verb|[,1.5]|, la virgule sert à indiquer que la valeur placée entre crochet correspond au deuxième argument (\verb|coeff|). Pour donner une valeur au quatrième argument on écrira \verb|[,,,2]|;
+ \item les caractères entre accolades ne sont pas interprétés par \CF, ce qui permet par exemple d'écrire des groupements d'atomes entre parenthèses sans que celles ci ne soient considérées comme une molécule ramifiée (voir page~\pageref{molecules.ramifiees}).
+\end{itemize}
+
+\subsection{Représentation de CRAM}
+\idx*{representation de Cram@représentation de Cram}Une autre façon d'indiquer l'angle de la liaison entre deux atomes.
+\exemple{Le méthane}|\chemfig{C(-[5]H)(-[2]H)(<[:-70]H)(<:[:-20]H)}|
+
+\subsection{Formule topologique}
+\idx*{formule topologique}Une saisie simplifiée à son maximum, seule les liaisons covalentes sont indiquées ainsi que leurs éventuels paramètres.
+\exemple{Le but-2-ène}|\chemfig{-[:30]=[:-30,,,,red]-[:30]}|
+
+La liaison double est tracée de part et d'autre de la ligne de liaison simple. Pour garder une cohérence graphique des formules topologiques de certains composés, il est intéressant de déporter\idx*{liaison!déportées} cette liaison double soit au dessus de cette ligne, soit au dessous. Il suffit alors de faire suivre le signe ``\verb-=-'' de ``\verb-^-'' ou ``\verb-_-'' :
+\exemple{Comparaison doubles liaisons/doubles liaisons déportées}/\chemfig{-[:-30]=[:30]-[:-30]} \chemfig{-[:-30]=^[:30]-[:-30]}\par
+\chemfig{=[:-30]-[:30]=[:-30]} \chemfig{=_[:-30]-[:30]=^[:-30]}/
+
+\subsection{Formule de Lewis}
+\idx*{representation de Lewis@représentation de Lewis}La syntaxe est la suivante :
+\centerverb/\lewis{<indice de position><Ă©tat Ă©lectronique>,<atome>}/
+\smallskip
+
+Les états électroniques pouvant être un doublet non liant, une lacune électronique ou un électron célibataire. Par défaut l'état électronique est un doublet non liant. L'électron est représenté par le caractère \boxedfalseverb. et la lacune par \boxedfalseverb|.
+
+\exemple{Le chlorométhane et l'eau}|\chemfig{C(-[2]H)(-[4]H)(-[6]H)-\lewis{260,Cl}}\hspace{1cm}
+\chemfig{[:40]H-\lewis{13,O}-[::-80]H}|
+
+Remarque : les positions prennent des valeurs entières allant de 0 à 7.
+\exemple{Positions}/\lewis{0.2.4.6.,C}\hspace{1cm}
+\lewis{0|2.46.,C}\hspace{1cm}
+\lewis{1357,Ar}/
+
+\section{Molécules ramifiées}\label{molecules.ramifiees}
+Pour indiquer une \idx{ramification}, il suffit de faire suivre l'atome portant la ramification d'un \verb-<code>- entre parenthèses. Ce \verb-<code>- est le code de la sous molécule qui viendra s'attacher sur l'atome. Il peut bien sûr y avoir plusieurs ramifications sur un même atome. Celles-ci peuvent aussi être imbriquées.
+
+\exemple{Alcanes}|\chemfig{H_3C-CH(-[2]CH_3)-CH_3}
+\hspace{.5cm}\chemfig{-(-[2])(-[6])-}|
+
+Dans ce type de représentation il est parfois nécessaire de relier deux atomes distants. Pour cela on dispose du caractère \verb|?|\idx*{liaison!atomes éloignés} qui va servir de crochet entre deux atomes. La fonction
+\centerverb/?[<nom>,<liaison>,<tikz>]/
+accepte trois arguments, le nom du crochet, le type de liaison et du code tikz. L'exemple suivant indique comment poser deux crochets différents.
+
+\exemple*{CocaĂŻne}|\chemfig{H_2C(-C?[a]H-[:-30]CH_2-[:30]C?[b]H-O-CO-C_6H_5)
+-[2]CH_2-[,1.7]CH(-[3]N?[a]-[3]H_3C)(-[,1.35]C?[b]H-CO-OCH_3)}|
+
+\section{Cycles}
+\idx*{cycle}\CF peut tracer des polygones réguliers facilement. La syntaxe est la suivante :
+\centerverb/\chemfig{*n(<code de la molécule>)}/
+\smallskip
+
+\exemple{Quelques cycles}|
+\chemfig{*3(---)}\hspace{.5cm}
+\chemfig{*5(-=-=-)}\hspace{.5cm}
+\chemfig{*6(-=-=-=)}|
+
+Les ramifications s'utilisent de la même façon\idx*{cycle!ramification}
+
+\exemple{Cycles et ramifications}|\chemfig{*4(-(--[1]*4(----))---)}|
+
+Remarque : un cycle ne pas commencer ou finir par l'atome ou le groupe d'atomes sur lequel on veut refermer le cycle. L'entité chimique sur laquelle on veut boucler doit impérativement se trouver en dehors du cycle.
+
+\exemple{Le bon codage}|\chemfig{A*4(-B-C-D-)}|
+
+\exemple{Les mauvais codages}|\chemfig{*4(A-B-C-D-)}\hspace{1cm}
+\chemfig{*4(-B-C-D-A)}|
+
+\section{Ions}
+La commande \verb|\chemfig| vous place directement dans le mode mathématique\idx*{mode mathematique@mode mathématique}\footnote{Il existe un problème de placement des groupes d'atomes contenant des exposants ou des indices. Voir page~\pageref{alignement.vertical}.} de \TeX, il est donc très simple d'écrire un ion. Il faut toutefois placer le signe $-$ entre accolades pour éviter à \CF qu'il le confonde avec le symbole d'une liaison covalente.
+
+\exemple{L'ion acétate}|\chemfig{-(-[1]O^{-})=[7]O}|
+
+Pour les puristes il est possible d'entourer la charge de l'ion en utilisant les commandes \verb|\ominus| et \verb|\oplus|\idx*{charge!\protect\texttt{\protect\string\protect\oplus}}\idx*{charge!\protect\texttt{\protect\string\protect\ominus}}.
+
+Pour répondre à toutes les exigences, il existe deux autres commandes \idx{\chemabove} et \idx{\chembelow} qui permettent de placer les charges au dessus et en dessous de l'atome considéré.\idx*\lewis
+
+\exemple{Quelques ions}|\chemfig{-(-[1]O^{\ominus})=[7]O}
+\hspace{1cm}
+\chemfig{\lewis{35,O}=\lewis{26,Cl}-\chemabove
+{\lewis{026,O}}{\ominus}}
+\vskip5pt
+\chemfig{-\chemabove{N}{\scriptstyle\oplus}(=[1]O)-[7]O^{\ominus}}|
+
+Pour ceux qui font du zèle, les commandes \idx{\chemabove} et \idx{\chembelow} acceptent un argument optionnel qui règle la distance entre la charge et l'atome.\idx*\lewis
+\exemple{Position de la charge}|\chemfig{\lewis{35,O}=C-\chemabove
+[3pt]{\lewis{246,O}}{\hspace{.5cm}\ominus}}|
+
+\section{Équations chimiques}
+\idx*{reaction chimique@réaction chimique}Voici un exemple de réaction chimique :
+\exemple*{RĂ©action chimique}/\chemfig{**6(------)} \hspace{.5cm} + \hspace{.5cm} \chemfig{H_3C-Cl}
+\hspace{.5cm} $\xrightarrow{catalyseur}$ \hspace{.5cm}
+\chemfig{**6(---(-)---)} \hspace{.5cm} + \hspace{.5cm} \chemfig{H-Cl}/
+
+\CF introduit également deux nouvelles commandes \idx{\chemsign} et \idx{\chemrel} qui permettent de simplifier légèrement la syntaxe précédente.
+
+\exemple*{Avec les commandes \CF}|\setchemrel{0pt}{1.2em}{6em}
+\chemfig{**6(------)}\chemsign[0.5cm]+\chemfig{H_3C-Cl}
+\chemrel[\itshape\tiny Catalyseur]{->}
+\chemfig{**6(---(-)---)}\chemsign[0.5cm]+\chemfig{H-Cl}|
+\newpage
+
+\part{Fonctionnement de \protect\CF}
+Cette partie est consacrée à la description des fonctionnalités les plus courantes de \CF. Le cadre de cette description dépasse largement celui de \og\CF pour l'impatient\fg{} mais 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{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\idx*{decoupage en atomes@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-[,1.75]C(=[:30,1.5]O)(-[:-30,1.5]OH)}}
+
+\section{Différents types de liaisons}
+\idx*{liaison!types}Comme on l'a vu (voir page~\pageref{types.liaisons}), les liaisons peuvent être de 9 types, chacune correspondant aux caractères \boxedfalseverb-, \boxedfalseverb=, \boxedfalseverb~, \boxedfalseverb>, \boxedfalseverb<, \boxedfalseverb{>:}, \boxedfalseverb{<:}, \boxedfalseverb{>|} et \boxedfalseverb{<|}.
+
+\label{longueur.liaison}\idx*{liaison!longueur}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 <=5pt,shorten >=5pt,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=5pt]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=-5pt]bl){};
+ \draw[blue,dash pattern=on 1pt off 1pt](bl)--([yshift=0.7cm]bl);
+ \draw[blue,dash pattern=on 1pt off 1pt]([xshift=-5pt]bl)--([xshift=-5pt,yshift=0.7cm]bl);
+ \draw[<->]([yshift=0.6cm]bl.center)--([xshift=-5pt,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=5pt]al)--([xshift=5pt,yshift=0.7cm]al);
+ \draw[<->]([yshift=0.6cm]al.center)--([xshift=5pt,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[<->]([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{setatomsep}La macro \verb-\setatomsep{<dimension>}-\idx*{\setatomsep} règle cette distance interatome $\Delta$. Si la \verb-<dimension>- est vide, elle prend sa valeur par défaut : 3em. Cette commande, comme toutes les commandes de réglage, agit sur toutes les molécules qui vont suivre.
+
+\exemple{Distance interatome}|\setatomsep{2em}\chemfig{A-B}\par
+\setatomsep{50pt}\chemfig{A-B}|
+
+\label{setbondoffset}\idx*{\setbondoffset}La commande \verb-\setbondoffset{<dimension>}- permet de régler l'espacement $\delta$ entre le trait représentant la liaison et l'atome. Si la \verb-<dimension>- est vide, alors $\delta=\text{2 pt}$.
+\exemple{Retrait des liaisons}|\setbondoffset{0pt}\chemfig{A-B}\par
+ \setbondoffset{5pt}\chemfig{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{modif.retrait}On peut spécifier l'espacement $\delta$ pour une seule liaison avec le caractère \verb-#-\idx*{\protect\symbol{'043}@\protect\texttt{\protect\symbol{'043}}}. 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}/\setbondoffset{4pt}
+\chemfig{A-B-C}\par
+\chemfig{A-#(,0pt)B-C}\par
+\chemfig{A-B-#(0pt)C}\par
+\chemfig{A-#(,0pt)B-#(0pt)C}/
+\endgroup
+
+Par défaut, tous les atomes se trouvant dans les groupes d'atomes sont composés en mode mathématique\idx*{mode mathematique@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\idx*{representation de Cram@représentation de Cram}\idx*\setcrambond. On utilise cette syntaxe :\label{setcrambond}
+\centerverb/\setcrambond{<dim1>}{<dim2>}{<dim3>}/
+\smallskip
+
+Si l'un des argument est vide, il prend sa valeur par défaut. Les 3 arguments sont :
+\begin{itemize}
+ \item \verb-<dim1>- est la largeur de la base des triangles et vaut 1.5ex par défaut;
+ \item \verb-<dim2>- est l'épaisseur des pointillés et vaut 1pt par défaut;
+ \item \verb-<dim3>- 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}-\setcrambond{10pt}{0.4pt}{1pt}
+\chemfig{A>B>:C>|D}-
+
+\section{Angle d'une liaison}
+\idx*{liaison!angle}\idx*{liaison!argument optionnel|(}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}
+\idx*{liaison!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, ainsi de suite jusqu'à \verb-[7]- qui spécifie un angle de 315\degres. L'entier peut trouver en dehors de l'intervalle $[0\;;\;7]$ auquel cas l'angle est ramené dans l'intervalle $[0\;;\;360]$.
+
+\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]}|
+
+\subsection{Angle absolu}
+\idx*{liaison!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}
+\idx*{liaison!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}
+\idx*{liaison!longueur}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 \idx{\setatomsep} 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.
+
+On voit sur l'exemple ci-dessus qu'il est donc nécessaire de pouvoir augmenter (ou parfois réduire) la distance interatome par l'intermédiaire de leur liaison. 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.\idx*{liaison!longueur}
+\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\idx*{taille des molécules@taille des molecules} en jouant sur la taille de la police ou sur \idx\setatomsep, éventuellement sur les deux\footnote{On peut aussi utiliser le deuxième argument optionnel de la commande \texttt{\string\chemfig}, voir page~\pageref{arguments.optionnels}.}, en prenant soin de confiner ces changements à l'intérieur d'un groupe si on veut en limiter la portée :
+\exemple{Modifier la taille des molécules}/\normalsize \chemfig{H-[:30]O-[:-30]H}\par
+\setatomsep{2.5em}\chemfig{H-[:30]O-[:-30]H}\par
+\small \chemfig{H-[:30]O-[:-30]H}\par
+\footnotesize \chemfig{H-[:30]O-[:-30]H}\par
+\scriptsize \chemfig{H-[:30]O-[:-30]H}\par
+\tiny \chemfig{H-[:30]O-[:-30]H}/
+
+\section{Atome de départ et d'arrivée}
+\idx*{liaison!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 :
+\centerverb/[,,<entier 1>,<entier 2>]/
+\smallskip
+
+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}
+\idx*{liaison!personnalisation}Il existe un 5\ieme{} et dernier argument optionnel pour les liaisons qui se trouve Ă  droite de la 4\ieme{} virgule :
+\centerverb/[,,,,<code tikz>]/
+\smallskip
+
+\idx*{tikz}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-''\idx*{liaison!invisible}. 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}
+\idx*{chemfig@\protect\texttt{\protect\string\protect\chemfig}!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
+\centerverb/[<angle>,<coeff>,<n1>,<n2>,<code tikz>]/
+\smallskip
+
+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}|\idx*{liaison!argument optionnel|)}
+
+\section{Ramifications}\idx*{ramification}
+\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}
+\idx*{liaison!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 :
+\centerverb/?[<nom>,<liaison>,<tikz>]/
+\smallskip
+
+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}\idx*{cycle|(}
+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 :
+\centerverb/<atome>*<n>(<code>)/
+\smallskip
+
+\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\idx*{cycle!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\idx*{cycle!cercle intérieur}. Pour cela, on utilise cette syntaxe :
+\centerverb/<atome>**[<angle 1>,<angle 2>,<tikz>]<n>(<code>)/
+\smallskip
+
+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}
+\idx*{cycle!position angulaire}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}
+\idx*{cycle!ramification}Pour faire partir une ramification d'un des sommets du cycle, on emploie la syntaxe déjà vue :
+\centerverb/<atome>(<code>)/
+\smallskip
+
+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}
+\idx*{cycle!imbrication}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\idx*{liaison!atome de départ et d'arrivée}. Ici, il faut relier \verb/C-F/ et \verb/F-G/ en le spécifiant avec l'argument optionnel de ces liaisons\idx*{liaison!argument optionnel} :
+\exemple{Atomes de départ et d'arrivée imposés}|\chemfig{AB*5(-CDE-[,,1]F-[,,,1]GH-I-)}|\idx*{cycle|)}
+
+\section{Représentation des déplacements d'électrons}\label{mecanismes-reactionnels}\idx*{mécanismes réactionnels|(}
+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>}-''\idx*{"@}. 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 ``\idx{tikzpicture}''. Cela suppose que le visualiseur prenne en charge le ``\idx{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 \idx{\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-\idx*{chemmove@\protect\texttt{\protect\string\protect\chemmove}|(}\footnote{En réalité, la commande \texttt{\string\chemmove} place son argument dans un environnement ``\idx{tikzpicture}'' dans lequel les options sont ``\texttt{remember picture,overlay}''.} et auront la syntaxe suivante si par exemple, on doit relier un nœud portant le nom ``\verb-<nom1>-'' au nœud portant le nom ``\verb-<nom2>-'' :
+\centerverb|\chemmove[<opt>]{\draw[<opt tikz>](<nom1>)<link tikz>(<nom2>);}|
+\smallskip
+
+L'argument optionnel \verb-<opt>- de la commande \verb-\chemmove- sera ajouté à l'argument de l'environnement \idx{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.
+
+\exemple{Effet mésomère 1}/\chemfig{@{a1}=_[@{db}::30]-[::-60]\lewis{2,X}}
+\chemrel{<->}
+\chemfig{\chemabove{\vphantom{X}}{\ominus}-[::30]=_[::-60]
+\chemabove{X}{\scriptstyle\oplus}}
+\chemmove{\draw[->](db).. controls +(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 :
+\centerverb|\chemmove{\draw[->](db)..controls +(100:5mm) and +(145:5mm)..(a1);}|
+\medskip
+
+Dans cet exemple nous demandons une flèche (\verb/[->]/) et nous utilisons 2 points de contrôle\idx*{points de controle@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}/\chemfig{@{a1}=_[@{db}::30]-[@{sb}::-60]@{dnl}\lewis{2,X}}
+\chemrel{<->}
+\chemfig{\chemabove{\vphantom{X}}{\ominus}-[::30]=_[::-60]
+\chemabove{X}{\scriptstyle\oplus}}
+\chemmove{
+ \draw[->](db)..controls +(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\idx*{points de controle@points de contrôle} comme suit : un angle de 90\degres{} à 4~mm de ``dnl'' et un angle de 45\degres{} à 4~mm de ``sb''. Mais nous ne sommes pas entièrement satisfaits car nous aimerions que la flèche ne touche pas le trait représentant le doublet non liant. Pour cela nous allons ajouter quelques options à notre flèche.
+\exemple{Effet mésomère 3}/\chemfig{@{a1}=_[@{db}::30]-[@{sb}::-60]@{dnl}\lewis{2,X}}
+\chemrel{<->}
+\chemfig{\chemabove{\vphantom{X}}{\ominus}-[::30]=_[::-60]
+\chemabove{X}{\scriptstyle\oplus}}
+\chemmove[->]{
+ \draw(db).. controls +(100:5mm) and +(145:5mm).. (a1);
+ \draw[shorten <=3pt,shorten >=1pt](dnl) .. controls +(90:4mm)
+ and +(45:4mm) .. (sb);}/
+
+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, non plus écrite ``\verb|->|'' mais ``\verb|-stealth|'', nous la dessinons en pointillés d'épaisseur fine et rouge. Nous rajoutons également la lettre $\pi$ au dessus de la flèche en son milieu :
+\exemple{Effet mésomère 4}/\chemfig{@{a1}=_[@{db}::30]-[@{sb}::-60]@{dnl}\lewis{2,X}}
+\chemrel{<->}
+\chemfig{\chemabove{\vphantom{X}}{\ominus}-[::30]=_[::-60]
+\chemabove{X}{\scriptstyle\oplus}}
+\chemmove{
+ \draw[-stealth,thin,dash pattern= on 2pt off 2pt,red]
+ (db).. controls +(100:5mm) and +(145:5mm)..
+ node[sloped,above] {$\pi$} (a1);
+ \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\idx*{points de controle@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\idx*{charge!\protect\texttt{\protect\string\protect\oplus}}.
+\exemple{Estérification: étape 1}/\setatomsep{7mm}
+\setchemrel{}{}{5mm}
+\chemfig{R-@{dnl}\lewis{26,O}-H}
+\chemsign{+}
+\chemfig{R-@{atoc}C([6]-OH)=[@{db}]O}
+\chemrel[\chemfig{@{atoh}\chemabove{H}{\scriptstyle\oplus}}]{<>}
+\chemmove[->,shorten <=2pt]{
+ \draw[shorten >=2pt](dnl)..controls +(90:1cm)and+(north:1cm)..(atoc);
+ \draw[shorten >=6pt](db)..controls +(north:5mm)and+(100:1cm)..(atoh);}/
+
+L'utilisation de la commande \verb|\chemabove{<code>}{<materiel>}|\idx*{\chemabove} ne change pas les dimensions de la boîte englobante\idx*{boite englobante@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\idx*{points de controle@points de contrôle} avec un angle de 110\degres{} à 1~cm de ``atoh'' et de raccourcir la flèche de 6pt. Dans l'exemple suivant, seconde étape de la réaction d'estérification, on peut voir que la flèche peut prendre des formes plus compliquées sans forcément surcharger le code.
+\exemple{Estérification: étape 2}/\setatomsep{7mm}
+\setchemrel{}{}{5mm}
+\chemfig{R-O-C(-[2]R)(-[6]OH)-@{dnl}\lewis{26,O}H}\hspace{1cm}
+\chemfig{@{atoh}\chemabove{H}{\scriptstyle\oplus}}
+\chemmove{
+ \draw[->,shorten <=2pt, shorten >=7pt]
+ (dnl).. controls +(south:1cm) and +(north:1.5cm).. (atoh);}/
+
+Nous laissons le soin au lecteur d'écrire la suite\idx*{chemmove@\protect\texttt{\protect\string\protect\chemmove}|)}\ldots\idx*{mécanismes réactionnels|)}
+
+\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\idx*\chemname
+\centerverb/\chemname[<dim>]{\chemfig{<code de la molécule>}}{<nom>}/
+\smallskip
+
+La \verb-<dimension>-, qui vaut 1.5ex par défaut, sera insérée verticalement entre la \idx{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\idx*{reaction chimique@réaction chimique} :
+\exemple*{Affichage du nom des molécules}/
+\chemname{\chemfig{R-C(-[:-30]OH)=[:30]O}}{Acide carboxylique}
+\chemsign{+}
+\chemname{\chemfig{R'OH}}{Alcool}
+\chemrel{->}
+\chemname{\chemfig{R-C(-[:-30]OR')=[:30]O}}{Ester}
+\chemsign{+}
+\chemname{\chemfig{H_2O}}{Eau}/
+
+Il y a quelques contraintes avec cette commande. Pour en pendre conscience, mettons que l'on ait inversé l'acide et l'alcool dans le membre de gauche :
+\exemple*{Alignement des noms 1}/
+\chemname{\chemfig{R'OH}}{Alcool}
+\chemsign{+}
+\chemname{\chemfig{R-C(-[:-30]OH)=[:30]O}}{Acide carboxylique}
+\chemrel{->}
+\chemname{\chemfig{R-C(-[:-30]OR')=[:30]O}}{Ester}
+\chemsign{+}
+\chemname{\chemfig{H_2O}}{Eau}/
+
+En fait, au dessous de la ligne de base de chaque molécule (en gris clair sur les exemples de ce manuel), pour écrire le \verb-<nom>-, la commande \idx{\chemname} insère 1.5ex${}+{}$\emph{la plus grande des profondeurs\footnote{En langage \TeX{}, la profondeur est la dimension qui s'étend verticalement sous la ligne de base.} des molécules rencontrées}. La macro \verb-\chemnameinit{<argument>}-\idx*{\chemnameinit} 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 \idx{\chemnameinit} avant et après la réaction :
+\exemple*{Alignement des noms 2}/
+\chemnameinit{\chemfig{R-C(-[:-30]OH)=[:30]O}}
+\chemname{\chemfig{R'OH}}{Alcool}
+\chemsign{+}
+\chemname{\chemfig{R-C(-[:-30]OH)=[:30]O}}{Acide carboxylique}
+\chemrel{->}
+\chemname{\chemfig{R-C(-[:-30]OR')=[:30]O}}{Ester}
+\chemsign{+}
+\chemname{\chemfig{H_2O}}{Eau}
+\chemnameinit{}/
+
+Enfin, pour écrire un nom sur plusieurs lignes, la commande \idx*{\protect\symbol{'134}\protect\symbol{'134}@\protect\texttt{\protect\symbol{'134}\protect\symbol{'134}}} rencontrée dans un \verb-<nom>- effectue un retour à la ligne\footnote{Par contre, la commande \texttt{\textbackslash par} est interdite et provoquera une erreur à la compilation.} :
+\exemple*{Nom sur 2 lignes}/
+\chemname{\chemfig{R-C(-[:-30]OH)=[:30]O}}{Acide\\carboxylique}
+\chemsign{+}
+\chemname{\chemfig{R'OH}}{Alcool}
+\chemrel{->}
+\chemname{\chemfig{R-C(-[:-30]OR')=[:30]O}}{Ester}
+\chemsign{+}
+\chemname{\chemfig{H_2O}}{Eau}
+\chemnameinit{}/
+\newpage
+
+\part{Utilisation avancée}\label{utilisation.avancee}
+\section{DĂ©coupage des atomes}\label{decoupage.atomes}
+Le mécanisme de découpage en atomes\idx*{decoupage en atomes@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\idx*{decoupage en atomes@découpage en atomes} 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 \idx{\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\idx*{mode mathematique@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{}\idx*{Latex@\protect\LaTeX}
+ \item \verb|\def\printatom#1{\ifmmode\rm#1\else$\rm#1$\fi}|\qquad en compilant avec $\varepsilon$\TeX{}\idx*{etex@$\protect\varepsilon$\protect\TeX} ou Con\TeX tX\idx*{ConTeXt@Con\protect\TeX{}t}.
+\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 \idx{\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{Arguments optionnels}\label{arguments.optionnels}
+La commande \idx{\chemfig} admet deux arguments optionnels\idx*{chemfig@\protect\texttt{\protect\string\protect\chemfig}!arguments optionnels} et sa syntaxe complète est la suivante :
+\centerverb|\chemfig[<opt1>][<opt2>]{<code molécule>}|
+\smallskip
+
+Le premier argument optionnel \verb-<opt1>- contient des instructions \TIKZ qui seront passées à l'environnement \idx{tikzpicture} dans lequel est dessinée la molécule. Le deuxième argument optionnel \verb-<opt2>- contient des instructions \TIKZ qui seront exécutées lors du dessin de chaque nœud\footnote{Ces instructions sont ajoutées à la fin de l'argument de \texttt{every node/.style\{<argument>\}}. Cet argument contient par défaut les instructions suivantes : ``{\ttfamily anchor=base,inner sep=0pt,outer sep=0pt,minimum size=0pt}''.}.
+
+Par l'intermédiaire du premier argument optionnel, on peut choisir par exemple la couleur générale ou l'épaisseur des lignes :
+\exemple{Choix du style}/\chemfig{A-B-[2]C}\par\medskip
+\chemfig[line width=1.5pt]{A-B-[2]C}\par\medskip
+\chemfig[red]{A-B-[2]C}/
+
+Avec le second argument optionnel, on peut choisir la couleur des nœud dessinés par \TIKZ, modifier l'inclinaison du dessin ou changer l'échelle\idx*{taille des molécules@taille des molecules} :
+\exemple{Choix des styles}/\chemfig{A-B-[2]C}\par\medskip
+\chemfig[][red]{A-B-[2]C}\par\medskip
+\chemfig[dash pattern=on 1pt off 2pt][red]{A-B-[2]C}\par\medskip
+\chemfig[][rotate=20]{A-B-[2]C}\par\medskip
+\chemfig[][scale=0.5]{A-B-[2]C}/
+
+\section{Alignement vertical}\label{alignement.vertical}
+\idx*{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 \idx{ligne de base} :
+\exemple*{Placement horizontal}/\Huge\setatomsep{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 \idx{\vphantom} de l'atome de départ, mais sans l'inclure dans le contenu de cet atome d'arrivée : ce \idx{\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 \idx\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\setatomsep{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 \idx{\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\setatomsep{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 \idx\vphantom. Il suffit pour cela de placer dans le groupe d'atomes la commande \idx{\chemskipalign} : l'alignement reprendra au groupe d'atomes suivant comme si le groupe d'atome contenant \idx{\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 \idx{\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 \idx{\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-#-''\idx*{\protect\symbol{'043}@\protect\texttt{\protect\symbol{'043}}}, 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{;}-\idx*{\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}
+\idx*{liaison!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}
+\idx*{liaison!delocalisee@délocalisée}Il est parfois nécessaire de tracer une liaison double dont un trait serait plein et l'autre en pointillé\footnote{Merci à Andreas \textsc{Bröermann} qui m'a suggéré cette fonctionnalité et m'a donné la solution à ce problème.}. Cette fonctionnalité n'est pas codée en dur dans \CF puisque \TIKZ, sa librairie ``decorations'' et ses styles programmables ont tout ce qu'il faut pour le rendre possible.
+
+Tout d'abord, après avoir chargé la librairie ``decorations'' en mettant \verb-\usetikzlibrary{decorations}- dans le préambule, il faut définir (lignes 1 à 14) une décoration baptisée ``ddbond'' pour \og Dashed Double Bond\fg puis définir (lignes 15 et 16) deux styles de \TIKZ que l'on appelle ``lddbond'' et ``rddbond''. Pour le premier, le trait pointillé se fera à gauche du trait médian et pour le second à droite. Ces styles peuvent désormais être appelés avec le 5\ieme{} argument optionnel des liaisons :
+\exemple*{Décorations personnalisées}|\pgfdeclaredecoration{ddbond}{initial}
+{
+ \state{initial}[width=4pt]
+ {
+ \pgfpathlineto{\pgfpoint{4pt}{0pt}}
+ \pgfpathmoveto{\pgfpoint{2pt}{2pt}}
+ \pgfpathlineto{\pgfpoint{4pt}{2pt}}
+ \pgfpathmoveto{\pgfpoint{4pt}{0pt}}
+ }
+ \state{final}
+ {
+ \pgfpathlineto{\pgfpointdecoratedpathlast}
+ }
+}
+\tikzset{lddbond/.style={decorate,decoration=ddbond}}
+\tikzset{rddbond/.style={decorate,decoration={ddbond,mirror}}}
+\setatomsep{4em}
+\chemfig{[:-30]R-C-[::60]C(-[::60,,,,rddbond]O)-[,,,,lddbond]N(-[::-60]H)-[::60]C-R}|
+
+\section{Sauvegarde d'une sous molécule}\label{definesubmol}
+\idx*{sauvegarde d'une molécule|(}\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\idx*{\definesubmol}
+\centerverb|\definesubmol{<nom>}{<code>}|
+\smallskip
+
+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 \idx{\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}
+\centerverb|\redefinesubmol{<nom>}{<code>}|\idx*\redefinesubmol
+\smallskip
+
+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\idx*{liaison!angle!relatif}, 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 \idx{\definesubmol} admet un argument optionnel et sa syntaxe complète est la suivante :
+\centerverb/\definesubmol{<nom>}[<code1>]{<code2>}/
+\medskip
+
+Dans la cas où l'argument optionnel est présent, l'alias ``\verb-!<nom>-'' sera remplacé par \verb'<code1>' si la liaison qui arrive sur l'alias vient de droite, c'est à dire si l'angle que fait la liaison 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)\idx*{\definesubmol} :
+\exemple{Alias dual}/\definesubmol\Me[H_3C]{CH_3}
+\chemfig{*6((-!\Me)=(-!\Me)-(-!\Me)=(-!\Me)-(-!\Me)=(-!\Me)-)}/\idx*{sauvegarde d'une molécule|)}
+
+\section{DĂ©corations}
+\subsection{Formule de Lewis}\label{lewis}
+\idx*{representation de Lewis@représentation de Lewis}La macro \idx{\lewis} permet de placer des paires d'électrons, des électrons ou une lacune. On utilise cette syntaxe :
+\centerverb|\lewis{<n1><n2>...<ni>,<atome>}|
+\smallskip
+
+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-\idx*{\lewis} :
+\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-|-''\idx*{\lewis} :
+\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 \idx{\lewis} ne sont pas comptabilisées dans la boîte englobante\idx*{boite englobante@boîte englobante} de l'atome. Les décorations sont faites en surimpression. On en voit une conséquence dans les deux exemples ci-dessus où les cadre ne semblent ne plus être correctement ajustés au dessin de la molécule qui dépasse légèrement vers le bas. Ceci sera parfois observable dans ce chapitre ``Décorations'' où l'on présente des commandes qui ne modifient pas la boîte englobante.
+
+On peut le constater de façon plus évidente en traçant une \verb-\fbox- autour des atomes décorés\idx*{\lewis} :
+\exemple{Boîte englobante et macro \string\lewis}*\fboxsep0pt
+\fbox{\lewis{0.2.4.6.,A}}\par\medskip
+\fbox{\lewis{13,B}}*
+
+\label{setlewis}On peut régler plusieurs paramètres à l'aide la macro\idx*\setlewis
+\centerverb|\setlewis[<dim1>]{<dim2>}{<dim3>}{<code tikz>}|
+\smallskip
+
+Si un argument est vide, il prend sa valeur par défaut.
+\begin{itemize}
+ \item \verb-<dim1>- est la largeur du rectangle représentant une lacune obtenue avec le caractère ``|''. Elle vaut 0.3ex par défaut;
+ \item \verb-<dim2>- est la distance entre la boîte englobant l'atome et la décoration. Elle vaut 0.4ex par défaut;
+ \item \verb-<dim3>- est la longueur du trait représentant la paire d'électrons. Elle vaut 1.5ex par défaut;
+ \item \verb-<code tikz>- est le code qui sera passé directement à \TIKZ. Ce code est vide par défaut.
+\end{itemize}
+
+\idx*{\lewis}\exemple{Les paramètres de la macro \string\lewis}*\setlewis{4pt}{1.5em}{red}
+\chemfig{A-\lewis{26,B}-C}\par\bigskip
+\setlewis[0.8ex]{}{}{line width=1pt}
+\chemfig{A-\lewis{2|,B}-C}*
+
+\subsection{Empilement de caractères}
+Les macros\label{chemabove}\idx*{\chemabove}
+\centerverb|\chemabove[<dim>]{<code>}{<matériel>}|
+et\idx*{\chembelow}
+\centerverb|\chembelow[<dim>]{<code>}{<matériel>}|
+\smallskip
+
+placent le \verb-<matériel>- respectivement au dessus et au dessous du \verb-<code>- à une distance verticale \verb-<dim>-, et cela sans changer la \idx*{boite englobante@boîte englobante} du \verb-<code>-. La dimension \verb-<dim>- vaut 1.5pt par défaut.
+
+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\idx*{cycle!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}*
+
+\subsection{Réactions chimiques}\idx*{reaction chimique@réaction chimique}
+Pour écrire des réactions chimiques, \CF fournit une commande pour les signes et une commande pour les flèches.
+
+\label{chemsign}La commande \verb-\chemsign[<dim>]<signe>-\idx*{\chemsign} écrit le \verb-<signe>-, celui-ci étant entouré de part et d'autre d'un espacement horizontal insécable \verb-<dim>- qui vaut 0.5em par défaut.
+
+\label{chemrel}La commande \verb-\chemrel[<arg1>][<arg2>]{<code flèche>}-\idx*{\chemrel} trace une flèche où les argument optionnels \verb-<arg1>- et \verb-<arg2>- seront placés respectivement au dessus et au dessous de la flèche, sans que sa boîte englobante soit modifiée. Le \verb-<code flèche>- est directement passé à \TIKZ sauf dans le cas où il comporte ``\verb/<>/'' qui permet de tracer deux flèches l'une au dessus de l'autre.
+\exemple{Types de flèches}*A\chemrel{->}B\par
+A\chemrel{<-}B\par
+A\chemrel{<->}B\par
+A\chemrel{<>}B\par
+A\chemrel{->,red,thick}B*
+
+\label{setchemrel}La commande \verb-\setchemrel{<dim1>}{<dim2>}{<dim3>}-\idx*{\setchemrel} permet de régler les dimensions dans le tracé de la flèche :
+\begin{itemize}
+ \item \verb-<dim1>- est l'espacement vertical entre la flèche et les textes optionnels écrits au dessus et/ou au dessous. Si cet argument est vide, il prend la valeur 2pt par défaut;
+ \item \verb-<dim2>- est l'espacement horizontal insécable inséré avant et après la flèche. Si cet argument est vide, il prend sa valeur par défaut de 0,7em;
+ \item \verb-<dim3>- est la longueur de la flèche. Si l'argument est vide, il prend sa valeur par défaut de 4em.
+\end{itemize}
+
+\exemple{Textes au dessus des flèches}*\setchemrel{1pt}{}{6em}
+A\chemrel[\footnotesize au dessus][\tiny au dessous]{<->}B*
+
+Voici un exemple de réaction chimique :
+\exemple*{RĂ©action chimique}|\setchemrel{0pt}{1.2em}{6em}
+\chemfig{**6(------)}\chemsign+\chemfig{H_3C-Cl}
+\chemrel[\itshape\footnotesize Catalyseur]{->}
+\chemfig{**6(---(-)---)}\chemsign+\chemfig{H-Cl}|
+
+Et en voici une autre :
+\exemple*{Synthèse du phényléthyne}/\chemfig{*6(-=*6(-(-Br)-(-Br))-=-=)}
+\chemrel[\chemfig{NaNH_2}][\chemfig{NH_3}]{->}
+\chemfig{*6(-=(-~)-=-=)}/
+
+\section{Utilisation de {\protect\ttfamily\protect\textbackslash chemfig} dans l'environnement \protect\ttfamily tikzpicture}
+Il est possible d'appeler la commande \idx{\chemfig} à l'intérieur d'un environnement {\ttfamily\idx{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 macro \idx{\setnodestyle} 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 \verb-\setbondoffset{0pt}-\idx{\setbondoffset} pour que les liaisons touchent les frontières des nœuds. L'espace interatome est allongé à 75pt. Enfin, la commande \idx{\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}/\setnodestyle{draw,inner sep=2pt}
+\setbondoffset{0pt}
+\setatomsep{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\idx*{\printatom} :
+\exemple*{Schéma de famille}/\setnodestyle{draw,circle,fill=cyan,minimum size=25pt}
+\setbondoffset{0pt}
+\setatomsep{80pt}
+\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\idx*{liaison!angle!prédéfini} :
+\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\idx*{liaison!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}
+\idx*{liaison!angle!absolu}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\idx*{chemfig@\protect\texttt{\protect\string\protect\chemfig}!arguments optionnels}, 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\idx*{liaison!ramification} ``\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}
+\idx*{liaison!angle!relatif}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\idx*{cycle!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)}|
+
+\idx*{cycle!ramification}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}
+\idx*{cycle!imbrication}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}
+\idx*{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}
+\idx*{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}-''\idx*{\definesubmol} :
+\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 \protect\og chaise\protect\fg}
+\idx*{representation chaise@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}
+\idx*{projection de Haworth}Le but est de représenter cette molécule de D-glucopyranose :
+{\setcrambond{2pt}{}{}
+\chemfig{HO-[2,0.5,2]?<[7,0.7](-[2,0.5]OH)-[,,,,line width=2pt](-[6,0.5]OH)>[1,0.7](-[6,0.5]OH)-[3,0.7]O-[4]?(-[2,0.3]-[3,0.5]OH)}}
+
+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\idx*{chemfig@\protect\texttt{\protect\string\protect\chemfig}!arguments optionnels} 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\idx*{\setcrambond} :
+\exemple{Structure}|\setcrambond{2pt}{}{}
+\chemfig{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\idx*{\setcrambond} :
+\exemple{Projection de Haworth}|\setcrambond{2pt}{}{}
+\chemfig{HO-[2,0.5,2]?<[7,0.7](-[2,0.5]OH)-[,,,,
+line width=2pt](-[6,0.5]OH)>[1,0.7](-[6,0.5]OH)-[3,0.7]
+O-[4]?(-[2,0.3]-[3,0.5]OH)}|
+
+\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\idx*{cycle!ramification} 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\idx*{chemfig@\protect\texttt{\protect\string\protect\chemfig}!arguments optionnels} 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\idx*{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\idx*{cycle!imbrication} 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\idx*{\definesubmol} :
+\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\idx*{\definesubmol} :
+\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-''\idx*{\definesubmol} :
+\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\idx*{cycle!imbrication} 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\idx*{\chembelow} :
+\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}
+\idx*{couleur (atome)}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 \idx{\color} et \idx{\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 \idx*{decoupage en atomes@découpage en atomes} qu'utilise \CF : ici, le premier atome de la molécule commence à ``\verb-C-'' et s'étend jusqu'à la prochaine lettre majuscule. Cet atome est donc ``\verb-C\color{blue}-'' et donc, le changement de couleur se fait en fin d'atome et reste sans effet. Il faut forcer \CF à couper le premier atome juste après ``\verb-C-'' avec le caractère ``\verb-|-'' et ensuite, englober \verb-\color{blue}H_3- entre accolades de façons à ce que \CF ne stoppe pas l'atome \no2 avant le ``\verb-H-'' ce qui laisserait le changement de couleur seul et donc inefficace dans un atome :
+
+\exemple{Couleurs}/\chemfig{C|{\color{blue}H_3}-C(=[1]O)-[7]O|{\color{red}H}}/
+
+On peut obtenir le mĂŞme effet avec \verb-\textcolor- :
+
+\exemple{Couleurs}/\chemfig{C|\textcolor{blue}{H_3}-C(=[1]O)-[7]O|\textcolor{red}{H}}/
+
+Le principal inconvénient est qu'il faut répéter l'opération pour chaque atome que l'on veut colorer, même si ceux-ci sont contigus.
+
+\subsection{Ajouter un exposant sans influer sur une liaison}
+Ajouter une \idx{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\idx\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 à \idx\rlap, l'\idx{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$''\idx*{charge!\protect\texttt{\protect\string\protect\oplus}}, on peut trouver que la charge est trop basse : $\mathrm{A^\oplus}$. Dans ce cas, pourquoi ne pas se servir de \idx{\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 \idx{\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\idx*{charge}, la meilleure méthode est de créer une liaison invisible\idx*{liaison!invisible} qui parte de ce sommet, ce qu'on fait ici avec \idx\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\idx*{liaison!courbe} :
+
+\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-@-''\idx*{"@} 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 \idx{\chemmove} :
+
+\exemple{Liaisons courbes}/\chemfig{@{a}A-[,,,,draw=none]@{b}B}
+\chemmove{\draw[-](a)..controls +(45:7mm) and +(225:7mm)..(b);}
+\bigskip
+
+\chemfig{*6(@{a}---@{b}---)}
+\chemmove{\draw[-](a)..controls +(60:3em) and +(240:3em)..(b);}
+\quad
+\chemfig{*6(@{a}---@{b}---)}
+\chemmove{\draw[-](a)..controls +(60:3em) and +(30:1em)..
+ ++(20:2em) ..controls +(210:3em) and +(-120:4em) ..(b);}/
+
+\subsection{Modifier la taille d'une molécule}
+\idx*{taille des molécules@taille des molecules}Deux paramètres déterminent par défaut la taille d'une molécule : la taille de la police et le paramètre de \idx{\setatomsep} qui est de 3em par défaut. On peut jouer indépendamment sur ces deux paramètres pour modifier la taille d'une molécule :
+
+\exemple{Modification de la taille}/\definesubmol\hho{H-[:30]O-[:-30]H}
+\chemfig{!\hho}
+
+\setatomsep{2.5em}\chemfig{!\hho}
+
+\scriptsize\chemfig{!\hho}
+
+\tiny\chemfig{!\hho}\setatomsep{5em}\chemfig{!\hho}/
+
+Il est possible d'utiliser le second argument optionnel de \verb-\chemfig-\idx*{chemfig@\protect\texttt{\protect\string\protect\chemfig}!arguments optionnels} pour agrandir ou réduire une molécule, et ceci globalement, c'est-à-dire que le texte et les liaisons seront réduits selon la même proportion :
+
+\exemple{Modification globale de la taille}/\definesubmol\hho{H-[:30]O-[:-30]H}
+\chemfig{!\hho}
+
+\chemfig[][scale=0.75]{!\hho}
+
+\chemfig[][scale=0.5]{!\hho}
+
+\chemfig[][scale=0.33]{!\hho}/
+
+\subsection{Dessiner un élément de polymère}
+\idx*{polymère}La difficulté réside dans le fait d'afficher des délimiteurs (parenthèses ou crochets) sur des liaisons. Pour cela, on va encore définir avec le caractère ``\verb-@-''\idx*{"@} des nœuds globaux que l'on utilisera ensuite pour qu'ils servent d'ancre aux délimiteurs. Nous partirons du principe que le nœud marquant l'emplacement du délimiteur ouvrant porte le nom ``opbr'' et celui du délimiteur fermant le nom ``clbr''.
+
+Nous allons écrire une macro toute simple \verb-\setpolymerbracket- dont les deux caractères qui suivent définissent le délimiteur ouvrant et le délimiteur fermant.
+
+Ensuite, la macro \verb-\makebraces- admettra un argument optionnel de la forme``\verb-<dim up>,<dim down>-''. Ces deux dimensions seront la hauteur et la profondeur des délimiteurs par rapport à la ligne de base. L'argument obligatoire de \verb-\makebraces- sera l'indice placé après le délimiteur fermant.
+
+\exemple*{Polymères}|\newcommand\setpolymerdelim[2]{%
+ \def\delimleft{#1}\def\delimright{#2}}
+
+\def\definedelimdim#1,#2\enddefinedelim{\def\delimht{#1}\def\delimdp{#2}}
+
+\newcommand\makebraces[2][0pt,0pt]{%
+ \definedelimdim#1\enddefinedelim
+ \chemmove{%
+ \node[at=(opbr),yshift=(\delimht-\delimdp)/2]
+ {\llap{$\left\delimleft\strut\vrule height\delimht depth\delimdp width0pt \right.$}};%
+ \node[at=(clbr),yshift=(\delimht-\delimdp)/2]
+ {\rlap{$\left.\strut\vrule height\delimht depth\delimdp width0pt \right\delimright_{#2}$}};%
+ }%
+}
+\setpolymerdelim()
+Polyéthylène:
+\chemfig{\vphantom{CH_2}-[@{opbr,1}]CH_2-CH_2-[@{clbr,0}]}\makebraces{n}
+\bigskip
+
+Polyvinyl chloride:
+\chemfig{\vphantom{CH_2}-[@{opbr,1}]CH_2-CH(-[6]Cl)-[@{clbr,0}]}
+\makebraces[0pt,15pt]{\!\!\!n}
+\bigskip
+
+Nylon 6:
+\chemfig{\phantom{N}-[@{opbr,1}]{N}(-[2]H)-C(=[2]O)-{(}CH_2{)_5}-[@{clbr,0}]}
+\makebraces[20pt,0pt]{}
+\bigskip
+
+Polycaprolactame:\setatomsep{2em}
+\chemfig{[:-30]-[@{opbr,1}]N(-[6]H)-[:30](=[2]O)--[:30]--[:30]--[@{clbr,0}:30]}
+\makebraces[5pt,5pt]{n}
+
+\setpolymerdelim[]
+Polyphénylène sulfide:
+\chemfig{\vphantom{S}-[@{opbr,1}]S-(**6(---(-[@{clbr,0}])---))}
+\makebraces[15pt,15pt]{}|
+
+\subsection{Dessiner le symétrique d'une molécule}\label{retournement}
+\idx*{symetrique d'une molecule@symétrique d'une molécule}Il existe deux commandes \idx{\hflipnext} et \idx{\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}
+\idx*{liaison!avec texte}Une fois que l'on a compris que le caractère ``\verb-@-''\idx*{"@} 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\footnote{La commande \texttt{\string\si} est fournie par le package \href{http://www.ctan.org/tex-archive/help/Catalogue/entries/siunitx.html}{\texttt{\textbf{siunitx}}}.}.
+
+\idx*{liaison!angle!codage}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\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\si\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\si\angstrom}
+\namebond{2}{3}{\footnotesize0.9584\si\angstrom}
+\arclabel{0.5cm}{1}{2}{3}{\footnotesize104.45\si\degree}
+\qquad
+Molécule d'eau pivotée de +30\si\degree : \chemfig{[:30]@1H-[::37.775,2]@2O-[::-75.55,2]@3H}
+\namebond12{\footnotesize0.9584\si\angstrom}
+\namebond23{\footnotesize0.9584\si\angstrom}
+\arclabel{0.5cm}{1}{2}{3}{\footnotesize104.45\si\degree}|
+
+\section{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<code>-\idx*\chemfig&dessine la molécule dont le dessin est décrit par le \verb-<code>-\\
+\verb-\printatom-\idx*\printatom & cette macro affiche les atomes dans les molécules. Elle peut être redéfinie pour personnaliser l'affichage, voir~\pageref{perso.affichage}\\
+\verb-\setnodestyle{<style tikz>}-\idx*\setnodestyle& à l'aide de la syntaxe de \TIKZ, cette macro définit le style de nœuds contenant les atomes, voir~\pageref{style.noeuds}\\
+\verb-\hflipnext-\idx*\hflipnext&la prochaine molécule sera inversée horizontalement\\
+\verb-\vflipnext-\idx*\vflipnext&la prochaine molécule sera inversée verticalement\\
+\verb-\definesubmol{<nom>}[code1]{<code2>}-\idx*\definesubmol & créé un alias \verb-!<nom>- que l'on peut placer dans le code des molécules à dessiner qui remplace le \verb-<code1>- ou le \verb-<code2>- selon l'inclinaison de la dernière liaison. Voir page~\pageref{definesubmol}\\
+\verb-\chemskipalign-\idx*\chemskipalign & Ignore le groupe d'atomes en cours pour le mécanisme d'alignement vertical. Voir page~\pageref{chemskipalign}.\\
+\verb-\redefinesubmol{<nom>}{<code>}-\idx*\redefinesubmol & remplace l'alias déjà existant \verb-!<nom>- par le nouveau \verb-<code>-. Voir page~\pageref{redefinesubmol}\\[2ex]\hline
+&\\
+\verb-\setcrambond{<dim1>}{<dim2>}{<dim3>}-\idx*\setcrambond & règle les dimensions des triangles représentant les liaisons de Cram : \verb-<dim1>- est la largeur de la base, \verb-<dim2>- est l'espacement entre les pointillés et \verb-<dim3>- est la largeur des pointillés. Voir page~\pageref{setcrambond}\\
+\verb-\setatomsep{<dim>}>-\idx*\setatomsep & règle la distance interatome. Voir page~\pageref{setatomsep}\\
+\verb-\setbondoffset{<dim>}-\idx*\setbondoffset & règle l'espacement entre les atomes liés et la liaison. Voir page~\pageref{setbondoffset}\\
+\verb-\setdoublesep{<dim>}-\idx*\setdoublesep & règle l'espacement entre les deux traits d'une double liaison. Voir page~\pageref{setdoublesep}\\[2ex]\hline
+&\\
+\verb-\lewis{<codes>,<atome>}-\idx*\lewis & 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-\setlewis{<dim1>}{<dim2>}{<code tikz>}-\idx*\setlewis & règle les décoration de Lewis; \verb-<dim1>- est la distance entre l'atome et la décoration, \verb-<dim2>- est la longueur du trait représentant la paire d'électrons et \verb-<code tikz>- est le code qui sera passé directement à \TIKZ. Voir page~\pageref{setlewis}\\[2ex]\hline
+&\\
+\verb-\chemmove[<options tikz>]<code tikz>-\idx*\chemmove & Ouvre un environnement \verb-tikzpicture- en y ajoutant à celles qui existent déjà les \verb-<options tikz>-, et relie avec le \verb-<code tikz>- les nœuds posés dans les molécules à l'aide du caractère ``\verb-@-''. Voir page~\pageref{mecanismes-reactionnels}.\\
+\verb-\chemsign[<dim>]<signe>-\idx*\chemsign & affiche le \verb-<signe>- en plaçant avant et après un espace insécable de longueur \verb-<dim>-. Voir page~\pageref{chemsign}\\
+\verb-\chemrel[<txt1>][<txt2>]{<code fleche>}-\idx*\chemrel & affiche une flèche décrite par son \verb-<code fleche>- en positionnant les textes optionnels \verb-<txt1>- et \verb-<txt2>- respectivement au dessus et au dessous de la flèche. Voir page~\pageref{chemrel}\\
+\verb-\setchemrel{<dim1>}{<dim2>}{<dim3>}-\idx*\setchemrel & règle les dimensions des flèches dessinées avec la commande \verb-\chemrel- : \verb-<dim1>- est l'espacement vertical entre la flèche et les textes optionnels, \verb-<dim2>- est l'espacement horizontal insécable inséré avant et après la flèche et \verb-<dim3>- est la longueur de la flèche. Voir page~\pageref{setchemrel}\\[2ex]\hline
+&\\
+\verb-\chemabove[<dim>]{<txt1>}{txt2}-\idx*\chemabove & é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}-\idx*\chembelow & écrit le \verb-{txt1}- et positionne le \verb-<txt2>- au dessous en laissant \verb-<dim>- d'espacement vertical. Cette commande ne change pas la boîte englobante de \verb-<txt1>-. Voir page~\pageref{chemabove}\\
+\verb-\chemname[<dim>]{<molécule>}{<nom>}-\idx*\chemname & Affiche le \verb-<nom>- sous la \verb-<molécule>-\\
+\verb-\chemnameinit-\idx*\chemnameinit & Initialise la plus grande profondeur des molécules rencontrées pour avoir un alignement correct de leurs noms\\\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. Compte tenu de la jeunesse de cette extension, j'espère que vous serez indulgent quant aux bugs rencontrés. Un \href{mailto:unbonpetit@gmail.com}{\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}/
+
+\idx*\definesubmol
+\idx*\phantom
+\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!@}/
+
+\idx*\definesubmol
+\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](!y)-[,1.5](!y)-[,1.5](!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)-)-=-=-)}/
+
+\idx*\setcrambond
+\exemple*{Camphre}/\chemfig{*6(-(<:[::120](-[::-100,0.7])(-[::100,0.7]))--(=O)-(-)(<:[::120])--)}
+\quad ou \quad
+\setcrambond{3pt}{}{}
+\chemfig{<[:10](>[:85,1.8]?(-[:160,0.6])-[:20,0.6])
+>[:-10]-[:60](=[:30,0.6]O)-[:170]?(-[:30,0.6])-[:190]-[:240]}/
+
+\idx*\definesubmol
+\exemple*{Triphenylméthane}/\chemfig{*6(-=-*6(-(-*6(=-=-=-))-*6(=-=-=-))=-=)}
+\quad ou \quad
+\definesubmol{@}{*6(=-=-=-)}
+\chemfig{(-[:-30]!@)(-[:90]!@)(-[:210]!@)}/
+
+\idx*\setcrambond
+\idx*\definesubmol
+\exemple*{Amygdaline}/\setcrambond{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(=-=-=-)}/
+
+\idx*\setcrambond
+\idx*\definesubmol
+\exemple*{Adénosine triphosphate}/\setcrambond{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]?=-=))
+-=-))-=-))-=-)}/
+
+\idx*\definesubmol
+\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>)--)}/
+
+\idx*\chembelow
+\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)--)---)}/
+
+\idx*\lewis
+\exemple*{Colorant(rouge)}/\chemfig{**6(--*6(-(-NO_2)=-(-\lewis{26,O}-[0]H)=(-\lewis{4,N}=[0]\lewis{2,N}-[0]Ar)-)----)}/
+
+\idx*\lewis
+\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]?)}/
+
+\idx*\chembelow
+\idx*\chemsign
+\idx*\chemrel
+\exemple*{Synthèse de Fischer de l'indole}/\chemfig{*6(=-*6(-\chembelow{N}{H}-NH_2)=-=-)}
+\chemsign+
+\chemfig{(=[:-150]O)(-[:-30]R_2)-[2]-[:150]R_1}
+\chemrel[$\mathrm{H^+}$]{-stealth}
+\chemfig{*6(-=*5(-\chembelow{N}{H}-(-R_2)=(-R_1)-)-=-=)}/
+
+\idx*\chemabove
+\idx*\chemrel
+\idx*\lewis
+\idx*{"@}
+\idx*\chemmove
+\idx*{charge!\protect\texttt{\protect\string\protect\oplus}}
+\idx*{charge!\protect\texttt{\protect\string\protect\ominus}}
+\exemple*{Mécanisme réactionnel : groupement carbonyle}/
+\chemfig{C([3]-)([5]-)=[@{db,.5}]@{atoo}\lewis{06,O}}
+\chemrel{<>}
+\chemfig{\chemabove{C}{\scriptstyle\oplus}([3]-)([5]-)-\chemabove
+ {\lewis{026,O}}{\hspace{5mm}\scriptstyle\ominus}}
+\chemmove{\draw[->,shorten <=2pt, shorten >=2pt](db) ..controls +(up:5mm) and +(up:5mm)..(atoo);}/
+
+\idx*\chembelow
+\idx*\lewis
+\idx*\chemabove
+\idx*{"@}
+\idx*\chemrel
+\idx*\chemmove
+\exemple*{Mécanismes réactionnels : dérivés nitrés}/
+\chemfig{R-\chembelow{N}{\hspace{-5mm}\scriptstyle\oplus}([1]=[@{db}]@{atoo1}O)([7]-[@{sb}]@{atoo2}
+ \chemabove{\lewis{157,O}}{\hspace{7mm}\scriptstyle\ominus})}
+\chemrel{<->}
+\chemfig{R-\chemabove{N}{\hspace{-5mm}\scriptstyle\oplus}([1]-\chemabove{O}{\scriptstyle\ominus})([7]=O)}
+\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);
+}/
+
+\idx*\lewis
+\idx*\chemsign
+\idx*\chemabove
+\idx*\chemmove
+\idx*\chemrel
+\idx*{"@}
+\idx*\chembelow
+\idx*{charge!\protect\texttt{\protect\string\protect\oplus}}
+\exemple*{Addition nucléophile. Amines primaires}/\chemfig{R-@{aton}\lewis{2,N}H_2}
+\chemsign{+}
+\chemfig{@{atoc}C([3]-CH_3)([5]-CH_3)=[@{atoo1}]O}
+\hspace{1cm}
+\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);}
+\chemrel[\tiny addition]{<>}
+\chemfig{R-@{aton}\chembelow{N}{\scriptstyle\oplus}H([2]-[@{sb}]H)-C(-[2]CH_3)(-[6]CH_3)-OH}
+\par
+\chemmove{
+ \draw[-stealth,dash pattern= on 1pt off 1pt,shorten <=3pt, shorten >=2pt]
+ (sb)..controls +(left:5mm) and +(135:2mm)..(aton);}
+\chemrel{<>}
+\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);}
+\chemrel[\tiny Ă©limination]{<>}
+\chemfig{R-N=C(-[1]CH_3)(-[7]CH_3)}
+\chemsign{+}
+\chemfig{H_3\chemabove{O}{\scriptstyle\oplus}}/
+
+\idx*\setbondoffset
+\idx*\setatomsep
+\idx*\lewis
+\idx*\chemrel
+\idx*\chemsign
+\idx*\chemmove
+\idx*{"@}
+\exemple*{Mécanismes réactionnels de la chloration}/\scriptsize
+\setbondoffset{1pt}\setatomsep{2em}
+\chemfig{Cl-[4]@{a0}(=[@{a1}:120]@{a2}O)-[:-120](=[:-60]O)-[4]Cl}\chemsign{+}
+\chemfig{*6(-=-=(-@{oh1}OH)-=)}\chemrel{-stealth}
+\chemfig{*6((-O-[:150](-[@{o0}:150]@{o1}\lewis{6.,O})(-[@{cl0}:60]@{cl1}Cl)-[:240](-[4]Cl)=[6]O)=-=-=-)}
+\chemrel{-stealth}\chemfig{*6((-O-[:150](=[2]O)-[:-150](=[6]O)-[:150]Cl)=-=-=-)}\chemsign{+}
+\chemfig{HCl}\par
+\chemfig{*6(-=*6(-O-*6(-@{o2}(=[@{o3}]@{o4}O)-Cl)=)-=-=)}\chemsign{+}
+\chemfig{*6(-=-=(-@{oh2}OH)-=)}\chemrel{-stealth}
+\chemfig{*6(-=*6(-O-(-(-[@{cl2}:60]@{cl3}Cl)(-[@{o5}:-120]@{o6}\lewis{6.,O})-O-[::-40]*6(=-=-=-))=)-=-=)}
+\kern-3em \chemrel{-stealth}\chemfig{[:30]*6(=-(-O-[:-60](=O)-[:-120](=[4]O)-[:-60]O-*6(=-=-=-))=-=-)}
+\kern-3em \chemsign{+}\chemfig{HCl}
+\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);}/
+
+\idx*\chemrel
+\idx*\chemabove
+\idx*\chembelow
+\idx*{"@}
+\idx*\chemmove
+\idx*{charge!\protect\texttt{\protect\string\protect\ominus}}
+\exemple*{Cannizzaro}/\chemfig{[:-30]*6(=-=(-@{atoc}C([6]=[@{db}]@{atoo1}O)-H)-=-)}
+\chemrel[\chemfig{@{atoo2}\chemabove{O}{\scriptstyle\ominus}}H]{-stealth}
+\chemmove[-stealth,shorten >=2pt,dash pattern=on 1pt off 1pt,thin]{
+ \draw[shorten <=8pt](atoo2) ..controls +(up:10mm) and +(up:10mm)..(atoc);
+ \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);}
+\vspace{1cm}
+\par
+\chemrel{-stealth}
+\chemfig{[:-30]*6(=-=(-C([1]-@{atoo2}O-[@{sb}0]@{atoh}H)([6]=O))-=-)} \hspace{1cm}
+\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);}/
+
+\begingroup
+\catcode`;=12
+\idx*\setbondoffset
+\idx*\setatomsep
+\idx*\chemrel
+\idx*{"@}
+\idx*\chemabove
+\idx*\chemmove
+\idx*\lewis
+\idx*{charge!\protect\texttt{\protect\string\protect\oplus}}
+\exemple*{RĂ©arrangement de Beckmann}/
+\setbondoffset{1pt}
+\setatomsep{2.5em}
+\chemfig{(-[:-150]R')(-[:-30]R)=[2]N-[:30]OH}
+\kern-1em
+\chemrel[\chemfig{\chemabove{H}{\kern10pt\scriptstyle\oplus}}]{<>}
+\kern-0.5em
+\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);
+}
+\kern-1.5em
+\chemrel[\chemfig{{-}H_2O}]{<>}
+$\left[\begin{tabular}{c}
+ \chemfig{R'-\lewis{2:,N}=@{a1}\chemabove{C}{\scriptstyle\oplus}-R}\\
+ \tikz\draw[stealth-stealth](0,3mm)--(0,-3mm);\\
+ \chemfig{R'-\chemabove{N}{\scriptstyle\oplus}~C-R}
+\end{tabular}\right]$
+\chemrel[\chemfig{H_2@{a0}\lewis{0:2:,O}}]{<>}\par
+\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)}
+\chemrel[\chemfig{{-}\chemabove{H}{\kern10pt\scriptstyle\oplus}}]{<>}
+\chemfig{*6(R\rlap{$'$}-N=(-R)-OH)}
+\chemrel{-stealth}
+\chemfig{*6(R\rlap{$'$}-\chembelow{N}{H}-(-R)(=[2]O))}
+/
+\endgroup
+
+\idx*\definesubmol
+\idx*\setatomsep
+\idx*\chemname
+\idx*\chemsign
+\idx*\chemrel
+\idx*\chemmove
+\idx*{charge!\protect\texttt{\protect\string\protect\oplus}}
+\exemple*{Sulfonation de la naphtalène}/\newcommand\putchemnode[1]{\begin{tikzpicture}[remember picture]\node(#1){};\end{tikzpicture}}
+\definesubmol\cycleoplus{-[,0.25,,,draw=none]\oplus}
+\definesubmol{so2oh}{S(=[::90]O)(=[::-90]O)-OH}
+\footnotesize
+\setatomsep{2.5em}
+\begin{tabular}{ll}
+&\putchemnode{l1}\chemname{\chemfig{*6(=-*6(-=-(!\cycleoplus)-(-SO_3H)-)=-=-)}}{Ion 1-arenium}
+\chemrel{-stealth}
+\chemname{\chemfig{*6(=-*6(-=-=(-!{so2oh})-)=-=-)}}{Acide 1-naphthalenesulfonique}\\
+\chemname{\chemfig{*6(=-*6(-=-=-)=-=-)}}{Naphtalène}
+\chemsign{+}
+\chemfig{H_2SO_4}\putchemnode{a}\kern1cm&\\[-5ex]
+&\putchemnode{l2}\chemname{\chemfig{*6(=-*6(-=-(-SO_3H)-(!\cycleoplus)-)=-=-)}}{Ion 2-arenium}\kern-3em
+\chemrel{-stealth}
+\chemname{\chemfig{*6(=-*6(-=-(-!{so2oh})=-)=-=-)}}{Acide 2-naphthalenesulfonique}
+\end{tabular}
+\chemmove[-stealth,yshift=1cm]{
+ \draw(a)--node[sloped,above]{80\degre C}(l1);\draw(a)--node[sloped,above]{160\degre C}(l2);}/
+
+\begingroup\catcode`;12
+\idx*\chemname
+\idx*\color
+\idx*\lewis
+\idx*{"@}
+\idx*\chemmove
+\idx*{charge!\protect\texttt{\protect\string\protect\delta}}
+\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);
+}}/
+\endgroup
+
+\idx*\setatomsep
+\idx*\printatom
+\idx*\setbondoffset
+\idx*\definesubmol
+\idx*\redefinesubmol
+\exemple*{Cristallographie}/\newcommand\disk{\tikz\draw[fill=black,overlay](0,0)circle(2pt);}
+\setatomsep{20pt}
+\renewcommand\printatom[1]{#1}
+\setbondoffset{2pt}
+\definesubmol{hat}{-[:40,1.5]\disk-[::-30,2]\disk-[::-30,2]\disk-[::-120,2]\disk-[::-30,2]\disk}
+\definesubmol{motif}{-[:40,1.5]\disk(-[2,3])-[::-30,2]\disk
+(-[2,3])-[::-30,2]\disk(-[2,3])-[::-120,2]\disk(-[2,3])-[::-30,2]\disk}
+\chemfig{\disk?[a](-[2,3]\disk?[b](-[2,3]\disk?[c]!{hat}?[c])!{motif}?[b](-[2,3]))!{motif}?[a](-[2,3])}
+\qquad
+\redefinesubmol{motif}{\disk(-[2,3])(-[:42,3.6,,,draw=none]\disk)-[:30,2.6]\disk
+(-[2,3])-[0,3]\disk(-[2,3])-[:-150,2.6]\disk(-[4,3])-[2,3]-[4,3]}
+\redefinesubmol{hat}{\disk-[:30,2.6]\disk-[0,3]\disk-[:-150,2.6]\disk-[4,3]}
+\chemfig{!{motif}!{motif}!{hat}}
+\qquad
+\redefinesubmol{motif}{(-[2,3])(-[:25,2.75,,,white]-[2,1.5,,,white]\disk)-[:50,3]\disk
+(-[2,3])-[::-50,3]\disk(-[2,3])-[::-130,3]\disk-[2,3]-[4,3]\disk}
+\redefinesubmol{hat}{-[:50,3]\disk-[::-50,3]\disk-[::-130,3]\disk}
+\chemfig{-[4,3]\disk!{motif}(-[:25,2.75,,,draw=none]\disk?[uat]?[dat](-[::0,2.75]?[uat1]?[dat1]
+-[::-90,1.3]\disk?[uat2]?[dat2])-[::-90,1.3]-[:25,2.75])!{hat}?[uat3]?[dat3]-[:50,1.5]
+(-[6,1.5,,,draw=none]\disk?[dat,,,blue]?[dat1,,,blue]?[dat2,,,blue]?[dat3,,,blue])
+-[2,1.5,,,draw=none]\disk?[uat,,,red]?[uat1,,,red]?[uat2,,,red]?[uat3,,,red]}/
+
+\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)-)}/
+
+\idx*{(\kern1cm)|see{ramification}}
+\idx*{?@\protect\texttt{?}|see{liaison/atomes éloignés}}
+\idx*{distance interatome|see{liaison/longueur}}
+\idx*{*|see{cycle}}
+\idx*{**|see{cycle/cercle intérieur}}
+\idx*{\protect\symbol{'0174}@\protect\texttt{\protect\symbol{'0174}}|see{découpage en atomes}}
+\idx*{>, <, >\protect\symbol{'0174}, <\protect\symbol{'0174}, >:, <:@\protect\texttt>, \protect\texttt<, \protect\texttt{>\protect\symbol{'0174}}, \protect\texttt{<\protect\symbol{'0174}}, >\protect\string:, <\protect\string:|see{représentation de Cram}}
+\idx*{-, =, \protect\string\protect~@\protect\texttt-, \protect\texttt=, \protect\texttt{\protect\string~}|see{liaison/types}}
+\idx*{=\protect\string_, =\protect\string^@\protect\texttt{=\protect\string_}, \protect\texttt{=\protect\string^}|see{liaison/déportées}}
+\idx*{"!|see{sauvegarde d'une molécule}}
+\idx*{Cram|see{représentation de Cram}}
+\idx*{Lewis|see{représentation de Lewis}}
+\clearpage
+\phantomsection
+\addcontentsline{toc}{part}{Index}
+\printindex
+\end{document} \ No newline at end of file