[Tex/LaTex] How to make an article’s table of contents clickable so it can redirect to a section

articlehyperrefpdfsubfloatstable of contents

I'm using Mixtex 2.9 in Windows XP and I'm trying to make my article's table of contents clickable. I tried to add the package hyperref like this:

\usepackage{hyperref}
\hypersetup{
    colorlinks,
    citecolor=black,
    filecolor=black,
    linkcolor=black,
    urlcolor=black
}

but it throws the following error:

Runaway argument?
\sf@counterlist \relax \def \sf@temp {\@nil }\ifx \sf@temp \@nnil \else \ETC.
! Paragraph ended before \sf@setref was complete.
<to be read again> 
                   \par 
l.15 

What is going on? If I try this in a new article it does work, so how comes it doesn't work on mine?

My article is defined as:

\documentclass[10pt]{article}

I'm importing these packages;

\usepackage[utf8]{inputenc}                    
\usepackage[spanish]{babel}                   
\usepackage{graphicx}                               
\usepackage[usenames,dvipsnames]{color}          
\usepackage{wallpaper}                         
\usepackage{fancyhdr}                          
\usepackage[hmargin=3cm,vmargin=3.5cm]{geometry} 
\usepackage{marvosym}                           
\usepackage{caption}
\usepackage{subcaption}
\usepackage{subfig}
\usepackage{chapterfolder}

Best Answer

The subcaption package is incompatible with subfig (or with the obsolete subfigure); anyways, you only need either subfig or subcaption (not both, and preferably the latter since you are using caption), so simply use

\documentclass{article}
\usepackage[utf8]{inputenc}                    
\usepackage[spanish]{babel}                   
\usepackage{graphicx}                               
\usepackage[usenames,dvipsnames]{color}          
\usepackage{wallpaper}                         
\usepackage{fancyhdr}                          
\usepackage[hmargin=3cm,vmargin=3.5cm]{geometry} 
\usepackage{marvosym}                           
\usepackage{caption}
\usepackage{subcaption}
\usepackage{chapterfolder}
\usepackage{hyperref}
\hypersetup{
   colorlinks,
   citecolor=black,
   filecolor=black,
   linkcolor=black,
   urlcolor=black
}

\begin{document}

\tableofcontents
\section{Test} 

\end{document}

and build you sub-floats with the syntax provided by subcation. You could also use subfig instead of subcaption:

\documentclass{article}
\usepackage[utf8]{inputenc}                    
\usepackage[spanish]{babel}                   
\usepackage{graphicx}                               
\usepackage[usenames,dvipsnames]{color}          
\usepackage{wallpaper}                         
\usepackage{fancyhdr}                          
\usepackage[hmargin=3cm,vmargin=3.5cm]{geometry} 
\usepackage{marvosym}                           
\usepackage{caption}
\usepackage{subfig}
\usepackage{chapterfolder}
\usepackage{hyperref}
\hypersetup{
   colorlinks,
   citecolor=black,
   filecolor=black,
   linkcolor=black,
   urlcolor=black
}

\begin{document}

\tableofcontents
\section{Test} 

\end{document}

(and this time use the syntax provided by subfig).

Related Question