1
\documentclass{article}
\usepackage{mwe}
\usepackage{biblatex}
\addbibresource{biblatex-examples.bib}
\begin{document}
\cite*{kastenholz}, \citeyear{kastenholz}
\end{document}

I am look for a way to cite only the first author (or more if it is not unique) and the year with one command. Kind of fullcite{} but the other way around. I couldn't find this in the docu.

I need this on a specific part of the paper. The this should work "local" and not affect any global settings of the document. I want to use this in a table to reference papers where the data comes from but with minimal space usage in the table.

  • 3
    You've tagged this biblatex, but your MWE doesn't use biblatex (or any package for bibliography). Are you actually using one? – Alan Munn Oct 28 '17 at 21:18
2

It looks like you want an author-year type citation. So load biblatex with the authoryear style.

If you really want only the first author to show up, then use maxnames=1 or maxcitenames=1 which will render the example citation as Kastenholz et al. (2006).

\documentclass{article}
\usepackage{mwe}
\usepackage[style=authoryear]{biblatex}
\addbibresource{biblatex-examples.bib}
\begin{document}
\textcite{kastenholz}
\end{document}

output of code

  • I specified my question depending on your answer. I need the global biblatex settings. – buhtz Oct 28 '17 at 22:10
  • @buhtz I'm sorry but then I don't understand what you are doing. You are using the numeric style, but need a specific author/year citation in one place? – Alan Munn Oct 28 '17 at 22:17
2

You can define a new command for that like this

\documentclass{article}
\usepackage{mwe}
\usepackage[style=numeric, labeldateparts]{biblatex}
\addbibresource{biblatex-examples.bib}

\newbibmacro{aycite}{%
  \defcounter{maxnames}{1}%
  \ifnameundef{labelname}
    {\printfield{labeltitle}%
     \setunit{\printdelim{nonameyeardelim}}}
    {\printnames{labelname}%
     \setunit{\printdelim{nameyeardelim}}}
  \printtext[bibhyperref]{\printlabeldateextra}}

\DeclareCiteCommand{\aycite}
  {\usebibmacro{prenote}}%
  {\usebibmacro{citeindex}%
   \usebibmacro{aycite}}
  {\multicitedelim}
  {\usebibmacro{postnote}} 

\begin{document}
\aycite{kastenholz}
\end{document}

I would have preferred to use mincitenames=1, maxcitenames=1, uniquelist=true instead of \defcounter{maxnames}{1}, but that would have been against your wish to not change any settings. It is only possible to fulfil the 'or more if it is not unique' desideratum with mincitenames=1, maxcitenames=1, uniquelist=true. Since you use a numeric style it is unlikely that the three options would impact other citations, but not impossible (if you use \textcite there could be changes, if you only use \cite there should not be a problem).

I introduced the labeldateparts option, but that does not impact other commands.

1

You could create a new cite command, from the ones available, to do what you want.

\documentclass{article}
\usepackage{mwe}
\usepackage{biblatex}
\addbibresource{biblatex-examples.bib}

\newcommand\mycite[1]{\AtNextCite{\defcounter{maxnames}{1}}\citeauthor{#1}, \citeyear{#1}}

\begin{document}
\mycite{kastenholz}

\end{document}

enter image description here

Update: As pointed out by moewe in the comments, this approach, albeit simple, has relevant limitations. It won't deal with pre- and post-notes (though it could be adapted to deal with one of them) and also not handle multiple entries. If this is enough for your case, then fine, otherwise, for a more general solution using \DeclareCiteCommand is preferred (see https://tex.stackexchange.com/a/398595/105447).

  • If this is what @buhtz wants I'll just delete my answer. – Alan Munn Oct 28 '17 at 22:29
  • @AlanMunn, I was also going in the same direction as you. But given your interaction, it sounds like this is what the OP wants. Let's hear from him anyway. But I'd leave your answer if I were you, for if other people stumble into this question later, it offers a more standard way to do what the title states. – gusbrs Oct 28 '17 at 22:38
  • Combining several biblatex-\cite... commands is usually inferior to defining a specific command with \DeclareCiteCommand. The command in your answer has problems when multiple entries are cited and also with pre- and postnotes. – moewe Oct 29 '17 at 9:52
  • True @moewe, I'm aware of the limitations of this approach. But thought this should be enough for the purposes of "using this in a table". We haven't heard from the OP yet, but if you think it is best to keep the site cleaner of these "hacks", I can provide a proper cite command. – gusbrs Oct 29 '17 at 10:06
  • @moewe, I was trying to do it for the sake of learning and for the fun of it, but couldn't make it. So, if you care to provide an answer, defining a proper cite command with \DeclareCiteCommand I won't be troubled at all, rather the contrary. – gusbrs Oct 29 '17 at 10:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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