Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

This is my code:

% arara: pdflatex: { shell: yes }
% arara: biber
% arara: pdflatex: { shell: yes }
% arara: pdflatex: { shell: yes }
\documentclass[12pt,a4paper]{article}
\usepackage{filecontents}
\begin{filecontents}{jobname.bib}
@techreport{NBERw10828,
 title = "Accounting for Cross-Country Income Differences",
 author = "Francesco Caselli",
 institution = "National Bureau of Economic Research",
 type = "Working Paper",
 series = "Working Paper Series",
 number = "10828",
 year = "2004",
 month = "October",
 URL = "http://www.nber.org/papers/w10828",
 abstract = {Why are some countries so much richer than others? Development Accounting is a first-pass attempt at organizing the answer around two proximate determinants: factors of production and efficiency. It answers the question "how much of the cross-country income variance can be attributed to differences in (physical and human) capital, and how much to differences in the efficiency with which capital is used?" Hence, it does for the cross-section what growth accounting does in the time series. The current consensus is that efficiency is at least as important as capital in explaining income differences. I survey the data and the basic methods that lead to this consensus, and explore several extensions. I argue that some of these extensions may lead to a reconsideration of the evidence.},
}}
\end{filecontents}
\usepackage[utf8]{inputenc}
\usepackage{hyperref}
\hypersetup{
colorlinks = true,
linkcolor = black,
anchorcolor = black,
citecolor = black,
urlcolor=blue,
bookmarksopen = true,
bookmarksnumbered = true,
bookmarksopenlevel = 2,
pdfstartview = {FitH},
pdfborder = {0 0 0}
}
\usepackage[indexing=cite,style=authoryear,citestyle=authoryear,sorting=none,backend=biber]{biblatex}
\makeatletter
\AtEveryCite{%
  \let\parentext=\parentexttrack%
  \let\bibopenparen=\bibopenbracket%
  \let\bibcloseparen=\bibclosebracket}
\makeatother
%\renewcommand{\mkbibnamelast}[1]{\mkbibemph{#1}}
\addbibresource{jobname.bib}
\begin{document}
First \cite{NBERw10828}\par
\printbibliography
\end{document}

This is what it gives: enter image description here

This is what I want to have as a URL link, one short word Link which is underlined and blue:

enter image description here

How it can be done?

P.S.

BTW how can be star be added to citation if front *Caselli?

share|improve this question
3  
A serious disadvantage of printing only a "stub", rather than the actual URL, is that readers of hardcopy versions of your document will have a needlessly hard time tracking down the reference. –  Mico Mar 15 at 8:49
    
@Mico I agree, but it is what I was asked, and they want to do as it is... –  saldenisov Mar 15 at 8:51
    
Can you use the \href command in the bibtex file? Usually I see \url command, but maybe you can put \href{url}{Link}. –  wwjoze Mar 15 at 9:37

2 Answers 2

up vote 8 down vote accepted

Though it is not really advisable - in my opinion - you can use the redefinition

\DeclareFieldFormat{url}{\href{#1}{\underline{Link}}}

this definition will print the full URL if hyperref is not enabled

\DeclareFieldFormat{url}{%
  \ifhyperref
    {\href{#1}{\underline{Link}}}
    {\url{#1}}}

Or maybe even - making use of the localisation capabilities biblatex offers

\DefineBibliographyStrings{english}{%
  url = {link},
}

\DeclareFieldFormat{url}{%
  \ifhyperref
    {\href{#1}{\bibstring{url}}}
    {\url{#1}}}

For more options to customise the look of hyperlinks, see for example How can I have colored and underlined links with hyperref?

MWE

\documentclass[12pt,a4paper]{article}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@techreport{NBERw10828,
 title = "Accounting for Cross-Country Income Differences",
 author = "Francesco Caselli",
 institution = "National Bureau of Economic Research",
 type = "Working Paper",
 series = "Working Paper Series",
 number = "10828",
 year = "2004",
 month = "October",
 URL = "http://www.nber.org/papers/w10828",
}
\end{filecontents}
\usepackage[utf8]{inputenc}
\usepackage{hyperref}
\hypersetup{
colorlinks = true,
linkcolor = black,
anchorcolor = black,
citecolor = black,
urlcolor=blue,
bookmarksopen = true,
bookmarksnumbered = true,
bookmarksopenlevel = 2,
pdfstartview = {FitH},
pdfborder = {0 0 0}
}
\usepackage[indexing=cite,style=authoryear,citestyle=authoryear,sorting=none,backend=biber]{biblatex}
\makeatletter
\AtEveryCite{%
  \let\parentext=\parentexttrack%
  \let\bibopenparen=\bibopenbracket%
  \let\bibcloseparen=\bibclosebracket}
\makeatother

\DefineBibliographyStrings{english}{%
  url = {link},
}

\DeclareFieldFormat{url}{%
  \ifhyperref
    {\href{#1}{\bibstring{url}}}
    {\url{#1}}}

%\renewcommand{\mkbibnamelast}[1]{\mkbibemph{#1}}
\addbibresource{\jobname.bib}
\begin{document}
First \cite{NBERw10828}\par
\printbibliography
\end{document}

enter image description here

share|improve this answer
    
BTW, do you how to make *in front of citation? *Caselli... –  saldenisov Mar 15 at 12:54
1  
@saldenisov Try Functionality of apacites \nocitemeta with biblatex-apa: adding asterisks to author lastnames (meta-analysis). If that does not help, better ask a new question. –  moewe Mar 15 at 13:07

You can redefine the way URLs are printed as follows (somewhere in your preamble after loading bibtex):

\DeclareFieldFormat{url}{\ifhyperref{\href{#1}{Link.}}{\url{#1}}}

Image showing "Link"

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.