2

Well, here is my problem. My friends can compile this document. I can't, and I don't know why. The error is:

File: "C:\Program Files\MikTex\tex\latex\float\float.sty 
Type: Error
Line: Line99 
message: ! LaTeX Error: Command \float@makebox already defined.

If u can tell me how fix it, I'll be very grateful. I'm using TexMaker and MikTex 2.9.

% PREAMBLE
% Document
    \documentclass[spanish,10pt,a4paper,twoside]{article}
    \usepackage[top=1in, bottom=1in, left=1in, right=1in, marginpar=57pt]{geometry}
    \usepackage[bookmarks=true, bookmarksopen=true, bookmarksopenlevel=1, colorlinks=true, pdfstartview={XYZ null null 1},hidelinks]{hyperref}
    %   \usepackage{anysize} 
    %   \marginsize{3cm}{3cm}{1.5cm}{1.5cm} %izquierda derecha arriba abajo
% Language
    \usepackage[latin1]{inputenx}
    \usepackage{babel}
    \usepackage[T1]{fontenc}
    \usepackage{textcomp}
% AMS Packages
    \usepackage{amsmath}
    \usepackage[adobe-utopia]{mathdesign}

%--------------------------------------------------------------
% Graphics Packages
%--------------------------------------------------------------
    \usepackage{graphicx}
    \usepackage{subcaption} 
%Wrapfig: Insertar imagen dentro del texto, 
    \usepackage{wrapfig}


    \usepackage{float}
%   \floatstyle{boxed} 
%   \restylefloat{figure}



% SUBFIGURE Y SUBFIG ESTAN DESCATALOGADOS Y NO DEBEN USARSE
    %\usepackage{subfigure}
%   \usepackage[lofdepth,lotdepth]{subfig}
%   \usepackage[section]{placeins}

\begin{document}

 Hello , fans of Latex


\subsection{Images}

\subsubsection{Matrix of images}


\begin{figure}[H]
\framebox[1\textwidth]{\begin{minipage}[m]{1\textwidth}
    \centering
    \begin{subfigure}[b]{0.2\textwidth}
        \includegraphics[width=\textwidth]{gatico.jpeg}%
        \vspace{-1pt}\\%
        \includegraphics[width=\textwidth]{gatico.jpeg}%
        \vspace{-1pt}
    \end{subfigure}%
    \begin{subfigure}[b]{0.4\textwidth}
        \includegraphics[width=\textwidth]{gatico.jpeg}%
        \vspace{-1pt}
    \end{subfigure}\\%
    \begin{subfigure}[b]{0.6\textwidth}
        \includegraphics[width=0.3333\textwidth]{gatico.jpeg}%
        \includegraphics[width=0.3333\textwidth]{gatico.jpeg}%
        \includegraphics[width=0.3333\textwidth]{gatico.jpeg}%
    \end{subfigure}
\end{minipage}}
    \caption{Collage}
\end{figure}


\begin{figure}[H]
\framebox[1\textwidth]{\begin{minipage}[m]{1\textwidth}
    \centering
    \begin{subfigure}[b]{0.3\textwidth}
        \includegraphics[width=\textwidth]{gatico.jpeg}%
        \caption{}
    \end{subfigure} 
    \begin{subfigure}[b]{0.3\textwidth}
        \includegraphics[width=\textwidth]{gatico.jpeg}%
        \caption{}
    \end{subfigure}
\end{minipage}}
    \caption{Matrix of images}
\end{figure}





\end{document}

I can compile this document https://www.writelatex.com, and this is the result http://dl.dropbox.com/u/29496113/gatico.pdf

DaniTeba
  • 1,145
  • 1
    You can indent you code by four spaces to get them formatted properly. or select the code and press {} found above. –  Jan 14 '13 at 23:59
  • If I comment out the includegraphics (as I don't have that file) and remove sone characters that appear to have been mis-encoded between latin-1 and utf-8 while posting, your file runs without error in texlive 2012 – David Carlisle Jan 15 '13 at 00:26
  • @DavidCarlisle In https://www.writelatex.com i have compiled this document, with no error, but is an english web and it doesn't recognise the Spanish hyphenation. That means the document is ok, but is something wrong with my MikTex 2.9. – DaniTeba Jan 15 '13 at 00:46
  • are you sure you have used latin 1 (it is hard to tell as the spanish characters are mis-encoded in the file as pasted above, accented A is usually a sign that a UTF-8 file has been mis-interpreted as UTF-8. (I'm assuming imágenes is an encoding error?) – David Carlisle Jan 15 '13 at 00:52
  • I have delete all the spanish hyphenation ^^ I hope this will help all of you to find where is the error. Thank you. – DaniTeba Jan 15 '13 at 01:06
  • I think it maybe a problem between package "subcaption" and "float", because if i change the order, and put "float" before "subcaption", i have no error message and everything works ok. maybe because my MikTeX have been updated, is a different version with new problems? – DaniTeba Jan 15 '13 at 01:25

1 Answers1

4

The package load order is incorrect. According http://mirrors.ctan.org/macros/latex/contrib/hyperref/README the correct load order is:

\usepackage{float}
\usepackage{hyperref}

i.e. hyperref after float so the hyperref package is able to patch the float package. See also: https://texfaq.org/FAQ-hyperdupdest

When changing the load order the problem should go away, at least it does on my PC.

Addendum 2013-02-06

caption.sty v3.3-65 is out now (on CTAN and as TeXlive update) and has a revised handling of load order regarding the float and hyperref packages. All six load order combinations caption-float-hyperref should now compile find and give correct results, at least if you use at least v6.82q of hyperref.

See also:

Problem with algorithm(ic) and hyperref

http://www.latex-community.org/forum/viewtopic.php?f=46&t=20075

David Carlisle
  • 757,742
  • YES!! Thanks a lot, @AxelSommerfeldt Wow, i've never figured out that's was the problem. Thank you again ^^ I also resolved the problem with float before subcaption, do you know why it also works?? – DaniTeba Jan 15 '13 at 11:12
  • @Daniteba I usually implement and test the caption package bundle with correct package load orders (especially regarding hyperref as noted in its README). Since the caption package bundle currently supports 7 document class families, 3 babel options, and 17 packages I simply cannot test (and support) all wrong package orders as well. So it might happen that a specific version will drop an error message in such cases. However, I put that specific package load order on my TODO list so the very next version will give the expected (=wrong) result without error messages. –  Jan 18 '13 at 15:40
  • @Daniteba caption.sty v3.3-65 is out now (on CTAN and as TeXlive update) and has a revised handling of load order regarding the float and hyperref packages. All six combinations should now give correct results, at least if you use at least v6.82q of hyperref. (So when using these versions your example document should compile again and will now give a correct result additionally.) –  Feb 06 '13 at 07:54