1

I'm using TeXmaker for OS X with pdflatex extension (I'm new to LaTeX, too), I've a problem with the hyperref package. I can't put https://, and special char like ?. My document class is report.

Here is how I use the command:

\url{www.orange-sans-guigne.com/osg-forum/viewtopic.php?id=379}

And I get

www.orange-sans-guigne.com/osg-forum/viewtopic.php\protect\relax?id=379

When I add https://

I get:

https\protect\relax:\@beginparpenalty=\@M\relax//www.orange-sans-guigne. com/osg-forum/viewtopic.php\protect\relax?id=379

I tried to use url package, but I get an error because I use hyperref.

Solution

\documentclass{report}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
%\usepackage{french} % This is why I got my url broken
\usepackage[french]{babel} % This is the solution
\PassOptionsToPackage{hyphens}{url}\usepackage[pdfpagelabels,plainpages=false]{hyperref}
\usepackage{url}

\begin{document}

\url{www.orange-sans-guigne.com/osg-forum/viewtopic.php?id=379}

\end{document}
6
  • It works for me (pdfLaTeX with vim/emacs, no nonsense, TeX Live 2016), looks like texmaker is escaping too much. \documentclass{report} \usepackage[pdfpagelabels,plainpages=false]{hyperref} \usepackage{url} \begin{document} \url{www.orange-sans-guigne.com/osg-forum/viewtopic.php?id=379} \end{document} ![image](i.stack.imgur.com/hsYo9.png) Feb 1, 2018 at 13:09
  • 2
    (1) welcome, (2) Please provide a full minimal example instead of a sniplet, that makes it a lot easier for others to test your code
    – daleif
    Feb 1, 2018 at 13:15
  • The problem come from \usepackage{french}
    – mytDRAGON
    Feb 1, 2018 at 14:08
  • Please, edit your question rather than using comments or the space for answers. Since the french package is not commonly used, a minimal example of code is really necessary.
    – egreg
    Feb 1, 2018 at 14:15
  • @mytDRAGON: Please add a full compilable, but minimal example document (MWE). Consider asking "How to get ? into urls with french package" or similar. You current self-answer doesn't solve the issue. Therefore the whole question and answer is not very useful for others with the same problem. Feb 1, 2018 at 14:16

3 Answers 3

1
\documentclass{report}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
%\usepackage{french} % This is why I got my url broken
\usepackage[french]{babel} % This is the solution
\PassOptionsToPackage{hyphens}{url}\usepackage[pdfpagelabels,plainpages=false]{hyperref}
\usepackage{url}

\begin{document}

\url{www.orange-sans-guigne.com/osg-forum/viewtopic.php?id=379}

\end{document}

The problem is due to the package \usepackage{french}

2
  • 3
    and the solution is to use \usepackage[french]{babel} instead. Feb 1, 2018 at 14:15
  • Thank you, I solved it by removing the package but it is working with {babel}.
    – mytDRAGON
    Feb 1, 2018 at 14:22
0

As a member of the french package (e-french in the distributions) maintenance team, with Raymond Juillerat, I'm discovering your problem. At the moment, we don't have a real solution, but only a workaround:

\nonfrench\url{www.orange-sans-guigne.com/osg-forum/viewtopic.php?id=379}\endnonfrench

I must concede it is not very satisfying, but easy to insert in a \newcommand macro, and I believe that the french package has some qualities for typesetting texts in French.

0

After some tries it seems that putting \usepackage{french} (or \usepackage{efrench}, it's the same) after \usepackage[pdfpagelabels,plainpages=false]{hyperref} could solve the problem. The simplest idea is sometimes the more efficient.

4
  • Wouldn't an even better solution consist of not loading the french package in the first place? Instead, isn't it ok to load the babel package with the language option french: \usepackage[french]{babel}?
    – Mico
    Apr 30, 2019 at 7:45
  • 1
    Well, the french package has some features absent from babel, it is more convenient, and more beautiful IMHO (I'm biased, of course, as a moral heir of the late Bernard Gaulle). May 1, 2019 at 8:43
  • That's interesting. Is there a website somewhere that compares the advantages (and disadvantages, presumably) of the french and babel packages?
    – Mico
    May 1, 2019 at 8:45
  • Hum, the best available is here: efrench.org/doc, but not really a comparison. May 1, 2019 at 22:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .