# How to cite book (author-year) and url(author) simultaneously in Biblatex

I have a book document and I want to use biblatex pacakage to cite a book (referring to author-year) and cite a url (referring to author) inside the text. It does not print any bibliography for me. Do you know how to do it?

\documentclass{book}
\usepackage[style=authoryear]{biblatex}
\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@book{mybook,
author       = {Her Name},
date         = {2010},
title        = {Her title},
publisher    = {City: publisher},
}
@online{myurl,
author       = {his Name},
title        = {his title},
organization = {Wikibooks},
url          = {https://helping_each_other_and_i_help_u.com},
}
\end{filecontents}

\bibliography{\jobname}

\begin{document}
like to see \cite{mybook} try \cite{myurl}.
\printbibliography
\end{document}

• It's not clear how you are processing this file. Usually, you need to run latex, then biber or bibtex, then latex twice. Are you following that sequence? I was able to create a bibliography from your example this way. – John May 12 '19 at 17:20
• Hello John. I only run XeLatex+MakeIndex+BibTeX. I got error when I run BibTeX – Aria May 12 '19 at 17:26
• you are set up to use biber, not bibtex, since you have the biblatex package loaded. The solution depends on your particular software -- to adjust, see the various examples in this question. – John May 12 '19 at 17:37
• I run XeLatex+MakeIndex+BibTeX and now I see the results is that correct way of running or as u said run latex, then biber or bibtex, then latex twice? – Aria May 12 '19 at 17:40
• Not sure what you are asking -- is it working? Then you are done. If not, what error are you seeing? – John May 12 '19 at 18:28

To me it makes no real sense to cite authors in this way. However, here is a solution:

\documentclass{book}
\usepackage[style=authoryear]{biblatex}
\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@book{mybook,
author       = {Her Name},
date         = {2010},
title        = {Her title},
publisher    = {City: publisher},
}
@online{myurl,
author       = {His Name},
title        = {His title},
organization = {Wikibooks},
url          = {https://helping_each_other_and_i_help_u.com},
}
\end{filecontents}
\DeclareNameFormat{family}{%
\usebibmacro{name:family}
{\namepartfamily}
{\namepartgiven}
{\namepartprefix}
{\namepartsuffix}}
\newbibmacro*{name:family}[4]{\mkbibnamefamily{#1}\isdot}

\DeclareNameFormat{labelname}{\nameparts{#1}%
\usebibmacro{name:given-family}{\namepartfamily}{\relax}{\relax}}
\DeclareNameFormat{author}{\nameparts{#1}%
\usebibmacro{name:given-family}{\namepartfamily}{\relax}{\relax}}
\DeclareLabeldate{\field{date}\field{eventdate} \field{origdate}}