# How to make an article's table of contents clickable so it can redirect to a section?

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{
citecolor=black,
filecolor=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}

-

## migrated from stackoverflow.comDec 15 '12 at 16:07

This question came from our site for professional and enthusiast programmers.

There seems to be an incompatibility between the subfig package and hyperref. –  cyberSingularity Dec 15 '12 at 16:23
Welcome to TeX.sx! Please add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. In any case you shouldn't load both subfig and subcaption as they're incompatible. –  clemens Dec 15 '12 at 16:37
Your post was migrated here from Stack Overflow. Please register on this site, too, and make sure that both accounts are associated with each other (by using the same OpenID), otherwise you won't be able to comment on or accept answers or edit your question. –  Werner Dec 15 '12 at 22:01

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{
citecolor=black,
filecolor=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{
citecolor=black,
filecolor=black,
urlcolor=black
}

\begin{document}

\tableofcontents
\section{Test}

\end{document}


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

-