4

I have a list of biblatex items in a document which additionally has a bibliography section. In this part I want to list some bibliography items with \fullcite but in a different style then the main bibliography.

I can change the number of authors like this:

\begingroup
\defcounter{minnames}{2}
\fullcite{key}
\endgroup

How can I further modify the style of \fullcite?

MWEB

\documentclass[en-US,de-DE]{article}

\usepackage[
  style=authoryear-ibid,
  maxnames=2,
  backend=biber,
  safeinputenc,
  isbn=false,
  doi=false,
  maxcitenames=2,
  urldate=iso8601,
  date=iso8601
]{biblatex}

\addbibresource{\jobname.bib}
\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@book{key,
  author = {Author, A.},
  year = {2001},
  title = {Title},
  publisher = {Publisher},
  pagetotal = {383},
  edition = {1},
  pages = {151--154},
  url = {http://www.google.com},
}
\end{filecontents}

\begin{document}
text1

\fullcite{key}

text2

\cite{key}

text3

\printbibliography[heading=bibintoc]

\end{document}

I want to remove the year, URLs from these items listed by \fullcite as well and any page numbers and the edition of books?

pdf rendering

Max N
  • 425
  • 1
    know there are "better" ways to make a publications list like https://tex.stackexchange.com/questions/115143/biblatex-list-of-publications-in-the-cv but thats not what I need. – Max N Feb 10 '18 at 21:09
  • 2
    Please don't post code fragments. Instead post a minimal document that shows what you're doing and some sample .bib items. And you haven't specified enough information: page numbers from all entry types? Editions from all entry types? etc. – Alan Munn Feb 10 '18 at 21:20
  • I second Alan's request. You probably could do this with the combined use of the \AtNextCitekey hook and \clearfield. But, in this case, it is hard to help without a minimal working example with bibliography (MWEB). – gusbrs Feb 10 '18 at 21:24
  • added mweb. in my original document I have 12 items to list. – Max N Feb 10 '18 at 21:51

1 Answers1

8

There are two ways you can do this: you can redefine the \fullcite command to clear the fields you don't want, or as noted in the comments, you can use \AtEverycitekey to do the same thing.

Conceptually, modifying \fullcite seems like the better solution, since using \AtEveryCitekey modifies any citation, so if you want to remove any information from the \fullcite that is normally included in the regular \cite then you must use this solution.

If you're just removing URL, edition and pages from the \fullcite there will be no bad side-effects of using \AtEveryCitekey since it is only the \fullcite citation command that would ever output those fields. But if you want to remove the year as well (as you mention in the comments), then modifying \fullcite is the only way to do it. I've removed the \AtEveryCitekey solution from the code for this reason, but placed it separately at the end.

Depending on the type of information you need to suppress, you may need to use one of \clearfield, \clearlist or \clearname. In the case of publisher, or location, for example, their type is a list, and so you need to use \clearlist to clear them. Section 2.2.2 of the biblatex documentation describes each field and its data type.

\documentclass[en-US,de-DE]{article}

\usepackage[
  style=authoryear-ibid,
  maxnames=2,
  backend=biber,
  safeinputenc,
  isbn=false,
  doi=false,
  maxcitenames=2,
  urldate=iso8601,
  date=iso8601
]{biblatex}

\addbibresource{\jobname.bib}
\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@book{key,
  author = {Author, A.},
  year = {2001},
  title = {Title},
  publisher = {Publisher},
  pagetotal = {383},
  edition = {1},
  pages = {151--154},
  url = {http://www.google.com},
}
\end{filecontents}

\DeclareCiteCommand{\fullcite}
  {\usebibmacro{prenote}}
  {\clearfield{url}%
   \clearfield{pages}%
   \clearfield{pagetotal}%
   \clearfield{edition}%
   \clearfield{labelyear}%
   \usedriver
     {\DeclareNameAlias{sortname}{default}}
     {\thefield{entrytype}}}
  {\multicitedelim}
  {\usebibmacro{postnote}}
\begin{document}
text1
\cite{key}

\fullcite{key}

text2

\cite{key}

text3

\printbibliography[heading=bibintoc]

\end{document}

output of code

Using \AtEveryCitekey

As noted above, using \AtEveryCitekey can also work if there is no overlap in the information you need in a regular cite and the information you suppress in the \fullcite. Here's the code to use that method:

\AtEveryCitekey{
\clearfield{url}
   \clearfield{pages}
   \clearfield{pagetotal}
   \clearfield{edition}
   \clearfield{labelyear}
}
Alan Munn
  • 218,180
  • 1
    It would also be safe to just clear these fields in the \AtEveryCitekey hook. That way one doesn't need to redefine \fullcite. – moewe Feb 10 '18 at 23:02
  • @moewe in my preliminary tests I tried that with \AtNextCite but it didn't work, but I didn't try \AtNextCitekey. Should they have different behaviour? – Alan Munn Feb 10 '18 at 23:10
  • 1
    Yes indeed. \AtEveryCite is executed at the beginning of a cite command, at that point the entry data is not yet available. \AtEveryCitekey is executed for every cite entry separately and at a point where the data is available. For \cite{sigfridsson,worman} \AtEveryCite is executed once at the beginning and \AtEveryCitekey once for sigfridsson and once for worman. The two are conceptually similar to \AtBeginBibliography and \AtEveryBibitem. – moewe Feb 10 '18 at 23:15
  • @moewe Thanks. I'll update the answer to show that option too. – Alan Munn Feb 11 '18 at 02:11
  • There seems to be extra whitespace added between text1 and A. Author – Max N Feb 11 '18 at 16:04
  • 1
    @MaxN Damn end of line spaces! :) Add % after each \clearfield in the redefinition of \fullcite or use the \AtEveryCitekey version. I've edited the code. Thanks. – Alan Munn Feb 11 '18 at 16:32
  • Is there a way to get rid of the (2001) ? Where can I find documentation on this whole thing, and how do you know those? I looked in the biblatex manual and I don't see the info there. – Max N Feb 11 '18 at 16:40
  • 1
    @MaxN I've updated the solution. If you want to remove the year, then you can't use the \AtEveryCitekey solution. I've explained how this works. As for finding out about this stuff, much of it is in the biblatex manual, but to understand more of the internals, you also need to browse the actual code of the package. (It would be nice to have a map...). – Alan Munn Feb 11 '18 at 17:01
  • Oh, no.. There is one more thing: It's kind of silly to have my own name in my list of publications, however, I need the co-authors to be there for papers with co-authors. Sorry, so complicated. – Max N Feb 11 '18 at 17:36
  • @MaxN If you are in a field that remotely uses some sort of author ordering to attribute responsibility to a paper, then removing your name is not a good idea. But I think that should be for a separate question, linking to this one. But search around, since there are likely various similar questions about highlighting or removing particular authors on the site. – Alan Munn Feb 11 '18 at 17:51
  • @AlanMunn I think I'll have to make one, because I don't find any. – Max N Feb 11 '18 at 18:50
  • strangely \clearfield{publisher}% doesn't remove the publisher. – Max N Feb 11 '18 at 18:59
  • 1
    @MaxN I've added some explanation why. publisher is a list, not a simple field. – Alan Munn Feb 11 '18 at 20:06
  • 1
    @maxN I have in mind this answer although how to get it to work just for \fullcite is not clear to me. – Alan Munn Feb 11 '18 at 20:30
  • Can I not construct it by adding fields rather then removing them? Alternatively how do I remove all fields (so that I can comment out some of these removals to ensure only these commented out fields are shown). – Marten Mar 20 '23 at 13:52
  • @Kvothe I'm not sure I understand your question. But if you want you ask a new question linking to this one. – Alan Munn Mar 20 '23 at 16:29