Is it possible to change the URL entries to normal text mode by using biblatex? (Hope MWE is not required for this, if requires, will provide)
1 Answer
biblatex
delegates its URL typesetting to the url
package. So you can use
\urlstyle{same}
to have all URLs typeset by url
in the document font.
Note that this also changes "URL-like" things such as DOIs and many eprint
formats.
\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[style=authoryear, backend=biber]{biblatex}
\addbibresource{biblatex-examples.bib}
\urlstyle{same}
\begin{document}
\cite{sigfridsson,ctan}
\printbibliography
\end{document}
Here is a solution that treats the URL as normal text. That is complicated for two reasons
Biber applies percent/URL encoding to the
url
field, see How to disable percent-encoding in URLs? and Scandinavian letters in Biblatex URL. That means that if you want a backslash to survive, you must print the special fieldurlraw
instead ofurl
.URLs are interpreted verbatim, that means that none of the special characters have their usual special meaning.
~
is just~
and not a space, similarly_
is just an underscore and not the subscript marker that lands you in math mode. But then\
is just a backslash and not the special character that starts control sequence names. So we need to 'reactivate'\
, in the MWE I did that with\scantokens
, but that means that all other special characters get back their special meaning as well. Effectively that means you can't have#
,_
and~
in your URL any more.
All that suggests that, while theoretically possible, this approach is really not something you should use.
\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[style=authoryear, backend=biber]{biblatex}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@book{appleby,
author = {Humphrey Appleby},
title = {On the Importance of the Civil Service},
date = {1980},
url = {http://example.com/\break sir-humphrey/imp.html},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}
\DeclareFieldFormat{url}{%
\mkbibacro{URL}\addcolon\space
\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter
\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter
\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter
\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter
\expandafter\expandafter\expandafter
\scantokens
\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter
\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter
\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter
\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter
\expandafter\expandafter\expandafter
{\thefield{urlraw}}}
\begin{document}
\cite{sigfridsson,appleby}
\printbibliography
\end{document}
If you are having trouble with the way URLs are broken in the bibliography have a look at Line breaks of long URLs in biblatex bibliography? and Forcing linebreaks in \url for canonical solutions to URL breaking in TeX. You might also be interested in How to adjust the breaking in the bibliography?.
-
thanks for quick reply, but I just want to remove the hyperlinks to the URL entries and should be treated as normal text, i.e., if I give the \break within URL entry, then it should executed– MadyYuviOct 25, 2018 at 5:41
-
@MadyYuvi That won't really work. URLs are read in verbatim mode which means that special characters don't have their special meaning. This is primarily to make sure that characters such as
~
,_
and#
don't cause errors, but it also means that commands can not be executed any more.– moeweOct 25, 2018 at 5:51 -
@MadyYuvi If you are having trouble with URL breaks in the bibliography I strongly recommend not to use any ad-hoc
\break
. Instead have a look at tex.stackexchange.com/q/134191/35864 and tex.stackexchange.com/q/3033/35864– moeweOct 25, 2018 at 5:53