I use \usepackage{url}
and \url{…}
to typeset URLs, but the typewriter font stands out a little too much. How can I have the URLs typeset in a different font?
[Tex/LaTex] Typeset URL in a non-typewriter font
fontsurls
Related Solutions
Program listings does not actually use the typewriter font family by default, so you have to change this in the settings. To change it for a single listing, right click it, choose Settings and select Typewriter as Font family.
To make it a global change, go to Document --> Settings --> Listings, and type in the following option:
basicstyle={\ttfamily}
For the spacing, try adding
columns=fullflexible
to the options list for listings. I'm not entirely sure about this, though the different choices for columns
is described in the listings
manual (listings
is the package used for these program listings), section 2.10
Fixed and flexible columns.
I figured my long comments to your updated question were not that good so here goes a thorough explanation.
Your redefinition of the url
field format contains two sources of error for biblatex
.
\DeclareFieldFormat{url}{\addcolon\space\bibstring{en ligne <}\url{#1}\bibstring{>}}
Firstly, it starts with a command to add a colon and a space before printing any text at all, fortunately biblatex
ignores this (there is no unnecessary colon before "en ligne" in your MWE), but we should get rid of it anyway.
Secondly, and more importantly, en ligne <
is not actually a bibstring
. bibstrings
are certain localisation keys that change with the language, so \bibstring{editor}
prints "editor" in an English, "Herausgeber" in a German and (apparently) "éditeur" in an French document. In order for this to work biblatex
has to know these bibstrings and en ligne <
is certainly not one of them (neither is >
for that matter; a list of standard bibstrings
can be found in the biblatex
documentation §4.9.2 Localization Keys). Unknown bibstrings will trigger a warning (Bibliography string 'en ligne <' undefined
) and their "key" will be printed in bold to clearly notify you in the document that something went wrong.
To print verbose text in biblatex
use \printtext{foo}
instead of \bibstring{foo}
, but in \DeclareFieldFormat
\printtext
is not actually needed, so in this case
\DeclareFieldFormat{url}{en ligne <\url{#1}>}
might do what you want.
But you can use biblatex
's localisation utilities for this.
\DefineBibliographyStrings{french}{
url = {en ligne}
}
Will make sure the bibstring
url
contains "en ligne" in a French document, so \bibstring{url}
prints "en ligne" in French and "address" in English.
We can also define a macro \mkbiblege
analogous to \mkbibparens
to wrap text in <
and >
.
\makeatletter
\newrobustcmd{\mkbiblege}[1]{%
\begingroup
\blx@blxinit
\blx@setsfcodes
<#1>
\endgroup}
\makeatother
So we can define
\DeclareFieldFormat{url}{\bibstring{url}\space\mkbiblege{\url{#1}}}
Finally, our MWE
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english,ngerman,frenchb]{babel}
\usepackage{csquotes}
\usepackage[style=verbose-trad1,backend=bibtex8]{biblatex}
\renewcommand{\UrlFont}{\small\rm}
\DefineBibliographyStrings{french}{
url = {en ligne},
}
\DefineBibliographyStrings{german}{
url = {online},
}
\makeatletter
\newrobustcmd{\mkbiblege}[1]{%
\begingroup
\blx@blxinit
\blx@setsfcodes
<#1>
\endgroup}
\makeatother
\DeclareFieldFormat{url}{\bibstring{url}\space\mkbiblege{\url{#1}}}
\addbibresource{biblatex-examples.bib}
\begin{document}
\nocite{markey}
\printbibliography
\end{document}
gives
Best Answer
According to the README,
You can also define your own font:
(The last example is from http://www.kronto.org/thesis/tips/url-formatting.html.)