Hot answers tagged

66

Hacking \UrlBreaks is not needed for \url inside the bibliography of biblatex. Package biblatex uses \biburlsetup and has already added lots of characters. The breaking at some character classes is controlled by counters. From the documentation of biblatex, "4.10.3 User-definable Lengths and Counters": biburlnumpenalty: If this counter is set to a value ...


56

The default was chosen by the package author, according to the common way of setting URLs. Using a monospaced font helps distinguishing them, and this is the main reason. However the font can be changed with \urlstyle that accepts one argument among tt rm sf same The default is equivalent to \urlstyle{tt}; with \urlstyle{rm} and \urlstyle{sf} the font ...


52

The line number in the error message is the line of the .bbl file that is generated by bibtex, it is not the line of the .bib file. Therefore the question quotes the wrong lines. The line in the error message contains: pp. 225--236, 10.1007/978-0-387-68772-8_18. [Online]. Therefore I think the entry in the .bib file contains doi = {10.1007/978-0-387-68772-...


52

Internally \url uses \UrlFont. You can change it with \urlstyle (see the documentation of url in url.sty) or by redefining \UrlFont: \documentclass{memoir} \usepackage{hyperref,xcolor} \begin{document} Lala \url{www.example.com}. \urlstyle{sf} Lala \url{www.example.com}. \renewcommand\UrlFont{\color{red}\rmfamily\itshape} Lala \url{www.example.com}. \end{...


48

Load the url package explicitly with the hyphens option: \usepackage[hyphens]{url} \usepackage{hyperref} By default, the url package does not consider hyphens as legal break points.


46

It should be noted up front that the long-URL issues you are encountering can arise regardless of whether the URL occurs inside an enumerate environment or not. By default, if a URL string contains a hyphen character, neither \burl of the breakurl package nor \url of the url package will insert a linebreak after a hyphen character. (This setting is chosen ...


42

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). Here an MWE: % arara: pdflatex \documentclass{article} \parindent=0pt \usepackage{xurl} \begin{document} \rule{\linewidth}{1pt} An example of everywhere ...


41

\usepackage[strings]{underscore}


40

The bibliography style - ieeetr in your case - is responsible for choosing which fields to include in each entry of the bibliography. It seems that the howpublished field is not included for manuals. How about just putting the url in the note field, like this: @Manual{XXXX, title = {Title}, author = {Paul}, note = {Available at \url{http://www.qqq.com}...


39

One possibility is to extend Herbert's bibmacro to several nested conditions. (The following example contains only placeholder links for the ISBN/ISSN fields because I don't know how this links must be formatted.) With regard to your further issues: I'm not sure if the url field allows to specify several URLs separated by white spaces; if it does, I don't ...


39

Moving argument entries may require protection. In this case, use \protect\url{...}: \documentclass{article} \usepackage{url}% http://ctan.org/pkg/url \begin{document} \begin{figure}[ht] \centering\rule{150pt}{100pt} \caption{This is the foobar graphic. Source: \protect\url{http://foo.bar/baz} \label{fig:foobar}} \end{figure} \end{document}


38

\documentclass{article} \usepackage{biblatex} \AtEveryBibitem{% \ifentrytype{manual}{% }{% \clearfield{url}% \clearfield{urldate}% }% } \usepackage{filecontents} \begin{filecontents}{\jobname.bib} @manual{A01, author = {Author, A.}, year = {2001}, title = {Alpha}, url = {tex.stackexchange.com}, } @misc{B02, author = {Buthor, B.}, ...


37

The following example uses hyperref (the question has mentioned "hyperlinking") and hooks into \hyper@linkurl to get the URLs. The catched URLs are written into an index file \jobname-url.idx: \urlentry{<hex coded URL>}{<page number>} The URL are hex encoded to avoid trouble with special characters. Package filecontents helps to create a style ...


35

The style chicago provides the following entries: address author booktitle chapter edition editor howpublished institution journal key month note number organization pages publisher school series title type volume year You see there is no entry url. To use one you can use the entry ...


34

Use \href instead: \documentclass{article} \usepackage{hyperref} \begin{document} \href{http://www.example.com}{\textit{www.example.com}}. \end{document} This takes two arguments: the first is the actual url, the second is the link text. The above code produces


34

The url package provides an interesting extra piece of flexibility, via the construct \Urlmuskip. This specifies the spacing around the breakable characters. By default it is 0mu however you can set it some glue specification: \Urlmuskip=0mu plus 1mu (Unfortunately the example in the url manual is wrong. It says \Urlmuskip=0pt plus 1mu. Being a ...


33

Just use \href from hyperref: \href{tel:15555555555}{+1 555 555 5555}


31

None of the answers helped me out. My long url was placed in a footnote. After searching around I found a working solution here. In my preamble: \usepackage{hyperref} \def\UrlBreaks{\do\/\do-} The last line instructs the url-package which is loaded with the hyperref-package to additionally break at the characters / and -. The option breaklinks=true in ...


30

\url comes from package url (loaded by hyperref). \urlstyle configures the font. The same font: \urlstyle{same} This means, no special font is set and the current font is used for the URL. Other pre-defined styles: \urlstyle{rm}: The font \rmfamily is used. \urlstyle{sf}: The font \sffamily is used. \urlstyle{tt}: This is the default: \ttfamily. See ...


28

Using the sloppypar environment as in \begin{sloppypar} Figure \ref{fig:example_instant_lumi}: Public result available from \url{https://twiki.cern.ch/twiki/bin/view/AtlasPublic/LuminosityPublicResults}, version of 16.12.2011. \end{sloppypar} helps in my case. Without sloppypar the AtlasPublic part runs over the right margin, with sloppypar LaTeX ...


28

Add the following load order to your preamble: \usepackage[obeyspaces]{url}% http://ctan.org/pkg/url \usepackage{hyperref}% http://ctan.org/pkg/hyperref See the UK TeX FAQ entry Typesetting URLs. Or, since hyperref loads url by default, perhaps with other package options, use: \PassOptionsToPackage{obeyspaces}{url}% ~ \usepackage[...,obeyspaces]{url} \...


25

Edited 7/17/12 to add a workaround for XeLaTeX's lack of \pdfliteral Edited 8/1/12 to consistently handle XeLaTeX's different location of the origin I've been working on an alternate approach to ocgcolorlinks that doesn't prevent line breaks in the set text. And it also doesn't have to do any trickery to redefine macros, change catcodes, or even typeset ...


24

It's in general a bad idea to footnote section titles. The footnote can go, if really necessary, to the first paragraph. In case you can't get without it, you have to use the optional argument: \section[Section title]{Section title\footnote{A footnote}} otherwise you'll footnote also the table of contents and the headers, which is wrong (and with a \url ...


24

The following solution does not (anymore) use ImageMagick's convert command as this would always create raster images, which will stand out from the text. Instead, it uses Ghostscript to vectorise the letters so that they appear like normal text but are in fact an uncopyable image. Note that you also have to run pdflatex with the --shell-escape switch ...


23

The above answer by mhp may not provide a solution when PDFLaTeX complains with "Option clash for package url." The cause of this may be because of the package hyperref, which also loads the package. If hyperref is loaded before the url package it gives this error, because the url package is then loaded twice with different options: one without and one with ...


22

Since hyperref version 2011/02/05 v6.82a, the option hidelinks has been available, which suppresses the highlighting of links.


22

Another approach is to define a new format that adds links. This can be used in any bibliography macro that applies the title format. In standard styles there are only two of these macros: title and periodical. You can revert to the original style with \DeclareFieldAlias{<new format name>}{default}. The url field is intended to hold only one URL, so ...


22

The first version of url.sty was written in 1996. While nowadays URLs are common and recognized by everyone, this wasn't the case at that time. At that time URLs were still heavily connected to computer code.


20

Most bibliography styles format the field url direct with the command \url. You can use the field note to add unformatted text: NOTE = "\url{http://citeseer.ist.psu.edu/562256.html} and \url{http://gfs.sf.net/gerris.pdf}",


19

I want to provide an other solution. You can work with the command \DeclareFieldFormat. In this way you can simple add new entry types or you are able to set special formation for different entry types. The command \DeclareFieldFormat has a star version which sets the defined for every entry type. In the next step you can define a special setting for one ...


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