1

Based on Biblatex: Two bibliographies with different styles and sortings, I have the following MWE.

\documentclass{article}

%%% To use with the \DeclareFieldFormat and \defbibenvironment below: % \usepackage[backend=biber, style=alphabetic, labelnumber, defernumbers=true]{biblatex}

\usepackage[backend=biber, style=authoryear, sorting=none, natbib=true, backref]{biblatex}

% Append keywords to identify different bibliography entries. % appendstrict only appends if the field is nonempty, % we use that to add a comma to avoid mushing together two keywords \DeclareSourcemap{ \maps[datatype=bibtex, overwrite]{ \map{ \perdatasource{Referenzen_academic.bib} \step[fieldset=KEYWORDS, fieldvalue={, }, appendstrict] \step[fieldset=KEYWORDS, fieldvalue=primary, append] } \map{ \perdatasource{Referenzen_popular.bib} \step[fieldset=KEYWORDS, fieldvalue={, }, appendstrict] \step[fieldset=KEYWORDS, fieldvalue=secondary, append] } } }

\begin{filecontents}{Referenzen_academic.bib} @BOOK{BookA03, author = {Author Aaa}, title = {Some Title}, publisher = {Some Publisher}, year = 2003, % keywords = {hello}, } @BOOK{BookB02, author = {Author Bbb}, title = {Some Title}, publisher = {Some Publisher}, year = 2002, } \end{filecontents} \begin{filecontents}{Referenzen_popular.bib} @MISC{LinkC04, author = {Author Ccc},
title = {Some Title}, year = 2004, url = {www.test1.com/bild.jpg}, % keywords = {bye}, } @MISC{LinkD01, author = {Author Ddd}, title = {Some Title}, year = 2001, url = {www.test2.com/bild.jpg}, } \end{filecontents} \addbibresource{Referenzen_academic.bib} \addbibresource{Referenzen_popular.bib}

\usepackage{hyperref}

\begin{document} The first two citations \cite{LinkD01} and \cite{BookB02}. The others are \cite{LinkC04} and \cite{BookA03}.

\printbibliography[title=Bibliography (academic), keyword=primary] \newrefcontext[sorting=none] % \printbibliography[env=bibliographyNUM, title=References, keyword=secondary, resetnumbers] \printbibliography[title=Bibliography (conventional), keyword=secondary]

\end{document}

I have two different bibliography files. I would like that the bibliographies themselves are the same (as shown). But, I would like that the citing for each are different. Namely, I would like that the citings in the main body of text for the second article contain author and title instead of author and year. How can I do this?

Make42
  • 1,772

2 Answers2

1

I managed to answer my question with the following code

\documentclass{article}
\usepackage[backend=biber, style=authoryear, sorting=none, natbib=true, backref]{biblatex}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% %%% Automatically adding keywords, depending on the file origin %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Append keywords to identify different bibliography entries. % appendstrict only appends if the field is nonempty, % we use that to add a comma to avoid mushing together two keywords \DeclareSourcemap{ \maps[datatype=bibtex, overwrite]{ \map{ \perdatasource{Referenzen_academic.bib} \step[fieldset=KEYWORDS, fieldvalue={, }, appendstrict] \step[fieldset=KEYWORDS, fieldvalue=primary, append] } \map{ \perdatasource{Referenzen_popular.bib} \step[fieldset=KEYWORDS, fieldvalue={, }, appendstrict] \step[fieldset=KEYWORDS, fieldvalue=secondary, append] } } }

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% %%% Create or Customize cite commands %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Here we redefine cite and parencite: \DeclareCiteCommand{\cite} {\usebibmacro{prenote}} {\ifkeyword{secondary}{% \bibhyperref{\printfield{labeltitle}\setunit{\addcomma\addspace}\printnames{labelname}}% }{% \usebibmacro{cite}% }% } {\multicitedelim} {\usebibmacro{postnote}}

