Hot answers tagged

78

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 ...


71

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 ...


57

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{...


56

\usepackage[strings]{underscore}


55

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}...


54

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-...


46

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 ...


45

\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 ...


38

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 ...


38

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

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


32

https://norwied.wordpress.com/2012/07/10/how-to-break-long-urls-in-bibtex/ \usepackage{url} \def\UrlBreaks{\do\/\do-} \usepackage{breakurl} \usepackage[breaklinks]{hyperref}


31

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

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 ...


24

Setting \interfootnotelinepenalty=10000 should prevent all footnotes from breaking over a page.


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

A generic (reference manager and browser independent) solution: Create a new bookmark in the bookmark panel of your browser. Name it ("๐ŸŒ โžœ ๐Ÿ“š" or whatever). URL: Insert this: javascript:"use strict";(function(){function copyToClipboard(text){window.prompt("Copy to clipboard: Ctrl+C, Enter",text)}function jsDate2bibTex(date){var dd=date.getDate();var mm=...


22

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


21

The problem is the underscore _ in a doi. It occurs in line 190 of the LaTeX file (or in the .bbl) not in the .bib file. Search for 10.1007/978-0-387-68772-8_18 in your .bib file. You can use the url package and enclose the entry in \url{10.1007/978-0-387-68772-8_18} to avoid the error. Alternatively you can use a bibtex style that knows about dois.


21

Use the package hyperref and call the url by \url{https://someplace.org} \documentclass{report} \usepackage{hyperref} \begin{document} The paragraph.\footnote{has a footnote with and url \url{https://someplace.org}.} \end{document}


20

\urlstyle{rm} or \urlstyle{same} (See Roey Angel's comment). The documentation of package url says: Style: You can switch the style of printing using \urlstyle{tt}, where tt can be any defined style. The pre-defined styles are tt, rm, sf, and same which all allow the same linebreaks but different fonts – the first three select a ...


20

You can redefine the bibmacro doi+eprint+url so that the doi field is printed only if the url field is not defined, that is, add the following lines in the preamble: \renewbibmacro*{doi+eprint+url}{% \iftoggle{bbx:doi} {\iffieldundef{url}{\printfield{doi}}{}} {}% \newunit\newblock \iftoggle{bbx:eprint} {\usebibmacro{eprint}} {}% \...


19

Your question is not clear. Do you want to use package biblatex or not? Some of your comments make me think you mixed up BibTeX, biblatex and principles of building bib files. The following MWE shows you the usage of biblatex with some package options to controll the layout of your bibliography. What you at last need you can read in the manual of package ...


19

One way to proceed is to create a modified version of the file plainnat.bst, in which the functions that format and print fields such as doi and isbn are reduced to stubs that do nothing: Find the file plainnat.bst in your TeX distribution. Make a copy of this file and call it, say, myplainnat.bst. (Don't edit an original file of the TeX distribution ...


18

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=ragged]{biblatex} will do the trick


18

It's better to use a different command, so that its usage is clear: \documentclass{article} \usepackage{xcolor} \usepackage[ colorlinks, linkcolor=magenta ]{hyperref} \newcommand\rurl[1]{% \href{http://#1}{\nolinkurl{#1}}% } \begin{document} This is a link \rurl{ipython.org} written in abbreviated form. \end{document} Of course you lose the tricks \...


17

biblatex has a number of counters which when set to non-zero positive values less than 10000 allow breaks in urls in the bibliography. The specific counters are biburlnumpenalty biburlucpenalty biburllcpenalty for breaks after numbers, uppercase letters and lowercase letters, respectively. In your case it suffices to set the lowercase penalty to 9000; ...


17

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) and \usepackage[T1]{fontenc}. This allows properly clicking and copy-&-pasting URLs with underscores. However, it turned out, using package hyperref wasn't ...


16

Try using in the preamble \usepackage{url}. This should clear the problem.


16

If you use biber, this might be best handled with the related entries feature supported by biblatex 2.0+. The preamble below defines a new type of related entry: prelim. This key specifies the localization string, formatting directive and bibliography macro used to set the entries given in the related field. \documentclass{article} \usepackage[american]{...


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