2

This is the command I used for generating the first bibliography. However I wanted the format of second picture, which an extra block in front of the references. File can be found in the onedrive link below.

\documentclass{article}

\usepackage[citestyle=authoryear-comp,bibstyle=authortitle,sorting=nyt,dashed=false,%
    maxcitenames=1]{biblatex}

\newcounter{mymaxcitenames}
\AtBeginDocument{%
  \setcounter{mymaxcitenames}{\value{maxnames}}%
}

\renewbibmacro*{begentry}{%
  \printtext[brackets]{%
    \begingroup
    \defcounter{maxnames}{\value{mymaxcitenames}}%
    \printnames{labelname}%
    \setunit{\nameyeardelim}%
    \usebibmacro{cite:labelyear+extrayear}%
    \endgroup
    }%
  \quad% or \addspace
}

\DeclareNameAlias{sortname}{first-last}

\usepackage{filecontents}

\begin{filecontents}{biblatextest.bib}
@misc{A01,
  author = {Author, A. and Buthor, B.},
  year = {2001},
  title = {Alpha},
}
\end{filecontents}

\addbibresource{biblatextest.bib}

\begin{document}

Some text \autocite{A01}.

\printbibliography

\end{document}

https://onedrive.live.com/redir?resid=231B471A96C9FC0E!1268&authkey=!ALCb5Oz421IDx0w&ithint=file%2cpdf

Now the commands generate the bibliography in this style:

enter image description here

However I would like to have it like this:

enter image description here

Heiko Oberdiek
  • 271,626
Lippiyea
  • 21
  • 2

1 Answers1

2

This answer makes very heavy use of Audrey's excellent answer to tabular bibliography with biblatex as well as lockestp's answer to Adding an [AuthorYear] block at the beginning of bibliography entries.

Besides the definition of \printbibtabular we only need

\newcounter{mymaxcitenames}
\AtBeginDocument{%
  \setcounter{mymaxcitenames}{\value{maxnames}}%
}

\newbibmacro*{bibcite}{%
  \defcounter{maxnames}{\value{mymaxcitenames}}%
    \iffieldundef{shorthand}
      {\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}}
         {\usebibmacro{cite:label}%
          \setunit{\addspace}}
         {\printnames{labelname}%
          \setunit{\nameyeardelim}}%
       \usebibmacro{cite:labelyear+extrayear}}
      {\usebibmacro{cite:shorthand}}}

Where the last piece of code is taken from authoryear.cbx, it will emulate the cite behaviour here (we did not take the code from authoryear-comp to avoid unwanted compression of the citation that would leave us with only the year in some cases).

An appropriate bibtabular format could then be

\defbibtabular{bibtabular}
  {\begin{tabular}{p{0.2\textwidth}p{0.8\textwidth}}}
  {\end{tabular}}
  {\usebibmacro{bibcite}}
  {}

MWE

\documentclass{article}

\usepackage[citestyle=authoryear-comp, bibstyle=authortitle, sorting=nyt, dashed=false,%
    maxcitenames=1]{biblatex}


\DeclareNameAlias{sortname}{first-last}

\addbibresource{biblatex-examples.bib}

\makeatletter

% user-level command for printing tabular bibliography
\let\printbibtabular\printbibliography
\patchcmd{\printbibtabular}{\blx@printbibliography}{\bbx@printbibtabular}{}{}
\patchcmd{\printbibtabular}{\blx@printbibliography}{\bbx@printbibtabular}{}{}
\let\bbx@printbibtabular\blx@printbibliography
\patchcmd{\bbx@printbibtabular}{\blx@bibliography}{\bbx@bibtabular}{}{}
\patchcmd{\bbx@printbibtabular}
  {\def\blx@theenv{bibliography}}{\def\blx@theenv{bibtabular}}{}{}

% underlying macros
\def\bbx@bibtabular#1{%
  \blx@bibheading\blx@theheading\blx@thetitle
  \blx@bibnote\blx@theprenote
  \begingroup
  \blx@bibinit
  \let\@noitemerr\@empty
  \let\blx@noitem\blx@warn@bibempty
  \ifnum\bibinitsep=\z@
    \let\blx@initsep\relax
  \fi
  \ifnum\bibnamesep=\z@
    \let\blx@namesep\relax
  \fi
  \csuse{blx@hook@bibinit}%
  % copy filtered list of entries to internal list macro
  \def\blx@do##1{%
    \blx@ifdata{##1}{%
      \begingroup
      \blx@getdata{##1}
      \blx@bibcheck
      \iftoggle{blx@skipentry}{}{%
        \global\let\blx@noitem\@empty
        \listadd\blx@tempa{##1}}%
      \endgroup}{}}
  \let\blx@done\relax
  \blx@listloop{#1}
  % tabular output for each item in list macro
  \def\do##1{\bbx@tab@label{##1} & \bbx@tab@item{##1} \\}
  \csuse{blx@env@\blx@theenv}%
  \dolistloop{\blx@tempa}
  \csuse{blx@endenv@\blx@theenv}%
  \blx@bibnote\blx@thepostnote
  \endgroup}

\def\bbx@tab@label#1{%
  \begingroup
  \blx@getdata{#1}%
  \blx@setoptions@type\abx@field@entrytype
  \blx@setoptions@entry
  \blx@thelabelnumber
  \blx@addprefixnumber
  \addtocounter{instcount}\@ne
  \csuse{bbx@tabenv@\blx@theenv}\relax
  \endgroup}

\def\bbx@tab@item#1{%
  \begingroup
  \blx@getdata{#1}%
  \blx@setoptions@type\abx@field@entrytype
  \blx@setoptions@entry
  \csuse{blx@item@\blx@theenv}\relax
  \blx@initsep
  \blx@namesep
  \csuse{blx@hook@bibitem}%
  \blx@execute
  \blx@initunit
  \blx@anchor
  \blx@beglang
  \bibsentence
  \blx@pagetracker
  \blx@driver\abx@field@entrytype
  \blx@postpunct
  \blx@endlang
  \endgroup}

% user-level command for defining tabular bibliography format
\newrobustcmd*{\defbibtabular}[5]{%
  \long\csdef{blx@env@#1}{#2}%
  \long\csdef{blx@endenv@#1}{#3}%
  \long\csdef{bbx@tabenv@#1}{#4}%
  \long\csdef{blx@item@#1}{#5}}

\makeatother

\newcounter{mymaxcitenames}
\AtBeginDocument{%
  \setcounter{mymaxcitenames}{\value{maxnames}}%
}

\newbibmacro*{bibcite}{%
  \defcounter{maxnames}{\value{mymaxcitenames}}%
    \iffieldundef{shorthand}
      {\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}}
         {\usebibmacro{cite:label}%
          \setunit{\addspace}}
         {\printnames{labelname}%
          \setunit{\nameyeardelim}}%
       \usebibmacro{cite:labelyear+extrayear}}
      {\usebibmacro{cite:shorthand}}}

\defbibtabular{bibtabular}
  {\begin{tabular}{p{0.2\textwidth}p{0.8\textwidth}}}
  {\end{tabular}}
  {\usebibmacro{bibcite}}
  {}

\begin{document}

Some text \autocite{sigfridsson, geer, nussbaum, worman, knuth:ct:b, knuth:ct:c}.

\printbibtabular
\end{document}

tabular bibliography: left column contains the result of a \cite, right column item information

moewe
  • 175,683