\DeclareCiteCommand{\parencite} {\bibopenparen\usebibmacro{prenote}} {\ifkeyword{secondary}{% \bibhyperref{\printfield[citetitle]{labeltitle}\setunit{\addcomma\addspace}\printnames{labelname}}% }{% \usebibmacro{cite}% }% } {\multicitedelim} {\usebibmacro{postnote}\bibcloseparen}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% %%% Produce and add the bib files %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{filecontents}{Referenzen_academic.bib} @BOOK{BookA03, author = {FirstnameXA FamilyXA}, title = {Some Title XA}, publisher = {Some Publisher XA}, year = 2003, keywords = {hello}, } @BOOK{BookB02, author = {FirstnameXB FamilyXB}, title = {Some Title XB}, publisher = {Some Publisher XB}, year = 2002, keywords = {wiki} } \end{filecontents} \begin{filecontents}{Referenzen_popular.bib} @MISC{LinkC04, author = {FirstnameYC FamilyYC},
title = {Some Title YC}, year = 2004, url = {www.test1.com/bild.jpg}, keywords = {bye}, } @MISC{LinkD01, author = {FirstnameYD FamilyYD}, title = {Some Title YD}, year = 2001, url = {www.test2.com/bild.jpg}, keywords = {wiki} } \end{filecontents} \addbibresource{Referenzen_academic.bib} \addbibresource{Referenzen_popular.bib}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% %%% use other packages %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\usepackage{hyperref}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% %%% Document %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document} The first two citations \cite{LinkD01} and \cite{BookB02}. The others are \cite{LinkC04} and \cite{BookA03}.

\cite{LinkD01}

\parencite{BookB02}

\parencite{LinkD01}

\printbibliography[title=Bibliography (academic), keyword=primary] \printbibliography[title=Bibliography (conventional), keyword=secondary]

\end{document}

this includes the following tricks:

  • we add respective keywords based on the file the reference comes from
  • we check for keywords to change the citation command
  • if the respective keywords are not changed, we keep the original command
Make42
  • 1,772
0

Is it OK for you to use a different citation command (\authtitcite in my MWE) in the second article?

\documentclass{article}

%%% To use with the \DeclareFieldFormat and \defbibenvironment below: % \usepackage[backend=biber, style=alphabetic, labelnumber, defernumbers=true]{biblatex}

\usepackage[backend=biber, style=authoryear, sorting=none, natbib=true, backref]{biblatex}

% Append keywords to identify different bibliography entries. % appendstrict only appends if the field is nonempty, % we use that to add a comma to avoid mushing together two keywords \DeclareSourcemap{ \maps[datatype=bibtex, overwrite]{ \map{ \perdatasource{Referenzen_academic.bib} \step[fieldset=KEYWORDS, fieldvalue={, }, appendstrict] \step[fieldset=KEYWORDS, fieldvalue=primary, append] } \map{ \perdatasource{Referenzen_popular.bib} \step[fieldset=KEYWORDS, fieldvalue={, }, appendstrict] \step[fieldset=KEYWORDS, fieldvalue=secondary, append] } } }

\begin{filecontents}{Referenzen_academic.bib} @BOOK{BookA03, author = {Author Aaa}, title = {Some Title}, publisher = {Some Publisher}, year = 2003, % keywords = {hello}, } @BOOK{BookB02, author = {Author Bbb}, title = {Some Title}, publisher = {Some Publisher}, year = 2002, } \end{filecontents} \begin{filecontents}{Referenzen_popular.bib} @MISC{LinkC04, author = {Author Ccc},
title = {Some Title}, year = 2004, url = {www.test1.com/bild.jpg}, % keywords = {bye}, } @MISC{LinkD01, author = {Author Ddd}, title = {Some Title}, year = 2001, url = {www.test2.com/bild.jpg}, } \end{filecontents}

% Adapted from https://tex.stackexchange.com/a/123145/101651 \DeclareCiteCommand{\authtitcite} {\boolfalse{citetracker}% \boolfalse{pagetracker}% \usebibmacro{prenote}} {\ifciteindex {\indexnames{labelname}% \indexfield{indextitle}} {}% \printnames{labelname}% \setunit{\addcomma\addspace}% \printfield[citetitle]{labeltitle}} {\multicitedelim} {\usebibmacro{postnote}}

\addbibresource{Referenzen_academic.bib} \addbibresource{Referenzen_popular.bib}

\usepackage{hyperref}

\begin{document} Do you intend this in the first article:

The first two citations \cite{LinkD01} and \cite{BookB02}.

and this in the second article:

The others are \authtitcite{LinkC04} and \authtitcite{BookA03}.

? \printbibliography[title=Bibliography (academic), keyword=primary] \newrefcontext[sorting=none] % \printbibliography[env=bibliographyNUM, title=References, keyword=secondary, resetnumbers] \printbibliography[title=Bibliography (conventional), keyword=secondary]

\end{document}

enter image description here

CarLaTeX
  • 62,716
  • I managed to get what I want with https://tex.stackexchange.com/a/684270/49283. Can you explain, what the possible advantages of your code are? I am asking, because I reckon that you are more proficient in Latex than I am. – Make42 Apr 29 '23 at 15:29
  • @Make42 Your solution is better, don't worry – CarLaTeX Apr 29 '23 at 17:24