标题与 TikZ 和 EPS 图形之间的间距一致

标题与 TikZ 和 EPS 图形之间的间距一致

我遇到的问题是 TikZ 图形与其标题之间的间距比任何其他类型的图片与其间距之间的间距都大: TikZ 的巨大间距

显然,可以通过在序言或浮动中进行硬编码\vspace{}或调整来解决skip,这似乎有点繁琐且不“语义化”。但如何才能在不破坏其他图形间距的情况下全局修复它呢?

而且,一般来说,为什么 Tikz 的字幕间距这么大(甚至没有 EPS 来比较)?

我们:

\documentclass[
oneside,
openright,
titlepage,
numbers=noenddot,
headinclude,
footinclude,
cleardoublepage=empty,
BCOR=5mm,
paper=b5,
fontsize=10pt
abstract=on
]{scrreprt}

\usepackage{classicthesis}
\usepackage{tikz,pgfplots}
\usepackage{subcaption}
\usetikzlibrary{backgrounds}
\pgfplotsset{compat=newest,
    width=\textwidth,
    height=0.75\textwidth,
    %tick label style={font=\small},
    %legend style={font=\small},
    ylabel shift={-3pt},
    xlabel shift={-3pt}
}

\begin{document}
\begin{figure}
\begin{subfigure}[b]{0.49\textwidth}
% This file was created by matplotlib2tikz v0.6.18.
\input{pic.tex}
\caption{Figure}
\end{subfigure}
~
\begin{subfigure}[b]{0.49\textwidth}
    % This file was created by matplotlib2tikz v0.6.18.
    \input{pic.tex}
    \caption{Figure}
\end{subfigure}

\end{figure}
\end{document}

图片.tex:

% This file was created by matplotlib2tikz v0.6.18.
\begin{tikzpicture}[background rectangle/.style={fill=olive!45}, show background rectangle]

\definecolor{color0}{rgb}{0.12156862745098,0.466666666666667,0.705882352941177}
\definecolor{color1}{rgb}{1,0.498039215686275,0.0549019607843137}

\begin{axis}[
legend cell align={left},
legend entries={{$\lambda_{min}$},{$\lambda_{max}$}},
legend style={at={(0.03,0.03)}, anchor=south west, draw=white!80.0!black},
tick align=outside,
tick pos=left,
x grid style={white!69.01960784313725!black},
xlabel={$\omega$},
xmin=0, xmax=5.1,
xtick={0,1,2,3,4,5,6},
xticklabels={$0$,$1$,$2$,$3$,$4$,$5$,$6$},
y grid style={white!69.01960784313725!black},
ylabel={$\log_{10} ||\lambda_i| - 1|$},
ymin=-15, ymax=2,
ytick={-16,-14,-12,-10,-8,-6,-4,-2,0,2},
yticklabels={$-16$,$-14$,$-12$,$-10$,$-8$,$-6$,$-4$,$-2$,$0$,$2$}
]
\addplot [semithick, color1, dotted]
table [row sep=\\]{%
    0   -0.0150784734238995 \\
    0.00340226817878586 -0.0150785247930231 \\
    0.00680453635757171 -0.0150786789065911 \\
    0.0102068045363576  -0.0150789357831926 \\
    0.0136090727151434  -0.0150792954538207 \\
    0.0170113408939293  -0.0150797579618575 \\
    5.08639092728486    1.64658769206306 \\
    5.08979319546364    1.65617254087203 \\
    5.09319546364243    1.66573665825563 \\
    5.09659773182121    1.67528018607781 \\
    5.1 1.6848032640236 \\
};

\end{axis}
\end{tikzpicture}

编译为: 在此处输入图片描述

\fbox{}修复了它: 在此处输入图片描述

答案1

图像太宽,并且强制在段落后出现一行白色(未满)文本,如果您更改最后pic.tex一行

\end{tikzpicture}

\end{tikzpicture}%

然后输出从

在此处输入图片描述

在此处输入图片描述

基本上每当 TeX 警告

Underfull \hbox (badness 10000) in paragraph at lines 40--33

这意味着某些事情非常糟糕,通常文档中有一个虚假的空行(10000 是糟糕程度的最大值,所以 TeX 警告你输出已经糟糕到极点了......)

相关内容