When I use chemfig in conjuction when \tikz[overlay,remember picture] the positioning does go in the correct position. I am using XeLaTeX and the yLaTeX class (see this link: https://github.com/HarveySheppard/yLaTeX). Here are a few examples of the error:
\begin{center}
\setchemfig{cram width=3pt}
\schemestart
\subscheme{
\chemleft[
\chemfig{@{F}\Lewis{0:2:4:6:,F}}
\chemright]}
\+
\chemfig{F-@{B}{\phantom{B}}(-[2,0,,,draw=none]{})(<[:-20]F)<:[:20]F}
\arrow{->}
\chemleft[
\chemfig{\chembelow[0.5pt]{F}{\scriptstyle\hspace{4.5mm}\oplus}-[:-90,0.8]@{cb}\chemabove[0.5pt]{B}{\scriptstyle\hspace{4.5mm}\ominus}(<:[:-40,0.8]F)(<[:-70,0.8]F)-[:-140]F}
\chemright]
\schemestop
\tikz[overlay,remember picture]{
\begin{scope}[overlay,shift={(B)}]
\draw[-] (-0.1,0.2) ..controls +(120:1) and +(60:1) .. (0.1,0.2);
\draw[-,fill=black!10] (-0.1,-0.2) ..controls +(-120:1) and +(-60:1) ..
+(0.2,0);
\end{scope}
\node[fill=white,inner sep=0.1pt] at (B){{\fontfamily{cmr}\selectfont
B
}};
\draw[-latex,shorten <=2pt] (F) ..controls +(90:1.7cm)and+(90:1cm)..
([yshift=9pt]B.north);
}
\tikz[overlay,remember picture]{
\draw[-latex,shorten <=2pt,densely dashed] ([yshift=9pt]cb.north) ..controls +(180:0.7) and +(-90:1).. +(-0.7,1) node[above,align=center] {\scriptsize coordinate \scriptsize covalent\\ \scriptsize bond};
}
\chemmove{\node[xshift=6pt] at (c2.north east) {$-$};}
\chemmove{\node[xshift=6pt] at (c3.north east) {$-$};}
\end{center}
Here is the output:
The dashed arrow that points to coordinate covalent bond should be from the vertical bond between the Boron (B) and fluorine (F) in the last compound.
Another example:
\setchemfig{cram width=3pt}
\chemnameinit{}
\schemestart
\chemname{\chemfig{H_{3}C-C(=[:45]O)-[:-45]O-[:0]H}}{\tikzmarknode{A}{Acetic
Acid}}
+
\chemname{\chemfig{H_{3}C-\Lewis{2:,N}(<:[:-15]H)<[:-40]H}}{\tikzmarknode{B}{Methylamine}}
\arrow{<=>}
\chemname{\chemfig{H_{3}C-C(=[:45]O)-[:-45]O\rlap{${}^-$}}}{\tikzmarknode{C}{Acetate
Ion}}
+
\chemname{\chemfig{H_{3}C-N\rlap{${}^+$}(-[:45]H)(<:[:-15]H)<[:-40]H}}{\tikzmarknode{D}{Mathylammonium
Ion}}
\schemestop
\begin{tikzpicture}[overlay,remember picture]
\node[below=3mm of A,fill=dullblue,draw,ellipse] (Acid1) {Acid};
\node[below=3mm of B,draw,ellipse] (Base1) {Base};
\node[below=3mm of C,fill=dullblue,draw,ellipse] (Base2) {Base};
\node[below=3mm of D,draw,ellipse] (Acid2) {Acid};
\draw[blue!50] (Acid1) -- ++ (0,-1.5) coordinate(aux) -| (Base2);
\draw (Base1) -- ++ (0,-2) -| (Acid2);
\node[anchor=south,blue!50,fill=white,outer sep=1pt] at (aux-|Base1) {Conjugate pair};
\end{tikzpicture}
The following is required in the preamble:
\usepackage{chemfig}
\usepackage{tikz}
\usetikzlibrary{tikzmark,positioning,shapes.geometric}
\definecolor{dullblue}{RGB}{178,201,231}
The code comes from one of my previous questions: How to typset/draw conjugate acids and bases. It produces the following output
The text comes from the rest of my document. I am more worried about the fact that the tikz ovals are not in the correct location and do not know how to solve this issue. Any help would be appreciated.
\documentclassand the appropriate packages so that those trying to help don't have to recreate it. – Peter Grill Dec 14 '18 at 06:30overlay/remember picturething just doesn't work with other drivers thanpdftexorluatex. I got similar unsatisfactory results with the Dvips route. – AlexG Dec 14 '18 at 10:44\tikzmarknodewith\subnode. Second, use the workaround definition within\makeatletter ... \makeatotherfrom the answer in the link. – whatisit Dec 15 '18 at 05:12