How to use \DeclareCiteCommand, with style

I am attempting something similar to: Biblatex footnotes to margin To the extend that I can steal their example.

What I would like to do, is have the text cited in the main text normally, then in the side bar using the author name, then the date, then the work name.

For purposes of this MWE I am just using base latex \marginpar. (In my actual work I am using Koma scrnote-layer stuff. But that doesn't really matter as I am trying to understand BibLaTeX)

MWE:

\documentclass{article}
\usepackage{blindtext}

% bib-file
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@book{Knu86,
author = {Knuth, Donald E.},
year = {1986},
title = {The \TeX book},
}
@BOOK{KandR,
AUTHOR    = {Kernighan, Brian W. and Ritchie, Dennis M.},
TITLE     = {{The C Programming Language Second Edition}},
PUBLISHER = {Prentice-Hall, Inc.},
YEAR      = {1988},
}
\end{filecontents}

\usepackage[]{biblatex}

\newcommand{\tcite}[1]{
\textcite{#1}
\marginpar{
\citeauthor{#1},
\citeyear{#1}.
\citetitle{#1}
}
}

% doc
\begin{document}
\blindtext
\tcite{Knu86}
\blindtext
\tcite{Knu86,KandR}
\blindtext
\end{document}


It can be seen that the Blue circled text is perfect. But the red cirled text is wrong, because it is collated by fields. The reason for this is obvious of course. My command does not process per key, it processes all the keys together.

My current command is:

\newcommand{\tcite}[1]{
\textcite{#1}
\marginpar{
\citeauthor{#1},
\citeyear{#1}.
\citetitle{#1}
}
}


I believe that I want to replace it with something made using BibLaTeX's \DeclareCiteCommand

So I took a swing at it:

\DeclareCiteCommand{\tcite}
{   % prenote
\usebibmacro{prenote}%
}
{   %loopcode
\printnames{author}%
\marginpar{
\printnames{author},
\printfield{year}.
\printfield{title}
}
}
{   %sepcode
\multicitedelim%
}
{\usebibmacro{postnote}}


This works, we can see both the blue circled and the red circles is fine as far as being seperate. But I am not benifiting from the Styling of Author names (eg being abridged to last name only, based on my settings). And since I haven't uses \textcite but rather just put in printnames{author} then I am not benefiting from any styling there either.

This is (I assume) because I have used the low level commands, for these things. How can I use higher level commands that respect style/configuration

You should not use high-level commands such as \citeauthor in a \DeclareCiteCommand. It is possible to do so with \citeauthor{\thefield{entrykey}}, but it is not a great idea.

Instead just use the bibmacros that are used for \citeauthor

\newbibmacro{sidecite}{%
\printnames{labelname}%
\setunit{\printdelim{nametitledelim}}%
\printfield[citetitle]{labeltitle}%
\printfield{year}}


Since in your example you wanted to recreate \textcite of numeric, I went with.

\documentclass{article}
\usepackage{blindtext}

% bib-file
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@book{Knu86,
author = {Knuth, Donald E.},
year = {1986},
title = {The \TeX book},
}
@BOOK{KandR,
AUTHOR    = {Kernighan, Brian W. and Ritchie, Dennis M.},
TITLE     = {{The C Programming Language Second Edition}},
PUBLISHER = {Prentice-Hall, Inc.},
YEAR      = {1988},
}
\end{filecontents}

\usepackage[]{biblatex}

\newbibmacro{sidecite}{%
\printnames{labelname}%
\setunit{\printdelim{nametitledelim}}%
\printfield[citetitle]{labeltitle}%
\printfield{year}}

\makeatletter
\DeclareCiteCommand{\cbx@textcite}
{\usebibmacro{textcite:init}}
{\usebibmacro{citeindex}%
\usebibmacro{textcite}%
\setunit{}%
\marginpar{\usebibmacro{sidecite}}%
\setunit{%
\ifbool{cbx:parens}
{\bibcloseparen\global\boolfalse{cbx:parens}}
{}%
\textcitedelim}}
{}
{\usebibmacro{textcite:postnote}}
\makeatother

% doc
\begin{document}
\blindtext
\textcite{Knu86}
\blindtext
\textcite{Knu86,KandR}
\blindtext
\end{document}


With authoryear things are easier

\documentclass{article}
\usepackage{blindtext}

% bib-file
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@book{Knu86,
author = {Knuth, Donald E.},
year = {1986},
title = {The \TeX book},
}
@BOOK{KandR,
AUTHOR    = {Kernighan, Brian W. and Ritchie, Dennis M.},
TITLE     = {{The C Programming Language Second Edition}},
PUBLISHER = {Prentice-Hall, Inc.},
YEAR      = {1988},
}
\end{filecontents}

\usepackage[style=authoryear]{biblatex}

\newbibmacro{sidecite}{%
\printnames{labelname}%
\setunit{\printdelim{nametitledelim}}%
\printfield[citetitle]{labeltitle}%
\printfield{year}}

\DeclareCiteCommand{\tcite}
{\usebibmacro{prenote}}%
{\usebibmacro{citeindex}%
\usebibmacro{cite}%
\marginpar{\usebibmacro{sidecite}}}
{\multicitedelim}
{\usebibmacro{postnote}}

% doc
\begin{document}
\blindtext
\tcite{Knu86}
\blindtext
\tcite{Knu86,KandR}
\blindtext
\end{document}


\usebibmacro{<macroname>} lets you invoke a bib-macro in a DeclareCiteCommand. It doesn't, however, let you invoke something that was itself defined using DeclareCiteCommand so no \usebibmacro{citeauthor}.

So the new code could be:

\DeclareCiteCommand{\tcite}%
{\usebibmacro{prenote}}% prenote
{   %loopcode
\usebibmacro{cite}%
\marginpar{\usebibmacro{cite}, \printfield{title} \\
}
}
{\multicitedelim}% sepcode
{\usebibmacro{postnote}}


Running this, with a more interesting citation style set in biblatex: \usepackage[citestyle=authoryear]{biblatex} gives:

• A command declared with \DeclareCiteCommand is not a bibmacro. You can call it simply with \citeauthor. In another \DeclareCiteCommand you'd need \citeauthor{\thefield{entrykey}}. But it is easier and more natural to just use the associated bibmacro: \usebibmacro{author}, for example. – moewe Jul 10 '17 at 6:17