2

My problem seems to be simple although I could not find any solutions for it yet. I am writing my thesis in LaTeX, but I am totally new to this type of language.

I am trying to reference a figure as:

(see Figure~\ref{fig:transistor1})

whereas the figure is defined right after the reference as:

\begin{figure}[htb]
\centering
\includegraphics[width=0.4\linewidth]{./_pic/transistor1}
\caption[The first transistor]{The first point-contact transistor developed by Bell Laboratories}
\label{fig:transistor1}
\end{figure}

During compilation, I get the error "Paragraph ended before \Hy@setref@link was complete", and of course in the compiled pdf there is not any number after the word Figure, moreover the ) symbol is also missing.

I've tried changing the order of the figure and its reference, leaving the () marks but nothing helped.

I am waiting for your help guys, and thank you in advance :)

Update: MWE:

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

\usepackage[pdfusetitle, colorlinks, filecolor={[rgb]{0,0,1}},urlcolor={[rgb]{0,0,1}}, citecolor={[rgb]{0,0,0.4}}, linkcolor={[rgb]{0,0,0.4}}, bookmarks]{hyperref}

\begin{document}
\chapter{MEMS technology}

\ref{fig:transistor1}

\begin{figure}[htb]
\centering
\caption[The first transistor]{The first point-contact transistor developed by Bell Laboratories}
\label{fig:transistor1}
\end{figure}

\end{document}

Now if you compile this without the hyperref package, than with it, you can get the same error. If you compile again, the error disappears in the MWE (however in the whole document the error stays).

Update#2: Now I have managed to find the proper MWE, the problem occours when the \selectlanguage command is used:

\documentclass[a4paper,12pt,twoside,openright]{report}
\usepackage[british,german,hungarian]{babel}
\usepackage[pdfusetitle, colorlinks, filecolor={[rgb]{0,0,1}},urlcolor={[rgb]{0,0,1}}, citecolor={[rgb]{0,0,0.4}}, linkcolor={[rgb]{0,0,0.4}}, bookmarks]{hyperref}

\begin{document}
\selectlanguage{british}
\chapter{MEMS technology}

\ref{fig:transistor1}

\begin{figure}[htb]
\centering
\caption[The first transistor]{The first point-contact transistor developed by Bell Laboratories}
\label{fig:transistor1}
\end{figure}

\end{document}

Thank you in advance Adam

  • It's difficult to say. Perhaps delete the .aux and try again to compile. – Werner Mar 7 '14 at 15:03
  • 2
    Take just your reference and figure code above, put it in a new document, and see if that compiles (you'll either need to comment out the \includegraphics command, or add the graphicx package). If that works, the problem stems from something else in your document. After you've done that, build 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}. – Mike Renfro Mar 7 '14 at 15:05
  • With \autoref there is no such error, but it is not what I would want to have. – AdamNagy Mar 7 '14 at 15:54
2

Package hyperref with package nameref changes the internal data format of the \label data, because they need additional data. Therefore errors can be triggered, if the data in the .aux file is written by a different package combinations, especially with or without hyperref/nameref.

Workarounds:

  • In this case, the error can be ignored, a new .aux file is written and the next LaTeX run should be fine.

  • Or delete the auxiliary files, if hyperref/nameref (or some other packages) are added or removed.

  • Unfortunately this works only for the MWE (which seems to be not a proper MWE as it does not show the error as it should), but not the whole document as I have written... I am trying to find the minimal code which shows the same error... – AdamNagy Mar 8 '14 at 11:00
0

I have found the answer: If you use "hungarian" as the last language in the options of babel package, the error occurs. If you use any other permutations, the code will compile without any problem....

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.