Hot answers tagged urls
18
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}
...
14
You can use the UTF-8 (hex.) representation:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{hyperref}
\begin{document}
\href{http://www.something.com/cami\%C3\%B3n/ }{link}
\end{document}
A site with a table to look up characters: http://www.utf8-chartable.de/
As Heiko Oberdiek mentions in his comment, the browser might help to get ...
13
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}.
...
12
Define a special behavior for the slash:
\documentclass{article}
\usepackage{url}
\makeatletter
\def\Url@twoslashes{\mathchar`\/\@ifnextchar/{\kern-.2em}{}}
\g@addto@macro\UrlSpecials{\do\/{\Url@twoslashes}}
\makeatother
\begin{document}
\urlstyle{sf}\url{http://tex.stackexchange.com/4427}
\bigskip
\urlstyle{rm}\url{http://tex.stackexchange.com}
...
12
The url package has a way how to do search-and-replace in the url strings. See the self-documented code. We tweak into \Url@acthash because it's called by \url exactly at the right place.
\documentclass{article}
\pagestyle{empty}
\usepackage{url}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\makeatletter
% nice "//"
...
11
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 = ...
11
This is best done using biber's sequential source mapping feature which allows you to modify the data as a stream as it's processed, without actually changing the source files:
\documentclass{article}
\usepackage{biblatex}
\addbibresource{test.bib}
\DeclareSourcemap{
\maps[datatype=bibtex, overwrite=true]{
\map{
\step[fieldset=keywords, ...
10
This is difficult to handle within a style as it depends on how people store data in their database. (Different users will have different ideas about which types should and should not include a URL.) However, within a document it should be easy enough to handle using biblatex's abilities to access the data model. For example, something like
...
10
\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 ...
9
How to tell LaTeX to automatically remove envelopping curly braces in a string to use with biblatex?
Make sure you are using biblatex 2.0+ and biber 1.0+ and put this in your preamble:
\DeclareSourcemap{
\maps[datatype=bibtex]{
\map[overwrite]{
\step[fieldsource=url,
match=\regexp{\A\{(.+)\}\z},
replace=$1]
}
}
}
Of course the regexp can be tuned to your liking. See section 4.5.2 of the current biblatex manual.
9
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}
...
9
\lowercase (and {}) are not expandable so you need to change the order of execution:
\documentclass{article}
\usepackage{url}
\newcommand{\Subject}{Skeleton}
\newcommand\lcURL[1]{%
\edef\tmp{\lowercase{\noexpand\url{http://www.cheatsheet.jim.pm?subject=#1}}}%
\tmp}
\begin{document}
\lcURL{\Subject}
\end{document}
If you need to remove space you ...
8
As you noticed, the # confuses TeX, because the endnotes are eventually read in as a macro replacement text.
Use \urldef for the problematic entry:
\documentclass[12pt, a4paper, twoside]{article}
\usepackage[T1]{fontenc}
\usepackage{endnotes}
\usepackage{url}
\urldef\rossetti\url|http://www.rossettiarchive.org/docs/nb0005.duke.rad.html#0.1.19|
...
8
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
8
The characters, where breaks are allowed, can be changed. See documentation of package url, section "5.2 Changing linebreaks". In this case the dot is part of \UrlBreaks. The following redefines it without the dot:
\usepackage{url}
\renewcommand*{\UrlBreaks}{\do\@\do\\\do\/\do\!\do\_\do\|\do\;\do\>\do\]%
\do\)\do\,\do\?\do\'\do+\do\=\do\#}%
7
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}",
7
Update: This question's OP himself has found a good solution between an extra \\ and a working hyperref.
With the help of the hyperref package one can write (the example is changed to an unpublished publication because there is, apparently, no journal):
@unpublished{koepke2009naturalness,
year={2009},
title={Naturalness in formal mathematics},
...
7
The dedicated url package or the hyperref package will help you here.
url
\documentclass{article}
\usepackage{url}
\begin{document}
\footnote{\url{http://www.bmu-klimaschutzinitiative.de/de/projekte_nki?p=1&d=450}, gesichtet am 21.10.2012}
\end{document}
The font can be changed with \urlstyle (url manual section 3 “Style”, works with hyperref, too):
...
7
If you are using the default Computer Modern Fonts, then the Latin Modern fonts might be an alternative, because they are derived from the Computer Modern Fonts.
The tilde is lower. Also there is a proportionally spaced typewriter variant that might look better than the mono-spaced font for URLs.
\documentclass{letter}
\usepackage{url}
...
6
The biblatex package has a facility for this:
\begin{filecontents*}{\jobname.bib}
@online{Torvalds11,
author = {Linus Torvalds},
title = {Linux Makefile: Commit 693d92a},
url = {http://github.com/torvalds/linux/commit/693d92a1bbc9e42681c42ed190bd42b636ca876f}
}
\end{filecontents*}
\documentclass{report}
\usepackage[english]{babel}
\usepackage{lipsum}
...
6
you can modify the \url command with a redefinition to take two urls into account:
\RequirePackage{filecontents}
\begin{filecontents}{test3.bib}
@Misc{oai:CiteSeerPSU:562256,
title = "Gerris: {A} Tree-Based Adaptive Solver For The
Incompressible Euler Equations In Complex Geometries",
author = "St Ephane Popinet",
year = "2002",
month ...
6
http://www.ctan.org/pkg/urlbst has a collection of bibtex styles that have support for webpage, url and lastchecked entry types.
the bundle also provides a script that will edit an existing .bst to offer those entry types.
the incidental text in the styles is in english (herbert's suggested styles are in german).
6
Example 18 from the biblatex documentation (18-numeric-hybrid.tex) will get you most of the way there. The document below takes the example a step further by integrating citation labels for URL references via the shorthand field, dispensing with the need for an additional citation command. The solution requires some fixes to the biber-only multiple sorting ...
6
This seems to be a design decision in the plainnat style. I get no URL for the @inproceedings entries if I modify plainnat.bst to have the following inproceedings function:
FUNCTION {inproceedings}
{ output.bibitem
format.authors "author" output.check
author format.key output
new.block
format.title "title" output.check
new.block
crossref ...
6
I am not really sure how you envision things to work, nor am I convinced that there is a need for this. It seems (to me) more reasonable to first download the image to the local folder (rather than re-downloading for every run), with a filename of your choice rather being automatically derived based on the URL, and then just to include that.
Here's a proof ...
6
The following document generates some URLs, with and without percent encoding:
\pdfobjcompresslevel=0
\documentclass{article}
\usepackage{hyperref}
\begin{document}
\url{http://lyle.smu.edu/~tspell/jaws}
\href{http://lyle.smu.edu/\%7Etspell/jaws}{%
\nolinkurl{http://lyle.smu.edu/~tspell/jaws}%
}
\url{http://lyle.smu.edu/%7Etspell/jaws}
\end{document}
...
6
The break points set by package url can be configured by setting \UrlBreakPenalty and \UrlBigBreakPenalty. A value of 10000 prevents the hyphenation:
\documentclass[12pt,a4paper,oneside]{report}
\usepackage{url}
\usepackage{apacite}
\usepackage[T1]{fontenc}
\usepackage[osf]{libertine}
\mathchardef\UrlBreakPenalty=10000
\mathchardef\UrlBigBreakPenalty=10000
...
5
This works for T1 and OT1 encodings, would need modification for other encodings (basically needs some invisible character to use as a fake hyphenation character)
As can be seen if no break is added (first example) no arrow, or arrows will be added if it breaks after the URL syntax / or . (second example) or at a hyphenation point such as exam-ple (third ...
5
I suggest you to write
\fancyhead[R]{%
\small Krakowskie Centrum Psychodynamiczne\\
\href{http://www.kcp.krakow.pl}{\nolinkurl{www.kcp.krakow.pl}}%
}
that will print only www.kcp.krakow.pl but will refer internally to http://www.kcp.krakow.pl.
You can check that it's considered indeed a URL by changing the option
urlcolor=red
and see that ...
5
OK Inspired by Joseph Wright's idea of using lua for this i threw together an attempt at this in pure lua.
\newcommand{\grabto}[2]{#2\ifluatex%
\directlua 0 {
local uri = "\luatexluaescapestring{#1}"
local fname = "\luatexluaescapestring{#2}"
local job = "\luatexluaescapestring{\jobname}"
local file = io.open(fname, 'r')
if file \string~= nil then
...
Only top voted, non community-wiki answers of a minimum length are eligible