我将表格环境表与 TikZ 图表并排放置。但是,这会导致一些奇怪的布局问题并产生额外的空间。这是我使用的代码:
\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}
这产生了以下结果(注意分子结构中不必要的间距和奇怪的位置):
我希望它显示如下内容:
任何能实现这一目标的建议都将非常感激。
答案1
不要使用这些\vspace
命令。使用包m
中的列说明符和tikz 选项。工作示例:array
baseline=(current bounding box.west)
\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}
输出: