Document ClassesMemoir/hyperref/babel conflict

Information and discussion about specific document classes and how to create your own document classes.
Post Reply
jvegh
Posts: 3
Joined: Fri Apr 06, 2012 11:40 pm

Memoir/hyperref/babel conflict

Post by jvegh »

Hi,

I experienced some strange conflict, see the code example below.
When the babel-related line is commented out, everything works fine,
i.e. List of Figures page is generated, and the links to the individual figures
point to the correct place. However, if it is uncommented, it compiles fine,
the list is OK, but the links do not work.
It looks like the problem is caused by \selectlanguage{magyar}, i.e.
English language users do not see this problem.

Any ideas?

Thanks for any help in advance

Janos

Code: Select all

documentclass[11pt, a4paper,
extrafontsizes,twocolumn]{memoir}

\usepackage{memsty}

%\usepackage[english,magyar]{babel}

\begin{document} 
\listoffigures
\clearpage
\chapter{Introduction}

\begin{figure}
    \includegraphics{IntegratedOS}
  \caption{OS}
\end{figure}
\clearpage
\begin{figure}
    \includegraphics{IntegratedOS}
  \caption{OS}
\end{figure}
\clearpage

\begin{figure}
    \includegraphics{IntegratedOS}
  \caption{OS}
\end{figure}
\clearpage

\end{document} 

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Memoir/hyperref/babel conflict

Post by Stefan Kottwitz »

Hi Janos,

welcome to the board!
jvegh wrote:the list is OK, but the links do not work.
In your example, you did not load hyperref, that's why there are no hyperlinks. You also did not load graphicx, so also \includegraphics would not work. I guess the example code is not really relevant for the problem. A Infominimal working example should be compilable and should show the problem, this example does neither yet. So I cannot say more, except that

Code: Select all

\usepackage[english,magyar]{babel}
works for me, with hyperlinks in a list of figures in a memoir document.

Stefan
LaTeX.org admin
jvegh
Posts: 3
Joined: Fri Apr 06, 2012 11:40 pm

Memoir/hyperref/babel conflict

Post by jvegh »

Hi Stefan,

thanks for greeting, maybe I come often (be frightened!)

Here goes the code. With the babel line on, it jumps to the title page.

Code: Select all

\documentclass[11pt, a4paper,extrafontsizes,titlepage]{article}
\usepackage{graphicx}
\usepackage{beamerarticle}

\usepackage[english,magyar]{babel}

\usepackage[
  bookmarks=true,		% show bookmarks
  unicode=true,		% allows to use Unicode chars in bookmarks
  pdfborder= {2 5 0.5 [3 3]},
  breaklinks %allow to break long links in \listoffigures
]{hyperref}
\title{My title}

\begin{document} 
\maketitle
\listoffigures

\clearpage

\begin{figure}
  Figure 1
  \caption{Fig on page 1}
\end{figure}
\clearpage
\begin{figure}
  Figure 2
  \caption{Fig on page 2}
\end{figure}
\clearpage

\begin{figure}
  Figure 3
  \caption{Fig on page 3}
\end{figure}
\clearpage

\end{document}
Without it, it works OK. (it looks to be NOT a memoir problem)

by the way: I used memsty.sty, which loads both


Regards
Janos
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Memoir/hyperref/babel conflict

Post by localghost »

Try to repair this with the hypcap package.

Code: Select all

\usepackage[all]{hypcap}
It's important that you load it after the hyperref package.


Best regards and welcome to the board
Thorsten
jvegh
Posts: 3
Joined: Fri Apr 06, 2012 11:40 pm

Memoir/hyperref/babel conflict

Post by jvegh »

HI Thorsten,
thanks for the tip. After inserting the hypcap line, I receive error messages on lines
following my lines with "\caption", stating
"You have forgotten to use \caption"

Something wrong. Please find the code below

Janos

Code: Select all

\documentclass[11pt, a4paper,extrafontsizes,titlepage]{article}
\usepackage{graphicx}
\usepackage{beamerarticle}

\usepackage[english,magyar]{babel}

\usepackage[
  bookmarks=true,               % show bookmarks
  unicode=true,         % allows to use Unicode chars in bookmarks
  pdfborder= {2 5 0.5 [3 3]},
  breaklinks %allow to break long links in \listoffigures
]{hyperref}
\usepackage[all]{hypcap}
\title{My title}

\begin{document} 
\maketitle
\listoffigures

\clearpage

\begin{figure}
  Figure 1
  \caption{Fig on page 1}
\end{figure}
\clearpage
\begin{figure}
  Figure 2
  \caption{Fig on page 2}
\end{figure}
\clearpage

\begin{figure}
  Figure 3
  \caption{Fig on page 3}
\end{figure}
\clearpage

\end{document}
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Memoir/hyperref/babel conflict

Post by localghost »

It seems that the »magyar« option of babel messes up a lot of things here. The caption package would offer the same feature as hypcap does. But it's not for sure that it supports the memoir class. The package manual does not mention any support for this class.
User avatar
sommerfee
Posts: 503
Joined: Mon Apr 09, 2007 4:20 pm

Memoir/hyperref/babel conflict

Post by sommerfee »

localghost wrote:It seems that the »magyar« option of babel messes up a lot of things here.
Unfortunately I can confirm this. The adaption of my caption package to the magyar babel option was really a pain. (Note: You need at least v3.2 of the caption package for that.)
The caption package would offer the same feature as hypcap does. But it's not for sure that it supports the memoir class. The package manual does not mention any support for this class.
Using the caption package with memoir seems to work fine (at least if you load the caption package before hyperref), but you lost all captioning stuff offered by the memoir document class:

Code: Select all

Class memoir Warning: You are using the caption package with the memoir 
(memoir)              class. This may cause unexpected or inconsistent 
(memoir)              results if you use any of memoir's captioning facilities.
Post Reply