我的身材余地太大

我的身材余地太大

我收到的这个图的边距太大了。这个图出现在一整页中,我试过 \vspace*{-5pt}。什么都没变。如能帮助我将不胜感激。

\documentclass [12pt] {article}   
\usepackage{hyperref}% http://ctan.org/pkg/hyperref
\renewcommand{\sectionautorefname}{\S}          
\usepackage[cyr]{aeguill}
\usepackage{float}
\usepackage{mathptmx} 
\usepackage[T1]{fontenc}
\usepackage{pgf}
\usepackage{pgfplots}
\usepackage[scaled=2]{helvet}
\usepackage{courier} 
\usepackage{subcaption}
\usepackage{xspace}
\usepackage{fancyhdr}
\usepackage{tkz-tab}
\usepackage{booktabs} 
\usepackage{graphicx}
\usepackage{multirow} 
\usepackage{tabularx}
\usepackage[latin1]{inputenc}
\usepackage{tikz}   
\usetikzlibrary{shapes, arrows, positioning,fit, calc, patterns}
\usepackage{tabularx}   
\usepackage{natbib}
\usepackage[left=3cm, top=3cm, right=3cm, bottom=3cm, nohead]{geometry}
\usepackage{authblk} 
\usepackage{parskip}
\setlength{\parskip}{\medskipamount}
\usepackage{verbatim}
\usepackage{amsmath}
\usepackage[german,english]{babel}   
\newcommand{\minim}{\mathop{\hbox{min}}}
\newcommand{\minimize}[1]{\displaystyle\minim_{#1}}
\newcommand{\st}{\mathop{\hbox{s.t: \thinspace}}} 
\pgfplotsset{compat=1.11}
\usepackage{xcolor}
\renewcommand{\baselinestretch}{1}\normalsize 
\def\firstcircle{(0,0) circle (1.5cm)}
\def\secondcircle{(0:2cm) circle (1.5cm)}
\def\thirdcircle{(0:4cm) circle (1.5cm)}
\def\fourthcircle{(-1.8cm:0.9cm) circle (0.5cm)}
\def\fifthcircle{(0,0) circle (1.5cm)}
\def\sixthcircle{(0:4.5cm) circle (1.5cm)}

\tikzset{filled/.style={fill=white, draw=circle edge, thick},
outline/.style={draw=black, thick}}

\begin{document}  
\begin{figure}[htbp]
\resizebox{0.5\textwidth}{!}{
\begin{tikzpicture} 
\node[shape=circle,draw=black]  (n1) at (1,10) {};
\node[shape=circle,draw=black]  (n2) at (5,10)  {};
\node[shape=circle,draw=black]  (n5) at (1,6)  {};
\node[shape=circle,draw=black]  (n4) at (5,6) {};
\node[shape=circle,draw=black]  (n3) at (10,8)  {};
\node[shape=circle,draw=red,thick]  (n7) at (2,8.5) {$F_1$};
\node[shape=circle,draw=red,thick]  (n8) at (3.5,7) {$F_2$};
\node[shape=circle,draw=red,thick]  (n9) at (7,8) {$F_3$};
\node[shape=circle,draw=red,thick]  (n10) at (3.5,4.5) {$F_4$};
\draw (n1) -- (n2);
\draw (n2) -- (n3);
\draw (n2) -- (n4);
\draw (n2) -- (n5);
\draw (n3) -- (n4);
\draw (n4) -- (n5);
\draw (n5) -- (n1);
\end{tikzpicture}
}
\caption{Graph $G$ as an (isolated) system}
\end{figure}

\begin{figure}[htbp]
\resizebox{0.8\textwidth}{!}{
\begin{tikzpicture}
\node[shape=circle,draw=black]  (n1) at (1,10) {1};
\node[shape=circle,draw=black]  (n2) at (5,10)  {2};
\node[shape=circle,draw=black]  (n5) at (1,6)  {5};
\node[shape=circle,draw=black]  (n4) at (5,6) {4};
\node[shape=circle,draw=black]  (n3) at (10,8)  {3};
\node[shape=circle,draw=red,thick]  (n7) at (2,8.5) {$F_1$};
\node[shape=circle,draw=red,thick]  (n8) at (3.5,7) {$F_2$};
\node[shape=circle,draw=red,thick]  (n9) at (7,8) {$F_3$};
\node[shape=circle,draw=red,thick]  (n10) at (3.5,4.5) {$F_4$};
\draw (n1) -- (n2);
\draw (n2) -- (n3);
\draw (n2) -- (n4);
\draw (n2) -- (n5);
\draw (n3) -- (n4);
\draw (n4) -- (n5);
\draw (n5) -- (n1);
\draw[draw=red, dashed, thick] (n7) -- (n8);
\draw[draw=red, dashed, thick] (n8) -- (n9);
\draw[draw=red, dashed, thick] (n8) -- (n10);
\draw[draw=red, dashed, thick] (n10) to [out=10,in=10] (n9);
\draw[draw=red, dashed, thick] (n7) to [out=-198,in=190,looseness=2] (n10);
\draw[draw=red, dashed, thick] (n10) to [out=-30,in=30,looseness=4] (n9);
\draw[draw=red, dashed, thick] (n7) to [out=100,in=200,looseness=3.5] (n10);
\end{tikzpicture}
}
\caption{Graph $G^\star=(N^\star,A^\star)$}
\end{figure}
\end{document}

答案1

这是一份经过稍微修剪的文档,其中\fbox说明了为什么您的图形被放置在原处。

\documentclass [12pt] {article}
\usepackage{float}
\usepackage{mathptmx}
\usepackage[T1]{fontenc}
\usepackage{pgfplots}
% these will look horrible with CM or CM-like fonts
% \usepackage[scaled=2]{helvet}
% \usepackage{courier}
\usepackage{subcaption}
\usepackage{xspace}
\usepackage{fancyhdr}
\usepackage{tkz-tab}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage{tabularx}% don't load packages twice
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{shapes, arrows, positioning,fit, calc, patterns}% shapes and arrows are deprecated
\usepackage{natbib}
\usepackage[left=3cm, top=3cm, right=3cm, bottom=3cm, nohead]{geometry}% so fancyhdr is only for footers? no headers in this document?
\usepackage{authblk}
\usepackage{parskip}
\setlength{\parskip}{\medskipamount}
\usepackage{verbatim}
\usepackage{amsmath}
\usepackage[german,english]{babel}
\pgfplotsset{compat=1.11}
\usepackage{hyperref}% http://ctan.org/pkg/hyperref
\renewcommand{\baselinestretch}{1}\normalsize % this is a terrible idea - at least use setspace, but this is too little anyway
\renewcommand{\sectionautorefname}{\S}
\newcommand{\minim}{\mathop{\hbox{min}}}
\newcommand{\minimize}[1]{\displaystyle\minim_{#1}}
\newcommand{\st}{\mathop{\hbox{s.t: \thinspace}}}
\newcommand*\firstcircle{(0,0) circle (1.5cm)}
\newcommand*\secondcircle{(0:2cm) circle (1.5cm)}
\newcommand*\thirdcircle{(0:4cm) circle (1.5cm)}
\newcommand*\fourthcircle{(-1.8cm:0.9cm) circle (0.5cm)}
\newcommand*\fifthcircle{(0,0) circle (1.5cm)}
\newcommand*\sixthcircle{(0:4.5cm) circle (1.5cm)}

\tikzset{filled/.style={fill=white, draw=circle edge, thick},
outline/.style={draw=black, thick}}

\begin{document}
\begin{figure}[htbp]
  \fbox{%
    \resizebox{0.5\textwidth}{!}{% this method is considered evil
      \begin{tikzpicture}
        \node[shape=circle,draw=black]  (n1) at (1,10) {};
        \node[shape=circle,draw=black]  (n2) at (5,10)  {};
        \node[shape=circle,draw=black]  (n5) at (1,6)  {};
        \node[shape=circle,draw=black]  (n4) at (5,6) {};
        \node[shape=circle,draw=black]  (n3) at (10,8)  {};
        \node[shape=circle,draw=red,thick]  (n7) at (2,8.5) {$F_1$};
        \node[shape=circle,draw=red,thick]  (n8) at (3.5,7) {$F_2$};
        \node[shape=circle,draw=red,thick]  (n9) at (7,8) {$F_3$};
        \node[shape=circle,draw=red,thick]  (n10) at (3.5,4.5) {$F_4$};
        \draw (n1) -- (n2);
        \draw (n2) -- (n3);
        \draw (n2) -- (n4);
        \draw (n2) -- (n5);
        \draw (n3) -- (n4);
        \draw (n4) -- (n5);
        \draw (n5) -- (n1);
      \end{tikzpicture}%
    }%
  }
  \caption{Graph $G$ as an (isolated) system}
\end{figure}

\begin{figure}[htbp]
  \fbox{%
    \resizebox{0.8\textwidth}{!}{% this method is considered evil
      \begin{tikzpicture}
        \node[shape=circle,draw=black]  (n1) at (1,10) {1};
        \node[shape=circle,draw=black]  (n2) at (5,10)  {2};
        \node[shape=circle,draw=black]  (n5) at (1,6)  {5};
        \node[shape=circle,draw=black]  (n4) at (5,6) {4};
        \node[shape=circle,draw=black]  (n3) at (10,8)  {3};
        \node[shape=circle,draw=red,thick]  (n7) at (2,8.5) {$F_1$};
        \node[shape=circle,draw=red,thick]  (n8) at (3.5,7) {$F_2$};
        \node[shape=circle,draw=red,thick]  (n9) at (7,8) {$F_3$};
        \node[shape=circle,draw=red,thick]  (n10) at (3.5,4.5) {$F_4$};
        \draw (n1) -- (n2);
        \draw (n2) -- (n3);
        \draw (n2) -- (n4);
        \draw (n2) -- (n5);
        \draw (n3) -- (n4);
        \draw (n4) -- (n5);
        \draw (n5) -- (n1);
        \draw[draw=red, dashed, thick] (n7) -- (n8);
        \draw[draw=red, dashed, thick] (n8) -- (n9);
        \draw[draw=red, dashed, thick] (n8) -- (n10);
        \draw[draw=red, dashed, thick] (n10) to [out=10,in=10] (n9);
        \draw[draw=red, dashed, thick] (n7) to [out=-198,in=190,looseness=2] (n10);
        \draw[draw=red, dashed, thick] (n10) to [out=-30,in=30,looseness=4] (n9);
        \draw[draw=red, dashed, thick] (n7) to [out=100,in=200,looseness=3.5] (n10);
      \end{tikzpicture}%
    }%
  }
  \caption{Graph $G^\star=(N^\star,A^\star)$}
\end{figure}
\end{document}

方框中的数字

第二个图形对于 LaTeX 来说实在太大了,无法将其放在顶部或底部(或“此处”),因为它的浮动放置算法是这样的。因此,它会将其移动到浮动页面,而且由于它是唯一一个最终出现在那里的浮动图形,因此它位于自己的页面上。

边距保持不变。这就是浮动的工作原理。

更简单的版本:

\documentclass [12pt] {article}
\usepackage{tikz}
\usepackage[left=3cm, top=3cm, right=3cm, bottom=3cm, nohead]{geometry}% so fancyhdr is only for footers? no headers in this document?
\begin{document}
\begin{figure}[htbp]
  \fbox{%
    \resizebox{0.5\textwidth}{!}{% this method is considered evil
      \begin{tikzpicture}
        \node[shape=circle,draw=black]  (n1) at (1,10) {};
        \node[shape=circle,draw=black]  (n2) at (5,10)  {};
        \node[shape=circle,draw=black]  (n5) at (1,6)  {};
        \node[shape=circle,draw=black]  (n4) at (5,6) {};
        \node[shape=circle,draw=black]  (n3) at (10,8)  {};
        \node[shape=circle,draw=red,thick]  (n7) at (2,8.5) {$F_1$};
        \node[shape=circle,draw=red,thick]  (n8) at (3.5,7) {$F_2$};
        \node[shape=circle,draw=red,thick]  (n9) at (7,8) {$F_3$};
        \node[shape=circle,draw=red,thick]  (n10) at (3.5,4.5) {$F_4$};
        \draw (n1) -- (n2);
        \draw (n2) -- (n3);
        \draw (n2) -- (n4);
        \draw (n2) -- (n5);
        \draw (n3) -- (n4);
        \draw (n4) -- (n5);
        \draw (n5) -- (n1);
      \end{tikzpicture}%
    }%
  }
  \caption{Graph $G$ as an (isolated) system}
\end{figure}

\begin{figure}[htbp]
  \fbox{%
    \resizebox{0.8\textwidth}{!}{% this method is considered evil
      \begin{tikzpicture}
        \node[shape=circle,draw=black]  (n1) at (1,10) {1};
        \node[shape=circle,draw=black]  (n2) at (5,10)  {2};
        \node[shape=circle,draw=black]  (n5) at (1,6)  {5};
        \node[shape=circle,draw=black]  (n4) at (5,6) {4};
        \node[shape=circle,draw=black]  (n3) at (10,8)  {3};
        \node[shape=circle,draw=red,thick]  (n7) at (2,8.5) {$F_1$};
        \node[shape=circle,draw=red,thick]  (n8) at (3.5,7) {$F_2$};
        \node[shape=circle,draw=red,thick]  (n9) at (7,8) {$F_3$};
        \node[shape=circle,draw=red,thick]  (n10) at (3.5,4.5) {$F_4$};
        \draw (n1) -- (n2);
        \draw (n2) -- (n3);
        \draw (n2) -- (n4);
        \draw (n2) -- (n5);
        \draw (n3) -- (n4);
        \draw (n4) -- (n5);
        \draw (n5) -- (n1);
        \draw[draw=red, dashed, thick] (n7) -- (n8);
        \draw[draw=red, dashed, thick] (n8) -- (n9);
        \draw[draw=red, dashed, thick] (n8) -- (n10);
        \draw[draw=red, dashed, thick] (n10) to [out=10,in=10] (n9);
        \draw[draw=red, dashed, thick] (n7) to [out=-198,in=190,looseness=2] (n10);
        \draw[draw=red, dashed, thick] (n10) to [out=-30,in=30,looseness=4] (n9);
        \draw[draw=red, dashed, thick] (n7) to [out=100,in=200,looseness=3.5] (n10);
      \end{tikzpicture}%
    }%
  }
  \caption{Graph $G^\star=(N^\star,A^\star)$}
\end{figure}
\end{document}

这会产生基本相同的输出。

如果您希望更改图像的边界框,则有多种方法可以做到。在这种情况下,最简单的方法可能是告诉 PGF 不要计算曲线,然后添加一些额外的坐标以扩展边界框。

例如,

\documentclass [12pt] {article}
\usepackage{tikz}
\usepackage[left=3cm, top=3cm, right=3cm, bottom=3cm, nohead]{geometry}% so fancyhdr is only for footers? no headers in this document?
\begin{document}
\begin{figure}[htbp]
  \centering
  \resizebox{0.5\textwidth}{!}{% this method is considered evil
    \begin{tikzpicture}
      \node[shape=circle,draw=black]  (n1) at (1,10) {};
      \node[shape=circle,draw=black]  (n2) at (5,10)  {};
      \node[shape=circle,draw=black]  (n5) at (1,6)  {};
      \node[shape=circle,draw=black]  (n4) at (5,6) {};
      \node[shape=circle,draw=black]  (n3) at (10,8)  {};
      \node[shape=circle,draw=red,thick]  (n7) at (2,8.5) {$F_1$};
      \node[shape=circle,draw=red,thick]  (n8) at (3.5,7) {$F_2$};
      \node[shape=circle,draw=red,thick]  (n9) at (7,8) {$F_3$};
      \node[shape=circle,draw=red,thick]  (n10) at (3.5,4.5) {$F_4$};
      \draw (n1) -- (n2);
      \draw (n2) -- (n3);
      \draw (n2) -- (n4);
      \draw (n2) -- (n5);
      \draw (n3) -- (n4);
      \draw (n4) -- (n5);
      \draw (n5) -- (n1);
    \end{tikzpicture}%
  }
  \caption{Graph $G$ as an (isolated) system}
\end{figure}

\begin{figure}[htbp]
  \centering
  \resizebox{0.8\textwidth}{!}{% this method is considered evil
    \begin{tikzpicture}
      \node[shape=circle,draw=black]  (n1) at (1,10) {1};
      \node[shape=circle,draw=black]  (n2) at (5,10)  {2};
      \node[shape=circle,draw=black]  (n5) at (1,6)  {5};
      \node[shape=circle,draw=black]  (n4) at (5,6) {4};
      \node[shape=circle,draw=black]  (n3) at (10,8)  {3};
      \node[shape=circle,draw=red,thick]  (n7) at (2,8.5) {$F_1$};
      \node[shape=circle,draw=red,thick]  (n8) at (3.5,7) {$F_2$};
      \node[shape=circle,draw=red,thick]  (n9) at (7,8) {$F_3$};
      \node[shape=circle,draw=red,thick]  (n10) at (3.5,4.5) {$F_4$};
      \draw (n1) -- (n2);
      \draw (n2) -- (n3);
      \draw (n2) -- (n4);
      \draw (n2) -- (n5);
      \draw (n3) -- (n4);
      \draw (n4) -- (n5);
      \draw (n5) -- (n1);
      \draw[draw=red, dashed, thick] (n7) -- (n8);
      \draw[draw=red, dashed, thick] (n8) -- (n9);
      \draw[draw=red, dashed, thick] (n8) -- (n10);
      \begin{pgfinterruptboundingbox}
        \draw[draw=red, dashed, thick] (n10) to [out=10,in=10] (n9);
        \draw[draw=red, dashed, thick] (n7) to [out=-198,in=190,looseness=2]coordinate [pos=.5] (c3) (n10);
        \draw[draw=red, dashed, thick] (n10) to [out=-30,in=30,looseness=4] coordinate [pos=.2] (c1)  coordinate [pos=.7] (c2)  (n9);
        \draw[draw=red, dashed, thick] (n7) to [out=100,in=200,looseness=3.5] coordinate [pos=.2] (c4) (n10);
      \end{pgfinterruptboundingbox}
      \path (c1) (c2) (c3) (c4);
    \end{tikzpicture}%
  }
  \caption{Graph $G^\star=(N^\star,A^\star)$}
\end{figure}
\end{document}

调整了第二张边界框的图像

相关内容