2

I am trying to use \href to link to a web address that contains hyphens (e.g. http://hyphenated-webpage.com) within a minipage environment, e.g.

\usepackage{hyperref}
\begin{minipage}[t]{0.5\textwidth}
     Web: \href{http://hypehated-webpage}{{\color{blue}Webpage}}
\end{minipage}

In my document \href works fine within minipage for non-hyphenated addresses, e.g.

\usepackage{hyperref}

\begin{minipage}[t]{0.5\textwidth}
     Web: \href{http://nonhypehatedwebpage}{{\color{blue}Webpage}}
\end{minipage}

And hyphenated addresses also work fine outside of minipage, e.g.

\usepackage{hyperref}

\begin{minipage}[t]{0.5\textwidth}
   ...
\end{minipage}

     Web: \href{http://hypehated-webpage}{{\color{blue}Webpage}}

But as soon as I include a hyphenated \href web address within the minipage environment, the resulting PDF link does not work. It's completely dud.

Any suggestions?

Minimal example:

\documentclass[10pt,a4paper]{article}

\usepackage{geometry}
\usepackage[sc]{mathpazo}
\usepackage[usenames,dvipsnames]{color} 
\usepackage{hyperref}
\usepackage{alltt}

\begin{document} 

\vspace{0.1in}

\begin{minipage}[t]{0.5\textwidth}
\begin{alltt}   \rmfamily
Company
Department 
Address Line 1
Address Line 2
Office: number
\end{alltt}

\end{minipage}
\begin{minipage}[t]{0.5\textwidth}
\begin{alltt}   \rmfamily
Web: \href{http://www.boredpanda.com/worst-domain-names/}{{\color{blue}Link}}
E-mail: \href{mailto:}{\color{blue}email 1} (Head office) 
        \href{mailto:}{\color{blue}email 2} (Other office)
Company reg: number 
Other Info
\end{alltt}
\end{minipage}

\end{document}
Daniel
  • 21

1 Answers1

2

It took me a while to realize that the OP was only using alltt to avoid having to insert \\ at the end of each line. Note: adding spaces before \rmfamily seems to create an extra line.

\documentclass[10pt,a4paper]{article}

\usepackage{geometry}
\usepackage[sc]{mathpazo}
\usepackage[usenames,dvipsnames]{color} 
\usepackage{hyperref}
\usepackage{alltt}

\begin{document} 

\vspace{0.1in}

\begin{minipage}[t]{0.5\textwidth}
\begin{alltt}\rmfamily
Company
Department 
Address Line 1
Address Line 2
Office: number
\end{alltt}
\end{minipage}
\begin{minipage}[t]{0.5\textwidth}
Web: \href{http://www.boredpanda.com/worst-domain-names/}{\color{blue}Link}\\
E-mail: \href{mailto:}{\color{blue}email 1}\\
(Head office) \href{mailto:}{\color{blue}email 2}\\
(Other office)\\
Company reg: number\\
Other Info
\end{minipage}

\end{document}

removing alltt

John Kormylo
  • 79,712
  • 3
  • 50
  • 120