[Tex/LaTex] How to locally reduce the vertical space around a figure

floatsgraphics

How can I reduce the space below and above a figure? I found the following answer, describing how I can reduce the vertical spacing for floats globally. How can I achieve this locally (on a single page)? I'm also satisfied with a solution without the floating environment (but including centering), as the figure is placed on a title page and is not really supposed to float. Below what I'm using now.

\documentclass[a4paper,11pt,twoside]{book}
\usepackage{graphicx} 
\usepackage{epstopdf}   
\usepackage{float}
\usepackage[nopar]{lipsum}



\begin{document}

\noindent \footnotesize{\lipsum[4]\\
\begin{figure}[H]
\centering
\includegraphics[width=3cm]{CC_logo.eps}
\end{figure}
\noindent \lipsum[4]


\end{document}

Best Answer

Since the image must appear on a precise location, instead of a floating object, you can use a minipage. Using \par\smallskip (or \medskip, or even \vspace{<length>}), you can adjust the vertical spacing:

\documentclass[a4paper,11pt,twoside]{book}
\usepackage[demo]{graphicx} 
\usepackage{epstopdf}   
\usepackage{float}
\usepackage[nopar]{lipsum}

\begin{document}

{\footnotesize
\noindent 
\lipsum[4]\par\smallskip
\noindent
\begin{minipage}{\linewidth}
\centering
\includegraphics[width=3cm]{CC_logo.eps}
\end{minipage}\par\smallskip
\noindent\lipsum[4]\par}

\end{document}

enter image description here

As a side note, \footnotesize does not receive arguments; it is a font switch. You can limit its scope by grouping: {\footnotesize text text...}, or {\footnotesize text text...\par} if more than one line is involved.

An alternative, mentioned by Werner in his comment, is to use a center environment and \vspace{<length>} commands to fine tune the space:

\documentclass[a4paper,11pt,twoside]{book}
\usepackage[demo]{graphicx} 
\usepackage{epstopdf}   
\usepackage{float}
\usepackage[nopar]{lipsum}

\begin{document}

{
\footnotesize
\noindent 
\lipsum[4]

\vspace{-7pt}
\begin{center}
\centering
\includegraphics[width=3cm]{CC_logo.eps}
\end{center}
\vspace{-9pt}
\lipsum[4]\par
}

\end{document}

The demo option for graphicx simply replaces actual figures with black rectangles; do not use that option in your actual document.

Related Question