summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2010-09-03 22:59:06 +0000
committerKarl Berry <karl@freefriends.org>2010-09-03 22:59:06 +0000
commit3bbe1d88307bb986d9472f0c2f2acbef3cb7b046 (patch)
tree41919bef12683ce8dfca763c22024ea527b82b61
parent232c31c3e8372ee6cbf87806f4e82af57950f4f4 (diff)
chemfig 0.2 (1sep10)
git-svn-id: svn://tug.org/texlive/trunk@19578 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/doc/latex/chemfig/README9
-rw-r--r--Master/texmf-dist/doc/latex/chemfig/chemfig_doc_en.pdfbin0 -> 856679 bytes
-rw-r--r--Master/texmf-dist/doc/latex/chemfig/chemfig_doc_en.tex1300
-rw-r--r--Master/texmf-dist/doc/latex/chemfig/chemfig_doc_fr.pdfbin829504 -> 868662 bytes
-rw-r--r--Master/texmf-dist/doc/latex/chemfig/chemfig_doc_fr.tex133
-rw-r--r--Master/texmf-dist/tex/latex/chemfig/chemfig.sty306
6 files changed, 1615 insertions, 133 deletions
diff --git a/Master/texmf-dist/doc/latex/chemfig/README b/Master/texmf-dist/doc/latex/chemfig/README
index d552dfc0086..de30c302cb0 100644
--- a/Master/texmf-dist/doc/latex/chemfig/README
+++ b/Master/texmf-dist/doc/latex/chemfig/README
@@ -2,9 +2,9 @@ ___________________________________
The
ChemFig package
- v0.1
+ v0.2
- 2010/06/23
+ 2010/08/31
___________________________________
Maintainer: Christian Tellechea
@@ -22,9 +22,6 @@ drawing using an easy, flexible and intuitive syntax.
The drawing is made with the tikz package. Therefore, Chemfig works
in dvi or pdf mode.
-PS : I apologize but for now, only the French version of the manual is
-available. The english translation should be released within weeks.
-
----------------------------------------------------------------------
Cette extension fournit la commande \chemfig{<code>} qui dessine la
@@ -34,4 +31,4 @@ 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
+ Christian Tellechea
diff --git a/Master/texmf-dist/doc/latex/chemfig/chemfig_doc_en.pdf b/Master/texmf-dist/doc/latex/chemfig/chemfig_doc_en.pdf
new file mode 100644
index 00000000000..5d254c43086
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/chemfig/chemfig_doc_en.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/chemfig/chemfig_doc_en.tex b/Master/texmf-dist/doc/latex/chemfig/chemfig_doc_en.tex
new file mode 100644
index 00000000000..df1233816e0
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/chemfig/chemfig_doc_en.tex
@@ -0,0 +1,1300 @@
+% _________________________________________________________________
+% | |
+% | |
+% | ChemFig Documentation |
+% | |
+% | August 31, 2010 |
+% | |
+% |_________________________________________________________________|
+%
+% 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
+%
+% The "chemfig" package consists of the 6 following files:
+% chemfig.sty (this file)
+% README
+% chemfig_doc_en.tex, chemfig_doc_en.pdf (english manual)
+% chemfig_doc_fr.tex, chemfig_doc_fr.pdf (french 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]{geometry}
+\usepackage[bottom]{footmisc}
+\usepackage{lmodern}
+\usepackage{amsmath}
+\usepackage{array}
+\usepackage{xspace}
+\usepackage{fancybox}
+\usepackage{textcomp}
+\usepackage{xstring}
+\usepackage{enumitem}
+\usepackage{chemfig}
+\usetikzlibrary{decorations.pathmorphing}
+\usepackage{emerald}
+\usepackage[protrusion=true,expansion,final,verbose=true,babel=true]{microtype}
+\usepackage{fancyhdr}
+ \fancyhead[L]{\small\bfseries\CF}
+ \fancyhead[C]{}
+ \fancyhead[R]{\scriptsize\slshape \leftmark}
+ \fancyfoot[l]{\tiny \LaTeX ed by Christian \textsc{Tellechea}, the \today.}
+ \fancyfoot[c]{}
+ \fancyfoot[r]{\thepage}
+
+\makeatletter
+\verbtocs\@diese|#|
+\verbtocs\@@diese|##|
+
+\newcommand\disable@lig[1]{%
+ \catcode`#1\active
+ \begingroup
+ \lccode`\~`#1\relax
+ \lowercase{\endgroup\def~{\leavevmode\kern\z@\string#1}}%
+}
+
+\newif\if@exstar
+
+\newcommand\exemple{\@ifstar{\@exstartrue\exemple@}{\@exstarfalse\exemple@}}
+
+\newcommand\exemple@[2][65]{%
+ \par\nobreak\vskip5pt
+ \def\part@coeff{#1}%
+ \def\code@name{#2}%
+ \relax\leavevmode\null
+ \bgroup
+ \obeylines\frenchspacing
+ \let\do\@makeother\dospecials
+ \@vobeyspaces
+ \disable@lig,\disable@lig-%
+ \exemple@@
+}
+
+\newcommand\exemple@@[1]{%
+ \def\@tempa##1#1{%
+ \xdef\left@content{##1}\egroup
+ \begingroup
+ \endlinechar\m@ne\everyeof{\relax}\catcode`\^^M=10
+ \@makeother:\@makeother~\@makeother!\@makeother?\@makeother;%
+ \expandafter\grab@toks\scantokens{##1}%
+ \endgroup
+ \exemple@@@
+ }%
+ \@tempa
+}
+
+\newcommand\exemple@@@{%
+ \begingroup
+ \StrSubstitute\left@content{\@diese\@diese}\@diese[\left@content]%
+ \if@exstar
+ \edef\part@left{\the\dimexpr\linewidth-2\fboxsep-2\fboxrule}%
+ \let\part@right\part@left
+ \else
+ \edef\part@left{\the\dimexpr0.\part@coeff\linewidth-\fboxsep-\fboxrule}%
+ \edef\part@right{\the\dimexpr\linewidth-0.\part@coeff\linewidth-\fboxsep-\fboxrule}%
+ \fi
+ \edef\saved@boxsep{\the\fboxsep}%
+ \fboxsep1pt\relax
+ \boxput*(0,1)%
+ {\colorbox{black}{{%
+ \leavevmode\kern1.5pt\relax
+ \color{white}\ECFAugie\footnotesize
+ \vphantom{Cp}\code@name
+ }\kern1.5pt\relax}}%
+ {\fboxsep\saved@boxsep
+ \fbox{%
+ \if@exstar
+ \parbox[c]\part@left{%
+ \vskip5pt\relax\ttfamily\footnotesize\left@content
+ \vskip3pt\hrule\vskip3pt
+ \everypar{{\color{lightgray}\rlap{\vrule height0.1pt width\part@right depth0.1pt}}}%
+ \par
+ \hfill\normalfont\right@content\hfill\null}%
+ \else
+ \parbox[c]\part@left{\vskip5pt\relax\ttfamily\footnotesize\left@content}%
+ \parbox[c]\part@right{%
+ \vskip5pt\relax
+ \everypar{{\color{lightgray}\rlap{\vrule height0.1pt width\part@right depth0.1pt}}}%
+ \normalfont\footnotesize
+ \right@content}%
+ \fi
+ }%
+ }%
+ \vskip7.5pt\relax
+ \endgroup
+}
+
+\long\def\grab@toks#1\relax{\gdef\right@content{#1}}
+
+\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={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~\thepart}}%
+ {1pc}%
+ {\titlerule\vspace{1pc}\Huge}
+
+\begin{document}
+\begin{titlepage}
+ \begin{tikzpicture}[remember picture,overlay]
+ \filldraw[blue](current page.south west) rectangle ([yshift=2.5cm]current page.center);
+ \filldraw[black](current page.north west) rectangle ([yshift=2.5cm]current page.east);
+ \end{tikzpicture}
+ \begin{center}
+ \color{white}\ECFAugie\fontsize{50pt}{50pt}\selectfont\CF\ v\csname CF@ver\endcsname\par\medskip
+ \footnotesize\csname CF@en@date\endcsname\par
+ \normalsize Christian Tellechea\par\vskip1.5cm
+ \huge A \LaTeX{} package for drawing molecules
+ \end{center}
+ \vskip4cm
+ \hfill
+ \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)-)}%
+ \hfill\null\par\bigskip
+ {\hfill\ECFAugie\small Taxotere\hfill\null}%
+\end{titlepage}
+\parindent0pt\pagestyle{fancy}
+\tableofcontents
+\parskip\medskipamount
+\newpage
+
+\setitemize{leftmargin=3em,topsep=0pt,parsep=0pt,itemsep=0pt}
+\part{Introduction}
+\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.
+
+\hfill\begin{minipage}{0.8\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.
+
+\hfill Christophe \textsc{Casseau}%
+\end{minipage}\hfill\null\bigskip
+
+Finally, I wish to warmly thank Theo \textsc{Hopman} for offering to translate this manual into English.
+
+\section{Presenting \CF}
+To use this package, start by adding the following code to the preamble:
+\centerverb/\usepackage{chemfig}/
+\smallskip
+
+The most important command for drawing molecules is \verb|\chemfig{<code>}|. The argument \verb|code| is a set of characters describing the structure of the molecule according to the rules which are described in this manual.
+
+Care has been taken to make it possible to draw the greatest possible number of molecular configurations, while maintaining a simple, flexible, and intuitive syntax. Despite this, the \verb-<code>- which describes the 2D structure of the molecule increases in complexity in proportion to that of the molecule being drawn.
+
+The command \verb|\chemfig| draws a molecule using the commands provided by the \TIKZ package, placed inside a \verb|tikzpicture| environment. The choice of \TIKZ implies that:
+\begin{itemize}
+\item the user has a choice of compilation method: pdf\LaTeX{} can be used equally well in dvi mode (tex $\longrightarrow$ dvi $\longrightarrow$ ps $\longrightarrow$ pdf) or in pdf mode (tex $\longrightarrow$ pdf). In effect \TIKZ, via the underlying pgf, gives identical graphical results in the two modes;
+\item the 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 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 baseline of the preceding code.
+\end{itemize}
+\newpage
+
+\part{\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| 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 between the two atoms;
+\item \verb-<coeff>- is a coefficient multiplying the default bond length;
+\item \verb-<n1>- and \verb-<n2>- are the numbers of the departure and arrival atoms of the bond;
+\item \verb-<tikz code>- is additional options concerning the colour or style of a bond.
+\end{itemize}
+\medskip
+Each bond takes optional arguments 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 baseline.
+
+\section{The different types of bonds}
+For \CF, bonds between two atoms are one of nine types, represented by the characters \boxedfalseverb-, \boxedfalseverb=, \boxedfalseverb~, \boxedfalseverb>, \boxedfalseverb<, \boxedfalseverb{>:}, \boxedfalseverb{<:}, \boxedfalseverb{>|} and \boxedfalseverb{<|} :\label{types.liaisons}
+\begin{center}
+\begin{tabular}{>{\centering\arraybackslash}m{1.7cm}>{\centering\arraybackslash}m{3cm}>{\centering\arraybackslash}m{2cm}m{4cm}}
+\hline
+Bond \#&Code &Result &Bond type\\\hline
+1 &\verb+\chemfig{A-B}+ &\chemfig{A-B} &Single\\
+2 &\verb+\chemfig{A=B}+ &\chemfig{A=B} &Double\\
+3 &\verb+\chemfig{A~B}+ &\chemfig{A~B} &Triple\\
+4 &\verb+\chemfig{A>B}+ &\chemfig{A>B} &right Cram, plain\\
+5 &\verb+\chemfig{A<B}+ &\chemfig{A<B} &left Cram, plain\\
+6 &\verb+\chemfig{A>:B}+&\chemfig{A>:B}&right Cram, dashed\\
+7 &\verb+\chemfig{A<:B}+&\chemfig{A<:B}&left Cram, dashed\\
+8 &\verb+\chemfig{A>|B}+&\chemfig{A>|B}&right Cram, hollow\\
+9 &\verb+\chemfig{A<|B}+&\chemfig{A<|B}&left Cram, hollow\\\hline
+\end{tabular}
+\end{center}
+\label{setdoublesep}The command \verb-\setdoublesep{<dim>}- 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. The first optional argument defines the \verb-<angle>- of the bond. 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'', page~\pageref{molecules.ramifiees}.
+
+There are many ways of specifying the angle of a bond.
+\begin{description}
+\item[Predefined angles] 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] To give an angle in degrees relative to the horizontal, the optional argument must take this form: \verb-[:<absolute angle>]-. The \verb-<absolute angle>- may be positive or negative, and may have decimal places. It is reduced to the interval $[0,360)$.
+\item[Relative angle] It is often useful to give the bond angle relative to the preceding bond. This syntax is used:\verb-[::<relative angle>]-. The \verb-<relative angle>- may be positive or negative, and may have decimal places.
+\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. 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.
+
+\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}
+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}
+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. 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}
+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}
+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. 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}
+\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(-=-=-=)}|
+
+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 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|.
+
+To meet all requirements, there are two other commands \verb|\chemabove| and \verb|\chembelow| which allow placement of charges above or below the current atom.
+
+\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 \verb|\chemabove| and \verb|\chembelow| accept an optional argument which sets the distance between the charge and the atom.
+\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 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 \verb-\chemsign- and \verb-\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 \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{>}}. \CF ignores all characters inside braces when splitting groups into atoms.
+
+Therefore the first group of atoms "$\mathrm{H_3C}$" is split into two atoms: $\boxednode{H_3}{}$ and $\boxednode C{}$. In terms of chemistry, of course, these are not real atoms; $\mathrm{H_3}$, for example, consists of three hydrogen atoms. In what follows the word atom refers to \CF's definition. Thus \CF sees the preceding molecule as follows:
+\molht{\boxednode{H_3}{}\boxednode{C}{}-[,1.75]\boxednode{C}{}(-[:-30,1.5]\boxednode{O}{}\boxednode{H}{})=[:30,1.5]\boxednode{O}{}}}
+
+\section{Different types of bonds}
+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}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>}- 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}The command \verb-\setbondoffset{<dimension>}- sets the spacing $\delta$ between the bond line and the atom:
+\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}\par
+\chemfig{A>B><>|<C}/
+
+By default, all atoms within groups of atoms are typeset in math mode (spaces are ignored). They may therefore contain math mode specific commands such as subscripts or superscripts\footnote{There is a problem with the placement of groups of atoms containing exponents or subscripts. See page~\pageref{alignement.vertical}.}:
+\exemple{Math mode}|\chemfig{A_1B^2-C _ 3 ^ 4}|
+
+There are settings specifically for Cram bonds. 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}
+Each bond takes an optional argument in brackets. This optional argument can adjust every aspect of a bond, and consists of five optional fields separated by commas. The first of these fields defines the bond angle. Angles increase counterclockwise, and are relative to the horizontal. If the angle field is empty, the angle takes its default value of 0\degres. We will see later how to change this default.
+
+There are several ways of specifying the bond angle.
+\subsection{Predefined angles}
+When the angle field contains an integer, this represents the angle the bond makes relative to the horizontal, in multiples of 45\degres. For example, \verb-[0]- specifies an angle of 0\degres, \verb-[1]- is 45\degres, and so on 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}
+If one wishes to specify an angle in degrees relative to the horizontal, then the optional angle field must take this form: \verb-[:<absolute angle>]-. If necessary, the \verb-<absolute angle>- is reduced to the interval $[0,360)$:
+\exemple{Absolute angles}/\chemfig{A-[:30]B=[:-75]C-[:10]D-[:90]>|[:60]-[:-20]E-[:0]~[:-75]F}/
+
+\subsection{Relative angles}\label{angle.relatif}
+It is often useful to specify a bond angle relative to the preceding bond. This syntax must be then be used: \verb-[::<relative angle>]-. The sign of the \verb-<relative angle>- can be omitted if it is a \verb-+-.
+
+Here is a molecule where the first bond has an absolute angle of $-5\degres$, and the rest of the bond angles are incremented by 20\degres:
+\exemple{Result of relative angles}|\chemfig{A-[:-5]-[::+20]-[::20]B-[::+20]-[::20]C-[::20]}|
+
+One can ``break'' a chain of relative angles by putting an absolute or predefined angle where desired. Here, atom ``B'' is followed by a bond at an absolute angle of 315\degres.
+\exemple{Result of relative angles followed by absolute}|\chemfig{A-[:-5]-[::20]-[::20]B-[7]-[::20]C-[::20]}|
+
+\section{Length of a bond}
+Rather than speaking of length of a bond, we should use the term interatomic spacing. If effect, only the interatomic spacing is adjustable with \verb-\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.
+\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]}/
+
+\section{Departure and arrival atoms}
+A group of atoms can contain several atoms. Suppose we want to connect the group ``ABCD'' to the group ``EFG'' with a bond. \CF calculates which atom of the first group and which of the second group are to be connected by looking at the angle of bond relative to the horizontal. If the angle is between (but not including) $-90\degres$ and 90\degres{} (modulo 360\degres) then the bond is made between the last atom of the first group and the first atom of the second group. In all other cases, the bond is made between the first atom of the first group and the last atom of the second group.
+
+Here are some examples where the bond is in the interval $(-90,90)$, and where the bond is made between D and E:
+\exemple{Default atom connections}|\chemfig{ABCD-[:75]EFG}\quad
+ \chemfig{ABCD-[:-85]EFG}\quad
+ \chemfig{ABCD-[1]EFG}|
+
+In the following examples, the angles are in the interval $[90,270]$ and so the bond is made between A and G:
+\exemple[60]{Default atom connections}|\chemfig{ABCD-[:100]EFG}\quad
+ \chemfig{ABCD-[:-110]EFG}\quad
+ \chemfig{ABCD-[5]EFG}|
+
+One may sometimes want the bond partners to be atoms other than those determined by \CF. The departure and arrival atoms can be set with the optional bond argument by writing:
+\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}
+There is a fifth and last optional argument for bonds which is found after the fourth comma:
+\centerverb/[,,,,<tikz code>]/
+\smallskip
+
+This \verb-<tikz code>- is passed directly to \TIKZ when the bond is drawn. There one can put characteristics such as colour (\verb-red-), dash type (\verb-dash pattern=on 2pt off 2pt-), thickness (\verb-line width=2pt-), or even decoration if the \TIKZ decoration library has been loaded. A bond can be made invisible by writing ``\verb-draw=none-''. To set several attributes, the syntax of \TIKZ is used, separating them by a comma:
+\exemple{Passing tikz code}|\chemfig{A-[,,,,red]B}\par
+ \chemfig{A-[,,,,dash pattern=on 2pt off 2pt]B}\par
+ \chemfig{A-[,,,,line width=2pt]B}\par
+ \chemfig{A-[,,,,red,line width=2pt]B}|
+
+Numerous \TIKZ decoration libraries are available. For example, one can use the ``\verb-pathmorphing-'' library by putting \verb-\usetikzlibrary{decorations.pathmorphing}- in the preamble in order to draw wavy bonds:
+\exemple{Wavy bonds}|\chemfig{A-[,3,,,decorate,decoration=snake]B}|
+
+Cram bonds ignore thickness and dash settings.
+
+\section{Default values}
+At the beginning of each molecule, the default values for the optional arguments are initialized. They are:
+\begin{itemize}
+ \item 0\degres{} for the bond angle;
+ \item 1 for the length multiplication coefficient;
+ \item \verb-<empty>- for the numbers of the departure and arrival atoms, which lets \CF calculate these based on the bond angle;
+ \item \verb-<empty>- for the parameters passed to \TIKZ.
+\end{itemize}
+
+These default values can be changed for the whole molecule by beginning the molecule code with
+\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}|
+
+\section{Branches}
+\subsection{Principle}
+Up to now, all the molecules have been linear, which is rare. A sub-molecule can be attached to an atom by following the atom with \verb-<code>- in parentheses. This \verb-<code>- is the code of the 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}
+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}
+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:
+\exemple{Incomplete 5-ring}|\chemfig{*5(-B=C-D)}|
+If a ring has a code which contains too many bonds and atom groups for the given number of vertices, all the bonds and groups over the maximum allowed are ignored:
+\exemple{Truncated 5-ring}|\chemfig{A*5(-B=C-D-E=F-G=H-I)}|
+
+It is possible to draw a circle or an arc in the inside of a ring. To do so, the following syntax is used:
+\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}
+As can be seen in the examples above, the rule is that the attachment atom ``\verb/A/'' is always at the south-west of the ring. Furthermore, the ring is always constructed counterclockwise, and the last bond descends vertically onto the attachment atom:
+\exemple{Angular position of rings}|\chemfig{A*4(-B-C-D-)}\qquad\chemfig{A*6(------)}|
+
+If this angular position is not convenient, it is possible to specify another angle using the optional argument at the beginning of the molecule. Here is a 6-cycle which has been rotated by $+30\degres$, by $-30\degres$, and lastly by $+60\degres$:
+\exemple[55]{Rotation of rings}|\chemfig{[:30]A*6(------)}\qquad
+ \chemfig{[:-30]A*6(------)}\qquad
+ \chemfig{[:60]A*6(------)}|
+
+\subsubsection{After a bond}
+When a ring does not begin a molecule and one or more bonds have already been drawn, the default angular position changes: the ring is drawn is such a way that the bond ending on the attachment atom bisects the angle formed by the first and last sides of the ring.
+
+Here is a simple case:
+\exemple{Bond ending on a ring}|\chemfig{A-B*5(-C-D-E-F-)}|
+
+The rule remains valid, whatever the angle of the preceding bond:
+\exemple{Bonds ending on a ring}|\chemfig{A-[:25]B*4(----)}\vskip5pt
+ \chemfig{A=[:-30]*6(=-=-=-)}|
+
+\subsection{Branches on a ring}
+To have branches attached to the vertices of a ring, we use the syntax we have already seen:
+\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}
+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. Here, \verb/C-F/ and \verb/F-G/ must be connected by using the optional argument of these bonds:
+\exemple{Forced departure and arrival atoms}|\chemfig{AB*5(-CDE-[,,1]F-[,,,1]GH-I-)}|
+\newpage
+
+\part{Advanced usage}\label{utilisation.avancee}
+\section{Displaying atoms}\label{perso.affichage}
+Once a molecule has been split into atoms, the macro \verb-\printatom- is called internally by \CF in order to display each atom. Its sole argument is the code of the atom to be displayed (e.g. ``\verb-H_3-''). By default, this macro enters math mode and displays its argument with the math font family ``rm''. It is defined by the following code:
+
+\hfill\verb-\newcommand*\printatom[1]{\ensuremath{\mathrm{#1}}}-\hfill\null
+
+One can modify the code of this macro to customize how atoms are displayed. In the following example, we redefine \verb-\printatom- so that each atom will be enclosed in a rectangular box:
+\exemple{Redefinition of \string\printatom}/\fboxsep=1pt
+\renewcommand*\printatom[1]{\fbox{\ensuremath{\mathrm{##1}}}}
+\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{Shifted double bonds}
+All double bonds are made up of two line segments, and these segments are drawn on either side of the imaginary line along which a single bond would be drawn. It is possible to shift a double bond so that one of the line segments lies on the imaginary line. The other segment is then shifted above or below the bond. Actually, it is more correct to say ``left'' or ``right'' of the imaginary line, as the bond is traversed in the direction of drawing.
+
+To shift the bond to the left, write ``\verb-=^-'' and to shift it to the right, write ``\verb-=_-'':
+\exemple{Shifted double bonds}/\chemfig{A-=-B}\par
+\chemfig{A-=^-B}\par
+\chemfig{A-=_-B}/
+
+In rings, double bonds are automatically shifted to the left. However, they can be shifted to the right by specifying it with ``\verb-=_-'':
+\exemple{Shifted double bonds and rings}/\chemfig{*6(-=-=-=)}\qquad
+\chemfig{*6(-=_-=_-=_)}/
+
+Shifted bonds are particularly useful in drawing skeleton diagrams of molecules consisting of carbon chains with double bonds. They give a continuous zig-zag path, whereas the path will be broken with regular double bonds:
+\exemple{Shifted bonds and skeleton diagrams}/\chemfig{-[:30]=[:-30]-[:30]=[:-30]-[:30]}\par
+\chemfig{-[:30]=^[:-30]-[:30]=^[:-30]-[:30]}\par
+\chemfig{-[:30]=_[:-30]-[:30]=_[:-30]-[:30]}/
+
+\section{Delocalized double bonds}
+It is sometimes necessary to draw a double bond so that one line segment is dashed while the other is solid\footnote{Thanks to Andreas \textsc{Bröermann} who suggested this feature and who gave me the solution to this problem.}. This feature is not hardcoded into \CF; instead \TIKZ, its ``decorations'' library and its programmable styles make it possible.
+
+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}
+\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
+\centerverb|\definesubmol{<name>}{<code>}|
+\smallskip
+
+which saves the \verb/<code>/ for recall in the code of the molecule via the shortcut ``\verb/!{name}/''. All alphanumeric characters\footnote{Actually all the characters that can be put between \texttt{\string\csname...\string\endcsname} are allowed.} are accepted for the \verb/<name>/. The \verb/<code>/ can itself contain other aliases.
+
+A previous definition can be overwritten by\label{redefinesubmol}
+\centerverb|\redefinesubmol{<name>}{<code>}|
+\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 ``\verb/CH2/'' for the sub-molecule $\mathrm{CH_2}$. If we use only relative angles, it is possible to rotate the entire molecule to any given angle by using the optional global angle parameter which specifies the default bond angle of the main molecule. It is set to 15\degres{} here:
+\exemple{Butane}|\definesubmol{CH2}{C(-[::+90]H)(-[::-90]H)}
+ \chemfig{[:15]H-!{CH2}-!{CH2}-!{CH2}-!{CH2}-H}|
+
+\section{Decorations}
+\subsection{Lewis diagrams}\label{lewis}
+The macro \verb+\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-:
+\exemple{The \string\lewis\ macro}|\lewis{0246,A}\par\medskip
+ \lewis{1357,B}\par\medskip
+ \chemfig{H-\lewis{26,O}-S(=[2]\lewis{13,O})
+ (=[6]\lewis{57,O})-\lewis{26,O}-H}|
+
+If one wishes to draw two electrons instead of a line, follow the integer with a ``\verb-:-''. If one wishes to draw a single electron, follow it with a ``\verb-.-''. To draw a lacuna, follow it with a ``\verb-|-'':
+\exemple{Lewis diagrams}*\lewis{0:2:4:6:,C}\qquad\lewis{1:3:5:7:,C}\par\bigskip
+ \lewis{0.2.4.6.,C}\qquad\lewis{1.3.5.7.,C}\par\bigskip
+ \lewis{0:2.4|,X}\par\bigskip
+ Hydronium ion: \chemfig{H-\lewis{5|7,O^+}(-[2]H)-H}*
+
+All the decorations drawn by \verb-\lewis- are not included in the 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:
+\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
+\centerverb|\setlewis{<dim1>}{<dim2>}{<tikz code>}|
+\smallskip
+
+If an argument is empty, it takes its default value.
+\begin{itemize}
+ \item \verb-<dim1>- is the distance between the bounding box and the decoration. It is 1.5pt by default;
+ \item \verb-<dim2>- is the length of the line segment representing a pair of electrons. It is 1.5ex by default;
+ \item \verb-<code tikz>- is code which is passed directly to \TIKZ. This code is empty by default.
+\end{itemize}
+
+\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}
+\centerverb|\chemabove[<dim>]{<code>}{<stuff>}|
+and
+\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 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 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}
+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>- 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>}- 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>}- 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 {\ttfamily\textbackslash chemfig} in the {\ttfamily tikzpicture} environment}
+It is possible to call the \verb-\chemfig- inside a \verb-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{Vertical alignment}\label{alignement.vertical}
+In some cases with condensed structural diagram of molecules having horizontal bonds, the placement of groups of atoms is incorrect.
+
+Careful study of the following example shows that the groups of atoms are not correctly aligned on the 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 \verb-\vphantom- of the departure atom, but does not include it in the contents of the arrival atom; this \verb-\vphantom- is not intended to affect the following atoms.
+
+The defective alignment can thus be explained. The atoms ``\verb-B-'' and ``\verb-F-'' are aligned correctly as they reflect the height of the atoms before them because of their \verb-\vphantom-. For the atoms ``\verb-C-'' and ``\verb-F-'', the heights of the immediately preceding atoms are taken into account, but those of the atoms ``\verb-A^1-'' and ``\verb-E_1-'' are ignored! It follows that these atoms are a little too high or too low, depending on the height of these bonds.
+
+We can show this by making visible the bounding boxes of the atoms; one sees clearly that the atoms ``\verb-B-'' and ``\verb-F-'' have bounding boxes that reflect the heights of the immediately preceding atoms:
+\bgroup
+\makeatletter
+\def\CF@display@chem#1{\fbox{\ensuremath{\mathrm{#1}}}}
+\makeatother
+\exemple*{Vertical placement and bounding boxes}/\Huge\setatomsep{2em}
+\fboxsep=0pt
+\chemfig{A^1-B-C-D}\qquad
+\chemfig{E_1-F-G-H}/
+\egroup
+
+Since there is no satisfactory manual solution, this problem can be worked around manually by putting \emph{inside} the third atom a \verb-\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}/
+
+\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 \verb-\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}- so that the bonds touch the edges of the nodes. The interatomic spacing is increased to 75pt. Finally, the command \verb-\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:
+\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:
+\exemple{Backbone of ethanal}|\chemfig{H-C-C=[1]O}|
+
+The three hydrogen atoms still have to placed at the correct orientation with the help of predefined angles. The first is at 90\degres{} with the branch ``\verb/(-[2]H)/'', the second at 270\degres{} with ``\verb/(-[6H])/'', and the one on the right at 315\degres{} with ``\verb/(-[7]H)/'':
+\exemple{Ethanal}|\chemfig{H-C(-[2]H)(-[6]H)-C(-[7]H)=[1]O}|
+
+\subsection{2-amino-4-oxohexanoic acid}
+Here is the molecule to be drawn: \chemfig{-[::+30]-[::-60](=[:-90]O)-[::+60]-[::-60](-[:-90]NH_2)-[::+60](=[:90]O)-[::-60]OH}
+
+As is often the case for most molecules, there are several methods and for each several different ways of getting the result. Here we will look at four different methods.
+
+\subsubsection{Absolute angles}
+We will first of all draw the central chain with absolute angles. We set the default angle to $+30\degres$ with the optional argument, and so only the descending bonds need to have their absolute angle set to $-30\degres$:
+\exemple{Backbone (absolute angles)}|\chemfig{[:30]--[:-30]--[:-30]--[:-30]OH}|
+
+The branches ``\verb/(=[6]O)/'', ``\verb/(-[6]NH_2)/'' and ``\verb/(=[2]O)/'' still have to be added to the correct vertices:
+\exemple{Molecule (absolute angles)}|\chemfig{[:30]--[:-30](=[6]O)--[:-30](-[6]NH_2)-(=[2]O)-[:-30]OH}|
+
+\subsubsection{Relative angles}
+A more general approach uses only relative angles, in this way:
+\exemple{Structure (relative angles)}|\chemfig{[:30]--[::-60]--[::-60]--[::-60]OH}|
+
+then
+\exemple{Molecule (relative angles)}|\chemfig{[:30]--[::-60](=[::-60]O)--[::-60](-[::-60]NH_2)
+-(=[::60]O)-[::-60]OH}|
+
+\subsubsection{Ring}
+Since the angles between the bonds are 120\degres{}, it is possible to use a 6-ring, although this method is less natural. Here we take advantage of the fact that a ring can be left unfinished. The ring must be rotated 120\degres{} so that the first vertex is to the south-east of the ring:
+\exemple{Backbone (ring)}|\chemfig{[:120]NH_2*6(---=O)}|
+
+Now the branches must be added to the right vertices:
+\exemple{Molecule (ring)}|\chemfig{[:120]NH_2*6(-(-(=[::60]O)-[::-60]OH)--(--[::60])=O)}|
+
+\subsubsection{Nested rings}
+Delving deeper into the ring method, we can also consider nesting incomplete 6-rings. We could start with this backbone:
+\exemple{Backbone (nested rings)}|\chemfig{*6(--*6(--=O))}|
+
+And then add the bonds which leave the vertices of these rings. There are no angles to worry about because the bonds leaving the rings are the bisectors of the sides of the ring, exactly what we want here:
+\exemple{Molecule (nested rings)}|\chemfig{*6((-)-(=O)-*6(-(-NH_2)-(-OH)=O))}|
+
+A close look shows that the second line segment of the double bond to the oxygen atom is \emph{inside} the incomplete 6-ring\footnote{This was also true for the preceding method with one ring.} Despite its brevity, this code does not give a perfect drawing. This can of course be corrected by adding a little to the code:
+\exemple{Molecule (corrected nested rings)}|\chemfig{*6((-)-(=O)-*6(-(-NH_2)-(-OH)(=[::60]O)))}|
+
+\subsection{Glucose}
+The goal here is to represent the glucose molecule according to several different conventions.
+
+\subsubsection{Skeleton diagram}
+The code here looks like that of 2-amino-4-oxohexanoic acid. This gives almost the same structure with absolute angles, except here the default angle is $-30\degres$:
+\exemple[60]{Backbone}|\chemfig{[:-30]HO--[:30]--[:30]--[:30]-H}|
+
+Adding the branches is no problem. We use predefined absolute angles:
+\exemple[60]{Glucose, skeleton diagram}|\chemfig{[:-30]HO--[:30](<[2]OH)-(<:[6]OH)
+-[:30](<:[2]OH)-(<:[6]OH)-[:30](=[2]O)-H}|
+
+\subsubsection{Fisher projection}
+The goal is to get the molecule below:
+\begin{center}
+ \definesubmol{x}{(-[4]H)(-[0]OH)}
+ \definesubmol{y}{(-[0]H)(-[4]OH)}
+ \chemfig{[2]OH-[3]-!x-!x-!y-!x-=[1]O}
+\end{center}
+The idea is to begin to draw the longest chain vertically by giving a default angle of ``\verb-[2]-''. Here is the skeleton, where we have added lower case letters at the end of each vertical bond:
+\exemple{Skeleton}|\chemfig{[2]OH-[3]-a-b-c-d-=[1]O}|
+
+Next we define two aliases for the horizontal bonds and the atoms at their ends. Lets choose ``\verb-x-'' which we will put in place of the lower case a, c and d, and ``\verb-y-'' which will replace the letter c. Since these alias are just one character, we do not need braces and can write ``\verb-!x-'' instead of ``\verb-!{x}-'':
+\exemple{Glucose (Fisher projection)}|\definesubmol{x}{(-[4]H)(-[0]OH)}
+\definesubmol{y}{(-[0]H)(-[4]OH)}
+\chemfig{[2]OH-[3]-!x-!x-!y-!x-=[1]O}|
+
+\subsubsection{``Chair'' representation}
+We will depict the $\alpha$-D-glucose molecule:
+\chemfig{?(-[:190]OH)-[:-50](-[:170]OH)-[:10](-[:-55,0.7]OH)-[:-10](-[6,0.7]OH)-[:130]O-[:190]?(-[:150,0.7]-[2,0.7]OH)}
+
+To do this, we will first of all draw five sides of the chair and link the first vertex to the last with a hook ``\verb-?-''. We will use the following absolute angles, running counterclockwise: $-50\degres$, $10\degres$, $-10\degres$, $130\degres$, $190\degres$.
+\exemple{Structure}|
+\chemfig{?-[:-50]-[:10]-[:-10]-[:130]O-[:190]?}|
+
+Now we simply add the branches inside parentheses. The angles are chosen to give the best impression of presentive, and some bonds are shortened by a factor of 0.7:
+\exemple{Chair representation}|\chemfig{?(-[:190]OH)-[:-50](-[:170]OH)-[:10](-[:-55,0.7]OH)
+-[:-10](-[6,0.7]OH)-[:130]O-[:190]?(-[:150,0.7]-[2,0.7]OH)}|
+
+\subsubsection{Haworth projection}
+The goal is to depict this D-glucopyranose molecule:
+{\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 will thus be ``\verb/[2,0.5,2]/''.
+
+Next, to give the impression of perspective to the ring, the diagonal bonds will be shortened by a coefficient of 0.7. For the bold diagonal lines we will use Cram bonds, having redefined the base of the triangles to be 2pt. The bold horizontal bond needs to be drawn with a thickness of 2pt, and so its optional argument will be ``\verb/[0,,,,line width=2pt]/''. Here is the skeleton of the molecule:
+\exemple{Structure}|\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 prespective:
+\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{Adrenaline}
+We want to draw the adrenaline molecule:
+\chemfig{*6((-HO)-=-(-(<[::60]OH)-[::-60]-[::-60,,,2]HN-[::+60]CH_3)=-(-HO)=)}
+
+We are going to use two different methods.
+
+\subsubsection{Using one ring}
+First of all, we start with a 6-ring and we draw the start of the branches which leave it:
+\exemple[60]{Skeleton of adrenaline}|\chemfig{*6((-HO)-=-(-)=-(-HO)=)}|
+
+The branch on the right still needs to be completed using, for example, relative angles:
+\exemple[60]{Adrenaline, step two}|\chemfig{*6((-HO)-=-(--[::-60]-[::-60]
+HN-[::+60]CH_3)=-(-HO)=)}|
+
+Then we need to add a Cram-bonded \verb-OH- and indicate that the bond which arrives at ``\verb-HN-'' does so on the second atom, i.e., ``N''. We use the fourth optional argument of the bond:
+\exemple[60]{Adrenaline}|\chemfig{*6((-HO)-=-(-(<[::60]OH)-[::-60]-[::-60,,,2]
+HN-[::+60]CH_3)=-(-HO)=)}|
+
+\subsubsection{Using two rings}
+This method is less natural, but the goal is to show here how to make a bond invisible.
+
+We could improve this code by considering that the drawing of the adrenaline molecule is made of two 6-rings adjacent to each other:
+\exemple[60]{Adrenaline, two-ring skeleton}|\chemfig{*6((-HO)-=*6(--HN---)-=-(-HO)=)}|
+
+Now the first two bonds of the ring on the right need to be made invisible. To do this we use the argument that is passed to \TIKZ, specifying ``\verb-draw=none-''. These bonds will thus have this code: ``\verb/-[,,,,,draw=none]/''. To keep the code readable, we define an alias named ``\verb-&-'' for these bonds:
+\exemple[60]{Adrenaline, step two}|\definesubmol{&}{-[,,,,draw=none]}
+\chemfig{*6((-HO)-=*6(!&!&HN---)-=-(-HO)=)}|
+
+The rest becomes easy; just add the branches to the right vertices:
+\exemple[60]{Adrenaline, step three}|\definesubmol{&}{-[,,,,draw=none]}
+\chemfig{*6((-HO)-=*6(!&!&HN(-CH_3)--(<OH)-)-=-(-HO)=)}|
+
+To finish, we specify that the bonds that \emph{arrive at and leave from} ``\verb-HN-'' must do so at the second atom. We therefore define another alias for the invisible bond which arrives at ``\verb-HN-'':
+\exemple[60]{Adrenaline}|\definesubmol{&}{-[,,,,draw=none]}
+\definesubmol{&&}{-[,,,2,draw=none]}
+\chemfig{*6((-HO)-=*6(!&!{&&}HN(-CH_3)-[,,2]-(<OH)-)-=-(-HO)=)}|
+
+\subsection{Guanine}
+We will draw the guanine molecule:
+\chemfig{*6((-H_2N)=N-*6(-\chembelow{N}{H}-=N?)=?-(=O)-HN-[,,2])}\medskip
+
+First of all, let's begin by drawing the nested rings, putting just the nitrogen atoms at the vertices:
+\exemple{Guanine, skeleton}|\chemfig{*6(=N-*6(-N-=N)=--N-)}|
+
+Then we can draw the horizontal bond in the right ring with a hook. We will also place a hydrogen atom under the nitrogen atom of the 5-ring with the command \verb-\chembelow{N}{H}-. We also need to write ``\verb-HN-'' instead of ``\verb-N-'' at the vertex at the upper left of the molecule:
+\exemple{Guanine, step two}|\chemfig{*6(=N-*6(-\chembelow{N}{H}-=N?)=?--HN-)}|
+
+We note that one bond leaves from the wrong atom\footnote{This seems illogical because the angle of the bond from the \texttt{HN} group toward the first vertes lies between $-90\degres$ and $90\degres$; \CF should therefore leave from the second atom. To explain this contradiction, one must know that in rings, the last bond always links the last vertex to the first, ignoring the \emph{calculated theoretical} angle of this bond (which here is $-90\degres$). \CF uses this theoretical angle to determine the departure and arrival atoms, but does not use it to draw the bond because the two ends are already defined. The departure atom for the last bond is thus the first atom.}! The automatic calculation mechanism must be corrected so that the bond leaves from the second atom ``\verb-N-'' instead of the first. To do this we give an optional argument for the last bond of the first 6-ring ``\verb-[,,2]-'':
+\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{List of commands}
+The commands created by \CF are:
+\begin{center}
+\begin{tabular}{>\footnotesize l>\footnotesize p{9cm}}\\\hline
+\hfill\normalsize Commands\hfill\null &\hfill\normalsize Description\hfill\null\\\hline
+\verb-\chemfig<code>-& draws the molecule whose design is described by the \verb-<code>-\\
+\verb-\printatom- & displays the atoms within the molecules. It can be redefined to customize the ouput. See page~\pageref{perso.affichage}\\
+\verb-\setnodestyle{<style tikz>}-& using \TIKZ syntax, this macro defines the style of nodes containing the atoms. See page~\pageref{style.noeuds}\\
+\verb-\definesubmol{<name>}{<code>}- & creates an alias \verb-!<name>- which replaces \verb-<code>- in the code of the molecule being drawn. See page~\pageref{definesubmol}\\
+\verb-\redefinesubmol{<name>}{<code>}- & replaces a pre-existing alias \verb-!<name>- with the new \verb-<code>-. See page~\pageref{redefinesubmol}\\[2ex]\hline
+&\\
+\verb-\setcrambond{<dim1>}{<dim2>}{<dim3>}- & sets the dimensions of the triangles representing Cram bonds: \verb-<dim1>- is the size of the base, \verb-<dim2>- is the spacing between the dashes and \verb-<dim3>- is the side of the dashes. See page~\pageref{setcrambond}\\
+\verb-\setatomsep{<dim>}>- & sets the interatomic distance. See page~\pageref{setatomsep}\\
+\verb-\setbondoffset{<dim>}- & sets the space between bonded atoms and the bond. See page~\pageref{setbondoffset}\\
+\verb-\setdoublesep{<dim>}- & sets the spacing between the two lines of a double bond. See page~\pageref{setdoublesep}\\[2ex]\hline
+&\\
+\verb-\lewis{<codes>,<atom>}- & displays the \verb-<atom>- and places Lewis dot decorations as specified in the \verb-<code>-. The dots drawn do not change the bounding box. See page~\pageref{lewis}\\
+\verb-\setlewis{<dim1>}{<dim2>}{<tikz code>}- & sets the Lewis dot parameters; \verb-<dim1>- is the distance between the atoms and the decoration, \verb-<dim2>- is the length of the line representing the pair of electrons and \verb-<tikz code>- is code which is passed directly to \TIKZ. See page~\pageref{setlewis}\\[2ex]\hline
+&\\
+\verb-\chemsign[<dim>]<sign>- & draws the \verb-<sign>-, placing before and after it an unbreakable space of length \verb-<dim>-. See page~\pageref{chemsign}\\
+\verb-\chemrel[<txt1>][<txt2>]{<arrow code>}- & draws an arrow described by its \verb-<arrow code>- and places the optional text \verb-<txt1>- and \verb-<txt2>- above and below the arrow respectively. See page~\pageref{chemrel}\\
+\verb-\setchemrel{<dim1>}{<dim2>}{<dim3>}- & sets the dimensions of the arrow drawn with the command \verb-\chemrel-: \verb-<dim1>- is the vertical space between the arrow and the optional text, \verb-<dim2>- is the unbreakable horizontal space inserted before and after the arrow and \verb-<dim3>- is the length of the arrow. See page~\pageref{setchemrel}\\[2ex]\hline
+&\\
+\verb-\chemabove[<dim>]{<txt1>}{txt2}- & writes \verb-<txt1>- and places \verb-<txt2>- above, leaving \verb-<dim>- of vertical space. This command does not change the bounding box of \verb-<txt1>-. See page~\pageref{chemabove}\\
+\verb-\chembelow[<dim>]{<txt1>}{txt2}- & writes \verb-{txt1}- and places \verb-<txt2>- below, leaving \verb-<dim>- of vertical space. This command does not change the bounding box of \verb-<txt1>-. See page~\pageref{chemabove}\\\hline
+\end{tabular}
+\end{center}
+\newpage
+
+\part{Gallery}
+This manual concludes with drawings of molecules of varying complexity.
+
+The curious user can look at the \verb-<code>- of each molecule, though it does become less attractive the more complex the molecule gets. Indeed, beyond a certain level of complexity, though it it is fairly easy to write \verb-<code>-, it becomes much harder to read the \verb-<code>- to analyse it afterwards. We quickly reached the limits of immediate readability of the code of a complex drawing.
+
+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
+
+TODO list :
+\begin{itemize}
+ \item allow the user to specify, if he wishes for one bond, the distance $\delta$ (see page~\pageref{longueur.liaison}) between the ends of this bond and the bounding boxes of the atoms it links. One syntax idea would be to use the character ``\verb-#-'':\par\smallskip
+ \hfill\verb-<atom><bond characters>-{\color{red}\verb-#(dim1,dim2)-}\verb-[<optional argument>]<atom>-\hfill\null\par\smallskip
+ where \verb-<dim1>- and \verb-<dim2>- would be the dimensions $\delta$ at the start and end of the bond;
+ \item add Newman projections to the features of \CF.
+\end{itemize}
+\begin{center}
+\parskip0pt
+$\star$\par
+$\star\quad\star$
+\end{center}
+\bigskip
+
+\exemple*{2-methylpentane}/\chemfig{[7]H_3C-CH(-[6]CH_3)-[1]CH_2-CH_2-[1]CH_3}/
+
+\exemple*{3-ethyl-2-methylhexane}/\chemfig{H_3C-[7]CH(-[6]CH_3)-[1]CH(-[7]C_3H_7)-[2]CH_2-[3]H_3C}/
+
+\exemple*{Stearine, condensed structural diagram}/\definesubmol{@}{([0,2]-O-[0,1]C(=[2,1]O)-C_{17}H_{33})}
+\chemfig{[2,2]CH_2!@-CH_{\phantom 2}!@-CH_2!@}/
+
+\exemple*{Stearine, skeleton diagram}/\definesubmol{x}{-[:+30,.6]-[:-30,.6]}
+\definesubmol{y}{-O-(=[2,.6]O)-!x!x!x!x!x!x!x!x}
+\chemfig{[2](!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)-)-=-=-)}/
+
+\exemple*{Camphor}/\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]}/
+
+\exemple*{Triphenylmethane}/\chemfig{*6(-=-*6(-(-*6(=-=-=-))-*6(=-=-=-))=-=)}
+\quad ou \quad
+\definesubmol{@}{*6(=-=-=-)}
+\chemfig{(-[:-30]!@)(-[:90]!@)(-[:210]!@)}/
+
+\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(=-=-=-)}/
+
+\exemple*{Adenosine triphosphate}/\setcrambond{3pt}{}{}
+\definesubmol{a}{-P(=[::-90]O)(-[::90]HO)-}
+\chemfig{[:-54]*5((--[::60]O([::-60]!aO([::-60]!aO([::60]!aHO))))<(-OH)
+-[,,,,line width=2pt](-OH)>(-N*5(-=N-*6(-(-NH_2)=N-=N-)=_-))-O-)}/
+
+\exemple*{Viagra}/\chemfig{N*6((-H_3C)---N(-S(=[::+120]O)(=[::+0]O)-[::-60]*6(-=-(-O-[::-60]-[::+60]CH_3)
+=(-*6(=N-*5(-(--[::-60]-[::+60]CH_3)=N-N(-CH_3)-=)--(=O)-N(-H)-))-=))---)}/
+
+\exemple*{Cholesterol ester}/\chemfig{[:30]R-(=[::+60]O)-[::-60]O-*6(--*6(=--*6(-*5(---(-(-[::+60]Me)
+-[::-60]-[::-60]-[::+60]-[::-60](-[::-60]Me)-[::+60]Me)-)-(-[::+0]Me)---)--)-(-[::+0]Me)---)}/
+
+\exemple*{Porphyrin}/\chemfig{?=[::+72]*5(-N=(-=[::-72]*5(-[,,,2]HN-[,,2](=-[::-36]*5(=N-(=-[::-72]*5(-NH-[,,1]?=-=))
+-=-))-=-))-=-)}/
+
+\exemple*{Manganese 5,10,15,20-tetra(N-ethyl-3-carbazolyl) porphyrin}/\definesubmol{A}{*6(=-*5(-*6(-=-=-)--N(--[::-60])-)=-=-)}
+\chemfig{([::+180]-!A)=[::+72]*5(-N=(-(-[::+54]!A)=[::-72]*5(-N(-[::-33,1.5,,,draw=none]Mn)
+-(=(-[::+72]!A)-[::-36]*5(=N-(=(-[::+54]!A)-[::-72]*5(-N-(-)=-=))-=-))-=-))-=-)}/
+
+\exemple*{Penicillin}/\chemfig{[:-90]HN(-[::-45](-[::-45]R)=[::+45]O)>[::+45]*4(-(=O)-N*5(-(<:(=[::-60]O)
+-[::+60]OH)-(<[::+0])(<:[::-108])-S>)--)}/
+
+\exemple*{LSD}/\chemfig{[:150]?*6(=*6(--*6(-N(-CH_3)--(<(=[::+60]O)-[::-60]N(-[::+60]-[::-60])
+-[::-60]-[::+60])-=)([::-120]<H)---)-*6(-=-=-(-[::-30,1.155]\chembelow{N}{H}?)=))}/
+
+\exemple*{Strychnine}/\chemfig{*6(=-*6(-N*6(-(=O)--([::-120]<:H)*7(-O--=?[0]([::-25.714]-[,2]?[1]))
+-*6(-?[0,{>}]--(<N?[1]?[2])-(<[::-90]-[::-60]?[2]))(<:[::+0]H)-([::+120]<H))--?)=?-=-)}/
+
+\exemple*{Codeine}/\chemfig{[:-30]**6(-(-OH)-?-*6(-(-[3]-[2,2]-[0,.5])*6(-(<:[:-150,1.155]O?)
+-(<:OH)-=-)-(<:[1]H)-(-[2]NCH_3)--)---)}/
+
+\exemple*{A dye (red)}/\chemfig{**6(--*6(-(-NO_2)=-(-\lewis{26,O}-[0]H)=(-\lewis{4,N}=[0]\lewis{2,N}-[0]Ar)-)----)}/
+
+\exemple*{Menthone}/\chemfig{CH_3-?(-[2]H)(-[::-30,2]-[::+60](=[1]\lewis{20,O})
+-[::-150,1.5](-[:20]CH(-[1]CH_3)(-[7]CH_3))(-[6]H)-[::-90,2]-[::+60]?)}/
+
+\exemple*{Fischer indole synthesis}/\chemfig{*6(=-*6(-\chembelow{N}{H}-NH_2)=-=-)}
+\chemsign+
+\chemfig{(=[:-150]O)(-[:-30]R_2)-[2]-[:150]R_1}\chemrel[$\mathrm{H^+}$]{->}
+\chemfig{*6(-=*5(-\chembelow{N}{H}-(-R_2)=(-R_1)-)-=-=)}/
+
+\exemple*{Cristallography}/\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)-)}/
+\end{document} \ No newline at end of file
diff --git a/Master/texmf-dist/doc/latex/chemfig/chemfig_doc_fr.pdf b/Master/texmf-dist/doc/latex/chemfig/chemfig_doc_fr.pdf
index 4835bf1f710..b94055cab63 100644
--- a/Master/texmf-dist/doc/latex/chemfig/chemfig_doc_fr.pdf
+++ b/Master/texmf-dist/doc/latex/chemfig/chemfig_doc_fr.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/chemfig/chemfig_doc_fr.tex b/Master/texmf-dist/doc/latex/chemfig/chemfig_doc_fr.tex
index 9cfe136169e..de0ea998f29 100644
--- a/Master/texmf-dist/doc/latex/chemfig/chemfig_doc_fr.tex
+++ b/Master/texmf-dist/doc/latex/chemfig/chemfig_doc_fr.tex
@@ -3,7 +3,7 @@
% | |
% | Documentation de ChemFig |
% | |
-% | 23 juin 2010 |
+% | 31 aout 2010 |
% | |
% |_________________________________________________________________|
%
@@ -17,10 +17,11 @@
% later, see http://www.latex-project.org/lppl.txt
% Copyright : Christian Tellechea 2010
%
-% L'extension "chemfig" est constituée de ces 4 fichiers :
+% L'extension "chemfig" est constituée de ces 6 fichiers :
% chemfig.sty
% 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
@@ -49,6 +50,7 @@
\usepackage{fancybox}
\usepackage{textcomp}
\usepackage{enumitem}
+\usepackage{xstring}
\usepackage{chemfig}
\usetikzlibrary{decorations.pathmorphing}
\usepackage{emerald}
@@ -62,6 +64,8 @@
\fancyfoot[r]{\thepage}
\makeatletter
+\verbtocs\@diese|#|
+\verbtocs\@@diese|##|
\newcommand\disable@lig[1]{%
\catcode`#1\active
@@ -102,6 +106,7 @@
\newcommand\exemple@@@{%
\begingroup
+ \StrSubstitute\left@content{\@diese\@diese}\@diese[\left@content]%
\if@exstar
\edef\part@left{\the\dimexpr\linewidth-2\fboxsep-2\fboxrule}%
\let\part@right\part@left
@@ -125,13 +130,13 @@
\vskip3pt\hrule\vskip3pt
\everypar{{\color{lightgray}\rlap{\vrule height0.1pt width\part@right depth0.1pt}}}%
\par
- \hfill\right@content\hfill\null}%
+ \hfill\normalfont\right@content\hfill\null}%
\else
\parbox[c]\part@left{\vskip5pt\relax\ttfamily\footnotesize\left@content}%
\parbox[c]\part@right{%
\vskip5pt\relax
\everypar{{\color{lightgray}\rlap{\vrule height0.1pt width\part@right depth0.1pt}}}%
- \footnotesize
+ \normalfont\footnotesize
\right@content}%
\fi
}%
@@ -180,7 +185,7 @@
\filldraw[black](current page.north west) rectangle ([yshift=2.5cm]current page.east);
\end{tikzpicture}
\begin{center}
- \color{white}\ECFAugie\fontsize{50pt}{50pt}\selectfont\CF\ v0.1\par\medskip
+ \color{white}\ECFAugie\fontsize{50pt}{50pt}\selectfont\CF\ v\csname CF@ver\endcsname\par\medskip
\footnotesize\csname CF@fr@date\endcsname\par
\normalsize Christian Tellechea\par\vskip1.5cm
\huge Une extension \LaTeX{} pour dessiner des molécules
@@ -208,7 +213,9 @@ Il m'a aidé tout au long de l'écriture du code à trouver des fonctionnalités
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}%
-\end{minipage}\hfill\null
+\end{minipage}\hfill\null\bigskip
+
+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 utiliser ce package, il faut commencer par placer dans le préambule le code suivant :
@@ -399,10 +406,12 @@ Intrinsèquement, le dessin d'une molécule chimique consiste à relier par des
{\fboxsep1pt
Mais dans cette molécule
\molht{H_3C-C(-[:-30]OH)=[:30]O}
+
on compte 4 groupes d'atomes : "$\mathrm{H_3C}$", "C", "O" et "OH". Pour des raisons que nous verrons plus tard, \CF examine chaque groupe d'atomes et le découpe en atomes. Chaque atome s'étend jusqu'à rencontrer une lettre majuscule ou un de ces caractères spéciaux : {\ttfamily \boxedfalseverb{-} \boxedfalseverb{=} \boxedfalseverb{~} \boxedfalseverb{(} \boxedfalseverb{!} \boxedfalseverb{*} \boxedfalseverb{<} \boxedfalseverb{>}}. Pour \CF, tous les caractères entre accolades sont ignorés pour le découpage en atomes.
Par conséquent, le premier groupe d'atomes "$\mathrm{H_3C}$" est découpé en 2 atomes : $\boxednode{H_3}{}$ et $\boxednode C{}$. Chimiquement, il arrive que ce ne soient pas de vrais atomes puisque $\mathrm{H_3}$ par exemple, est constitué de 3 atomes d'hydrogène. Par abus de langage, on parlera d'atomes par la suite. Par conséquent, \CF voit la molécule précédente ainsi :
-\molht{\boxednode{H_3}{}\boxednode{C}{}-[,1.75]\boxednode{C}{}(-[:-30,1.5]\boxednode{O}{}\boxednode{H}{})=[:30,1.5]\boxednode{O}{}}}
+\renewcommand*\printatom[1]{\fbox{\ensuremath{\mathrm{\vphantom{H_3}#1}}}}
+\molht{H_3C-[,1.75]C(=[:30,1.5]O)(-[:-30,1.5]OH)}}
\section{Différents types de liaisons}
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{<|}.
@@ -444,8 +453,8 @@ Si deux liaisons se suivent, alors \CF insère un groupe vide \verb-{}-, et auto
\exemple{Groupes vides}/\chemfig{A-B=-=C}\par
\chemfig{A>B><>|<C}/
-Tous les atomes se trouvant dans les groupes d'atomes sont composés en mode mathématique. 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}|
+Par défaut, tous les atomes se trouvant dans les groupes d'atomes sont composés en mode mathématique (les espaces sont ignorés). Ils peuvent donc contenir des caractères propres à ce mode comme la mise en indice ou en exposant\footnote{Il existe un problème de placement des groupes d'atomes contenant des exposants ou des indices. Voir page~\pageref{alignement.vertical}.}:
+\exemple{Mode mathématique}|\chemfig{A_1B^2-C _ 3 ^ 4}|
Il existe des réglages spécifiques aux liaisons de Cram. On utilise cette syntaxe :\label{setcrambond}
\centerverb/\setcrambond{<dim1>}{<dim2>}{<dim3>}/
@@ -489,7 +498,7 @@ On peut "casser" un enchaînement d'angles relatifs en mettant un angle absolu o
\exemple{Suite d'angles realtif puis angle absolu}|\chemfig{A-[:-5]-[::20]-[::20]B-[7]-[::20]C-[::20]}|
\section{Longueur d'une liaison}
-En fait, il faudrait plutôt parler d'espace interatome que de longueur d'une liaison. En effet, seul l'espace interatome est réglable avec \verb-\DCatomsep- 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" :
+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 \verb-\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}|
@@ -555,7 +564,7 @@ On peut changer ces valeurs par défaut pour toute la molécule en débutant le
\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 suivent l'atome "C" de cet exemple :
+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{Ecrasement 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 :
@@ -571,7 +580,7 @@ Dans cet exemple, la sous molécule "\verb/-[1]W-X/" vient s'attacher sur l'atom
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/[:30]-D-E/" dont l'angle par défaut vaut 30\degres{} absolus. On attache également sur "B" une sous molécule "\verb/[::-60,1.5]-X-Y/" dont l'angle par défaut vaut 60\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 :
+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]/" :
@@ -735,6 +744,20 @@ Pour que le cycle ait une forme régulière, il faut passer outre le mécanisme
\newpage
\part{Utilisation avancée}\label{utilisation.avancee}
+\section{Affichage des atomes}\label{perso.affichage}
+Une fois le découpage en atomes effectué, la macro \verb-\printatom- est appelée de façon interne par \CF pour afficher chaque atome. Son unique argument est le code produisant l'affichage de l'atome (par exemple ``\verb-H_3-''). Par défaut, cette macro se place en mode mathématique et affiche son argument avec la police mathématique ``rm''. Elle est définie par le code suivant :
+
+\hfill\verb-\newcommand*\printatom[1]{\ensuremath{\mathrm{#1}}}-\hfill\null
+
+On peut modifier le code de cette macro pour personnaliser l'affichage de atomes. Dans l'exemple ci-dessous, on redéfinit \verb-\printatom- de façon à ce que chaque atome soit contenu dans une boîte rectangulaire :
+\exemple{Redéfinition de \string\printatom}/\fboxsep=1pt
+\renewcommand*\printatom[1]{\fbox{\ensuremath{\mathrm{##1}}}}
+\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{Liaisons doubles déportées}
Toutes les liaisons doubles sont composées de 2 traits et ces traits sont tracés de part et d'autre de la ligne théorique que prendrait la liaison simple. Il est possible de déporter cette liaison double de telle sorte qu'un des deux traits soit dans le prolongement de 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é.
@@ -752,6 +775,29 @@ Les liaisons déportées sont particulièrement utiles dans le tracé de formule
\chemfig{-[:30]=^[:-30]-[:30]=^[:-30]-[:30]}\par
\chemfig{-[:30]=_[:-30]-[:30]=_[:-30]-[:30]}/
+\section{Liaisons doubles délocalisées}
+Il est parfois nécessaire de tracer une liaison double dont un trait serait plein et l'autre en pointillé\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}
\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.
@@ -789,9 +835,11 @@ Cette commande peut également être utilisée en dehors de l'argument de \verb-
\chemfig{H-\lewis{26,O}-S(=[2]\lewis{13,O})
(=[6]\lewis{57,O})-\lewis{26,O}-H}|
-Si au lieu d'une paire, on veut dessiner un électron, il suffit de faire suivre l'entier spécifiant la position d'un "\verb-.-" Pour dessiner une lacune, on le fait suivre d'un "\verb-|-" :
-\exemple{Carbone et ion oxonium}*\lewis{0.2.4.6.,C}\par\medskip
- \chemfig{H-\lewis{5|7,O^+}(-[2]H)-H}*
+Si au lieu d'une paire représentée par une ligne, on souhaite deux points, on fait suivre l'entier par "\verb-:-". Si on veut dessiner un électron, il suffit de le faire suivre par un "\verb-.-". Pour dessiner une lacune, on le fait suivre d'un "\verb-|-" :
+\exemple{Décorations de Lewis}*\lewis{0:2:4:6:,C}\qquad\lewis{1:3:5:7:,C}\par\bigskip
+ \lewis{0.2.4.6.,C}\qquad\lewis{1.3.5.7.,C}\par\bigskip
+ \lewis{0:2.4|,X}\par\bigskip
+ Ion oxonuim : \chemfig{H-\lewis{5|7,O^+}(-[2]H)-H}*
Toutes les décorations dessinées par l'intermédiaire de \verb-\lewis- ne sont pas comptabilisées dans la boîte englobante de l'atome. Les décorations sont faites en surimpression. On en voit une conséquence dans les deux exemples ci-dessus où les cadre ne semblent ne plus être correctement ajustés au dessin de la molécule qui dépasse légèrement vers le bas. Ceci sera parfois observable dans ce chapitre "Décorations" où l'on présente des commandes qui ne modifient pas la boîte englobante.
@@ -807,7 +855,7 @@ On peut le constater de façon plus évidente en traçant une \verb-\fbox- autou
Si un argument est vide, il prend sa valeur par défaut.
\begin{itemize}
\item \verb-<dim1>- est la distance entre la boîte englobant l'atome et la décoration. Elle vaut 1.5pt par défaut;
- \item \verb-<dim2>- est la longueur du trait représentant la paire d'électrons. Elle vaut 8pt par défaut;
+ \item \verb-<dim2>- est la longueur du trait représentant la paire d'électrons. Elle vaut 1.5ex par défaut;
\item \verb-<code tikz>- est le code qui sera passé directement à \TIKZ. Ce code est vide par défaut.
\end{itemize}
@@ -906,6 +954,27 @@ Aucune solution automatique n'étant satisfaisante, on peut contourner manuellem
\chemfig{A^1-B-{\vphantom{A^1}C}-D}\qquad
\chemfig{E_1-F-{\vphantom{E_1}G}-H}/
+\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 \verb-\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}- pour que les liaisons touchent les frontières des nœuds. L'espace interatome est allongé à 75pt. Enfin, la commande \verb-\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 :
+\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.
@@ -1075,6 +1144,8 @@ Les commandes créées par \CF sont :
\begin{tabular}{>\footnotesize l>\footnotesize p{9cm}}\\\hline
\hfill\normalsize Commandes\hfill\null &\hfill\normalsize Description\hfill\null\\\hline
\verb-\chemfig<code>-&dessine la molécule dont le dessin est décrit par le \verb-<code>-\\
+\verb-\printatom- & cette macro affiche les atomes dans les molécules. Elle peut être redéfinie pour personnaliser l'affichage, voir~\pageref{perso.affichage}\\
+\verb-\setnodestyle{<style tikz>}-& à l'aide de la syntaxe de \TIKZ, cette macro définit le style de nœuds contenant les atomes, voir~\pageref{style.noeuds}\\
\verb-\definesubmol{<nom>}{<code>}- & créé un alias \verb-!<nom>- que l'on peut placer dans le code des molécules à dessiner qui remplace le \verb-<code>-. Voir page~\pageref{definesubmol}\\
\verb-\redefinesubmol{<nom>}{<code>}- & remplace l'alias déjà existant \verb-!<nom>- par le nouveau \verb-<code>-. Voir page~\pageref{redefinesubmol}\\[2ex]\hline
&\\
@@ -1084,7 +1155,7 @@ Les commandes créées par \CF sont :
\verb-\setdoublesep{<dim>}- & règle l'espacement entre les deux traits d'une double liaison. Voir page~\pageref{setdoublesep}\\[2ex]\hline
&\\
\verb-\lewis{<codes>,<atome>}- & affiche l'\verb-<atome>- et positionne les décorations de Lewis selon ce qui est spécifié dans le \verb-<code>-. Les décorations dessinées ne modifient pas la boîte englobante de l'\verb-<atome>-. Voir page~\pageref{lewis}\\
-\verb-\setlewis{<dim1>}{<dim2>}{<dim3>}- & 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-\setlewis{<dim1>}{<dim2>}{<code tikz>}- & 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-\chemsign[<dim>]<signe>- & 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>}- & 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}\\
@@ -1108,7 +1179,6 @@ Quoi qu'il en soit, j'espère que cette extension aidera tous les utilisateurs d
TODO list :
\begin{itemize}
- \item écrire la traduction de ce manuel en anglais;
\item permettre à l'utilisteur de spécifier, s'il le veut pour une liaison, la distance $\delta$ (voir page~\pageref{longueur.liaison}) entre les extrémités de cette liaison et les boîtes englobantes des atomes qu'elle relie. Une idée de syntaxe serait d'utiliser le caractère "\verb-#-" :\par\smallskip
\hfill\verb-<atome><caractères liaison>-{\color{red}\verb-#(dim1,dim2)-}\verb-[<argument optionnel>]<atome>-\hfill\null\par\smallskip
où la \verb-<dim1>- et la \verb-<dim2>- seraient les dimensions $\delta$ du début et de la fin de la liaison;
@@ -1144,7 +1214,7 @@ $\star\quad\star$
\exemple*{Anhydride phtalique}/\chemfig{*6(=*5(-(=O)-O-(=O)-)-=-=-)}/
-\exemple*{Camphre}/\chemfig{*6((-[:170])(-[:-110])-(-[:90]?)--(=O)-(-)-?-)}
+\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])
@@ -1199,9 +1269,32 @@ $\star\quad\star$
\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^+}$]{->}
+\chemfig{(=[:-150]O)(-[:-30]R_2)-[2]-[:150]R_1}
+\chemrel[$\mathrm{H^+}$]{->}
\chemfig{*6(-=*5(-\chembelow{N}{H}-(-R_2)=(-R_1)-)-=-=)}/
+\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])
diff --git a/Master/texmf-dist/tex/latex/chemfig/chemfig.sty b/Master/texmf-dist/tex/latex/chemfig/chemfig.sty
index b594c97f38a..4931fe7f2cc 100644
--- a/Master/texmf-dist/tex/latex/chemfig/chemfig.sty
+++ b/Master/texmf-dist/tex/latex/chemfig/chemfig.sty
@@ -1,11 +1,11 @@
-% _________________________________________________________________
-% | |
-% | |
-% | chemfig v0.1 |
-% | |
-% | June 23, 2010 |
-% | |
-% |_________________________________________________________________|
+% __________________________________________________________________
+% | |
+% | |
+% | chemfig v0.2 |
+% | |
+% | August 31, 2010 |
+% | |
+% |__________________________________________________________________|
%
% This is chemfig.sty, the code of the "chemfig" package.
%
@@ -16,12 +16,13 @@
% later, see http://www.latex-project.org/lppl.txt
% Copyright : Christian Tellechea 2010
%
-% The "chemfig" package consists of the 4 following files:
+% The "chemfig" package consists of the 6 following files:
% chemfig.sty (this file)
% README
+% chemfig_doc_en.tex, chemfig_doc_en.pdf (english manual)
% chemfig_doc_fr.tex, chemfig_doc_fr.pdf (manual in french)
%
-% -------------------------------------------------------------------
+% --------------------------------------------------------------------
% 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.
@@ -31,15 +32,15 @@
%
% 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
-% -------------------------------------------------------------------
-\newcommand*\CF@ver {0.1}
-\newcommand*\CF@date {2010/06/23}
-\newcommand*\CF@fr@date {23 juin 2010}
-\newcommand*\CF@en@date {June 23, 2010}
+% --------------------------------------------------------------------
+\newcommand*\CF@ver {0.2}
+\newcommand*\CF@date {2010/08/31}
+\newcommand*\CF@fr@date {31 ao\^ut 2010}
+\newcommand*\CF@en@date {August 31, 2010}
\newcommand*\CF@package@name{chemfig}
\ProvidesPackage\CF@package@name[\CF@date\space v\CF@ver\space Draw molecule with an easy syntax]
@@ -63,7 +64,7 @@
\newbox\CF@box@boxa
\newbox\CF@box@boxb
-\newcommand*\CF@display@chem[1]{\ensuremath{\mathrm{#1}}}
+\newcommand*\printatom[1]{\ensuremath{\mathrm{#1}}}
\def\CF@empty@node{{}}
@@ -147,13 +148,22 @@
\csname @\ifx\CF@toks@a\CF@toks@b first\else second\fi oftwo\endcsname
}
-\newcommand*\CF@if@firsttokin[2]{% teste si le token qui commence #1 appartient aux tokens mis dans #2
- \ifx\@empty#2\@empty%
+\newcommand*\CF@if@firsttokin[1]{% teste si le token qui commence #1 appartient aux tokens mis dans #2
+ \futurelet\CF@toks@a\CF@gobble@tonil#1\relax\@nil
+ \CF@if@firsttokin@i
+}
+
+\newcommand*\CF@if@firsttokin@i[1]{%
+ \ifx\@empty#1\@empty
\expandafter\@secondoftwo
\else
- \CF@if@firsttokmatch{#1}{#2}%
- {\expandafter\@firstoftwo}%
- {\CF@swap@fi\CF@expand@second{\CF@if@firsttokin{#1}}{\@gobble#2}}%
+ \futurelet\CF@toks@b\CF@gobble@tonil#1\relax\@nil
+ \ifx\CF@toks@a\CF@toks@b
+ \expandafter\expandafter\expandafter\@firstoftwo
+ \else
+ \CF@swap@fi\CF@swap@fi
+ \expandafter\CF@if@firsttokin@i\expandafter{\@gobble#1}%
+ \fi
\fi
}
@@ -162,25 +172,41 @@
\CF@if@instr@i#1\@@nil#2\@nil
}
+\def\CF@after@space#1 #2\@nil{#2}
+
+\newcommand\CF@if@spacefirst[1]{%
+ \futurelet\CF@toks@a\CF@gobble@tonil#1\relax\@nil
+ \csname @\ifx\CF@toks@a\@sptoken first\else second\fi oftwo\endcsname
+}
+
\newcommand*\CF@seek@node[3]{% cherche un noeud au début de #1 l'assigne dans la sc #2 et met le reste dans #3
\let#2\@empty
\def#3{#1}%
- \CF@seek@node@i{#1}#2#3%
+ \futurelet\CF@toks@a\CF@gobble@tonil#1\relax\@nil
+ \csname @\ifx\CF@toks@a\@sptoken first\else second\fi oftwo\endcsname
+ {\expandafter\CF@seek@node@i\expandafter{\CF@after@space#1\@nil}#2#3}% ignore l'espace qui commence un groupe d'atome
+ {\CF@seek@node@i{#1}#2#3}%
}
\newcommand*\CF@seek@node@i[3]{%
\ifx\@empty#1\@empty
\let#3\@empty
\else
- \CF@if@firsttokmatch{#1}\bgroup
- {\CF@expadd@tocs#2{\expandafter{\@car#1\@nil}}%
- \CF@swap@fi\CF@expand@second\CF@seek@node@i{\@gobble#1}#2#3%
+ \futurelet\CF@toks@a\CF@gobble@tonil#1\relax\@nil
+ \csname @\ifx\CF@toks@a\@sptoken first\else second\fi oftwo\endcsname
+ {\CF@add@tocs#2{ }%
+ \CF@swap@fi\CF@expand@second\CF@seek@node@i{\CF@after@space#1\@nil}#2#3%
}%
- {\CF@expand@second\CF@if@firsttokin{\@car#1\@nil}{-=\CF@char@triplebond<>(!*}%
- {\def#3{#1}}%
- {\CF@expadd@tocs#2{\@car#1\@nil}%
+ {\csname @\ifx\CF@toks@a\bgroup first\else second\fi oftwo\endcsname
+ {\CF@expadd@tocs#2{\expandafter{\@car#1\@nil}}%
\CF@swap@fi\CF@expand@second\CF@seek@node@i{\@gobble#1}#2#3%
}%
+ {\CF@if@firsttokin@i{-=(*<>!\CF@char@triplebond}%
+ {\def#3{#1}}%
+ {\CF@expadd@tocs#2{\@car#1\@nil}%
+ \CF@swap@fi\CF@expand@second\CF@seek@node@i{\@gobble#1}#2#3%
+ }%
+ }%
}%
\fi
}
@@ -353,12 +379,13 @@
\fi
\let\CF@default@angle\pgfmathresult
\fi
+ \let\CF@default@stringangle\@empty
\else
\def\CF@default@angle{0}%
+ \def\CF@default@stringangle{:0}% angle pris par défaut si le champ est vide
\fi% angle par défaut
\let\CF@current@angle\CF@default@angle
- \def\CF@default@stringangle{:0}%
- \def\CF@default@length{1}% longueur de la liaison par défaut
+ \ifCF@incycle\else\def\CF@default@length{1}\fi% longueur de la liaison par défaut sauf pour un cycle où on prend celle en cours
\let\CF@default@fromatom\@empty% numero de l'atome d'où partent les liaisons par défaut
\let\CF@default@toatom\@empty% numéro de l'atome où arrivent les laisons par défaut
\let\CF@default@tikz\@empty
@@ -410,7 +437,8 @@
\fi
\else\CF@current@fromatom
\fi}%
- \CF@expand@second\CF@if@firsttokin\CF@remain@molecule{-=<>\CF@char@triplebond}% la suite est une liaison
+ \expandafter\futurelet\expandafter\CF@toks@a\expandafter\CF@gobble@tonil\CF@remain@molecule\relax\@nil
+ \CF@if@firsttokin@i{-=<>\CF@char@triplebond}% la suite est une liaison
{\ifnum\CF@last@action=\tw@% c'est la deuxième liaison consécutive ?
\CF@insert@emptygroup\CF@remain@molecule% insère un groupe vide
\edef\CF@bond@outnode{\CF@bond@outnode}%
@@ -426,17 +454,19 @@
oftwo%
\endcsname
{\let\CF@next@scan\endgroup
- \CF@draw@bond\CF@bond@type{\CF@bond@outnode}{\CF@hook@cycle}\CF@previous@atomgroup\CF@hook@atomgroup}%
+ \CF@draw@bond\CF@bond@type{\CF@bond@outnode}{\CF@hook@cycle}\CF@previous@atomgroup\CF@hook@atomgroup
+ }%
{\node[at=(\CF@bond@outnode),shift=(\CF@current@angle:\CF@current@length*\CF@atom@sep)](CF@node){};
\let\CF@previous@angle\CF@current@angle
- \let\CF@last@action\tw@}%
+ \let\CF@last@action\tw@
+ }%
\fi
\ifx\CF@remain@molecule\@empty% plus rien après la liaison -> insère un groupe vide
\CF@insert@emptygroup\CF@remain@molecule
\fi
}%
{\edef\CF@bond@outnode{\CF@bond@outnode}% évalue le l'atome de départ de liaison
- \CF@expand@second\CF@if@firsttokmatch\CF@remain@molecule(% une parenthèse pour commencer ?
+ \csname @\ifx(\CF@toks@a first\else second\fi oftwo\endcsname% une parenthèse pour commencer ?
{\ifnum\CF@last@action=\tw@% il y avait une liaison juste avant ?
\CF@insert@emptygroup\CF@remain@molecule
\else
@@ -451,7 +481,7 @@
{\ifx\CF@remain@molecule\@empty
\let\CF@next@scan\endgroup
\else% ce qui reste après le noeud courant n'est pas vide, ne commence pas par "-=~", ni par une parenthèse
- \CF@expand@second\CF@if@firsttokmatch\CF@remain@molecule*% un cycle ?
+ \csname @\ifx*\CF@toks@a first\else second\fi oftwo\endcsname% un cycle ?
{\ifnum\CF@last@action=\tw@
\CF@insert@emptygroup\CF@remain@molecule% insère un groupe vide
\else
@@ -590,6 +620,8 @@
\ifnum\CF@doublebond@type=\z@
\let\CF@doublebond@type\@ne
\fi
+ \pgfmathparse{\CF@double@sep*tan(180/\CF@cycle@num)}%
+ \let\CF@doublebond@lengthcorrection\pgfmathresult
\fi
\ifcase\CF@doublebond@type
\CF@create@normnodes{#2@@}{#3@@}{\CF@double@sep/2}{\CF@double@sep/2}%
@@ -598,11 +630,31 @@
\or
\CF@create@normnodes{#2@@}{#3@@}\CF@double@sep\CF@double@sep
\CF@draw@bond@i(#2@@)--(#3@@);
- \CF@draw@bond@i(#2@@1)--(#3@@1);
+ \begingroup% ajuste éventuellement les longueurs des liaisons doubles
+ \ifCF@incycle
+ \ifdim\CF@start@offset=\z@
+ \CF@add@tocs\CF@current@tikz{,shorten <=\CF@doublebond@lengthcorrection pt}%
+ \fi
+ \ifdim\CF@end@offset=\z@
+ \CF@add@tocs\CF@current@tikz{,shorten >=\CF@doublebond@lengthcorrection pt}%
+ \fi
+ \fi
+ \CF@draw@bond@i(#2@@1)--(#3@@1);
+ \endgroup
\or
\CF@create@normnodes{#2@@}{#3@@}\CF@double@sep\CF@double@sep
\CF@draw@bond@i(#2@@)--(#3@@);
- \CF@draw@bond@i(#2@@2)--(#3@@2);
+ \begingroup% ajuste éventuellement les longueurs des liaisons doubles
+ \ifCF@incycle
+ \ifdim\CF@start@offset=\z@
+ \CF@add@tocs\CF@current@tikz{,shorten <=-\CF@doublebond@lengthcorrection pt}%
+ \fi
+ \ifdim\CF@end@offset=\z@
+ \CF@add@tocs\CF@current@tikz{,shorten >=-\CF@doublebond@lengthcorrection pt}%
+ \fi
+ \fi
+ \CF@draw@bond@i(#2@@2)--(#3@@2);
+ \endgroup
\fi
\or% 3 = liaison triple
\CF@create@normnodes{#2@@}{#3@@}\CF@double@sep\CF@double@sep
@@ -664,6 +716,9 @@
\def\CF@extract@atom#1-#2\@nil{#2}% transforme le bound@outnode en n° de l'atome
+\newcommand\setnodestyle{\def\CF@node@style}
+\setnodestyle{}
+
\newcommand*\CF@draw@atomgroup[3]{% #1=angle d'arrivée de la liaison #2=numero atome sur lequel arrive la liaison #3=groupe d'atomes
\expandafter\let\expandafter\CF@bond@outcontent% assigne le contenu de l'atome d'où part la liaison
\csname\ifdefined\CF@bond@outnode atom@\expandafter\CF@extract@atom\CF@bond@outnode\@nil\else @empty\fi\endcsname
@@ -701,14 +756,14 @@
\else
\def\CF@node@strut{\vphantom\CF@bond@outcontent}%
\fi
- \def\CF@node@content{\expandafter\CF@display@chem\expandafter{\csname atom@\number\CF@cnt@atomnumber\endcsname\CF@node@strut}}%
- \edef\CF@opt@string{anchor=\ifnum\CF@last@action=\z@ base\else center\fi,at=(CF@node)}% premier atome de la molécule affiché
+ \def\CF@node@content{\expandafter\printatom\expandafter{\csname atom@\number\CF@cnt@atomnumber\endcsname\CF@node@strut}}%
+ \edef\CF@opt@string{anchor=\ifnum\CF@last@action=\z@ base\else center\fi,at=(CF@node),\CF@node@style}% premier atome de la molécule affiché
\loop
\unless\ifnum\CF@cnt@atomnumber>\CF@cnt@atomingroup
\expandafter\node\expandafter[\CF@opt@string](n\number\CF@cnt@groupnumber-\number\CF@cnt@atomnumber){\CF@node@content};%
\let\CF@node@strut\@empty
\advance\CF@cnt@atomnumber\@ne
- \edef\CF@opt@string{anchor=base west,at=(n\number\CF@cnt@groupnumber-\number\numexpr\CF@cnt@atomnumber-1.base east)}%
+ \edef\CF@opt@string{anchor=base west,at=(n\number\CF@cnt@groupnumber-\number\numexpr\CF@cnt@atomnumber-1.base east),\CF@node@style}%
\repeat
\CF@cnt@atomnumber\CF@hook@atomnumber
\ifnum\CF@last@action=\tw@% s'il faut tracer une liaison
@@ -719,7 +774,7 @@
\loop
\ifnum\CF@cnt@atomnumber>\@ne
\advance\CF@cnt@atomnumber\m@ne
- \edef\CF@opt@string{anchor=base east,at=(n\number\CF@cnt@groupnumber-\number\numexpr\CF@cnt@atomnumber+1.base west)}%
+ \edef\CF@opt@string{anchor=base east,at=(n\number\CF@cnt@groupnumber-\number\numexpr\CF@cnt@atomnumber+1.base west),\CF@node@style}%
\expandafter\node\expandafter[\CF@opt@string](n\number\CF@cnt@groupnumber-\number\CF@cnt@atomnumber){\CF@node@content};%
\repeat
\CF@hook@drawall
@@ -732,9 +787,17 @@
\else
\advance\CF@cnt@atomingroup\@ne
\CF@if@firsttokmatch{#1}\egroup
- {\CF@expand@second{\def\CF@current@atom}{\expandafter{\@car#1\@nil}}}%
- {\CF@expand@second{\def\CF@current@atom}{\@car#1\@nil}}% prend le 1er car
- \CF@swap@fi\CF@expand@second\CF@draw@atomgroup@ii{\@gobble#1}%
+ {\CF@expand@second{\def\CF@current@atom}{\expandafter{\@car#1\@nil}}%
+ \CF@swap@fi\CF@expand@second\CF@draw@atomgroup@ii{\@gobble#1}%
+ }%
+ {\CF@if@spacefirst{#1}%
+ {\def\CF@current@atom{ }%
+ \CF@swap@fi\CF@expand@second\CF@draw@atomgroup@ii{\CF@after@space#1\@nil}%
+ }%
+ {\CF@expand@second{\def\CF@current@atom}{\@car#1\@nil}%
+ \CF@swap@fi\CF@expand@second\CF@draw@atomgroup@ii{\@gobble#1}%
+ }%
+ }%
\fi
}
@@ -743,35 +806,40 @@
\expandafter\let\csname atom@\number\CF@cnt@atomingroup\endcsname\CF@current@atom
\let\CF@current@atom\@empty
\else
- \CF@if@firsttokmatch{#1}\bgroup
- {\CF@expadd@tocs\CF@current@atom{\expandafter{\@car#1\@nil}}%
- \CF@swap@fi\CF@expand@second\CF@draw@atomgroup@ii{\@gobble#1}%
- }%
- {\CF@expand@second\CF@ifcar@isupperletter{\@car#1\@nil}%
- {\expandafter\let\csname atom@\number\CF@cnt@atomingroup\endcsname\CF@current@atom
- \let\CF@current@atom\@empty
- \CF@swap@fi\CF@draw@atomgroup@i{#1}
+ \CF@if@spacefirst{#1}%
+ {\CF@expadd@tocs\CF@current@atom{ }%
+ \CF@swap@fi\CF@expand@second\CF@draw@atomgroup@ii{\CF@after@space#1\@nil}%
+ }
+ {\CF@if@firsttokmatch{#1}\bgroup
+ {\CF@expadd@tocs\CF@current@atom{\expandafter{\@car#1\@nil}}%
+ \CF@swap@fi\CF@expand@second\CF@draw@atomgroup@ii{\@gobble#1}%
}%
- {\CF@if@firsttokmatch{#1}?%
- {\expandafter\CF@if@firsttokmatch\expandafter{\@gobble#1}[% un crochet après le "?"
- {\expandafter\CF@grab@optarg\@gobble#1\@nil\CF@after@hook}%
- {\expandafter\CF@grab@optarg\expandafter[\expandafter]\@gobble#1\@nil\CF@after@hook}%
- \CF@expand@second{\CF@expand@second\CF@if@instr\CF@hook@list}{\expandafter(\CF@hook@currentname)}% crochet déjà défini ?
- {\expandafter\CF@hook@parselist\expandafter{\CF@hook@currentname}% va chercher les caractéristiques du crochet sauvegardé
- \CF@edefadd@tocs\CF@hook@drawlist{%
- [\CF@hook@currentname,\CF@hook@currentlink,\CF@hook@currenttikz]{\CF@hook@savedcoord}{n\number\CF@cnt@groupnumber-\number\CF@cnt@atomingroup}}%
- \CF@expadd@tocs\CF@hook@drawlist{\expandafter{\CF@hook@savedcontent}}%
- \CF@expadd@tocs\CF@hook@drawlist{\expandafter{\CF@current@atom}}% ajoute les 4 arguments à la liste des crochets à tracer
- \CF@global@let\CF@hook@drawlist\CF@hook@drawlist
+ {\CF@expand@second\CF@ifcar@isupperletter{\@car#1\@nil}%
+ {\expandafter\let\csname atom@\number\CF@cnt@atomingroup\endcsname\CF@current@atom
+ \let\CF@current@atom\@empty
+ \CF@swap@fi\CF@draw@atomgroup@i{#1}
+ }%
+ {\CF@if@firsttokmatch{#1}?%
+ {\expandafter\CF@if@firsttokmatch\expandafter{\@gobble#1}[% un crochet après le "?"
+ {\expandafter\CF@grab@optarg\@gobble#1\@nil\CF@after@hook}%
+ {\expandafter\CF@grab@optarg\expandafter[\expandafter]\@gobble#1\@nil\CF@after@hook}%
+ \CF@expand@second{\CF@expand@second\CF@if@instr\CF@hook@list}{\expandafter(\CF@hook@currentname)}% crochet déjà défini ?
+ {\expandafter\CF@hook@parselist\expandafter{\CF@hook@currentname}% va chercher les caractéristiques du crochet sauvegardé
+ \CF@edefadd@tocs\CF@hook@drawlist{%
+ [\CF@hook@currentname,\CF@hook@currentlink,\CF@hook@currenttikz]{\CF@hook@savedcoord}{n\number\CF@cnt@groupnumber-\number\CF@cnt@atomingroup}}%
+ \CF@expadd@tocs\CF@hook@drawlist{\expandafter{\CF@hook@savedcontent}}%
+ \CF@expadd@tocs\CF@hook@drawlist{\expandafter{\CF@current@atom}}% ajoute les 4 arguments à la liste des crochets à tracer
+ \CF@global@let\CF@hook@drawlist\CF@hook@drawlist
+ }%
+ {\CF@edefadd@tocs\CF@hook@list{(\CF@hook@currentname)|n\number\CF@cnt@groupnumber-\number\CF@cnt@atomingroup|}%
+ \CF@expadd@tocs\CF@hook@list{\CF@current@atom|}%
+ \CF@global@let\CF@hook@list\CF@hook@list
+ }%
+ \CF@swap@fi\CF@expand@second\CF@draw@atomgroup@ii\CF@after@hook
}%
- {\CF@edefadd@tocs\CF@hook@list{(\CF@hook@currentname)|n\number\CF@cnt@groupnumber-\number\CF@cnt@atomingroup|}%
- \CF@expadd@tocs\CF@hook@list{\CF@current@atom|}%
- \CF@global@let\CF@hook@list\CF@hook@list
+ {\CF@expadd@tocs\CF@current@atom{\@car#1\@nil}%
+ \CF@swap@fi\CF@expand@second\CF@draw@atomgroup@ii{\@gobble#1}%
}%
- \CF@swap@fi\CF@expand@second\CF@draw@atomgroup@ii\CF@after@hook
- }%
- {\CF@expadd@tocs\CF@current@atom{\@car#1\@nil}%
- \CF@swap@fi\CF@expand@second\CF@draw@atomgroup@ii{\@gobble#1}%
}%
}%
}%
@@ -824,43 +892,52 @@
\newcommand*\setlewis[3]{%
\ifx\@empty#1\@empty\def\CF@lewis@offset{1.5pt}\else\def\CF@lewis@offset{#1}\fi
- \ifx\@empty#2\@empty\def\CF@lewis@length{8pt}\else\def\CF@lewis@length{#2}\fi
- \ifx\@empty#3\@empty\def\CF@lewis@style{}\else\def\CF@lewis@style{#3}\fi}
+ \ifx\@empty#2\@empty\def\CF@lewis@length{1.5ex}\else\def\CF@lewis@length{#2}\fi
+ \ifx\@empty#3\@empty\def\CF@lewis@style{}\else\def\CF@lewis@style{#3}\fi
+}
+
\setlewis{}{}{}
\newcommand*\lewis[1]{\begingroup\@makeother;\CF@lewis@i#1\@nil}
\def\CF@lewis@i#1,#2\@nil%
{%
- \setbox\CF@lewis@box\hbox{\CF@display@chem{#2}}%
+ \setbox\CF@lewis@box\hbox{\printatom{#2}}%
\def\CF@lewis@remainpos{#1}%
\let\CF@lewis@previouspos\@empty
\loop
\unless\ifx\CF@lewis@remainpos\@empty
- \edef\CF@lewis@currentpos{\expandafter\@car\CF@lewis@remainpos\@nil}%
- \edef\CF@lewis@remainpos{\expandafter\@gobble\CF@lewis@remainpos}%
- \pgfmathparse{\wd\CF@lewis@box/2+\ifcase\CF@lewis@currentpos\space1\or1\or0\or-1\or-1\or-1\or0\or1\fi*(\wd\CF@lewis@box/2+\CF@lewis@offset)}%
- \let\CF@lewis@x\pgfmathresult
- \pgfmathparse{\ht\CF@lewis@box/2+\ifcase\CF@lewis@currentpos\space0\or1\or1\or1\or0\or-1\or-1\or-1\fi*(\ht\CF@lewis@box/2\ifnum\CF@lewis@currentpos>4 +\dp\CF@lewis@box\fi+\CF@lewis@offset)}%
- \let\CF@lewis@y\pgfmathresult
- \edef\CF@lewis@xoffset{\ifcase\CF@lewis@currentpos\space0\or0.7071\or1\or0.7071\or0\or-0.7071\or-1\or-0.7071\fi}%
- \edef\CF@lewis@yoffset{\ifcase\CF@lewis@currentpos\space-1\or-0.7071\or0\or0.7071\or1\or0.7071\or0\or-0.7071\fi}%
- \if.\expandafter\@car\CF@lewis@remainpos\relax\@nil
+ \edef\CF@lewis@currentpos{\expandafter\@car\CF@lewis@remainpos\@nil}%
\edef\CF@lewis@remainpos{\expandafter\@gobble\CF@lewis@remainpos}%
- \tikz \draw[overlay,fill,black] ([xshift=-\CF@lewis@yoffset*0.8,yshift=\CF@lewis@xoffset*0.8]\CF@lewis@x pt,\CF@lewis@y pt)circle(0.8pt);%
- \else
- \if|\expandafter\@car\CF@lewis@remainpos\relax\@nil
+ \pgfmathparse{\wd\CF@lewis@box/2+\ifcase\CF@lewis@currentpos\space1\or1\or0\or-1\or-1\or-1\or0\or1\fi*(\wd\CF@lewis@box/2+\CF@lewis@offset)}%
+ \let\CF@lewis@x\pgfmathresult
+ \pgfmathparse{\ht\CF@lewis@box/2+\ifcase\CF@lewis@currentpos\space0\or1\or1\or1\or0\or-1\or-1\or-1\fi*(\ht\CF@lewis@box/2\ifnum\CF@lewis@currentpos>4 +\dp\CF@lewis@box\fi+\CF@lewis@offset)}%
+ \let\CF@lewis@y\pgfmathresult
+ \edef\CF@lewis@xoffset{\ifcase\CF@lewis@currentpos\space0\or0.7071\or1\or0.7071\or0\or-0.7071\or-1\or-0.7071\fi}%
+ \edef\CF@lewis@yoffset{\ifcase\CF@lewis@currentpos\space-1\or-0.7071\or0\or0.7071\or1\or0.7071\or0\or-0.7071\fi}%
+ \if.\expandafter\@car\CF@lewis@remainpos\relax\@nil
\edef\CF@lewis@remainpos{\expandafter\@gobble\CF@lewis@remainpos}%
- \expandafter\tikz\expandafter\draw\expandafter[\CF@lewis@style,overlay]%
- (\CF@lewis@x-\CF@lewis@length*\CF@lewis@xoffset/2 pt,\CF@lewis@y-\CF@lewis@length*\CF@lewis@yoffset/2 pt)--
- ([xshift=-\CF@lewis@yoffset*2,yshift=\CF@lewis@xoffset*2]\CF@lewis@x-\CF@lewis@xoffset*\CF@lewis@length/2 pt,\CF@lewis@y-\CF@lewis@yoffset*\CF@lewis@length/2 pt)--
- ([xshift=-\CF@lewis@yoffset*2,yshift=\CF@lewis@xoffset*2]\CF@lewis@x+\CF@lewis@length*\CF@lewis@xoffset/2 pt,\CF@lewis@y+\CF@lewis@length*\CF@lewis@yoffset/2 pt)--
- (\CF@lewis@x+\CF@lewis@length*\CF@lewis@xoffset/2 pt,\CF@lewis@y+\CF@lewis@length*\CF@lewis@yoffset/2 pt)--cycle;%
+ \tikz \draw[overlay,fill,black] ([xshift=-\CF@lewis@yoffset*0.8,yshift=\CF@lewis@xoffset*0.8]\CF@lewis@x pt,\CF@lewis@y pt)circle(0.8pt);%
\else
- \expandafter\tikz\expandafter\draw\expandafter[\CF@lewis@style,overlay]%
- (\CF@lewis@x-\CF@lewis@length*\CF@lewis@xoffset/2 pt,\CF@lewis@y-\CF@lewis@length*\CF@lewis@yoffset/2 pt)--%
- (\CF@lewis@x+\CF@lewis@length*\CF@lewis@xoffset/2 pt,\CF@lewis@y+\CF@lewis@length*\CF@lewis@yoffset/2 pt);%
- \fi
+ \if|\expandafter\@car\CF@lewis@remainpos\relax\@nil
+ \edef\CF@lewis@remainpos{\expandafter\@gobble\CF@lewis@remainpos}%
+ \expandafter\tikz\expandafter\draw\expandafter[\CF@lewis@style,overlay]%
+ (\CF@lewis@x-\CF@lewis@length*\CF@lewis@xoffset/2 pt,\CF@lewis@y-\CF@lewis@length*\CF@lewis@yoffset/2 pt)--
+ ([xshift=-\CF@lewis@yoffset*2,yshift=\CF@lewis@xoffset*2]\CF@lewis@x-\CF@lewis@xoffset*\CF@lewis@length/2 pt,\CF@lewis@y-\CF@lewis@yoffset*\CF@lewis@length/2 pt)--
+ ([xshift=-\CF@lewis@yoffset*2,yshift=\CF@lewis@xoffset*2]\CF@lewis@x+\CF@lewis@length*\CF@lewis@xoffset/2 pt,\CF@lewis@y+\CF@lewis@length*\CF@lewis@yoffset/2 pt)--
+ (\CF@lewis@x+\CF@lewis@length*\CF@lewis@xoffset/2 pt,\CF@lewis@y+\CF@lewis@length*\CF@lewis@yoffset/2 pt)--cycle;%
+ \else
+ \if:\expandafter\@car\CF@lewis@remainpos\relax\@nil
+ \edef\CF@lewis@remainpos{\expandafter\@gobble\CF@lewis@remainpos}%
+ \tikz \draw[overlay,fill,black]
+ ([xshift=-2*\CF@lewis@xoffset,yshift=-2*\CF@lewis@yoffset]\CF@lewis@x pt,\CF@lewis@y pt)circle(0.8pt)%
+ ([xshift=2*\CF@lewis@xoffset,yshift=2*\CF@lewis@yoffset]\CF@lewis@x pt,\CF@lewis@y pt)circle(0.8pt);%
+ \else
+ \expandafter\tikz\expandafter\draw\expandafter[\CF@lewis@style,overlay]%
+ (\CF@lewis@x-\CF@lewis@length*\CF@lewis@xoffset/2 pt,\CF@lewis@y-\CF@lewis@length*\CF@lewis@yoffset/2 pt)--%
+ (\CF@lewis@x+\CF@lewis@length*\CF@lewis@xoffset/2 pt,\CF@lewis@y+\CF@lewis@length*\CF@lewis@yoffset/2 pt);%
+ \fi
+ \fi
\fi
\repeat
\box\CF@lewis@box
@@ -868,13 +945,13 @@
}
\newcommand*\chembelow[3][1.5pt]{%
- \setbox\CF@box@boxa\hbox{\CF@display@chem{#2}}\setbox\CF@box@boxb\hbox{\CF@display@chem{#3}}%
+ \setbox\CF@box@boxa\hbox{\printatom{#2}}\setbox\CF@box@boxb\hbox{\printatom{#3}}%
\vtop{%
- \hbox{\CF@display@chem{#2}}%
+ \hbox{\printatom{#2}}%
\hrule width0pt depth0pt height#1\relax
\hbox{%
\hskip\dimexpr(\wd\CF@box@boxa-\wd\CF@box@boxb)/2\relax
- \CF@display@chem{#3}%
+ \printatom{#3}%
\hskip\dimexpr(\wd\CF@box@boxa-\wd\CF@box@boxb)/2\relax
}%
\vskip-\dimexpr\ht\CF@box@boxb+\dp\CF@box@boxb+#1\relax
@@ -882,13 +959,13 @@
}
\newcommand*\chemabove[3][1.5pt]{%
- \setbox\CF@box@boxa\hbox{\CF@display@chem{#2}}\setbox\CF@box@boxb\hbox{\CF@display@chem{#3}}%
+ \setbox\CF@box@boxa\hbox{\printatom{#2}}\setbox\CF@box@boxb\hbox{\printatom{#3}}%
\vtop{%
- \hbox{\CF@display@chem{#2}}%
+ \hbox{\printatom{#2}}%
\hrule width0pt depth0pt height-\dimexpr#1+\ht\CF@box@boxa+\ht\CF@box@boxb+\dp\CF@box@boxb\relax
\hbox{%
\hskip\dimexpr(\wd\CF@box@boxa-\wd\CF@box@boxb)/2\relax
- \CF@display@chem{#3}%
+ \printatom{#3}%
\hskip\dimexpr(\wd\CF@box@boxa-\wd\CF@box@boxb)/2\relax
}%
}%
@@ -938,9 +1015,24 @@
\def\CF@remove@equichars#1<>#2\@nil{#1#2}
\endinput
-#####################################################################
-# Historique #
-#####################################################################
-
-v0.1 2010/06/23 Première version publique sur le CTAN
---------------------------------------------------------------------- \ No newline at end of file
+######################################################################
+# Historique #
+######################################################################
+
+v0.1 2010/06/23
+ - Première version publique sur le CTAN
+----------------------------------------------------------------------
+v0.2 2010/08/31
+ - Ajout de la documentation en anglais.
+ - Correction de bugs.
+ - \printatom est désormais une macro publique.
+ - Les espaces sont permis dans les molécules. Ils seront
+ ignorés par défaut puisque les atomes sont composés en mode
+ math par \printatom
+ - Une paire de Lewis peut être représentée ":".
+ - Dans les cycles, une correction de la longueur du trait
+ déporté des liaisons doubles est fait de telle sorte que si
+ l'on écrit \chemfig{*5(=====)}, on obtient deux polygones
+ réguliers concentriques.
+ - La séquence de contrôle \setnodestyle permet de spécifier le
+ style des nœuds dessinés par tikz. \ No newline at end of file