'tikzpicture' 和 'tabular' 的可变标题间距

'tikzpicture' 和 'tabular' 的可变标题间距

该选项与和\abovecaptionskip产生不同的结果。tikzpicturetabular

梅威瑟:

\documentclass{report}        
\usepackage{tikz}    
%    
\begin{document}    
  \setlength{\abovecaptionskip}{0pt}    
  \begin{figure}    
    \centering    
    \begin{tikzpicture}    
      \node[rectangle] {Some Figure};    
      \draw (current bounding box.south west) rectangle (current bounding box.north east); 
    \end{tikzpicture}
    \caption{A Caption}  
%   
    \vspace{1cm}
%   
    \begin{tabular}{|l|l|}
      \hline
      Nonlinear & 3.720894e-0\\ \hline
    \end{tabular} 
    \caption{B Caption}
  \end{figure} 
\end{document}

在此处输入图片描述

顺便问一下,我该如何将figure环境纳入其中standalone documentclass

答案1

如果你把环境tikzpicture放在一个盒子里,它就有高度15.84369pt和深度0pt,因为参考点在底部边界。然后 TeX 应用通常的线间算法,下一条基线有距离\baselineskip

如果tabular,则默认参考点以数学轴为中心(\vcenter用于垂直居中)。结果:高度为8.9pt,深度为3.9pt。如果 的常用算法\baselineskip给出的行间距小于\lineskiplimit,则 TeX 使用\lineskip(默认为1pt)。

如果您想要相似的间距,那么可以使用可选的放置选项将参考点tabular向下移动b

\documentclass{report}
\usepackage{tikz}

\begin{document}
  \setlength{\abovecaptionskip}{0pt}
  \begin{figure}
    \centering
    \begin{tikzpicture}
      \node[rectangle] {Some Figure};
      \draw (current bounding box.south west) rectangle (current bounding box.north east);
    \end{tikzpicture}
    \caption{A Caption}

    \vspace{1cm}

    \begin{tabular}[b]{|l|l|}
      \hline
      Nonlinear & 3.720894e-0\\ \hline
    \end{tabular}
    \caption{B Caption}
  \end{figure}
\end{document}

结果

或者从另一个方向,tikzpicture改变的参考点,例如:

\documentclass{report}
\usepackage{tikz}

\begin{document}
  \setlength{\abovecaptionskip}{0pt}
  \begin{figure}
    \centering
    \begin{tikzpicture}[baseline=(current bounding box.center)]
      \node[rectangle] {Some Figure};
      \draw (current bounding box.south west) rectangle (current bounding box.north east);
    \end{tikzpicture}
    \caption{A Caption}

    \vspace{1cm}

    \begin{tabular}{|l|l|}   
      \hline
      Nonlinear & 3.720894e-0\\ \hline
    \end{tabular}
    \caption{B Caption}
  \end{figure}
\end{document}

结果

可以通过以下方式实现不留任何空间的极端情况\nointerlineskip

\documentclass{report}
\usepackage{tikz}

\begin{document}
  \setlength{\abovecaptionskip}{0pt}
  \begin{figure}
    \centering
    \begin{tikzpicture}[baseline=(current bounding box.center)]
      \node[rectangle] {Some Figure};
      \draw (current bounding box.south west) rectangle (current bounding box.north east);
    \end{tikzpicture}

    \nointerlineskip
    \caption{A Caption}

    \vspace{1cm}

    \begin{tabular}{|l|l|}
      \hline
      Nonlinear & 3.720894e-0\\ \hline
    \end{tabular}

    \nointerlineskip
    \caption{B Caption}
  \end{figure}
\end{document}

结果

相关内容