svmiller / svm-r-markdown-templates

This is my (deprecated) suite of R Markdown templates for academic manuscripts, beamer presentations, and syllabi. DOWNLOAD {stevetemplates} INSTEAD.
http://svmiller.com/stevetemplates/
Other
896 stars 737 forks source link

Suggestion: make URLs wrap with [hyphens]{url} #6

Closed briatte closed 7 years ago

briatte commented 7 years ago

Long URLs in documents are sometimes better displayed if they are wrapped at hyphens. This can be done by passing the hyphens option to the url package (which is loaded by hyperref, so the option needs to be passed earlier than the call to hyperref to stick).

Here's your latex-ms template at lines 119-126:

\@ifpackageloaded{hyperref}{}{%
\ifxetex
  \usepackage[setpagesize=false, % page size defined by xetex
              unicode=false, % unicode breaks when used with xetex
              xetex]{hyperref}
\else
  \usepackage[unicode=true]{hyperref}
\fi

I currently use this modification to wrap long URLs:

\@ifpackageloaded{hyperref}{}{%
\ifxetex
  \PassOptionsToPackage{hyphens}{url}\usepackage[setpagesize=false, % page size defined by xetex
              unicode=false, % unicode breaks when used with xetex
              xetex]{hyperref}
\else
  \PassOptionsToPackage{hyphens}{url}\usepackage[unicode=true]{hyperref}
\fi
}
svmiller commented 7 years ago

Thanks again for the suggestion and the simple code to add two. I think because I rarely drop urls in my documents, I never noticed this issue, but I appreciate the input to make it more useful. Thanks for sharing the code too.