0

Update 1 I use biblatex and bibber to create my bibliography. the reference section contain a list of the articles referenced. How can the reference section be changed that the reference appear in table. Is the reference section by hand the corresponding latex code will look like

\section{Reference}

\begin{tabularx}{\textwidth}{||c|X||}\hline\hline
    cite1 & Title, author etc\\ \hline 
    cite2 & Title, author etc\\ \hline 
    cite3 & Title, author etc\\ \hline \hline   
\end{tabularx}

The string citeX can be the normal string [citeX] , or of the form X.Y.Z where X,Y,Z are number.

Update 2 (and 3)

From style=authoryear extra block in front of bibliography list the MWE is modified to

\documentclass{article}
\usepackage{longtable}

\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} \\ \hline}
  \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{longtable}{|p{0.2\textwidth}|p{0.8\textwidth}|}\hline}
  {\end{longtable}}
  {\usebibmacro{bibcite}}
  {}

\begin{document}

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

\printbibtabular

\end{document}

the modification is

\defbibtabular{bibtabular}
  {\begin{longtable}{|p{0.2\textwidth}|p{0.8\textwidth}|}\hline}
  {\end{longtable}}
  {\usebibmacro{bibcite}}
  {}

and see comment of Guido

enter image description here

Johan
  • 433

1 Answers1

0

With the help of comments received

\documentclass{article}
\usepackage{longtable}

\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} \\ \hline}
  \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{longtable}{|p{0.2\textwidth}|p{0.8\textwidth}|}\hline}
  {\end{longtable}}
  {\usebibmacro{bibcite}}
  {}

\begin{document}

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

\printbibtabular

\end{document}
Johan
  • 433