奇怪的水平盒子未满?

奇怪的水平盒子未满?

我不确定我是否发现了一个错误,或者我只是在某个地方遗漏了一个参数,但是我使用以下代码得到了一个未满的水平盒子,而且我不知道它来自哪里:

\documentclass[10pt]{article}

\usepackage[a4paper]{geometry}
\usepackage[T1]{fontenc}

\usepackage{pgfplots}

\usepackage{hyperref}
\pgfplotsset{compat=newest}
\usepackage{minted}

\begin{document}

\begin{figure}[ht]
\resizebox{\linewidth}{!}{\begin{tabular}[h]{c c}
\begin{tikzpicture}
  \begin{axis}[%
      xlabel = $q$,
      ylabel = $d$,
      xtick={-6,-4,...,7},ytick={.05,.1,...,.3},
      height=7cm, width=7cm,
      axis lines*=left,
      xmin = -6, xmax = 6,
      ymin = 0, ymax = .25,
      every y tick label/.append style  =
        { 
          /pgf/number format/.cd,
           precision = 2, 
           fixed zerofill,
           fixed
        },/pgf/number format/.cd,
        use comma]
  \end{axis}
\end{tikzpicture}
&
\begin{tikzpicture}
  \begin{axis}[%
      xlabel =$q$,
      ylabel =$p$,
      xtick={-6,-4,...,7},ytick={.1,.2,...,1},
      height=7cm, width=7cm,
      axis lines*=left,
      xmin = -6, xmax = 6,
      ymin = 0, ymax = 1,
      every y tick label/.append style  =
        { 
          /pgf/number format/.cd,
           precision = 2, 
           fixed zerofill,
           fixed
        },/pgf/number format/.cd,
        use comma]
  \end{axis}
\end{tikzpicture}
\end{tabular}}
\caption{stuff}
\end{figure}

\end{document}

答案1

你不仅会收到Underfull \hbox警告,还会

pdfTeX warning (ext4): destination with the same iden
tifier (name{figure.1}) has been already used, duplicate ignored

\@EveryShipout@Output ...@Org@Shipout \box \@cclv 

这显然是由于minted对 执行的操作\caption未被 捕获hyperref,因为它已被加载。

只需改变包的加载顺序。

顺便说一句,我不明白tabular内部的复杂性\resizebox。另请注意, 没有h选项tabular

\documentclass[10pt]{article}

\usepackage[a4paper]{geometry}
\usepackage[T1]{fontenc}

\usepackage{pgfplots}

\usepackage{minted}
\usepackage{hyperref}
\pgfplotsset{compat=newest}

\begin{document}

\begin{figure}[htp]
\centering

\begin{tikzpicture}
  \begin{axis}[%
      xlabel = $q$,
      ylabel = $d$,
      xtick={-6,-4,...,7},ytick={.05,.1,...,.3},
      height=.45\textwidth, width=.45\textwidth,
      axis lines*=left,
      xmin = -6, xmax = 6,
      ymin = 0, ymax = .25,
      every y tick label/.append style  =
        { 
          /pgf/number format/.cd,
           precision = 2, 
           fixed zerofill,
           fixed
        },/pgf/number format/.cd,
        use comma]
  \end{axis}
\end{tikzpicture}\hfill
\begin{tikzpicture}
  \begin{axis}[%
      xlabel =$q$,
      ylabel =$p$,
      xtick={-6,-4,...,7},ytick={.1,.2,...,1},
      height=.45\textwidth, width=.45\textwidth,
      axis lines*=left,
      xmin = -6, xmax = 6,
      ymin = 0, ymax = 1,
      every y tick label/.append style  =
        { 
          /pgf/number format/.cd,
           precision = 2, 
           fixed zerofill,
           fixed
        },/pgf/number format/.cd,
        use comma]
  \end{axis}
\end{tikzpicture}

\caption{stuff}
\end{figure}

\end{document}

在此处输入图片描述

相关内容