summaryrefslogtreecommitdiff
path: root/macros/generic/chemfig/chemfig-en.tex
diff options
context:
space:
mode:
Diffstat (limited to 'macros/generic/chemfig/chemfig-en.tex')
-rw-r--r--macros/generic/chemfig/chemfig-en.tex640
1 files changed, 343 insertions, 297 deletions
diff --git a/macros/generic/chemfig/chemfig-en.tex b/macros/generic/chemfig/chemfig-en.tex
index 5b247b3c09..8d29f8403a 100644
--- a/macros/generic/chemfig/chemfig-en.tex
+++ b/macros/generic/chemfig/chemfig-en.tex
@@ -126,7 +126,7 @@
\if\string b\detokenize\expandafter{\f@series}%
\lower0.01em\hbox{\itshape f}\kern-0.06em
\else
- \lower0.045em\hbox{\kern-0.05em \itshape f}\kern0.026em
+ \lower0.048em\hbox{\kern-0.04em \itshape f}\kern0.03em
\fi ig%
}%
\xspace
@@ -144,6 +144,7 @@
\newcommand*\CFval[1]{{\color{teal}\textlangle\textit{#1}\textrangle}}
\newcommand*\CFkv[2]{\CFkey{#1}{\color{teal}${}={}$}\CFval{#2}}
\newcommand*\CFparam[1]{\CFkey{#1}&\ifcat\relax\detokenize\expandafter\expandafter\expandafter{\useKV[chemfig]{#1}}\relax \textlangle\textit{empty}\textrangle\else\texttt{\detokenize\expandafter\expandafter\expandafter{\useKV[chemfig]{#1}}}\fi\\}
+\newcommand*\Chargeparam[1]{\CFkey{#1}&\ifcat\relax\detokenize\expandafter\expandafter\expandafter{\useKV[charge]{#1}}\relax \textlangle\textit{vide}\textrangle\else\texttt{\detokenize\expandafter\expandafter\expandafter{\useKV[charge]{#1}}}\fi}
\newcommand*\CFdelimparam[1]{\CFkey{#1}&\ifcat\relax\detokenize\expandafter\expandafter\expandafter{\useKV[CFdelimiters]{#1}}\relax \textlangle\textit{vide}\textrangle\else\texttt{\detokenize\expandafter\expandafter\expandafter{\useKV[CFdelimiters]{#1}}}\fi}
\usepackage[plainpages=false,pdfpagelabels,bookmarks=true,bookmarksopen=true,colorlinks=true,hyperfootnotes=false,filecolor=black,linkcolor=blue,urlcolor=magenta,pdfauthor={Christian TELLECHEA},pdftitle={ChemFig},pdfsubject={Draw 2D molecule with LaTeX},pdfkeywords={ChemFig},pdfcreator={LaTeX}]{hyperref}
@@ -194,8 +195,8 @@
\chemleft[{\subscheme[90]{%
\chemfig{R'-\chemabove{N}{\scriptstyle\oplus}~C-R}
\arrow{<->}[,0.75]
- \chemfig{R'-\lewis{2:,N}=@{a1}\chemabove{C}{\scriptstyle\oplus}-R}}}\chemright]
- \arrow{<=>[\chemfig{H_2@{a0}\lewis{0:2:,O}}]}[,1.1]
+ \chemfig{R'-\charge{90=\:}{N}=@{a1}\chemabove{C}{\scriptstyle\oplus}-R}}}\chemright]
+ \arrow{<=>[\chemfig{H_2@{a0}\charge{0=\:,90=\:}{O}}]}[,1.1]
\chemmove[red,-stealth,red,shorten <=3pt]{
\draw(a0)..controls+(90:10mm)and+(45:10mm)..([yshift=6pt]a1.45);}
\chemfig{*6(R\rlap{$'$}-N=(-R)-\chemabove{O}{\scriptstyle\oplus} H_2)}
@@ -215,54 +216,42 @@
\setitemize{leftmargin=3em,topsep=0pt,parsep=0pt,itemsep=0pt}
\part{Introduction}
-\section{New in v1.4}
-\subsection{Primitive \texttt{\textbackslash expanded}}
-\fbox{\vbox{\hsize\dimexpr\linewidth-2\fboxsep-2\fboxrule\relax\textbf{Important}: As of version 1.41, \CF requires a \TeX{} engine that provides the \texttt{\string\expanded} primitive. If this is not available, an error message will be issued and version 1.4 will be loaded (last version working without the primitive \texttt{\string\expanded}); it is strongly recommended that you update your \LaTeX{} distribution in order to take advantage of the newer \TeX{} engines that provide for the use of this new primitive.}}\medbreak
-
-\subsection{Position and rotation of delimiters}
-The new key \CFkey{h align} for delimiters allows, when set to \CFval{false}, to no longer automatically align delimiters horizontally. When the delimiters are no longer on the same horizontal, they can be rotated automatically by setting the key \CFkey{auto rotate} to \CFval{true}. You can override this automatic setting and choose the rotation angle with the key \CFkey{rotate}. See page~\pageref{polymerdelim}.
-
-\subsection{Private char}
-In the code of \CF, the character used in the name of private macros is "\verb|_|" (underscore) and no longer "\verb|@|" (arobe): the prefix of private macros of \CF is "\verb|\CF_|". The majority of \CF users should not be affected by this change, but the development or maintenance of specific codes such as those presented in the "Arrow customization" section on page~\pageref{definearrow} which uses private macros should take this catcode change into account; this will require an \emph{update of macros names} for those who have used private macros from \CF. To allow "\verb|_|" in macro names, we must execute the order "\verb|\catcode`\_=11|" and then, to return to a normal state run "\verb|\catcode`\_=8|".
-
-\subsection{Char \#}
-All those who program in \TeX{} know the extreme precautions that must be taken before using the "\verb|#|" character. This character is allowed in the code representing the molecule, but for internal operating reasons at \TeX, it will be doubled if the command \verb|\chemfig| is in the argument of a macro (like \verb|\fbox| in the example below). To avoid this doubling, we can write \verb|\#| or use the macro \verb|\CFhash|:
-
-\exemple{Char \#}/\setchemfig{atom sep=5em}\fboxsep=1pt
-1) \chemfig{A#-B_#-C^#}\par
-2) \fbox{\chemfig{A#-B_#-C^#}}\par
-3) \fbox{\chemfig{A\#-B_\#-C^\#}}\par
-4) \fbox{\chemfig{A\CFhash-B_\CFhash-C^\CFhash}}/
-
-For the macro \verb|\definesubmol|, the character \verb|#| is also allowed, but its use is more complex because it covers several cases that are examined on page~\pageref{definesubmol}.
-
-\subsection{Old macros and new syntax}
-Macros previously used to set the parameters of \CF are abandoned, are no longer defined and therefore, \emph{will result in a compilation error} if they are executed:
-\begin{center}
- \begin{tabular}{*3l}
- \verb-\setcrambond-&\verb-\setatomsep-&\verb-\enablefixedbondlength-\\
- \verb-\disablefixedbondlength-&\verb-\setbondoffset-&\verb-\setdoublesep-\\
- \verb-\setangleincrement-&\verb-\setnodestyle-&\verb-\setbondstyle-\\
- \verb-\setlewis-&\verb-\setlewisdist-&\verb-\setstacksep-\\
- \verb-\setcompoundstyle-&\verb-\setarrowdefault-&\verb-\setandsign-\\
- \verb-\setarrowoffset-&\verb-\setcompoundsep-&\verb-\setarrowlabelsep-\\
- \verb-\enablebondjoin-&\verb-\disablebondjoin-&\verb-\schemedebug-
- \end{tabular}
- \end{center}
-Now, to set the parameters of \CF we have the choice:
+\section{New in v1.5}
+\subsection{The macro \texttt{\protect\textbackslash charge}}
+Version 1.5 implements the macros \verb|\charge| and \verb|\Charge| (see page~\pageref{charge}) whose purpose is to place arbitrary elements around an atom that can be placed with great precision. These macros will replace the \verb|\lewis| and \verb|\Lewis| macros because they are much more powerful and configurable, even if more verbose. It is therefore important to note that the macros \verb|\lewis| and \verb|\Lewis| \textcolor{red}{\bfseries are no longer documented and will be removed from the \CF package}.
+
+\exemple{La macro \string\charge}/Simple charges around A :
+\Charge{0=\:,
+ 0:3pt[anchor=180]=$\color{red}\scriptstyle\delta^+$,
+ 120={\"["width=2pt,"style={draw=green,fill=gray}]},
+ 210=\|
+ }{A}
+\par
+Complex charges aroud "B" :
+\Charge{%
+ 30:10pt={\chemfig[atom sep=6pt,double bond sep=1.5pt]{[:20]*6(=-=-=-)}},
+ 120:5pt[scale=0.4,rotate=30,anchor=center]=\chemfig{CH_2=CH_2},
+ -45[anchor=west,rotate=\chargeangle]={%
+ \begin{tikzpicture}
+ \node[anchor=mid west](a){$\oplus$};\draw[-stealth](a)--(-.5,0);
+ \end{tikzpicture}}%
+ }{B}/
+
+\subsection{Consecutive bonds}
+As of version 1.5, two bonds are joined if the atom between them has all its dimensions equal to zero (i.e. width, height and depth in the sense of \TeX). Previously, two bonds were joined if the atom was \emph{empty}, which was more restrictive.
+
+Together with the use of the macro \verb|\charge|, this new feature makes it possible to place charges in a chain without using invisible bonds.
+\exemple{Consecutive bonds}/\chemfig{[:30]-\charge{90=\:}{}
+-[:-30]\charge{-90=\"}{}-\charge{90:2pt=$\delta^+$}{}-[:-30]}/
+
+\subsection{Manual Update}
+More detailed explanations are given on:
\begin{itemize}
- \item the macro \Verb|\setchemfig{<keys>=<values>}| sets the parameters according to the key/value method for the rest of the document;
- \item the macro \Verb|\chemfig[<keys>=<values>]| receives in its optional argument the parameters valid only for this molecule;
- \item the macro \verb|\resetchemfig| restores the parameters to their default values.
+ \item the role played by the first atom encountered in the placement of the whole molecule (page~\pageref{premieratome1} and \pageref{premieratome});
+ \item how \CF places the atoms in a group of atoms (page~\pageref{placementatomes});
+ \item how a bond joins two atoms (page~\pageref{liaisonatomes}).
\end{itemize}
-The complete list of parameters and their default values is shown page~\pageref{listeparametres}.
-
-Starred syntax \verb|\chemfig*| is no longer allowed. To specify a constant length of bonds, use the key \CFkey{fixed length} and set it to \CFval{true}, see page~\pageref{longueur.liaison}.
-
-\subsection{Macros \texttt{\textbackslash lewis} and \texttt{\textbackslash Lewis}}
-These two macros also have a slight syntax change. Their optional argument between brackets is no longer intended to receive the diagonal spacing coefficient, but \Verb|<<key>=values>| so that the parameters can be set for each macro call. See page~\pageref{lewis}.
-
\section{Presenting \protect\CF}
To use this package, start by adding the following code to the preamble:
\begin{itemize}
@@ -327,7 +316,7 @@ Here is the complete list of parameters as well as their default values\label{li
\end{minipage}\hfill
\begin{minipage}[t]{.45\linewidth}
\begin{longtable}{rl}\hline
- \chevrons{clés} & \chevrons{valeurs} par défaut\\\hline\endhead
+ \chevrons{keys} & default \chevrons{values}\\\hline\endhead
\CFparam{lewis radius}
\CFparam{lewis diag coeff}
\CFparam{cycle radius coeff}
@@ -359,8 +348,6 @@ The \Verb|<molecule code>| contains instructions for drawing the molecule accord
\item macros.
\end{itemize}
-In any case, \CF will place \emph{on the current baseline the first atom encountered}, whether it is empty or not. In the examples in this document, the baseline is drawn in light grey.
-
\section{Groups of atoms}
Drawing a molecule consists inherently of connecting groups of atoms with lines. Thus, in the molecule \chemfig{O=O}, there are two groups of atoms, each consisting of a single atom ``O''.
@@ -375,6 +362,13 @@ Therefore the first group of atoms ``$\mathrm{H_3C}$'' is split into two atoms:
A space is ignored when at the beginning of a group of atoms.
+\section{First atom's role}\label{premieratome1}
+It is important to understand that the placement of the entire molecule depends on the first atom placed, i.e. the first atom of the first group of atoms. For this first atom, its \TIKZ anchor "\verb|base east|" is placed on the baseline of the current line (drawn in gray in the examples of this manual).
+
+\exemple{Influence of the first atom}/\chemfig{A-B}\qquad
+\chemfig{-B}\qquad
+\chemfig{A^1-B}/
+
\section{Different types of bonds}
For \CF, bonds between two atoms are one of nine types, represented by the characters \boxedfalseverb-, \boxedfalseverb=, \boxedfalseverb~, \boxedfalseverb>, \boxedfalseverb<, \boxedfalseverb{>:}, \boxedfalseverb{<:}, \boxedfalseverb{>|} and \boxedfalseverb{<|} :\label{types.liaisons}
\begin{center}
@@ -821,10 +815,10 @@ The optional argument \Verb-<opt>- of the \verb-\chemmove- command will be added
\subsection{Mesomeric effects}
To make these concepts concrete, let's take the example of a mesomeric effect involving a double bond and non-bonding lone pair conjugate. Let's begin with the possible delocalization of electrons from the double bond. We will place a node named ``db'' (double bond) in the middle of the double bond and a node named ``a1'' on the end of the double bond.
-Les macros \verb|\schemestart|, \verb|\schemestop|, \verb|\arrow| et \verb|\+| sont exposées
+The macros \verb|\schemestart|, \verb|\schemestop|, \verb|\arrow| and \verb|\+| are explained in the chapter \ref{schemas}, starting on page \pageref{schemas}.
\exemple{Mesomeric effect 1}/\schemestart
- \chemfig{@{a1}=_[@{db}::30]-[::-60]\lewis{2,X}}
+ \chemfig{@{a1}=_[@{db}::30]-[::-60]\charge{90=\|}{X}}
\arrow{<->}
\chemfig{\chemabove{\vphantom{X}}{\ominus}-[::30]=_[::-60]
\chemabove{X}{\scriptstyle\oplus}}
@@ -840,7 +834,7 @@ To link the nodes ``db'' and ``a1'' we have used the following syntax:
For arrows in \verb|\chemmove|, the default tip is ``CF''.In this example we ask for an arrow (\verb/[->]/) and we use two \falseverb{control points}\footnote{To find all the ways of connecting two nodes with \TIKZ, read the documentation for that package.}. These will be located using polar coordinates at 80\degres{} and 8~mm from ``db'' for the first and at 145\degres{} and 8~mm from ``a1'' for the second. Though this syntax may seem complicated at first reading, one need not be alarmed because its use will usually be a matter of copying and pasting. Only the names and coordinates of the control points need be changed, as can be verified from the example below, where an arrow has been added from the lone pair (node ``dnl'' to the single bond (node ``sb'').
\exemple{Mesomeric effect 2}/\schemestart
- \chemfig{@{a1}=_[@{db}::30]-[@{sb}::-60]@{dnl}\lewis{2,X}}
+ \chemfig{@{a1}=_[@{db}::30]-[@{sb}::-60]@{dnl}\charge{90=\|}{X}}
\arrow{<->}
\chemfig{\chemabove{\vphantom{X}}{\ominus}-[::30]=_[::-60]
\chemabove{X}{\scriptstyle\oplus}}
@@ -851,7 +845,7 @@ For arrows in \verb|\chemmove|, the default tip is ``CF''.In this example we ask
For our new arrow we have set the \falseverb{control points} as follows: 4~mm at an angle of 90\degres{} from ``dnl'' and 4~mm at an angle of 45\degres{} from ``sb''. But we are not completely satisfied, since we would like the arrow not to touch the line segment representing the lone pair. To do this we will add some options to our arrow.
\exemple{Mesomeric effect 3}/\schemestart
- \chemfig{@{a1}=_[@{db}::30]-[@{sb}::-60]@{dnl}\lewis{2,X}}
+ \chemfig{@{a1}=_[@{db}::30]-[@{sb}::-60]@{dnl}\charge{90=\|}{X}}
\arrow{<->}
\chemfig{\chemabove{\vphantom{X}}{\ominus}-[::30]=_[::-60]
\chemabove{X}{\scriptstyle\oplus}}
@@ -865,7 +859,7 @@ The option ``\verb|shorten <=3pt|'' indicates that the tail of the arrow is to b
We can use all the power of \TIKZ instructions to modify the style of the arrow. Here we change the head of the arrow leaving the double bound and set it to ``\verb|-stealth|'', and we draw the arrow with a fine dashed red line. We also add the letter $\pi$ above the middle of the arrow:
\exemple{Mesomeric effect 4}/\schemestart
- \chemfig{@{a1}=_[@{db}::30]-[@{sb}::-60]@{dnl}\lewis{2,X}}
+ \chemfig{@{a1}=_[@{db}::30]-[@{sb}::-60]@{dnl}\charge{90=\|}{X}}
\arrow{<->}
\chemfig{\chemabove{\vphantom{X}}{\ominus}-[::30]=_[::-60]
\chemabove{X}{\scriptstyle\oplus}}
@@ -878,25 +872,25 @@ We can use all the power of \TIKZ instructions to modify the style of the arrow.
(dnl).. controls +(90:4mm) and +(45:4mm).. (sb);}/
In the following example, we'll see how to indicate the position of the departure or arrival anchor points of the arrow. If we write
-\exemple{Departure or arrival anchor point 1}/\chemfig{@{x1}\lewis{1:,X}}
+\exemple{Departure or arrival anchor point 1}/\chemfig{@{x1}\charge{45=\:}{X}}
\hspace{2cm}
-\chemfig{@{x2}\lewis{2|,X}}
-\chemmove{\draw[shorten >=4pt]
- (x1).. controls +(90:1cm) and +(90:1cm).. (x2);}/
+\chemfig{@{x2}\charge{90=\|}{X}}
+\chemmove{
+ \draw[shorten >=4pt](x1).. controls +(90:1cm) and +(90:1cm).. (x2);}/
Note that the tail of the arrow does not leave correctly from our electrons; it leaves from the middle of the upper edge of the node. Indeed, we chose a departure angle of 90~\degres{} and so \TIKZ makes the arrow leave from the anchor ``x1.90'' which corresponds to the intersection of the ray leaving from the center of node ``x1'' at a 90\degres{} angle relative to the horizontal and of the edge of the rectangular node. To get the arrow departure angle that we want, we must specify its position. After some trial and error, it is ``x1.57'':
-\exemple{Departure or arrival anchor point 2}/\chemfig{@{x1}\lewis{1:,X}}
+\exemple{Departure or arrival anchor point 2}/\chemfig{@{x1}\charge{45=\:}{X}}
\hspace{2cm}
-\chemfig{@{x2}\lewis{2|,X}}
-\chemmove{\draw[shorten <=4pt,shorten >=4pt]
- (x1.57).. controls +(60:1cm) and +(120:1cm).. (x2);}/
+\chemfig{@{x2}\charge{90=\|}{X}}
+\chemmove[shorten <=4pt,shorten >=4pt]{
+ \draw(x1.57).. controls +(60:1cm) and +(120:1cm).. (x2.90);}/
In some cases it will be easier to use Cartesian coordinated for the \falseverb{control points}. Here we use just one control point placed 1~cm to the right of and 1.5~cm above ``x1'':
-\exemple{A single control point}/\chemfig{@{x1}\lewis{1:,X}}
+\exemple{A single control point}/\chemfig{@{x1}\charge{45=\:}{X}}
\hspace{2cm}
-\chemfig{@{x2}\lewis{2|,X}}
-\chemmove{\draw[shorten <=4pt,shorten >=4pt]
- (x1.57).. controls +(1cm,1.5cm).. (x2);}/
+\chemfig{@{x2}\charge{90=\|}{X}}
+\chemmove[shorten <=4pt,shorten >=4pt]{
+ \draw(x1.57).. controls +(1cm,.8cm).. (x2.90);}/
All the graphics drawn by means of the command \verb|\chemmove| are superimposed and will not be included in the bounding boxes. We can see this in the preceding example.
@@ -904,18 +898,18 @@ All the graphics drawn by means of the command \verb|\chemmove| are superimposed
Thanks to the option \verb|remenber picture| which is passed to all the ``tikzpicture'' environments we can easily draw arrows indicating reaction mechanisms. Let's take for example the first step of the esterification reaction.
\exemple{Esterification: step 1}/\setchemfig{atom sep=7mm}
\schemestart
- \chemfig{R-@{dnl}\lewis{26,O}-H}
+ \chemfig{R-@{dnl}\charge{90=\|,-90=\|}{O}-H}
\+
\chemfig{R-@{atoc}C([6]-OH)=[@{db}]O}
\arrow(.mid east--){<->[\chemfig{@{atoh}\chemabove{H}{\scriptstyle\oplus}}]}
\schemestop
\chemmove[shorten <=2pt]{
- \draw(dnl)..controls +(90:1cm)and+(north:1cm)..(atoc);
- \draw[shorten >=6pt](db)..controls +(north:5mm)and+(100:1cm)..(atoh);}/
+ \draw(dnl)..controls +(90:1cm)and+(north:1cm)..(atoc);
+ \draw[shorten >=6pt](db)..controls +(north:5mm)and+(100:1cm)..(atoh);}/
The use of the \Verb|\chemabove{<code>}{<materiel>}| command does not change the dimensions of the \falseverb{bounding box} of \Verb|<code>|. For this reason we can run into some difficulty in pointing to the symbol representing the charge carried ($\oplus$ or $\ominus$). In the example above the solution is to create a control point with an angle of 110\degres{} at 1~cm from ``atoh'' and to shorten the arrow by 6pt. In the following example, the second step of the esterification reaction, we can see that the arrow can take more complicated forms without complicating the code.
\exemple{Esterification: step 2}/\setchemfig{atom sep=7mm}
-\chemfig{R-O-C(-[2]R)(-[6]OH)-@{dnl}\lewis{26,O}H}\hspace{1cm}
+\chemfig{R-O-C(-[2]R)(-[6]OH)-@{dnl}\charge{90=\|,-90=\|}{O}H}\hspace{1cm}
\chemfig{@{atoh}\chemabove{H}{\scriptstyle\oplus}}
\chemmove{
\draw[shorten <=2pt, shorten >=7pt]
@@ -1037,64 +1031,6 @@ With \CFkey{node style}, one can choose the colour of nodes drawn by \TIKZ, chan
\setchemfig{atom style={rotate=20}}\chemfig{A-B-[2]C}\par\medskip
\setchemfig{atom style={scale=0.5}}\chemfig{A-B-[2]C}/
-\section{Vertical alignment}\label{alignement.vertical}
-In some cases with condensed structural diagram of molecules having horizontal bonds, the placement of groups of atoms is incorrect.
-
-Careful study of the following example shows that the groups of atoms are not correctly aligned on the \falseverb{baseline}:
-\exemple*{Vertical placement}/\Huge\setchemfig{atom sep=2em}
-\chemfig{A^1-B-C-D}\qquad
-\chemfig{E_1-F-G-H}/
-
-Surprisingly, the second atom is correctly aligned while the last two undergo a vertical shift which seems to be the results of the different height of the bounding box of the atoms ``\verb-A^1-'' and ``\verb-E_1''-.
-
-In order to understand this phenomenon, we need to consider how \CF places groups of atoms relative to each other. Let us limit ourselves to the case of horizontal bonds in order to simplify terminology, although the algorithm is the same for other bonds. A horizontal bond leaves from the middle of the right side of the bounding box of the departure atom of this bond. The arrival atom is positioned in such a way that the middle of the left side of its bounding box is at the end of the bond. It follows that the vertical placement of the arrival atom depends on the height of the departure atom. To limit this phenomenon, \CF adds to each arrival atom the \falseverb{\vphantom} of the departure atom, but does not include it in the contents of the arrival atom; this \falseverb{\vphantom} is not intended to affect the following atoms. The atoms remaining in each group are aligned so that their baseline coincides with the baseline of the preceding atom.
-
-The defective alignment can thus be explained. The atoms ``\verb-B-'' and ``\verb-F-'' are aligned correctly as they reflect the height of the atoms before them because of their \falseverb{\vphantom}. For the atoms ``\verb-C-'' and ``\verb-F-'', the heights of the immediately preceding atoms are taken into account, but those of the atoms ``\verb-A^1-'' and ``\verb-E_1-'' are ignored! It follows that these atoms are a little too high or too low, depending on the height of these bonds.
-
-We can show this by making visible the bounding boxes of the atoms; one sees clearly that the atoms ``\verb-B-'' and ``\verb-F-'' have bounding boxes that reflect the heights of the immediately preceding atoms:
-\exemple*{Vertical placement and bounding boxes}/\Huge\setchemfig{atom sep=2em}
-\fboxsep=0pt
-\renewcommand\printatom[1]{\fbox{\ensuremath{\mathrm#1}}}
-\chemfig{A^1-B-C-D}\qquad
-\chemfig{E_1-F-G-H}/
-
-Since there is no satisfactory manual solution, this problem can be worked around manually by putting \emph{inside} the third atom a \falseverb{\vphantom} having the same height as the first, so that the height affects the following atoms:
-\exemple*{Vertical placement workaround}/\Huge\setchemfig{atom sep=2em}
-\chemfig{A^1-B-{\vphantom{A^1}C}-D}\qquad
-\chemfig{E_1-F-{\vphantom{E_1}G}-H}/
-
-\label{chemskipalign}For any group of atoms it is possible to temporarily deactivate the alignment adjustment mechanism and thus neutralize the \falseverb{\vphantom}. Simply place the \falseverb{\chemskipalign} command in the group of atoms; the alignment will resume in the following group of atoms as if the group of atoms containing \falseverb{\chemskipalign} had never existed. The following example shows the effects of this instruction: the reference point of the box containing the first atom is placed at the level of the bond which arrives from the left. The bounding boxes of the atoms are drawn in the second line.
-
-\exemple[60]{Deactivation of the alignment mechanism}/\large
-\chemfig{A-.-B}\quad
-\chemfig{A-\chemskipalign.-B}\par\bigskip
-\fboxsep=0pt
-\renewcommand\printatom[1]{\fbox{\ensuremath{\mathrm{#1}}}}
-\chemfig{A-.-B}\quad
-\chemfig{A-\chemskipalign.-B}/
-
-This command is to be used with caution lest the alignment of atoms in the next group be disrupted. In general, all will be well if the group of atoms featuring \falseverb{\chemskipalign} contains \emph{a single atom} whose height and depth are \emph{less} than those of the preceding and following atoms, and if the preceding and following atoms have identical heights and depths. Here is an example of the mess that results when the group of atoms contains two atoms, here ``\verb-\chemskipalign.-'' and ``\verb-B-'':
-\exemple{Consequence of the \string\chemskipalign command}/\large
-\fboxsep=0pt
-\renewcommand\printatom[1]{\fbox{\ensuremath{\mathrm{#1}}}}
-\chemfig{A-\chemskipalign.B-C}/
-
-This feature can sometimes be useful. Suppose we want to draw the following molecule
-\begin{center}
- \catcode`;12
- \def\emptydisk{\chemskipalign\tikz\draw(0,0)circle(2pt);}%
- \def\fulldisk{\chemskipalign\tikz\fill(0,0)circle(2pt);}%
- \chemfig{A-#(,0pt)\emptydisk-#(0pt,0pt)\fulldisk-#(0pt)B}%
-\end{center}
-We can define commands which will draw the empty and full disks with \TIKZ. To ensure that these disks are at the right height, namely the height of the bond arriving at them, we will use the command \falseverb{\chemskipalign}. In the second line below the bonds are ``stuck'' to the disks by using the ability to change the bond shortening with the ``\verb-#-'' character, a feature seen on page~\pageref{modif.retrait}.
-\begingroup\catcode`;12 \catcode`#12
-\exemple{Use of \string\chemskipalign\ and #}/\def\emptydisk{\chemskipalign\tikz\draw(0,0)circle(2pt);}
-\def\fulldisk{\chemskipalign\tikz\fill(0,0)circle(2pt);}
-\chemfig{A-\emptydisk-\fulldisk-B}\par
-\chemfig{A-#(,0pt)\emptydisk-#(0pt,0pt)\fulldisk-#(0pt)B}
-/\endgroup
-
-
\section{Shifted double bonds}
All double bonds are made up of two line segments, and these segments are drawn on either side of the imaginary line along which a single bond would be drawn. It is possible to shift a double bond so that one of the line segments lies on the imaginary line. The other segment is then shifted above or below the bond. Actually, it is more correct to say ``left'' or ``right'' of the imaginary line, as the bond is traversed in the direction of drawing.
@@ -1195,94 +1131,233 @@ It should be noted that if the \Verb|<number>| of arguments is incorrect (negati
Except in cases where the character "\verb|#|" is followed by a number between 1 and \Verb|<number>| in which case it represents an argument, "\verb|#|" are allowed in the sub-molecule codes.
-\exemple{Use of \#}/\definesubmol\X2{#1-#2-#2-#3-###(3pt,3pt)#4}
+\exemple{Use of \#}/\definesubmol\X2{#1-#2-#3-#(3pt,3pt)#4}
\chemfig{A-!\X{M}{N}-B}/
In this example, only \verb|#1| and \verb|#2| are understood as the arguments of the sub molecule \verb|\X|. The other "\verb|#|" are displayed as they are in the molecule (case of \verb|#3| and \verb|#4|) or understood as the character specifying the fine adjustment of the offset of the bonds.
-\section{Decorations}
-\subsection{Lewis diagrams}\label{lewis}
-The macro \falseverb{\lewis} allows placement of pairs of electrons, of single electrons, or of empty slots. This syntax is used:
+\section{Placement of Atoms}
+\subsection{First Atom}\label{premieratome}
+As explained on page~\pageref{first atom}, the first atom encountered (whether empty or not) is the one that is placed on the baseline, represented in gray on the examples of this manual. The choice of this first atom thus conditions the placement of all the others and often influences the placement of the whole molecule.
+
+\exemple{First atom}/\chemfig{H-[7]C(-[5]H)=C(-[1]H)-[7]H}\qquad
+\chemfig{C(-[3]H)(-[5]H)=C(-[1]H)-[7]H}/
+
+\subsection{Groups of atoms}\label{placementatomes}
+In a group of atoms, the atoms are placed one after the other in a well-established order:
+\begin{itemize}
+ \item the first one which is placed (which we will call "reference atom") is the one on which the bond arrives; in the case of the beginning of the molecule, the atom on the left is the reference atom;
+ \item the atoms to the right of the reference atom are then placed from left to right;
+ \item atoms to the left of the reference atom are finally placed from right to left.
+\end{itemize}
+
+In the group of atoms thus formed, the baselines of each atom are on \emph{the same horizontal line}, in other words, the atoms are all aligned on the same horizontal line.
+
+In the example below whose code would be "\verb|\chemfig{A[:-60,,,3]BCDEF}|" the reference atom of the 2nd{} group of atoms is "D" because the bond is requested to arrive on the 3rd{} atom. Below each atom of this group is the sequence number in which the atom is displayed:
\begin{center}
- \Verb|\lewis{<n1><n2>...<ni>,<atom>}|
+ \def\0#1#2{%
+ \vtop{%
+ \def\tempprintatom##1{\ensuremath{\mathrm{##1}}}%
+ \setbox0\hbox{\tempprintatom{#1}}%
+ \def\tempvrule{\vrule height.33ex width.4pt}%
+ \offinterlineskip\copy0 \kern2pt
+ \hbox to\wd0{\kern.5pt \tempvrule\hrulefill\tempvrule\kern.5pt}\kern2pt
+ \hbox to\wd0{\hss$\scriptstyle#2$\hss}}}
+ \chemfig{A-[:-60,,,3]\0{B}{5}|\0{C}{4}|\0{D}{1}|\0{E}{2}|\0{F}{3}}
\end{center}
-where the \Verb-<n1>-\dots\Verb-<ni>- represent the desired positions (in multiples of 45\degres) around the \Verb-<atom>-. These whole numbers must be between 0 and 7.
-This command can also be used inside the argument of \verb-\chemfig-:
-\exemple{The \string\lewis\ macro}|\lewis{0246,A}\par\medskip
-\lewis{1357,B}\par\medskip
-\chemfig{H-\lewis{26,O}-S(=[2]\lewis{13,O})
- (=[6]\lewis{57,O})-\lewis{26,O}-H}|
+\subsection{Bonds between atoms}\label{liaisonentreatomes}
+A bond starting from an atom would, if extended, pass through the centre of its bounding box. The atom placed at the end of the bond has its center of its bounding box is in the extension of the bond. Therefore, a bond between two atoms extends through the centers of their bounding boxes, as shown in this example:
+\begin{center}
+\fboxsep=.25pt
+\renewcommand\printatom[1]{\fbox{\ensuremath{\mathrm{#1}}}}
+\setchemfig{chemfig style={line width=1pt}}
+\Large
+\chemfig{A@ABC-[:65,,2,3]DE@BFG}
+\chemmove{%
+ \draw[red,fill=red] (A.center)circle(.2ex);
+ \draw[blue,fill=blue](B.center)circle(.2ex);
+ \draw[gray,-,dashed,shorten <=-1.5em, shorten >=-1.5em](A.center)--(B.center);
+}
+\end{center}
+This mechanism can create misalignments between groups of atoms that are particularly visible when the bonds are horizontal. Everything works well when the atoms have the same vertical dimensions; however, if a departure atom is high (with exponent) or deep (with subscript) and the arrival atom has a different vertical dimension, the alignment is broken.
+\exemple*{Horizontal alignment}/\Huge\setchemfig{atom sep=2em}
+\chemfig{A^1-B-C-D}\qquad
+\chemfig{E_1-F-G-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}*
+It is surprising that the second atom is correctly aligned when the last two are vertically shifted. This is because \CF adds in front of each arrival atom the \falseverb{\vphantom} of the departure atom, but without including it in the content of this arrival atom: this \falseverb{\vphantom} is thus not intended to be reflected on the following atoms. This phenomenon can be shown by making visible the bounding boxes of the atoms where it appears that the atoms "\verb-B-" and "\verb-F-" have bounding boxes whose height takes into account the heights of the preceding atom:
+\exemple*{Horizontal placement and bounbding boxes}/\Huge\setchemfig{atom sep=2em}
+\fboxsep=0pt
+\renewcommand\printatom[1]{\fbox{\ensuremath{\mathrm#1}}}
+\chemfig{A^1-B-C-D}\qquad
+\chemfig{E_1-F-G-H}/
-All the decorations drawn by \falseverb{\lewis} are not included in the \falseverb{bounding box} of the atom; they are drawn afterwards. A consequence of this is seen in the two examples above, where the frame does not appear to be properly fitted to the drawing of the molecule, which extends downward slightly. This will be seen more often in this the ``Decorations'' chapter, which presents commands which do not change the bounding box.
+Since no automatic solution is satisfactory, we can manually get around this problem by creating an departure atom being a "strut" equal to \verb|\vphantom{X}|: thus, the starting atom has a "normal" height and no shift will be reflected on the next group of atoms. A sub-molecule is used here for brevity.
+\exemple*{Bypassing vertical placement}/\Huge\setchemfig{atom sep=2em}
+\definesubmol\I{\vphantom{X}}
+\chemfig{A^1|!\I-B-C-D}\qquad
+\chemfig{E_1|!\I-F-G-H}/
+The disadvantage is that the first bond is too long because the departure atom now has a zero horizontal dimension.
+
+If we are \emph{really sure} to understand the consequences that this will have on the molecule and especially if it lends itself to it, we can redefine \verb|\printatom| so that it forces the atom's bounding box to have fixed vertical dimensions; for example that of "$\mathrm{X^1_1}$".
+\exemple*{Redefinition of \string\printatom}/\Huge\setchemfig{atom sep=2em}
+\let\oldprintatom\printatom
+\renewcommand\printatom[1]{%
+ \begingroup
+ \setbox0\hbox{\oldprintatom{X^1_1}}%
+ \edef\tmp{\ht0=\the\ht0\relax\dp0=\the\dp0\box0 }%
+ \setbox0\hbox{\oldprintatom{#1}}%
+ \ifnum1\ifdim\ht0=0pt0\fi\ifdim\dp0=0pt0\fi\ifdim\wd0=0pt0\fi<1000
+ \tmp
+ \fi
+ \endgroup
+}
+\chemfig{A^1-B-C-D}\qquad
+\chemfig{E_1-F-G-H}/
-\label{Lewis}The \falseverb{\Lewis} macro works the same way as \verb-\lewis- but decorations are taken into account in the bounding box.
+\subsection{La macro \texttt{\char`\\chemskipalign}}\label{chemskipalign}
+For any group of atoms it is possible to temporarily deactivate the alignment adjustment mechanism and thus neutralize the \falseverb{\vphantom}. Simply place the \falseverb{\chemskipalign} command in the group of atoms; the alignment will resume in the following group of atoms as if the group of atoms containing \falseverb{\chemskipalign} had never existed. The following example shows the effects of this instruction: the reference point of the box containing the first atom is placed at the level of the bond which arrives from the left. The bounding boxes of the atoms are drawn in the second line.
-This can be seen more clearly by drawing an \verb-\fbox- around decorated atoms:
-\exemple{Bounding box and the \string\lewis\ macro}*\fboxsep0pt
-\fbox{\lewis{0.2.4.6.,A}}\quad\fbox{\Lewis{0.2.4.6.,A}}\par\medskip
-\fbox{\lewis{13,B}}\quad\fbox{\Lewis{13,B}}*
+\exemple[60]{Deactivation of the alignment mechanism}/\large
+\chemfig{A-.-B}\quad
+\chemfig{A-\chemskipalign.-B}\par\bigskip
+\fboxsep=0pt
+\renewcommand\printatom[1]{\fbox{\ensuremath{\mathrm{#1}}}}
+\chemfig{A-.-B}\quad
+\chemfig{A-\chemskipalign.-B}/
-\label{setlewis}Several parameters can be set with the help of these \chevrons{keys}
-\begin{itemize}
- \item \CFkv{lewis | width}{dim}is the width of the rectangle which represents the empty slot obtained whith the character ``|'';
- \item \CFkv{lewis sep}{dim} is the distance between the bounding box and the decoration. It is 0.2ex by default;
- \item \CFkv{lewis length}{dim} is the length of the line segment representing a pair of electrons. It is 1.5ex by default;
- \item \CFkv{lewis style}{code tikz} is code which is passed directly to \TIKZ. This code is empty by default.
- \item \CFkv{lewis dist}{dim}: is the distance between 2 discs drawn with "\string:. This distance is set to \CFval{0.3em} by default;
- \item \CFkv{lewis radius}{dim}: is the radius of the disc drawn with "." or "\string:". Its default value is \CFval{0.15ex};
- \item \CFkv{lewis diag coeff}{decimal}: is the diagonal spacing factor and its default value is \CFval{1}.
-\end{itemize}
+This command is to be used with caution lest the alignment of atoms in the next group be disrupted. In general, all will be well if the group of atoms featuring \falseverb{\chemskipalign} contains \emph{a single atom} whose height and depth are \emph{less} than those of the preceding and following atoms, and if the preceding and following atoms have identical heights and depths. Here is an example of the mess that results when the group of atoms contains two atoms, here ``\verb-\chemskipalign.-'' and ``\verb-B-'':
+\exemple{Consequence of the \string\chemskipalign command}/\large
+\fboxsep=0pt
+\renewcommand\printatom[1]{\fbox{\ensuremath{\mathrm{#1}}}}
+\chemfig{A-\chemskipalign.B-C}/
-It should be noted that the parameters specific to Lewis decorations can be passed by
+This feature can sometimes be useful. Suppose we want to draw the following molecule
+\begin{center}
+ \catcode`;12
+ \def\emptydisk{\chemskipalign\tikz\draw(0,0)circle(2pt);}%
+ \def\fulldisk{\chemskipalign\tikz\fill(0,0)circle(2pt);}%
+ \chemfig{A-#(,0pt)\emptydisk-#(0pt,0pt)\fulldisk-#(0pt)B}%
+\end{center}
+We can define commands which will draw the empty and full disks with \TIKZ. To ensure that these disks are at the right height, namely the height of the bond arriving at them, we will use the command \falseverb{\chemskipalign}. In the second line below the bonds are ``stuck'' to the disks by using the ability to change the bond shortening with the ``\verb-#-'' character, a feature seen on page~\pageref{modif.retrait}.
+\begingroup\catcode`;12 \catcode`#12
+\exemple{Use of \string\chemskipalign\ and #}/\def\emptydisk{\chemskipalign\tikz\draw(0,0)circle(2pt);}
+\def\fulldisk{\chemskipalign\tikz\fill(0,0)circle(2pt);}
+\chemfig{A-\emptydisk-\fulldisk-B}\par
+\chemfig{A-#(,0pt)\emptydisk-#(0pt,0pt)\fulldisk-#(0pt)B}
+/\endgroup
+
+\section{The macro \texttt{\char`\\charge}}\label{charge}
+\subsection{Overview}
+The macro \verb| load|, which requires two mandatory arguments, allows to arrange elements (called \chevrons{charges}) around an \chevrons{atome}; its syntax is
+\begin{center}
+ \Verb|\charge{[<general parameters>]<position>[<tikz code>]=<charge>}{<atom>}|
+\end{center}
+where:
\begin{itemize}
- \item \Verb|\setchemfig{<keys>=<values>}| so that they last for the rest of the document;
- \item \Verb|\chemfig[<keys>=<values>]| and in this case, the settings are effective in the current molecule;
- \item \Verb|\lewis[<keys>=<values>]| so that the parameters are specific to this execution of the macro \verb|\lewis|.
+ \item the \chevrons{atom} is usually one or two letters, but it can also be empty;
+ \item the \chevrons{charge} is an arbitrary content that will be placed around the atom. Few constraints exist on this content: it can be text (in math mode if needed), or even \TIKZ code or a molecule drawn with \verb|chemfig|;
+ \item the \chevrons{general parameters} (optional) are a list of key/values specifying the options that this execution of the macro must satisfy. These keys/values are described below;
+ \item the \chevrons{position} is "\chevrons{angle}\verb-:-\chevrons{shift}", but it is possible to specify only the \chevrons{angle}, in which case, the \chevrons{shift} will be equal to \verb|0pt|;
+ \item the optionnal \chevrons{tikz code} sets the options given to the \TIKZ macro \verb|\node|, which places the \chevrons{charge}.
\end{itemize}
-The last way, of course, allows individual settings, but must be used with caution when the macro \verb|\lewis| is in the argument of \verb|\chemfig|. Indeed, the signs \verb-=- of the \Verb|<key>=<values>| should not be interpreted as a double bond and to do so, the macro \verb|\lewis|, its optional and mandatory argument \emph{must} be inside braces:
+\subsection{Parameters}
+The \chevrons{keys}${}={}$\chevrons{values} available in the \chevrons{general parameters} are:
+
+\begin{longtable}{rlp{8.5cm}}\hline
+ \chevrons{keys} & default \chevrons{values} & Description\\\hline\endhead
+ \Chargeparam{debug} & boolean which, when \CFval{true}, draws the outlines of the nodes receiving the \chevrons{atoms} (in green), the \chevrons{loads} (in blue) and the \chevrons{charge} (in red).\\
+ \Chargeparam{macro atom}&macro receiving the \chevrons{atom} as argument.\\
+ \Chargeparam{circle} & boolean which, when \CFval{true}, puts the \chevrons{atom} in a circular node; otherwise, the node is rectangular.\\
+ \Chargeparam{macro charge}&macro (e.g., \verb|\printatom| or \verb|\ensuremath|) receiving each charge as an argument.\\
+ \Chargeparam{extra sep} & node size increment of the \chevrons{atom} to put the \chevrons{charges}: it is the value passed to the \CFkey{inner sep} of \TIKZ.\\
+ \Chargeparam{overlay} & boolean which, when \CFval{true}, draws the \chevrons{charges} "overlay", i.e. outside the final bounding box.\\
+ \Chargeparam{shortcuts}&boolean which, when \CFval{true}, activates the shortcuts"\verb-\.-," "\verb-\:-," "\verb-\|- and "\verb-\"-" to draw Lewis formuas.\\
+ \Chargeparam{lewisautorot}&booleann which, when \CFval{true}, automatically rotates "\verb-\:-," "\verb-\|- and "\verb-\"-".\\
+ \Chargeparam{.radius}&radius of the point used to plot "\verb|\.|" and "\verb|\:|".\\
+ \Chargeparam{:sep} & separation between the two dots of "\verb|\:|".\\
+ \Chargeparam{.style}&\TIKZ style used to draw the "\verb|\.|" and "\verb|\:|" dots.\\
+ \Chargeparam{"length}&length of the rectangle "\verb-\- "and the line "\verb-\|-".\\
+ \Chargeparam{"width}&width of the rectangle \verb-\"-.\\
+ \Chargeparam{"style}&\TIKZ style used to draw the rectangle \verb-\"-.\\
+ \Chargeparam{|style}&TIKZ style used to draw the line \verb-\|-.\\\hline
+\end{longtable}
+
+It is possible to set some (or all) of these parameters by running the macro
+\begin{center}
+ \Verb|\setcharge{<keys>=<values>}|
+\end{center}
+and reset all parameters to their default values with
+\begin{center}
+ \verb|\resetcharge|
+\end{center}
+The \verb|\charge| macro places the \chevrons{charges} out of the bounding box (unless otherwise specified in the \chevrons{parameters}) while \verb|\Charge| places them into the bounding box.
+\medbreak
-\exemple{Optional argument of \string\lewis}/\chemfig{{\lewis[lewis style=red]{1:3:5:7:,X}}-{\lewis[lewis style=blue]{0:2:4:6:,Y}}}/
+The \chevrons{angle} is the location on the boundary of the node where the \chevrons{charge} is placed. This \chevrons{angle} can be expressed in degrees or it can be a boundary anchor in the sense of \TIKZ, like "south east." The \chevrons{shift} is a \TeX-dimension and represents an additional length between the boundary of the node containing the \chevrons{atom} and the place where the \chevrons{charge} is placed. Unless otherwise specified in the \chevrons{tikz code}, the \emph{center} anchor of \chevrons{charges}.
+\medbreak
-Here are some examples of customization:
+In the two following examples, \CFkey{debug} will be set to \CFval{true} in order to better perceive the changes induced by the modification of the parameters. In addition, the macro \verb|\Charge| will be used so that the bounding boxes take into account the charges. Here we see the influence of the node shape on the placement of the charges:
+\exemple{Generic example}|\setcharge{debug}
+Default then circle:
+\Charge{30=\:,120=$\ominus$,210=$\delta^+$}{Fe}\qquad
+\Charge{[circle]30=\:,120=$\ominus$,210=$\delta^+$}{Fe}|
-\exemple{Parameters for the \string\lewis\ macro}*\setchemfig{lewis sep=4pt,lewis length=1.5em,lewis style=red}
-\chemfig{A-\lewis{26,B}-C}\bigbreak
+To place the loads $\ominus$ and $\delta^+$ further away, we can play on the \chevrons{shift} or better, on the anchor: the \chevrons{angle} where the load is placed is stored in the macro \verb|\chargeangle|, so it is wise to choose the anchor \verb|180+\chargeangle|. It is also possible to specify a circular node to place the charge.
-\chemfig[lewis style={line width=0.4pt}]{A-\lewis{2|,B}-C}\bigbreak
+\exemple{Fine positioning}|\setcharge{debug}
+\Charge{30=\:,120:3pt=$\ominus$,210:5pt=$\delta^+$}{Fe}\qquad
+\Charge{[circle]30=\:,
+ 120[circle,anchor=180+\chargeangle]=$\ominus$,
+ 210[anchor=180+\chargeangle]=$\delta^+$}{Fe}|
-\Lewis{1:3:5:7:,X}\qquad\Lewis{0:2:4:6:,X}\bigbreak
+It is important to note that circular nodes have dimensions \emph{sometimes very different} from the "classic" rectangular nodes, especially in terms of horizontal and vertical extent. It is therefore advisable to set \CFval{true} the boolean key \CFkey{circle} knowingly.
-\Lewis[lewis dist=0.2em]{1:3:5:7:,X}\qquad
-\Lewis[lewis dist=0.2em]{0:2:4:6:,X}\bigbreak
+\exemple{Circular nodes}/\chemfig{\charge{90=\.}{N}H_3} : rectangle nodes\smallbreak
+\chemfig{\charge{[circle]90=\.}{N}H_3} : circle node/
-\Lewis[lewis dist=4pt,lewis radius=1.5pt]{1:3:5:7:,X}\qquad
-\Lewis[lewis dist=4pt,lewis radius=1.5pt]{0:2:4:6:,X}*
+\subsection{Lewis formula}
+When \CFkey{shortcut} is \CFval{true}, the shortcuts "\verb|\.|», "\verb|\:|», "\verb-\|- and "\verb-\"-» are actgive to draw Lewis formulas {\setcharge{extra sep=0pt}"\Charge{0=\.}{\vphantom{A}}», "\Charge{0=\:}{\vphantom{A}}», "\Charge{0=\|}{\vphantom{A}}» et "\Charge{0=\"}{\vphantom{A}}»}. You can deactivate them at any time with the \verb|\disableshortcuts| macro and reactivate them with \verb|\enableshortcuts|.
+
+When the boolean \CFkey{shortcut} is \CFval{false} or the shortcuts have been disabled with \verb|\disableshortcuts|, shortcuts "\verb|\:|", "\verb-\|-" and "\verb-\"-" are no longer programmed to draw Lewis formulas, so the macros \verb|\chargedot|, \verb|\chargeddot|, \verb|\chargeline| and \verb|\chargerect| must be used instead.
+\medbreak
-A problem sometimes occurs with the decorations of Lewis in the odd directions. In the example below with the atom ``O'', the decoration in position 1 seems farther from the atom than the decoration in position 4:
-\exemple{Odd directions}/\huge
-\Lewis{1|4|,O}/
-However, it is not the case as shown below by drawing the bounding box of the atom:
-\exemple{Optical illusion}/\huge
-\fboxsep0pt
-\def\printatom#1{\fbox{$\mathrm{#1}$}}
-\Lewis{1|4|,O}/
-\label{opt.lewis}The impression of greater distance is due to the shape of the letter ``O'' which is farther from the one of the bounding box in the corners, that is to say, in odd directions.
+The key \CFkey{lewisautorot}, which is \CFval{true} by default, acts on {\setcharge{extra sep=0pt}"\Charge{0=\:}{\vphantom{A}}", "\Charge{0=\|}{\vphantom{A}}" and "\Charge{0=\"}{\vphantom{A}}"} and rotates them.
-To move nearer (or farther) the Lewis drawings in odd directions, the \chevrons{clé} \CFkv{lewis diag coeff}{decimal} sets the factor which multiplies the gap between the bounding box and decoration Lewis. For the letter ``O'', it seems that 0.5 is the appropriated value:
-\exemple*{Optional argument of \string\lewis}/\huge
-\Lewis{1|4|,O}\quad \Lewis[lewis diag coeff=0.5]{1|4|,O}
+\exemple{Autorot}/\Charge{60=\:,150=\"}{A} et
+\Charge{[lewisautorot=false]60=\:,150=\"}{A}/
-\Lewis{0:5:,O}\quad \Lewis[lewis diag coeff=2]{0:5:,O}\quad \Lewis[lewis diag coeff=0.5]{0:5:,O}/
+The \verb|lewis| and \verb|Lewis| macros are still functional, but are no longer maintained or documented, and \textcolor{red}{\bfseries will be removed in a future version}, so it is advisable to prefer the \verb|\charge| and \verb|\Charge| macros, which give comparable results as shown below, while being much more powerful and configurable:
-\subsection{Stacking characters}
+\exemple{Comparison with \string\Lewis}/\Lewis{1:3.5|,X}\quad\Lewis{0:2.3|,X}\qquad(avec \string\Lewis)\par
+\Charge{45=\:,135=\.,225=\"}{X}\quad\Charge{0=\:,90=\.,135=\"}{X}%
+\qquad(avec \string\Charge)/
+
+The customization of Lewis' formulas is done via the macro \verb|\setcharge| or via the optional argument of \verb|\charge| by acting on the keys \CFkey{.radius}, \CFkey{:sep}, \CFkey{.style}, \CFkey{|style}, \CFkey{"length}, \CFkey{"width} and \CFkey{"style}. It is also possible to modify these keys for each formula with their optional argument which receives a list of \CFkey{keys}${}={}$\chevrons{values}.
+
+\exemple{Ccustomization}/\Charge{[.radius=1.5pt,.style={draw=gray}]
+ 45 =\.[{.style={draw=none,fill=red}}],
+ 135 =\.[{.style={draw=none,fill=blue}}],
+ -45 =\.[{.style={draw=none,fill=green}}],
+ -135=\.}{A}\quad
+\Charge{
+ 45 =\"[{"style={draw=red,fill=gray}}],
+ 135=\"[{"width=3pt,"style={line width=.8pt,draw=blue,fill=cyan}}]}{A}/
+
+\subsection{Integration in \CF}
+A macro \verb|\charge| can take the place of an atom, just like it did with \verb|\lewis|.
+
+\exemple{Charge in \CF}*\chemfig{H-\chemabove{\lewis{5|7,O}}{\quad\scriptstyle+}(-[2]H)-H}
+\qquad
+\chemfig{H-\charge{45:1.5pt=$\scriptstyle+$,-45=\|,-135=\"}{O}(-[2]H)-H}*
+
+However, \CF has been modified so that the bonds are \emph{joined} when the dimensions of an atom is zero, that is, if its width, height and depth are all \verb|0pt|. This was previously only the case if the atom was empty. This new feature makes it easy to place charges in carbon chains.
+
+\exemple{Charge in chain}/\chemfig{[:30]-\charge{90=\:}{}
+-[:-30]\charge{-90=\"}{}-\charge{90:2pt=$\delta^+$}{}-[:-30]}/
+
+\section{Stacking}
The macros\label{chemabove}
\begin{center}
\Verb|\chemabove[<dim>]{<code>}{<stuff>}|
@@ -1298,11 +1373,18 @@ These commands are independent of the macro \verb-\chemfig- and can be used eith
They are especially useful in rings, if care is taken to put braces around the letters A, B, C and D in order to prevent \CF from starting a new atom on these letters:
\exemple{Staking in rings}|\chemfig{*5(-\chembelow{A}{B}--\chemabove{C}{D}--)}|
-They are sometimes useful for placing pseudo-exponents which do not change the bounding box of the atoms, so that the bonds do not end up being too short:
-\exemple{Hydronium ion}*\chemfig{H-\chemabove{\lewis{5|7,O}}{\quad\scriptstyle+}(-[2]H)-H}*
-
\label{Chemabove}The \falseverb{\Chemabove} and \falseverb{\Chembelow} commands work in the same way, except that the bounding box takes into account the \Verb-<stuff>- placed above or below.
+What's the difference between \verb|\chemabove| and \verb|\charge| for placing one item above or below another?
+\exemple{\string\chemabove\space or \string\charge}/\chemfig{*5(----\chemabove{A}{\oplus}-)}
+\chemfig{*5(----\charge{90[anchor=-90]=$\oplus$}{A}-)}/
+
+By default, the two macros give very similar results. However, there are differences in their use:
+\begin{itemize}
+ \item \verb|\chemabove| and \verb|\chemabelow| can only be used in the argument of \verb|chemfig|, which is not the case for \verb|\charge|;
+ \item the \verb|\charge| macro requires \TIKZ, whereas \verb|\chemabove| and \verb|\chemabelow| use low-level \TeX{} primitives and are therefore fast and independent of any package.
+\end{itemize}
+
\section{Using {\protect\ttfamily\protect\textbackslash chemfig} in the {\protect\ttfamily tikzpicture} environment}
It is possible to call the \falseverb{\chemfig} inside a {\ttfamily\falseverb{tikzpicture}} environment:
\exemple{\textbackslash chemfig inside tikzpicture}|\begin{tikzpicture}[help lines/.style={thin,draw=black!50}]
@@ -1313,23 +1395,6 @@ It is possible to call the \falseverb{\chemfig} inside a {\ttfamily\falseverb{ti
\node[draw,red,anchor=base] at(3,2){\chemfig{X>[2,,,,blue]Y}};
\end{tikzpicture}|
-\section{Beyond chemistry}\label{style.noeuds}
-At heart \CF is a tool for drawing graphs, and this tool has been programmed to adapt it for chemistry. In some ways it is possible to return \CF to its roots to draw organization charts or other diagrams represented by graphs.
-
-Each atom is contained in a \TIKZ node. By default these nodes have an ``inner sep'' and an ``outer sep'' equal to 0pt. They are rectangular as seen on page~\pageref{longueur.liaison}. These defaults can be overwritten with the \chevrons{key} \CFkey{node style}, the argument of which is passed to \TIKZ and specifies the style of the nodes containing the atoms.
-
-In this example we specify only ``draw,inner sep=2pt'', which has the effect of drawing the outline of the nodes and separating the outline and node contents by 2pt. We also specify \CFkv{bond offset}{0pt} so that the bonds touch the edges of the nodes. The interatomic spacing is increased to 75pt. Finally, the command \falseverb{\printatom} is made as simple as possible so that math mode is no longer used and spaces are thus preserved.
-\exemple*{An organization chart}/\setchemfig{node style={draw,inner sep=2pt},bond offset=0pt,atom sep=75pt}
-\renewcommand\printatom[1]{#1}
-\chemfig{The boss-[6]Me(-[4]Them(-[6]The others)(-[7,2]Group 1))-You(-[:-120,0.5]Him)(-[:-60,0.5]Her)}/
-
-Here is another organization chart where the nodes are circular and coloured cyan:
-\exemple*{Family diagram}/\setchemfig{bond offset=0pt,atom sep=80pt,node style={draw,circle,fill=cyan,minimum size=25pt}}
-\renewcommand\printatom[1]{\textsf{#1}}
-\chemfig{Me(-[:-50,1.2]Brother)(-[:-10]Brother(-[:15]Niece)(-[:-35]Niece))
-(-[:-155,0.8]Sister-[:-80]Nephew)(-[:95,1.25]Father(-[:-25,0.8]Uncle)(-[:-65,0.8]Aunt))
-(-[:135]Mother-[:-95,0.5]Uncle)}/
-
\section{Annotated examples}\label{exemples.commentes}
In this chapter, several molecules will be drawn, putting into use the methods previously described. The aim here is to show a logical order for putting together a molecule so that the user unfamiliar with \CF will learn how to construct complex molecules. The construction steps will be shown to help with this learning process.
@@ -1511,15 +1576,13 @@ Adding a \falseverb{charge} to an atom with a mathematical exponent implies that
\exemple{Charge and bond}/\chemfig{A^+-[2]B}
\qquad
\chemfig{A\rlap{${}^+$}-[2]B}/
-If you want to use the command \verb-\oplus- which displays ``$\oplus$'', some could find that the charge is too low: $\mathrm{A^\oplus}$. In that case, why not use \falseverb{\chemabove} to put as precisely as you will, both vertically and horizontally the charge:
-\exemple{Charge et \string\chemabove}/\chemfig{\chemabove[0.5pt]{A}{\scriptstyle\hspace{3.5mm}\oplus}-[2]B}
-\qquad
-\chemfig{{\chemabove[-0.5pt]{A}{\scriptstyle\hspace{3.5mm}\oplus}}-[2]B}/
-We notice an additional level of braces for the second molecule. Indeed, as we specify ``\verb/-0.5pt/'' for the optional argument of \falseverb{\chemabove} to lower the charge, it is necessary to prevent \CF to understand the sign ``\verb/-/'' as a single bond.
-To add a load near the vertex of a cycle , the best method is to attach an invisible bond to this vertex, which is done here with \falseverb{\definesubmol} with a bond with a length coefficient equal to 0.2:
-\exemple{Charges and cycles}/\definesubmol\nobond{-[,0.2,,,draw=none]}
-\chemfig{*5(---(!\nobond\scriptstyle\oplus)-(!\nobond\scriptstyle{-})-)}/
+The macro \verb|\charge| allows this task to be performed simply and accurately.
+\exemple{Placing charges}/\chemfig{\charge{[extra sep=0pt]45[anchor=180+\chargeangle]=%
+$\scriptstyle\oplus$}{A}-[2]B}
+\qquad
+\chemfig{*5(---\charge{90:2pt=$\scriptstyle\oplus$}{}-%
+\charge{135:2pt=$\scriptstyle-$}{}-)}/
\subsection{Draw a curve bond}
We have already seen that with the \TIKZ library ``\verb-decorations.pathmorphing-'', we can draw a wavy bond:
@@ -1542,7 +1605,7 @@ For more flexibility, you can also define nodes using the character ``\verb-@-''
\chemmove{\draw[-](a)..controls +(60:3em) and +(30:1em)..
++(20:2em) ..controls +(210:3em) and +(-120:4em) ..(b);}/
-\subsection{Draw a ploymer element}\label{polymerdelim}
+\subsection{Draw a polymer element}\label{polymerdelim}
The macro \verb|\polymerdelim|, until now undocumented and in the test phase, becomes officially released in \CF with version 1.33. Its syntax is as follows:
\begin{center}
\Verb|\polymerdelim[<keys>=<values>]{<node1>}<node2>}|
@@ -1556,7 +1619,7 @@ The effect, after possibly \emph{two} compilations, is to place vertical delimit
\CFdelimparam{height} & Defines the height (above the node) of the delimiters.\\
\CFdelimparam{depth} & Defines the depth (below the node) of the delimiters. If the \chevrons{value} is empty, then the depth is equal to the height.\\
\CFdelimparam{h align}&Boolean which, when \CFval{false}, places the 2nd delimiter on the 2nd node, at the risk that the delimiters are not on the same horizontal line.\\
- \CFdelimparam{auto rotate}&Booléen which, when \CFval{true} and \CFkv{h align}{false}, automatically turns the delimiters to be perpendicular to the line that connects the two nodes.\\
+ \CFdelimparam{auto rotate}&Boolean which, when \CFval{true} and \CFkv{h align}{false}, automatically turns the delimiters to be perpendicular to the line that connects the two nodes.\\
\CFdelimparam{rotate}&When \CFkv{h align}{false} and \CFkv{auto rotate}{false}, sets the rotation angle of the two delimiters.\\
\CFdelimparam{open xshift}& Defines the horizontal offset of the opening delimiter.\\
\CFdelimparam{close xshift}& Defines the horizontal offset of the closing delimiter. If the \chevrons{value} is empty, then this offset becomes opposite to the offset of the opening delimiter.\\
@@ -1583,7 +1646,7 @@ Polycaprolactame
\polymerdelim[height = 5pt, indice = \!\!n]{left}{right}
\bigskip
-Polyphénylène sulfide:
+Polyphenyl sulfide:
\chemfig{\vphantom{S}-[@{op,.75}]S-(**6(---(-[@{cl,0.25}])---))}
\polymerdelim[delimiters = (), height = 15pt, indice = {}]{op}{cl}
\bigskip
@@ -1647,39 +1710,6 @@ Water molecule rotated 30\textdegree: \chemfig{[:30]@1H-[::37.775,2]@2O-[::-75.5
\namebond23{\footnotesize0.9584 \angstrom}
\arclabel{0.5cm}{1}{2}{3}{\footnotesize104.45\textdegree}|
-\subsection{Schéma de Lewis à l'angle près}
-In some very special cases, it is sometimes necessary to position Lewis diagrams to the nearest degree and no longer to multiples of 45 degrees.
-
-For this, it is relatively easy to write a macro \verb-\mylewis-, admitting an optional argument (the length of the doublet) which is 2ex and two mandatory arguments; the first being the name of the atom and the second being the list of angles separated by commas.
-
-The trick is to create an invisible circular node that contains the atom and draw the dipoles at the desired angles so that they are tangent to this circle:
-
-\exemple*{Doublets au degrés prés}|\catcode`\_11
-\newcommand\mylewis[3][2ex]{% #1=longueur, #2=atome #3=liste des angles
- \tikzpicture[baseline,anchor=base]%
- \node[inner sep=0pt,outer sep=1pt,circle,overlay](atom@@)at(0,0){\phantom{#2}};%
- \node[inner sep=0pt,outer sep=0pt]at(0,0){#2};%
- \def\list_angle{#3,}%
- \loop
- \expandafter\grab_angle\list_angle\_nil
- \pgfextractx\CF_dim{\pgfpointanchor{atom@@}\current_angle}\edef\CF_dimax{\the\CF_dim}%
- \pgfextracty\CF_dim{\pgfpointanchor{atom@@}\current_angle}\edef\CF_dimay{\the\CF_dim}%
- \pgfmathparse{#1*sin(\current_angle)/2}\let\offset_xx\pgfmathresult
- \pgfmathparse{#1*cos(\current_angle)/2}\let\offset_yy\pgfmathresult
- \draw[line width=.4pt,overlay]
- (\CF_dimax-\offset_xx,\CF_dimay+\offset_yy)--(\CF_dimax+\offset_xx,\CF_dimay-\offset_yy);%
- \unless\ifx\empty\list_angle
- \repeat
- \endtikzpicture
-}
-\def\grab_angle#1,#2\_nil{\def\current_angle{#1}\def\list_angle{#2}}
-\catcode`\_8
-Essai : \mylewis{Cl}{15}\qquad \mylewis[3ex]{Cl}{-60}\qquad \mylewis[1.5ex]{Cl}{60,120,240,300}
-\bigskip
-
-\chemfig{P(-[:72]\mylewis{Cl}{-18,72,162})(-[:-72]Cl)
-(-[:144]Cl)(-[:-144]Cl)-\mylewis{Cl}{0,90,-90}}|
-
\subsection{Dessiner des liaisons multiples}
Again, the ``decorations.markings'' library allows to draw multiple bonds:
@@ -2369,28 +2399,28 @@ A common problem can be the misalignment of the ``+'' sign with the molecules be
\schemestart
\chemfig{C(<[:40])(<[:160])=[6]C(<[:-130])<[:-20]}
\+
- \chemfig{\lewis{246,Br}-\lewis{026,Br}}
+ \chemfig{\charge{90=\|,180=\|,270=\|}{Br}-\charge{0=\|,90=\|,-90=\|}{Br}}
\schemestop/
-Here, the ``+'' sign sits on the same baseline as the compound before it, and this baseline is that of the top carbon atom. One may shift the ``+'' sign, but this would not change the vertical position of ``\kern0.3333em\chemfig{\lewis{246,Br}-\lewis{026,Br}}\kern0.3333em''. In fact, the ``+'' sign does not prevent \CF from reading a compound, as shown in the example above where everything is included in the compound `` c1''. Therefore, one must stop the compound right after the first molecule with a \verb-\arrow{0}[,0]- that will draw an invisible, zero-length arrow. In order to vertically center the whole scheme, one must also set the the anchor of the first compound as ``west'' (or ``180'', which is a synonym) with the second optional argument of the \verb-\schemestart- command:
+Here, the ``+'' sign sits on the same baseline as the compound before it, and this baseline is that of the top carbon atom. One may shift the ``+'' sign, but this would not change the vertical position of ``\kern0.3333em\chemfig{\charge{90=\|,180=\|,270=\|}{Br}-\charge{0=\|,90=\|,-90=\|}{Br}}\kern0.3333em''. In fact, the ``+'' sign does not prevent \CF from reading a compound, as shown in the example above where everything is included in the compound `` c1''. Therefore, one must stop the compound right after the first molecule with a \verb-\arrow{0}[,0]- that will draw an invisible, zero-length arrow. In order to vertically center the whole scheme, one must also set the the anchor of the first compound as ``west'' (or ``180'', which is a synonym) with the second optional argument of the \verb-\schemestart- command:
\exemple{+ sign alignment}/\setchemfig{scheme debug=true}
\schemestart[][west]
\chemfig{C(<[:40])(<[:160])=[6]C(<[:-130])<[:-20]}
\arrow{0}[,0]\+
- \chemfig{\lewis{246,Br}-\lewis{026,Br}}
+ \chemfig{\charge{90=\|,180=\|,270=\|}{Br}-\charge{0=\|,90=\|,-90=\|}{Br}}
\schemestop/
Thus, the first compound `` c1'' consists of the first molecule and the second compound consists of everything else, i.e. the ``+'' sign and the second molecule. Alternatively, one can play with anchors or styles via the \verb-\arrow- command to move the second compound to another location. Here, for example, the second compound is shifted downwards by 10pt in the first case. In the second case, the ``south east'' anchor of the first compound matches the ``south west'' anchor of the second one:
\exemple{+ sign alignment}/\setchemfig{scheme debug=true}
\schemestart[][west]
\chemfig{C(<[:40])(<[:160])=[6]C(<[:-130])<[:-20]}
\arrow(--[yshift=-10pt]){0}[,0]\+
- \chemfig{\lewis{246,Br}-\lewis{026,Br}}
+ \chemfig{\charge{90=\|,180=\|,270=\|}{Br}-\charge{0=\|,90=\|,-90=\|}{Br}}
\schemestop
\medskip
\schemestart[][west]
\chemfig{C(<[:40])(<[:160])=[6]C(<[:-130])<[:-20]}
\arrow(.south east--.south west){0}[,0]\+
- \chemfig{\lewis{246,Br}-\lewis{026,Br}}
+ \chemfig{\charge{90=\|,180=\|,270=\|}{Br}-\charge{0=\|,90=\|,-90=\|}{Br}}
\schemestop/
\newpage
@@ -2417,12 +2447,12 @@ The commands created by \CF are:
\item \CFkv{node style} {{}}: style of atoms
\item \CFkv{bond style} {{}}: style of bonds
\item \CFkv{lewis | width} {0.3ex}: width of the rectangle Lewis "|"
- \item \CFkv{lewis sep} {0.4ex}: space between atom and Lewis decorations
- \item \CFkv{lewis length} {1.5ex}: length of Lewis decorations
- \item \CFkv{lewis style} {{}}: style of Lewis decorations
- \item \CFkv{lewis dist} {0.3em}: space between discs of the ":" Lewis decoration
- \item \CFkv{lewis radius} {0.15ex}: radius of discs for Lewis decorations
- \item \CFkv{lewis diag coeff} {1}: factor that multiplies the distance to Lewis decorations in odd directions
+ \item \CFkv{lewis sep} {0.4ex}: space between atom and Lewis formulas
+ \item \CFkv{lewis length} {1.5ex}: length of Lewis formulas
+ \item \CFkv{lewis style} {{}}: style of Lewis formulas
+ \item \CFkv{lewis dist} {0.3em}: space between discs of the ":" Lewis formulas
+ \item \CFkv{lewis radius} {0.15ex}: radius of discs for Lewis formulas
+ \item \CFkv{lewis diag coeff} {1}: factor that multiplies the distance to Lewis formulas in odd directions
\item \CFkv{cycle radius coeff} {0.75}: shrinkage ratio of the circle or arc inside cycles
\item \CFkv{stack sep} {1.5pt}: vertical gap between arguments of \verb-\chemabove- and \verb-\chembelow- macros
\item \CFkv{compound style} {{}}: style of compounds
@@ -2449,8 +2479,8 @@ The commands created by \CF are:
\falseverb\chemskipalign& tells the vertical alignment mechanism to ignore the current group of atoms. See page~\pageref{chemskipalign}.\\
\Verb-\redefinesubmol{<name>}<n>[<code1>]{<code2>}- & replaces a preexisting alias \Verb-!<name>- with the new \Verb-<code>-. See page~\pageref{redefinesubmol}\\[2ex]\hline
&\\
-\Verb-\lewis[coeff]{<codes>,<atom>}-& displays the \Verb-<atom>- and places Lewis dot decorations as specified in the \Verb-<code>-. The dots drawn do not change the bounding box. See page~\pageref{lewis}\\
-\Verb-\Lewis[coeff]{<codes>,<atom>}-& displays the \Verb-<atom>- and places Lewis dot decorations as specified in the \Verb-<code>-. See page~\pageref{lewis}\\
+\Verb-\charge{[<parameters>]<pos>[<tikz>]}{<atom>}-& prints \Verb-<atome>- and places the charges according to their \Verb-<positions>-. The charges are places out of the bounding box of the \Verb-<atome>-. See page~\pageref{charge}\\
+\Verb-\Charge{[<parameters>]<pos>[<tikz>]}{<atom>}-& Same behaviour as \verb|\charge|, but the final bounding box takes the charges into account.\\
\Verb-\chemmove[<tikz options>]<tikz code>-& Makes a \verb-tikzpicture- environment, adding to it the \verb-<tikz options>-. Uses the \Verb-<tikz code>- to join the nodes specified in the molecules with the help pf the ``\verb-@-'' character. See page~\pageref{mecanismes-reactionnels}.\\[2ex]\hline
&\\
\Verb-\chemabove[<dim>]{<txt1>}{txt2}- & writes \Verb-<txt1>- and places \Verb-<txt2>- above, leaving \Verb-<dim>- of vertical space. This command does not change the bounding box of \Verb-<txt1>-. See page~\pageref{chemabove}\\
@@ -2559,11 +2589,28 @@ $\star\quad\star$
\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*{A dye (red)}/\chemfig{**6(--*6(-(-NO_2)=-(-\charge{90=\|,-90=\|}{O}-[0]H)=(-\charge{180=\|}{N}=[0]\charge{90=\|}{N}-[0]Ar)-)----)}/
-\exemple*{Menthone}/\chemfig{CH_3-?(-[2]H)(-[::-30,2]-[::+60](=[1]\lewis{20,O})
+\exemple*{Menthone}/\chemfig{CH_3-?(-[2]H)(-[::-30,2]-[::+60](=[1]\charge{0=\|,90=\|}{O})
-[::-150,1.5](-[:20]CH(-[1]CH_3)(-[7]CH_3))(-[6]H)-[::-90,2]-[::+60]?)}/
+\exemple*{Fullerene}/\definesubmol\fragment1{
+ (-[:#1,0.85,,,draw=none]
+ -[::126]-[::-54](=_#(2pt,2pt)[::180])
+ -[::-70](-[::-56.2,1.07]=^#(2pt,2pt)[::180,1.07])
+ -[::110,0.6](-[::-148,0.60](=^[::180,0.35])-[::-18,1.1])
+ -[::50,1.1](-[::18,0.60]=_[::180,0.35])
+ -[::50,0.6]
+ -[::110])
+}
+\chemfig{
+ !\fragment{18}
+ !\fragment{90}
+ !\fragment{162}
+ !\fragment{234}
+ !\fragment{306}
+}/% https://tex.stackexchange.com/questions/506293/how-to-draw-a-fullerene
+
\exemple*{Fischer indole synthesis}/\schemestart
\chemfig{*6(=-*6(-\chembelow{N}{H}-NH_2)=-=-)}
\+
@@ -2572,29 +2619,28 @@ $\star\quad\star$
\chemfig{*6(-=*5(-\chembelow{N}{H}-(-R_2)=(-R_1)-)-=-=)}
\schemestop/
-\exemple*{Reaction mechanisms: carbonyl group}/
-\schemestart
- \chemfig{C([3]-)([5]-)=[@{db,.5}]@{atoo}\lewis{06,O}}
+\exemple*{Reaction mechanisms: carbonyl group}/\schemestart
+ \chemfig{C([3]-)([5]-)=[@{db,.5}]@{atoo}\charge{0=\|,-90=\|}{O}}
\arrow(.mid east--.mid west){<->}
- \chemfig{\chemabove{C}{\scriptstyle\oplus}([3]-)([5]-)-\chemabove
- {\lewis{026,O}}{\hspace{5mm}\scriptstyle\ominus}}
+ \chemfig{\charge{90:3pt=$\scriptstyle\oplus$}{C}([3]-)([5]-)-%
+ \charge{0=\|,90=\|,-90=\|,45:3pt=$\scriptstyle\ominus$}{O}}
\schemestop
\chemmove{\draw[shorten <=2pt, shorten >=2pt](db) ..controls +(up:5mm) and +(up:5mm)..(atoo);}/
\exemple*{Reaction mechanisms: nitro group}/\schemestart
- \chemfig{R-\chembelow{N}{\hspace{-5mm}\scriptstyle\oplus}([1]=[@{db}]@{atoo1}O)([7]-[@{sb}]@{atoo2}
- \chemabove{\lewis{157,O}}{\hspace{7mm}\scriptstyle\ominus})}
+ \chemfig{R-\charge{225:3pt=$\scriptstyle\oplus$}{N}([1]=[@{db}]@{atoo1}O)([7]-[@{sb}]@{atoo2}
+ \charge{45=\|,-45=\|,-135=\|,45:5pt=$\scriptstyle\ominus$}{O})}
\arrow(.mid east--.mid west){<->}
- \chemfig{R-\chemabove{N}{\hspace{-5mm}\scriptstyle\oplus}([1]-\chemabove{O}{\scriptstyle\ominus})([7]=O)}
+ \chemfig{R-\charge{135:3pt=$\scriptstyle\oplus$}{N}([1]-\charge{90:3pt=$\scriptstyle\ominus$}{O})([7]=O)}
\schemestop
\chemmove{
- \draw[shorten <=2pt, shorten >=2pt](db) ..controls +(120:5mm) and +(120:5mm)..(atoo1);
+ \draw[shorten <=2pt, shorten >=2pt](db) ..controls +(120:5mm) and +(120:7mm)..(atoo1);
\draw[shorten <=3pt, shorten >=2pt](atoo2) ..controls +(225:10mm) and +(225:10mm)..(sb);
}/
\exemple*{Nucleophilic addition. Primary amines}/\setchemfig{atom sep=2.5em,compound sep=5em}
\schemestart
- \chemfig{R-@{aton}\lewis{2,N}H_2}
+ \chemfig{R-@{aton}\charge{90=\|}{N}H_2}
\+
\chemfig{@{atoc}C([3]-CH_3)([5]-CH_3)=[@{atoo1}]O}
\chemfig{@{atoo2}\chemabove{H}{\scriptstyle\oplus}}
@@ -2610,13 +2656,13 @@ $\star\quad\star$
\par
\schemestart
\arrow{<=>}
- \chemfig{R-@{aton}\lewis{2,N}([6]-[@{sbh}]H)-[@{sb}]C(-[2]CH_3)(-[6]CH_3)-[@{sbo}]@{atoo}
+ \chemfig{R-@{aton}\charge{90=\|}{N}([6]-[@{sbh}]H)-[@{sb}]C(-[2]CH_3)(-[6]CH_3)-[@{sbo}]@{atoo}
\chemabove{O}{\scriptstyle\oplus}(-[1]H)(-[7]H)}
\chemmove[-stealth,shorten <=3pt,shorten >=2pt,dash pattern= on 1pt off 1pt,thin]{
\draw(aton) ..controls +(up:5mm) and +(up:5mm)..(sb);
\draw(sbh) ..controls +(left:5mm) and +(south west:5mm)..(aton);
\draw(sbo) ..controls +(up:5mm) and +(north west:5mm)..(atoo);}
- \arrow{<=>[\tiny élimination]}\chemfig{R-N=C(-[1]CH_3)(-[7]CH_3)}
+ \arrow{<=>[\tiny elimination]}\chemfig{R-N=C(-[1]CH_3)(-[7]CH_3)}
\+
\chemfig{H_3\chemabove{O}{\scriptstyle\oplus}}
\schemestop/
@@ -2652,9 +2698,9 @@ $\star\quad\star$
\arrow{<->}
\chemfig{*6(-=-(!+)-(-[:120]Br)(-[:60]H)-=)}}\chemright]
\arrow(@c2--){<-[*0\chemfig{{-}AlBr_4|^\ominus}][*0\chemfig{Br_2/Al_2Br_3}]}[90,1.5]
- \chemname{\chemfig{*6(-=-=-=-)}}{Benzène 1}
+ \chemname{\chemfig{*6(-=-=-=-)}}{Benzene 1}
\arrow(@c4--){->[*0\chemfig{{-}H^\oplus}]}[90,1.5]
- \chemname{\chemfig{*6(-=-=(-Br)-=-)}}{Bromobenzène 2}
+ \chemname{\chemfig{*6(-=-=(-Br)-=-)}}{Bromobenzne 2}
\arrow(@c5.mid east--@c6.mid west)
\schemestop
\chemnameinit{}Z
@@ -2662,11 +2708,11 @@ $\star\quad\star$
\exemple*{Reaction mechanism of chlorination}/\scriptsize\setchemfig{bond offset=1pt,atom sep=2em,compound sep=4em}
\schemestart
\chemfig{Cl-[4]@{a0}(=[@{a1}:120]@{a2}O)-[:-120](=[:-60]O)-[4]Cl}\+\chemfig{*6(-=-=(-@{oh1}OH)-=)}\arrow
- \chemfig{*6((-O-[:150](-[@{o0}:150]@{o1}\lewis{6.,O})(-[@{cl0}:60]@{cl1}Cl)-[:240](-[4]Cl)=[6]O)=-=-=-)}
+ \chemfig{*6((-O-[:150](-[@{o0}:150]@{o1}\charge{-90=\.}{O})(-[@{cl0}:60]@{cl1}Cl)-[:240](-[4]Cl)=[6]O)=-=-=-)}
\arrow\chemfig{*6((-O-[:150](=[2]O)-[:-150](=[6]O)-[:150]Cl)=-=-=-)}\+\chemfig{HCl}
\arrow(@c1--){0}[-90,0.5]
\chemfig{*6(-=*6(-O-*6(-@{o2}(=[@{o3}]@{o4}O)-Cl)=)-=-=)}\+\chemfig{*6(-=-=(-@{oh2}OH)-=)}\arrow
- \chemfig{*6(-=*6(-O-(-(-[@{cl2}:60]@{cl3}Cl)(-[@{o5}:-120]@{o6}\lewis{6.,O})-O-[::-40]*6(=-=-=-))=)-=-=)}
+ \chemfig{*6(-=*6(-O-(-(-[@{cl2}:60]@{cl3}Cl)(-[@{o5}:-120]@{o6}\charge{-90=\.}{O})-O-[::-40]*6(=-=-=-))=)-=-=)}
\kern-3em \arrow\chemfig{[:30]*6(=-(-O-[:-60](=O)-[:-120](=[4]O)-[:-60]O-*6(=-=-=-))=-=-)}
\kern-3em \+\chemfig{HCl}
\schemestop
@@ -2718,8 +2764,8 @@ $\star\quad\star$
\chemleft[\subscheme[90]{%
\chemfig{R'-\chemabove{N}{\scriptstyle\oplus}~C-R}
\arrow{<->}[,0.75]
- \chemfig{R'-\lewis{2:,N}=@{a1}\chemabove{C}{\scriptstyle\oplus}-R}}\chemright]
- \arrow{<=>[\chemfig{H_2@{a0}\lewis{0:2:,O}}]}[,1.1]
+ \chemfig{R'-\charge{90=\:}{N}=@{a1}\chemabove{C}{\scriptstyle\oplus}-R}}\chemright]
+ \arrow{<=>[\chemfig{H_2@{a0}\charge{0=\:,90=\:}{O}}]}[,1.1]
\chemmove[red,-stealth,red,shorten <=3pt]{
\draw(a0)..controls+(90:10mm)and+(45:10mm)..([yshift=6pt]a1.45);}
\arrow(@c1--){0}[-90,0.333]
@@ -2770,21 +2816,21 @@ $\star\quad\star$
\exemple*{Electrophilic addition of halogen to olefin}/\schemestart
\subscheme{%
\chemfig{C(<[:40])(<[:160])=[6]C(<[:-130])<[:-20]}
- \arrow{0}[,0]\+\chemfig{\lewis{246,Br}-\lewis{026,Br}}}
+ \arrow{0}[,0]\+\chemfig{\charge{90=\|,180=\|,270=\|}{Br}-\charge{90=\|,0=\|,270=\|}{Br}}}
\arrow(@c1--olefin){<=>[*{0}rapide]}[-90]
\chemfig{>[:-20]C(<[:40])=[@{db}6]C(<[:-130])<[:-20]}
\arrow(--bromonium){0}[-90]
- \chemname{\chemfig{C*3((<)(<:[:-155])-\raise1.5pt\llap{$\scriptstyle\oplus$}\lewis{17,Br}-C(<:)(<[:155])-)}}
+ \chemname{\chemfig{C*3((<)(<:[:-155])-\charge{45=\|,-45=\|,180:3pt=$\scriptstyle\oplus$}{Br}-C(<:)(<[:155])-)}}
{bromonium ion}
\arrow(--carbeniumA){<<->}[,1.5]
\chemname{\chemfig{-[:-30]\chemabove{C}{\scriptstyle\oplus}(-[:30])-[6]C(<:[:-150])(<[:-100])-[:-30]
- \lewis{157,Br}}}{Xarbenium ion}
+ \charge{45=\|,-45=\|,225=\|}{Br}}}{Xarbenium ion}
\arrow(@bromonium--carbeniumB){<<->}[180,1.5]
\chemname{\chemfig{-[:-30]\chemabove{C}{\scriptstyle\oplus}(-[:30])-[6]C(<[:-150])
- (<:[:-100])-[:-30]\lewis{137,Br}}}{carbenium ion}
+ (<:[:-100])-[:-30]\charge{45=\|,-45=\|,135=\|}{Br}}}{carbenium ion}
\arrow(@olefin--){0}[,.25]
- \chemfig{@{Br1}\chemabove[3pt]{\lewis{246,Br}}{\scriptstyle\delta\oplus}-[@{b2}]@{Br2}
- \chemabove[3pt]{\lewis{026,Br}}{\scriptstyle\delta\ominus}}
+ \chemfig{@{Br1}\charge{90=\|,180=\|,270=\|,90:5pt=$\scriptstyle\delta\oplus$}{Br}-[@{b2}]@{Br2}
+ \charge{90=\|,0=\|,270=\|,90:5pt=$\scriptstyle\delta\ominus$}{Br}}
\arrow(@olefin--[left]){0}[180,0]
$\pi$ complexe
\arrow(@carbeniumA--@olefin){<=>[lent, \chemfig{{-}Br^\ominus}]}
@@ -2799,7 +2845,7 @@ $\star\quad\star$
\definesubmol{so2oh}{S(=[::90]O)(=[::-90]O)-OH}
\setchemfig{atom sep=2.5em}
\schemestart[,1.5]
- \chemname{\chemfig{*6(=-*6(-=-=-)=-=-)}}{Naphtalène}\+\chemfig{H_2SO_4}
+ \chemname{\chemfig{*6(=-*6(-=-=-)=-=-)}}{Naphtalene}\+\chemfig{H_2SO_4}
\arrow(nph.mid east--.south west){->[80\degres C]}[45]
\chemname{\chemfig{*6(=-*6(-=-(!\cycleoplus)-(-SO_3H)-)=-=-)}}{Ion 1-arenium}
\arrow(.mid east--.mid west)
@@ -2816,8 +2862,8 @@ $\star\quad\star$
\hspace{10em}
\tikz[remember picture]\node(n0){\chemname{}{Attacks\\nucleophiles}};\par
\vspace{2ex}\hspace{15em}
- \chemfig{R^2-(-[:-60]@{a0}H)-[:60]@{a1}(-[:120]R^1)(-[1,0.25,,,draw=none]\scriptstyle\color{red}\delta+)
- =[@{a2}]@{a3}\lewis{1:7:,O}-[1,0.5,,,draw=none]\scriptstyle\color{red}\delta{-}}
+ \chemfig{R^2-(-[:-60]@{m3}H)-[:60]@{m0}\charge{45:5pt=$\scriptstyle\color{red}\delta+$}{}(-[:120]R^1)
+ =[@{m1}]@{m2}\charge {45=\:,-45=\:,45:7pt=$\scriptstyle\color{red}\delta-$}{O}}
\hspace{5em}
\chemname[-15ex]{}{\tikz[remember picture]\node(n1){};Addition reactions}\kern1em
\chemname{}{\tikz[remember picture]\node(n2){};Basic properties}\par