#Struggling with TikZ positioning

1 messages · Page 1 of 1 (latest)

wise condor
#

I am trying to place labels over a chemfig drawing with TikZ and am struggling with the positioning

#

When i adjust the second number of the node, it doesn't move it in the y-direction as expected and instead changes the x-direction

#
\setchemfig{%
    atom sep = 1.75em,
    stack sep = 0.3em,% dim for chemabove and below
    bond offset = 1.25pt,
    double bond sep = .25em
}
\begin{tabular}{p {0.5\textwidth} c }
  \noindent\begin{tabular}{ l l l l }
    3.39 ppm  & triplet & 2H & \textcolor{blue}{A} \\
    3.61 ppm  & triplet & 2H & \textcolor{blue}{B} \\
  \end{tabular} &
  \adjustbox{valign=T}{
    \begin{tikzpicture}
      \node[anchor=south west,inner sep=0] (image) at (0,0) {\chemfig{-[:-30]-[:30]-[:-30]-[:30]Cl}};
      \node[anchor=south west,inner sep=0] (image) at (3,0) {\chemfig{-[:-30]-[:30]-[:-30]-[:30]Br}};
      \begin{scope}[x={(image.south east)},y={(image.north west)}]
          \footnotesize
          \node[draw,circle,inner sep=0.75pt,anchor=south west,blue, text=blue] at (0.83,0) {A};
          \node[draw,circle,inner sep=0.75pt,anchor=south west,blue, text=blue] at (0,0) {B};
      \end{scope}
  \end{tikzpicture}}\\
\end{tabular}```
#
\setchemfig{%
    atom sep = 1.75em,
    stack sep = 0.3em,% dim for chemabove and below
    bond offset = 1.25pt,
    double bond sep = .25em
}
\begin{tabular}{p {0.5\textwidth} c }
  \noindent\begin{tabular}{ l l l l }
    3.39 ppm  & triplet & 2H & \textcolor{blue}{A} \\
    3.61 ppm  & triplet & 2H & \textcolor{blue}{B} \\
  \end{tabular} &
  \adjustbox{valign=T}{
    \begin{tikzpicture}
      \node[anchor=south west,inner sep=0] (image) at (0,0) {\chemfig{-[:-30]-[:30]-[:-30]-[:30]Cl}};
      \node[anchor=south west,inner sep=0] (image) at (3,0) {\chemfig{-[:-30]-[:30]-[:-30]-[:30]Br}};
      \begin{scope}[x={(image.south east)},y={(image.north west)}]
          \footnotesize
          \node[draw,circle,inner sep=0.75pt,anchor=south west,blue, text=blue] at (0.83,0.1) {A};
          \node[draw,circle,inner sep=0.75pt,anchor=south west,blue, text=blue] at (0,0) {B};
      \end{scope}
  \end{tikzpicture}}\\
\end{tabular}```
#

Notice how the (A) moved to the right instead of moving up as expected

azure ginkgoBOT
#

Fanman03

#

Fanman03

wise condor
#

I finally got it how i wanted it but it took a lot of trial and error

#
\begin{tabular}{p {0.5\textwidth} c }
  \noindent\begin{tabular}{ l l l l }
    3.39 ppm  & triplet & 2H & \textcolor{blue}{A} \\
    3.61 ppm  & triplet & 2H & \textcolor{blue}{B} \\
  \end{tabular} &
  \adjustbox{valign=T}{
    \begin{tikzpicture}
      \node[anchor=south west,inner sep=0] (image) at (0,0) {\chemfig{-[:-30]-[:30]-[:-30]-[:30]Cl}};
      \node[anchor=south west,inner sep=0] (image) at (3,0) {\chemfig{-[:-30]-[:30]-[:-30]-[:30]Br}};
      \begin{scope}[x={(image.south east)},y={(image.north west)}]
          \footnotesize
          \node[draw,circle,inner sep=0.75pt,anchor=south west,blue, text=blue] at (0.5,0.6) {A};
          \node[draw,circle,inner sep=0.75pt,anchor=south west,blue, text=blue] at (0,0.57) {B};
      \end{scope}
  \end{tikzpicture}}\\
\end{tabular}```
azure ginkgoBOT
#

Fanman03

wise condor
lunar axle
#

hmm, this looks very convoluted