TransWikia.com

How to use url in fancyhead

TeX - LaTeX Asked by Obromios on October 1, 2021

I have text like the following in my document:

documentclass[12pt,oneside]{article}
usepackage{fancyhdr}
usepackage{url}
usepackage{systeme}
usepackage{hyperref}
setlength{overfullrule}{0pt}
fancyhf{}
fancyhead[C]{fontsize{10}{12} url{github.com/temp/long-url-long-long-long-long-long-long-long-long-long-temp.pdf}.   selectfont it{This study has not been peer reviewed.}}
renewcommandheadrulewidth{0pt}
setlength{headheight}{42 pt} 
pagestyle{fancy}
begin{document}
section{Example Document for SO Question}
end{document}

In the resultant pdf (see below), the url is being broken onto multiple lines and is not clickable. How do I fix this?
enter image description here

2 Answers

I was using Skim to preview the pdf produced by Latex, then produced another pdf by using the Skim menu sequence Print/PDF/Open in Preview. The resultant Skim produced pdf had the url broken. However, if I just opened the original pdf produced by Latex, the url works fine. Thank you to @muzimuzhiZ's comment which pointed me in the right direction.

Correct answer by Obromios on October 1, 2021

Did you load usepackage{fancyhdr} and assign a pagestyle? I just copied and compiled (assuming standard article) and everything looks fine, nothing broken, and the links are clickable.

enter image description here

The code

documentclass{article}
usepackage{fancyhdr}
usepackage[hyphens,spaces,obeyspaces]{url}
usepackage{hyperref}
usepackage{graphicx}
usepackage{amsmath}
%
pagestyle{fancy}
fancyhf{}
fancyhead[C]{fontsize{10}{12} url{https://github.com/temp/long-url-temp.pdf}}
%
usepackage{lipsum}
begin{document}
lipsum
end{document}

Answered by hesham on October 1, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP