Text Formatting\url and \href return errors with this web address

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
I am Gianluca
Posts: 6
Joined: Wed Dec 21, 2011 4:23 pm

\url and \href return errors with this web address

Post by I am Gianluca »

Hi guys,
I want insert this website on my document, but every time I try compile the .tex file with TexMaker it returns me errors.

Code: Select all

\url{https://www.mckinseyquarterly.com/Competing_through_data_Three_experts_offer_their_game_plans_2868?pagenum=1#interactive}
How could I resolve this problem?
Thank you for your time,

Gianluca

Recommended reading 2024:

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

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

User avatar
Stefan Kottwitz
Site Admin
Posts: 10322
Joined: Mon Mar 10, 2008 9:44 pm

\url and \href return errors with this web address

Post by Stefan Kottwitz »

Hi Gianluca,

you need to load the url package, so add

Code: Select all

\usepackage{url}
This works:

Code: Select all

\documentclass{article}
\usepackage{url}
\begin{document}
\url{https://www.mckinseyquarterly.com/Competing_through_data_Three_experts_offer_their_game_plans_2868?pagenum=1#interactive}
\end{document}
Stefan
LaTeX.org admin
I am Gianluca
Posts: 6
Joined: Wed Dec 21, 2011 4:23 pm

\url and \href return errors with this web address

Post by I am Gianluca »

Hi Stefan,
thank you for your interesting. I've already had the url package loaded.
I've found that TexMaker finish to compile if I use:

Code: Select all

\url{https://www.mckinseyquarterly.com/}
The problem appears only if I use the full website address.

Code: Select all

\url{https://www.mckinseyquarterly.com/Competing_through_data_Three_experts_offer_their_game_plans_2868?pagenum=1#interactive}
It returns me this error.

Code: Select all

! Illegal parameter number in definition of \Hy@tempa.
<to be read again>
i
l.5 ...ir_game_plans_2868?pagenum=1#interactive}.}
You meant to type ## instead of #, right?
Or maybe a } was forgotten somewhere earlier, and things
are all screwed up? I'm going to assume that you meant ##.
I think that TexMaker doesn't understand what that # is.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10322
Joined: Mon Mar 10, 2008 9:44 pm

Re: \url and \href return errors with this web address

Post by Stefan Kottwitz »

TeXmaker doesn't cause the error, it's raised by LaTeX, independently of the editor. It would be good if you would provide sufficient information. For example, you could have mentioned the error message in the first post, instead of just telling there's some error.

I guess you use hyperref. Correct? The error message leads to it. But it also works with hyperref. Perhaps we can help you if you tell us about your packages and your configuration, for example by posting your document preamble here.

Stefan
LaTeX.org admin
I am Gianluca
Posts: 6
Joined: Wed Dec 21, 2011 4:23 pm

\url and \href return errors with this web address

Post by I am Gianluca »

Sorry Stefan, you've got the point. Next time I will be more comprehensive on my first post ;)
Actually my preamble is this:

Code: Select all

\documentclass[a4paper,12pt,oneside]{memoir}

\usepackage[italian]{babel}
\usepackage[utf8]{inputenc}
\usepackage[redFoscari,default,centered,numsubsubsection,tocsubsubsection]{tesicafoscari}
\usepackage{color}
\usepackage{palatino}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage{memhfixc}
\usepackage[hyphenbreaks]{breakurl}
\usepackage{eurosym}
\usepackage{nomencl}%multirow}
\usepackage{enumerate}
\usepackage{rotating} % Per ruotare oggetti e tabelle
\usepackage{listings} % Per inserire codice sorgente di altri programmi (STATA, ecc.)
\usepackage{url}

%%% Per tabelle graficamente più apprezzabili e chiare (abilita l'uso di \toprule, \midrule e \bottomrule al posto di \hline per migliorare la spaziatura dei dati sotto le rules )
\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{longtable}
\usepackage{colortbl} % Per utilizzare i colori nelle tabelle
\newcommand{\rot}[2]{\rule{1em}{0pt}%
\makebox[0cm][c]{\rotatebox{#1}{\ #2}}}

%%% Per la bibliografia usando BibLaTeX: useprefix serve per considerare la particella nei cognomi come van Beethoven per disporli in ordine alfabetico
\usepackage[babel]{csquotes}
\usepackage[bibstyle=authoryear,citestyle=authoryear,useprefix]{biblatex}
\bibliography{bibliography}

%%% Indica il percorso dove sono salvate le figure che verranno incluse nel documento
\graphicspath{{/home/gianluca/thesis/latex/img/}}

%%% Simboli vari
%\usepackage{marvosym}

%%% Per scrivere equazioni
%\usepackage{empheq}

%%% Per la matematica
\usepackage{amsmath}
\usepackage{amsfonts}
%\usepackage{amssymb}
%\usepackage{dsfont}
%\usepackage{pxfonts}

%%% Per utilizzare l'operatore \sgn: ho utilizzato la formulazione convenzionale per il pacchetto amsmath
\DeclareMathOperator{\sgn}{sgn}
I wish you merry Christmas and happy holidays with your family and friends.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10322
Joined: Mon Mar 10, 2008 9:44 pm

\url and \href return errors with this web address

Post by Stefan Kottwitz »

It works with this preamble as well. If I complete this document by adding

Code: Select all

\begin{document}
    \url{https://www.mckinseyquarterly.com/Competing_through_data_Three_experts_offer_their_game_plans_2868?pagenum=1#interactive}
\end{document}
and if I comment out

Code: Select all

\usepackage[redFoscari,default,centered,numsubsubsection,tocsubsubsection]{tesicafoscari}
because I don't have this style file, it can be compiled and shows the URL.

Perhaps post an example, which causes the error. This means, reduce a copy of your document as much as possible as long it causes the error. Either you find the error yourself this way or you get a small but complete document which we can test.

Kindly have a look at "What is a minimal working example" to see the best way to get help.

Stefan
LaTeX.org admin
svanan
Posts: 3
Joined: Thu Dec 15, 2011 4:46 pm

\url and \href return errors with this web address

Post by svanan »

Hi,

I had commented out the below as I dont have the package,

Code: Select all

%\usepackage[redFoscari,default,centered,numsubsubsection,tocsubsubsection]{tesicafoscari}
I added the below code,

Code: Select all

\begin{document}
\begin{thebibliography}{10}
\bibitem{weblink}
\url{https://www.mckinseyquarterly.com/Competing_through_data_Three_experts_offer_their_game_plans_2868?pagenum=1#interactive}
\end{document}
and produced the result as shown in the image.

Seems ok to me. Is the attached not per your need, perhaps a MWE might be good before we able to assist.

rgds
Saravanan Kandasamy
Attachments
weburl.png
weburl.png (60.19 KiB) Viewed 11579 times
Post Reply