Skip to main content
196 votes

Forcing linebreaks in \url

Herbert Voß created (December 2017) the package xurl. This package allows urls to break everywhere, can be compiled simply with pdflatex, and has the same options as url (indeed, it loads url package)...
CarLaTeX's user avatar
  • 64.7k
77 votes

Missing $ inserted issue

\usepackage[strings]{underscore}
Roly's user avatar
  • 4,231
37 votes

Underscore in bibtex url

In case of IEEE templates, when using the file bib, replacing the underscore with {\_} should solve the problem. In the case of the question: @misc{code, title = {Code}, url = {https://1drv....
Francesco Boi's user avatar
34 votes
Accepted

Underscore in bibtex url

Just to formally answer and close this question: As Ulrike Fischer answered in the comments, the solution was to use \usepackage{hyperref} (or \usepackage[hidelinks]{hyperref} to avoid the ugly boxes) ...
stefanbschneider's user avatar
29 votes

Line breaks of long URLs in biblatex bibliography?

There is another way (SHORTER) of doing that: just put the entry below before the \begin{document}: \usepackage{url} \def\UrlBreaks{\do\/\do-} This allows to have your customized (or required!) ...
schmi's user avatar
  • 543
26 votes

URLs in bibliography: LaTeX not breaking line as expected

When using biblatex, this can also be achieved with the block=ragged option, see §3.1.2.1 in http://mirrors.ibiblio.org/CTAN/macros/latex/contrib/biblatex/doc/biblatex.pdf i.e. \usepackage[block=...
Andreas's user avatar
  • 361
19 votes
Accepted

Parsing Underscores in URLs from Mendeley

After further investigation and head scratching I have reached a working solution. Updated MWE \RequirePackage{filecontents} \begin{filecontents*}{\jobname.bib} @misc{enc2015, author = {{Example ...
samthecodingman's user avatar
14 votes
Accepted

Remove "n.d." (no date) from online entries without dates in biblatex

The answer was updated with a much better solution. See the edit history for the earlier, less elegant approach. The "nodate" marker is inserted by the labeldate format as fall-back with \literal{...
moewe's user avatar
  • 178k
13 votes

How to disable percent-encoding in URLs?

A current biber knows the option --nouri-encode and then you get this which isn't a sensible output either. With a unicode engine like lualatex or xelatex and such a document (and again with --nouri-...
Ulrike Fischer's user avatar
12 votes

Breaking links and escaping characters in bibliographies with backlinks and ocgcolorlinks set

B. Lerner's method suggested here served as the basis for re-implementing hyperrefs's ocgcolorlinks option in the ocgx2 package, v0.24 [2017/03/30]. Also, issues 1 (empty link texts) and 2 (page ...
AlexG's user avatar
  • 55.4k
12 votes
Accepted

BibTex: URL:s gets weird whitespace

(Too long for a comment, hence posted as an answer.) I recommend you load the URL package with the options hyphens, spaces, and obeyspaces: \usepackage[hyphens,spaces,obeyspaces]{url} If you load ...
Mico's user avatar
  • 515k
12 votes
Accepted

# and other characters in a url

You are using the \href in the argument of some other command. This will break as \href no longer can change the catcode of the #. The exact error message depends on the outer command, but will ...
Ulrike Fischer's user avatar
12 votes

Get Biblatex to show URL for Webpage references

The standard behaviour of biblatex is to always display URLs for @online regardless of the url option. So even with url=false you should see the URL of @online entries. Mendeley exports websites as @...
moewe's user avatar
  • 178k
11 votes

URL with tilde character?

This did it for me (plus: the link works!) \string~ From: https://latex.org/forum/viewtopic.php?t=3663
Cheque's user avatar
  • 111
11 votes
Accepted

How to I use a command in a href

Just remove the trailing {} that forms part of the URL: \href{https://example.com/\version}{version} Appending {} to a macro is only needed if you which to set a regular space between a macro and a ...
Werner's user avatar
  • 607k
11 votes
Accepted

How to break a long URL in bibliography, keeping the URL in plain text font?

URL strings can contain lots of characters that are "special" to TeX. Among them are _ (underscore), # (hash), % (percent), $ (dollar), & (ampersand), etc. The point of encasing URL strings in \...
Mico's user avatar
  • 515k
11 votes

How I can type an underscore character (_) that's part of an email address?

\documentclass{article} \usepackage{hyperref} \begin{document} \href{mailto: [email protected]}{ufukkaya\[email protected]} \end{document}
Zarko's user avatar
  • 300k
10 votes
Accepted

How to "really" solve the problem of "underfull \hbox" when typesetting url in footnote

Rather than breaking mid-word, you can re-introduce some stretch space around the break characters (. and / here) I use \Urlmuskip=0mu plus 10mu which allows more than enough flexibility in this ...
David Carlisle's user avatar
10 votes
Accepted

How to define a custom url entry in Biber?

There are several ways you can go about doing this. In newer versions of biblatex and Biber you could use the data annotation feature. For restricted URLs you can add url+an = {restricted}, that ...
moewe's user avatar
  • 178k
10 votes
Accepted

Breaking long URLs on Arxiv.org

At last \usepackage[hyphens]{url} \usepackage{hyperref} \usepackage[hyphenbreaks]{breakurl} did the trick.
Gergely's user avatar
  • 1,095
9 votes
Accepted

How to insert a percent symbol in url in beamer?

In order to do its work, beamer has to absorb a frame environment's contents at once. This has the consequence that \href cannot perform its duty of changing the nature of %, because when the contents ...
egreg's user avatar
  • 1.1m
9 votes
Accepted

url with # as footnote

Define the url before the footnote with \urldef: \documentclass[12pt,twoside]{report} \usepackage{hyperref} \begin{document} \urldef\urlchem\url{https://chemicalize.com/#/calculation} \footnote{\...
Ulrike Fischer's user avatar
9 votes
Accepted

How to handle URLs with TeX-special charactors in a footnote

Section 2, entitled "Defining a defined-url", of the user guide of the url package explains that if a URL string that contains TeX-special characters is supposed to be typeset in a footnote, ...
Mico's user avatar
  • 515k
8 votes

URL linebreak in footnote

The url package does linebreaks automatically [in long URL strings], but in the footnote it won't do it. The main issue -- not touched on by the previously-posted answers -- is that the \url macro ...
Mico's user avatar
  • 515k
8 votes

How to fill an underfull box in footnote with url?

As already stated, the command \raggedright should do the trick, whether you are using \url or another command. No package is needed for this, as it is already a built in LaTeX command. Microsoft ...
Aldahunter's user avatar
8 votes

URLs in bibliography: LaTeX not breaking line as expected

\usepackage{url} \def\UrlBreaks{\do\/\do-}
Yaser 's user avatar
  • 101
8 votes

'Link'-button instead of complete URL in bibliography

If you use biblatex you can change the output of url by \DeclareFieldFormat. In the example below a symbol of the package fontawesome is linked. \documentclass{article} \usepackage{fontawesome} \...
Marco Daniel's user avatar
  • 96.2k
8 votes
Accepted

Automatically prepend "http://" in bibliographic url hyperlinks?

You can do this by redefining the url field. % arara: pdflatex % arara: biber % arara: pdflatex % arara: pdflatex \begin{filecontents}{\jobname.bib} @book{key, author = {Author, A.}, year = ...
Henri Menke's user avatar
8 votes
Accepted

How do I horizontally compress or unstretch paragraph text?

In your case you can simply add \usepackage{xurl} in your preamble. Be sure to call xurl before package hyperref (if you omit that, hyperref itself calls package url with the result you got ...)! ...
Mensch's user avatar
  • 65.6k
8 votes
Accepted

\url with # and & inside \footnote

If you have an url with special chars you should define it (and the main problem is the # here): \documentclass{article} \usepackage{hyperref} \urldef\myurl\url{https://webbook.nist.gov/cgi/cbook.cgi?...
Ulrike Fischer's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible