Hot answers tagged

8

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


7

Even if the urls are turned off at TOC, they may appear in other places like the headers. Hence it is better to use the optional argument of \section \documentclass{article} \usepackage[% unicode, colorlinks=true, linkcolor=blue, urlcolor=blue, citecolor=blue]% {hyperref} \begin{document} \tableofcontents ...


7

As I hinted in a comment, even if Sharelatex allows to use lualatex as compiler for your documents, it does not allow network connections from luatex code. I performed the following test: Wrote the following testing file, which attempts a connection to Google Geocoding API to get a JSON containing geocoding information about the location "1600 Amphitheatre ...


6

A penalty of 10000 forbids breaks. Set the penalties to smaller values: \documentclass[fontsize=12pt,paper=a4,]{scrartcl} \usepackage[utf8]{inputenc} \usepackage[ngerman]{babel} \usepackage{biblatex} \addbibresource{bib.bib} \setcounter{biburlnumpenalty}{100} \setcounter{biburllcpenalty}{100} \setcounter{biburlucpenalty}{100} ...


6

My feeling is that luaotfload makes LuaTeX ignore the choice of stylistic sets when the font is used in math mode. In order to prove my claim, I did \mathcode``=\numexpr"7000+\mathcode``\relax and tried $\mathtt{`}$, which resulted in the curly backquote no matter what stylistic set in used in the definition of the mono font. Note that url typesets the ...


5

A minimal example reproducing the error is: \documentclass{article} \usepackage{hyperref} \begin{document} \footnote{\href{http://whatever}} \end{document} The solution: hyperref's \href has two arguments: \href{URL}{text}. Either use both or use \url{URL}: \documentclass{article} \usepackage{hyperref} \begin{document} ...


5

\href can be redefined locally: \begingroup \renewcommand*{\href}[2]{#2} \tableofcontents \endgroup


5

I would recommend against trying to import data directly into LaTeX from a REST/JSON API. This would in any case require outside tools as LaTeX cannot open network connections. I'd suggest to use a language like Python or Ruby to query the API and to transform the JSON data into something that is easier to process with LaTeX. A great tool for transforming ...


5

hyperref does a better job at managing line-breaks in URLs: \documentclass[11pt,letterpaper]{article} \usepackage{hyperref} \hypersetup{ hidelinks, % Remove visible links altogether %urlbordercolor = 1 1 1% Make URL link border white } \begin{document} \url{http://google.com} blah blah blah blah blah blah blah blah blah blah blah blah blah blah ...


4

The question is tagged with hyperref, then \nolinkurl is the counterpart of \url without link. If hyperref is not used, then the link is probably created by the PDF viewer, which uses a heuristics to detect links in text.


4

Because you gave no MWE I had to guess. I used paper=A6 to simulate your column. \documentclass[paper=A6]{scrartcl} \usepackage[hyphens]{url} \makeatletter \g@addto@macro{\UrlBreaks}{\UrlOrds\do\r\do\u\do\b\do\i} \makeatother \usepackage{showframe} % to show typing area and margins \begin{document} text ...


4

The macro \biburlsetup sets \Urlmuskip to 0mu plus 3mu, which is responsible for the space stretching. Here's a way for reverting the choice, but of course you'll get an underfull line. \documentclass{article} \usepackage[margin=1in,paperheight=3in]{geometry} \usepackage{filecontents} \begin{filecontents}{\jobname.bib} @Book{Example, author={Authorson, ...


4

\documentclass[12pt]{article} \usepackage[hyphens]{url} \usepackage[T1]{fontenc} \usepackage{fouriernc} \begin{document} This is a {\def\UrlBreaks{\do\y}% \url{http://reallyreallyreallyreallyreallyreallyreallyreallyreallyreallylongurl}} which \LaTeX\ will be unhappy about. So, how can we split this in the best way? Here is another one which I don't ...


4

From the url documentation: You can allow some spacing around the breakable characters by assigning \Urlmuskip = 0mu plus 1mu (with mu units because of math mode). In your case it seems to don't suffice, so you can try with: \Urlmuskip=0mu plus 2mu MWE: \documentclass[a4paper,11pt]{book} \usepackage[T1]{fontenc} ...


4

You can achieve it by testing if doi is empty inside the function format.url. Replace your format.url by the following: FUNCTION {format.url} { doi empty$ { url duplicate$ empty$ { pop$ "" } { "\urlprefix\url{" swap$ * "}" * } if$ } { "" } if$ }


3

The Basics: As you are missing some of the basics, I extended my answer a bit. biblatex works like this: You have the information about your references in a .bib text file. This is the project.bib you seem to have created with JabRef. You load the package with \usepackage[backend=biber]{biblatex} In you document, you can refer to your sources with ...


3

This is a bit simplified, so please don't tell me it isn't quite this straightforward and that Biblatex can also roast your coffee beans while Biber de-fleas the dog. This is a crude overview. For details of Biber's pet-grooming features, the interested reader is respectfully referred to the manual. To create a bibliography using the Biblatex package and ...


3

The penalties are not used in a bibitem, but only in \biburlsetup which is done at the begin of the bibliography. If you want to change the settings for one bibitem, you should call the url setup again: \AtEveryBibitem{% \ifcategory{badbreaks} {\defcounter{biburllcpenalty}{9000}\biburlsetup} {}} Output with OP MWE (\def\mybiburlval{0}):


3

The recently developed Bibulous project handles this directly. For article-type entries in a *.bib file, an example template definition is the following:: article = <au>, \enquote{<title>,} <journal>, <volume>: [<startpage>--<endpage>|<startpage>|<eid>|] (<year>).[ <doi>| <url>| <isbn>| ...


3

This was done on a smaller scale for a map of Hawaii using a 20x20 grid. For the final version you set the opacity of the map to 1. I find using a checkerboard background helps when aligning links to the map. Using a \parbox instead of tikz \matrix is much faster. I stole the map from http://www.enchantedlearning.com/usa/states/hawaii/map.GIF and ...


3

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


3

\usepackage[hyphens]{url} should be ok. If it does not work, then go to (2). \RequirePackage[hyphens]{url} before \documentclass. \expandafter\def\expandafter\UrlBreaks\expandafter{\UrlBreaks% save the current one \do\a\do\b\do\c\do\d\do\e\do\f\do\g\do\h\do\i\do\j% \do\k\do\l\do\m\do\n\do\o\do\p\do\q\do\r\do\s\do\t% ...


3

You can use escape character for the hash: \#. MWE \documentclass{standalone} \usepackage{todonotes} \usepackage{hyperref} \begin{document} \todo[inline, caption={}]{see this example url that works \url{http://rationalwiki.org/wiki/Francis_Crick}. And this one that does not \url{http://rationalwiki.org/wiki/Francis_Crick\#Quote_mine}. } \end{document} ...


3

I propose a different strategy, because \url is not able to execute all the substitutions before printing the name and also for better efficiency. \documentclass[11pt]{article} \usepackage{luatextra} \usepackage[french]{babel} \usepackage{xstring} \usepackage{hyperref} \makeatletter \newcommand{\delaccent}[3][]{% #1=liste des substitutions \begingroup ...


3

The problem is that biblatex already loads the url package, but without the hyphens option. So if you try to load it (again) with this option afterwards, LaTeX gives the appropriate error message. Changing the order in which you load the two packages solves the problem: \documentclass[journal,twoside]{IEEEtran} \usepackage[hyphens]{url} ...


3

URL line breaking in bibliographies is notoriously hard and you will find many questions on this site about it. In your case the ad hoc \apptocmd{\biburlsetup}{\def\UrlBigBreaks{\do\:\do\-\do\/}}% does the trick, the standard is \def\UrlBigBreaks{\do\:\do\-}%, we just added the / character. The url package documentation says (p. 4) The result is ...


3

If you use \url from the url package it just enables line breaking without any links.


2

You can mask the % with \. With the following MWE please check section test. There you will find: \cventry{Test 2}{}{}{}{\url{http://example.com/\%2Fs40993} Problem}{} To avoid error messages please see the added last pair of {}. Complete MWE: \documentclass[11pt,a4paper,sans]{moderncv} \moderncvstyle{classic} \moderncvcolor{blue} % character ...


2

I find that many answers in this forum apply only to LaTeX and not necessarily plain TeX. We use plain TeX, so the answers sometimes simply don't work. But, I found a solution for displaying TeX's special characters that work for us, so I thought I'd share it. I have no idea if it will work for LaTeX, though it seems like it should. You can include a ...


2

I suggest you load the url package with the options hyphens, spaces, and obeyspaces, issue the instruction \urlstyle{same}, and then encase all URL strings in an \url{...} wrapper. That way, LaTeX will almost surely find a decent linebreak in the URL string and won't need to stretch the interword whitespace in earlier part of the footnote.



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