TikZ-Bild und Tabelle nebeneinander positionieren

TikZ-Bild und Tabelle nebeneinander positionieren

Ich platziere eine tabellarische Umgebungstabelle neben einem TikZ-Diagramm. Dies verursacht jedoch einige seltsame Layoutprobleme und schafft zusätzlichen Platz. Hier ist der Code, den ich verwende:

\documentclass[12pt,twoside]{report}
\usepackage[utf8]{inputenc}
\usepackage[margin=0.75in]{geometry}
\usepackage{setspace}
\usepackage{chemfig}
\usepackage{adjustbox}
\usepackage[pdfversion=2.0]{hyperref}
\usepackage[numbered]{bookmark}
\usepackage[activate={true,nocompatibility},final,tracking=true,kerning=true,spacing=true,factor=1100,stretch=10,shrink=10]{microtype}

\newcommand{\titlehead}[1]{\begin{center}\pdfbookmark[chapter]{#1}{chapter#1}\section*{#1}\end{center}}
\newcommand{\sectionhead}[1]{\pdfbookmark[section]{#1}{sec#1}\section*{#1}\vspace*{-1em}}
\newcommand{\subsechead}[1]{\pdfbookmark[subsection]{#1}{sec#1}\textbf{\underline{#1}}\vspace*{-0.5em}}
\newenvironment{subcalc}[1]{\vspace{0.1cm}\\\underline{#1}\vspace{0.1cm}\\}{\vspace{0.1cm}}

\doublespacing
\begin{document}

\noindent\subsechead{Sodium Borohydride Product}
\\\begin{tabular}{p {0.5\textwidth} c }
  \vspace{-1em}\hspace{-0.5em}\subcalc{\textsuperscript{1}H NMR Spectroscopy:}
  \begin{tabular}{ l l l l }
    1.36 ppm  & multiplet & 6H & \textcolor{blue}{A} \\
    2.56 ppm  & doublet & 1H & \textcolor{blue}{B} \\
    4.23 ppm  & multiplet & 3H & \textcolor{blue}{C} \\
  \end{tabular} &
  \adjustbox{valign=T}{
    \begin{tikzpicture}
      \node[anchor=south west,inner sep=0] (image) at (0,0) {\chemfig{-[:30](-[::+60]OH)-[:-30]-[:30](=[:90]O)-[:-30]O-[:30]-[:-30]}};
      \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.2,1.14) {D};
          \node[draw,circle,inner sep=0.75pt,anchor=south west,blue, text=blue] at (0.3,-0.23) {B};
          \node[draw,circle,inner sep=0.75pt,anchor=south west,blue, text=blue] at (0.8,0.5) {C};
          \node[draw,circle,inner sep=0.75pt,anchor=south west,blue, text=blue] at (0.12,-0.08) {C};
          \node[draw,circle,inner sep=0.75pt,anchor=south west,blue, text=blue] at (-0.14,0) {A};
          \node[draw,circle,inner sep=0.75pt,anchor=south west,blue, text=blue] at (1.06,0.06) {A};
      \end{scope}
  \end{tikzpicture}}\\
\end{tabular}

\noindent Lorem ipsum dolor sit amet

\end{document}

Dies führt zu folgendem Ergebnis (beachten Sie die unnötigen Abstände und die seltsame Positionierung der Molekülstruktur):

Bildbeschreibung hier eingeben

So soll es aussehen:

Bildbeschreibung hier eingeben

Ich wäre für jeden Vorschlag, der dies erreichen kann, sehr dankbar.

Antwort1

Verwenden Sie diese \vspaceBefehle nicht. Verwenden Sie mden Spaltenbezeichner aus arraydem Paket und baseline=(current bounding box.west)für die Tikz-Option. Funktionierendes Beispiel:

\documentclass[12pt,twoside]{report}
\usepackage[margin=0.75in]{geometry}
\usepackage{setspace}
\usepackage{chemfig}
\usepackage{array}
\usepackage[numbered]{bookmark}
\usepackage[activate={true,nocompatibility},final,tracking=true,kerning=true,spacing=true,factor=1100,stretch=10,shrink=10]{microtype}
\microtypecontext{spacing=nonfrench}
\usepackage{hyperref}
\newcommand{\subsechead}[1]{\pdfbookmark[subsection]{#1}{sec#1}\textbf{\underline{#1}}}
\doublespacing


\begin{document}
\noindent\subsechead{Sodium Borohydride Product}

\noindent\begin{tabular}{@{} m{0.5\textwidth} @{} m{0.5\textwidth} @{}}
\underline{\textsuperscript{1}H NMR Spectroscopy:}
  
\begin{tabular}{ l l l l }
    1.36 ppm  & multiplet & 6H & \textcolor{blue}{A} \\
    2.56 ppm  & doublet & 1H & \textcolor{blue}{B} \\
    4.23 ppm  & multiplet & 3H & \textcolor{blue}{C} \\
  \end{tabular} &
\begin{tikzpicture}[baseline=(current bounding box.west)]
      \node[anchor=south west,inner sep=0] (image) at (0,0) {\chemfig{-[:30](-[::+60]OH)-[:-30]-[:30](=[:90]O)-[:-30]O-[:30]-[:-30]}};
      \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.2,1.14) {D};
          \node[draw,circle,inner sep=0.75pt,anchor=south west,blue, text=blue] at (0.3,-0.23) {B};
          \node[draw,circle,inner sep=0.75pt,anchor=south west,blue, text=blue] at (0.8,0.5) {C};
          \node[draw,circle,inner sep=0.75pt,anchor=south west,blue, text=blue] at (0.12,-0.08) {C};
          \node[draw,circle,inner sep=0.75pt,anchor=south west,blue, text=blue] at (-0.14,0) {A};
          \node[draw,circle,inner sep=0.75pt,anchor=south west,blue, text=blue] at (1.06,0.06) {A};
      \end{scope}
  \end{tikzpicture}\\
\end{tabular}

\noindent Lorem ipsum dolor sit amet
\end{document}

Ausgabe:

Bildbeschreibung hier eingeben

verwandte Informationen