[Tex/LaTex] An .eps image, whose caption is too separated from the image.

captionsfloatsgraphicsincludespacing

I am writing a thesis in a large .tex file in Vim. I have an .eps image, whose caption is too separated from the image.

I have extensively read similar posts, tried almost everything, but the problem still persists, because it only occurs with this particular image:

imagefilename.eps 

I would appreciate very much if you could help me.

I have a very simple preamble.

The rest of the captions (from the rest of the .eps images) have the exact space that I need, except for this particular image. This way, I would not prefer to write commands in the preamble, due to this will modify all captions of the rest of the images. I would only like to reduce the space image-caption of this particular image.

I don’t know why the space caption-image for this particular image is bigger than the rest.

Here is the code that introduces the image:

\begin{center}
\begin{figure}
\begin{center}
\includegraphics[scale=0.150,angle=0]{imagefilename.eps}
\caption{\small\sf This text is the image caption for the image showed. Note that this text is too separated from the image above.} 
\label{image}
\end{center}
\end{figure}
\end{center}

Here is the link to direct download of the image, in order to check previously if a possible solution works:

https://www.mediafire.com/?xtub719odxrvbsx

I also show a direct link of another .eps image:

https://www.mediafire.com/?225azt8wkhyblzh

Just try to maintain the last code, and replace the

imagefilename.eps

with

a.eps

And you will see that the caption for a.eps is closer to the figure (!!!)

My preamble is this:

\documentclass[12pt,a4paper,twoside,openany]{report}
\usepackage[left=2.5cm,top=2.5cm,right=2.5cm,bottom=2.5cm]{geometry}
\parindent 1 true cm
\usepackage[dvips]{graphicx}
\usepackage{eufrak}
\usepackage[spanish]{babel}
\usepackage[latin1]{inputenc}  
\usepackage[T1]{fontenc}
\usepackage{times}
\usepackage{amsmath}
\usepackage{graphicx,epsfig}
\usepackage{multirow}
\usepackage{float}
\usepackage{color}
\usepackage[longnamesfirst,super]{natbib} 
\setcitestyle{square} 
\usepackage{fancyhdr}   
\pagestyle{fancy}                                     
\renewcommand{\chaptermark}[1]{\markboth{\thechapter .\ #1}{}}         
\renewcommand{\sectionmark}[1]{\markright{\thesection .\ #1}{}} 
\lhead{\nouppercase}
\rhead{\nouppercase}
\fancyhead[LE]{{\sf \leftmark}}                                 
\fancyhead[RE]{}                                                
\fancyhead[RO]{{\sf \rightmark}}                              
\fancyhead[LO]{} 
\fancyfoot[LE,RO]{\thepage}
\fancyfoot[CE,CO]{}                                                         
\renewcommand{\headrulewidth}{0.0pt}                                
\renewcommand{\baselinestretch}{1.25}
\usepackage{adjustbox}
\usepackage{enumerate}
\usepackage{courier}
\begin{document}

I would appreciate very much if someone could help me, making tests with the images provided above, using my preamble, and the code that introduces the image. (I am writing the thesis .tex file in Vim).

Best Answer

Your preamble has several sins; but that's not the problem. If you type

\fbox{\includegraphics[scale=0.150,angle=0]{imagefilename.eps}}

TeX will add a frame and you'll realize that the figure has wide blank space around the main part:

enter image description here

How can you do? Add the trim option; I tried

\includegraphics[scale=0.150,trim=300 450 300 500,clip]{imagefilename.eps}

and the result is

enter image description here

(still with \fbox to show better the image, remove it when you're satisfied). The four parameters are the length (in PostScript points) to trim from the four sides in the order “left bottom right top”.

Here's a polished version of your document with some comments.

\documentclass[12pt,a4paper,twoside,openany]{report}

%%% language part
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage[spanish]{babel}

%%% page geometry
\usepackage[left=2.5cm,top=2.5cm,right=2.5cm,bottom=2.5cm]{geometry}

%%% fonts
\usepackage{mathptmx} % times is obsolete
\usepackage{courier}
\usepackage{eufrak}

%%% misc packages
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{multirow}
\usepackage{float}
\usepackage{color}
\usepackage{fancyhdr}
\usepackage{adjustbox}
\usepackage{enumerate}
\usepackage{caption}

%%% bibliography package
\usepackage[longnamesfirst,super]{natbib}

%%% settings
\setcitestyle{square}

\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\markboth{\thechapter .\ #1}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesection .\ #1}{}}
\fancyhf{} % clear all fields
\fancyhead[LE]{\sffamily\leftmark}
\fancyhead[RO]{\sffamily \rightmark}
\fancyfoot[LE,RO]{\thepage}
\renewcommand{\headrulewidth}{0.0pt}
\renewcommand{\baselinestretch}{1.25}
\setlength{\headheight}{14.5pt}

\captionsetup{font={small,sf}}

\setlength{\parindent}{1cm} %%% WHY?

\begin{document}

\begin{figure}
\centering

\fbox{\includegraphics[scale=0.150,trim=300 450 300 500,clip]{imagefilename.eps}}

\caption{This text is the image caption for the image showed. Note that this text
   is too separated from the image above.}
\label{image}

\end{figure}

\end{document}

The packages times and epsfig are obsolete; the second one should never be used, to substitute the first one load mathptmx or, better

\usepackage{newtxtext,newtxmath}

The option dvips should never be passed to graphicx.

For changing the font of captions, use the caption package. Don't put figure inside a center environment and don't use center inside, but the simple declaration \centering.

Related Question