10

I introduce a figure as follows:

\begin{figure}
\centering

\includegraphics[scale=0.300]{Figure.eps}

\caption{Caption for the figure}
\label{a}

\end{figure}

In the preamble I have written:

\usepackage{caption}
\captionsetup{font={small}}

I am writing the .tex file in Vim, in Ubuntu 12.04 LTS. When I compile the .tex file writing in the terminal:

bash make_latex.sh

(script which link is here: http://www.mediafire.com/view/p6ha13gt53nilpv/make_latex.sh )

I receive this error:

enter image description here

I have installed manually the caption package following all these steps: http://en.wikibooks.org/wiki/LaTeX/Installing_Extra_Packages

First Step: I extracted the .ins file writing

latex caption.ins

The information generated in the terminal is here: https://www.mediafire.com/?o4giarg9jb4rov9

Second Step: As said in the instructions, I wrote:

latex caption.dtx

The information generated in the terminal is here: https://www.mediafire.com/?cl9ocvbid721p0a

Third Step: In /usr/local/share/texmf/tex/latex/caption I copied the files that the info in the First Step told that were necessary to be copied. Here is the "proof":

enter image description here

Fourth Step: As said in the instructions, I made

texhash

And as it is shown here:

enter image description here

The process was done.

So, the question is: Why am I receiving that error when compiling ? I would appreciate very much if someone could help me

The latex version is:

enter image description here

Here is my entire preamble:

\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{graphicx}
\usepackage{eufrak}
\usepackage[spanish]{babel}
\usepackage[latin1]{inputenc}  
\usepackage[T1]{fontenc}
\usepackage{times}
\usepackage{amsmath}
\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}
\usepackage{caption}
\usepackage[version=3]{mhchem}
\usepackage{rotating}
\usepackage[percent]{overpic}
\captionsetup{font={small}}
\begin{document}
DavidC.
  • 845
  • 1
    You should have installed caption with a suitable apt-get command. Did you run sudo mktexlsr? – egreg Jun 23 '14 at 20:08
  • 1
    First try sudo apt-get install texlive-latex-recommended – egreg Jun 23 '14 at 20:10
  • @egregI have just done: sudo apt-get install texlive-latex-recommended. The result is this: https://www.mediafire.com/?oy4czyk74kjtlws – DavidC. Jun 23 '14 at 20:15
  • 2
    So you already have caption. As far as I can remember, \captionsetup was already present in the version of caption available in 2009. Anyway, being five years behind is really too much, you should try upgrading your TeX Live. – egreg Jun 23 '14 at 20:21
  • @egreg I have made bash make_latex.sh but I receive the same Undefined control sequence error. – DavidC. Jun 23 '14 at 20:23
  • @egreg Ok,but even though with this version, a installation of a package like caption should function. Why is giving this error? Was installation made correctly ? – DavidC. Jun 23 '14 at 20:29
  • 1
    @DavidC.: Make sure you're using the correct (installed) version, and not some random copy identified via mktexlsr. See Which package version am I using? – Werner Jun 23 '14 at 20:47
  • @Werner: I downloaded the Caption Package from CTAN, http://www.ctan.org/pkg/caption . Was the installation made correctly or is there something wrong? – DavidC. Jun 23 '14 at 22:00
  • 1
    What happens if you type \usepackage[font=small]{caption} and omit the \captionsetup instruction? – Mico Jun 23 '14 at 22:03
  • 1
    @DavidC.: That's not what I said/asked. When you run texhash, TeX creates a hash table containing the folder structure where all accessible files are located. However, when you actually \usepackage{caption}, it may be that TeX grabs a file from your local working folder, or perhaps from a location that is different from /usr/local/share/texmf/tex/latex/caption. That's why, adding \listfiles to your preamble and examining the location of the packages is important... – Werner Jun 23 '14 at 22:03
  • @Werner: Just added the listfiles in the preamble. Latex was grabbing a .sty from the folder where I am writing. I have removed that file, and have make sure there is no such stys or similar package's files in any folder but the /usr/local/share/texmf/tex/latex/caption Now it does not give that error. THANKS. BUT, BUT the battle is not ended (!!): there is a new problem: I have in the preamble: \usepackage{caption} followed by \captionsetup{font=small,stretch={0.80}}. I receive this error: https://www.mediafire.com/?v4tridr8acvg5i1 – DavidC. Jun 23 '14 at 22:29
  • @Werner: There should not appear such error due to stretch is an option for this package: http://osl.ugr.es/CTAN/macros/latex/contrib/caption/caption-eng.pdf – DavidC. Jun 23 '14 at 22:36
  • 1
    @DavidC.: You need \usepackage{caption,setspace} and then use \captionsetup{font={small,stretch=0.80}}, not \captionsetup{font=small,stretch=0.80}. – Werner Jun 23 '14 at 22:46
  • @Werner: Yes indeed, in page 38 from http://osl.ugr.es/CTAN/macros/latex/contrib/caption/caption-eng.pdf it is explained that it is possible to do what you have just said: \captionsetup{font={small,stretch=0.80}} , but it is needed the setspcace package. In page 10 from that document, it is said that \setstretch{amount} would make the same effect without installing the setspace package. -To be continued- – DavidC. Jun 23 '14 at 23:41
  • @Werner: Cont-.: Well, I have tried: \captionsetup{font={small,{\setstretch{0.80}}}} but I receive this error: https://www.mediafire.com/?3o848ydeeai9yha I have also tried other combinations with this \setspace{amount} but no success; I receive the same error. How could I correctly interpret the \setstretch{amount} in order that it works ? – DavidC. Jun 23 '14 at 23:41
  • 1
    @DavidC.: There is no mention of using stretch without the setspace package. So, add \usepackage{setspace} to your preamble. – Werner Jun 23 '14 at 23:46

1 Answers1

8

Depending on your setup, you may have different versions of packages floating around. When you're not sure what's going on with your version, it's best to see what version of a package you're using. Even though you think your TeXMF folder hash is updated, TeX may be grabbing something local, or something located elsewhere during the construction of the hash.

From the comments it seems like this was indeed the case (a local, outdated version).


In terms of your font selection inside \captionsetup. If you wish to use the stretch option, note that is should be supplied as part of the font setup:

\usepackage{caption,setspace}
\captionsetup{font={small,stretch=0.80}}
Werner
  • 603,163