我想用 BibLaTeX 创建自定义参考书目。我已经几乎达到要求的程度,但我无法将参考书目分成两列,也不知道如何在每列下方写上作者。
期望输出:
电流输出:
我的代码: %!TEX root = ../root.tex
% Formats the bibliography environment
\defbibenvironment{bibliography}
{\list
{\usebibmacro{author/editor+others/translator+others}}
{\setlength{\leftmargin}{0.2\textwidth}%
\setlength{\itemindent}{-\leftmargin}%
\setlength{\itemsep}{\bibitemsep}%
\setlength{\parsep}{\bibparsep}}}
{\endlist}
{\item}
\makeatletter
\AtEveryBibitem{%
\global\undef\bbx@lasthash%
\clearfield{extrayear}}
\makeatother
% Adds ":" after authors.
\renewcommand{\labelnamepunct}{\addcolon\space}
% Commas between units
\renewcommand{\newunitpunct}{\addcomma\space}
% Delimiter between multiple authors:
\renewcommand{\multinamedelim}{\addsemicolon\space}
% Delimiter between last two authors:
\renewcommand{\finalnamedelim}{\addsemicolon\space}
% More space between entries
\setlength\bibitemsep{2\itemsep}
% Lastname, Firstname for all authors
\DeclareNameAlias{sortname}{family-given}
% Remove url prefix
\DeclareFieldFormat{url}{\url{#1}}
% o.J. if no date is given
\newcommand{\mkbibnodate}{\addcomma \space o\adddot J\adddot}
\renewbibmacro*{publisher+location+date}{%
\printlist{location}%
\iflistundef{publisher}
{\setunit*{\addcomma\space}}
{\setunit*{\addcolon\space}}%
\printlist{publisher}%
\setunit*{\addcomma\space}%
\iffieldundef{year}
{\mkbibnodate}
{\usebibmacro{date}}
\newunit}
% Makes title in this Format: (Shorttitle) Title
\renewbibmacro*{title}{%
\printfield[parens]{shorttitle}%
\setunit{\space}%
\printfield{title}%
\newunit}
% Bibliography style online, modified
\DeclareBibliographyDriver{online}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
%\usebibmacro{author/editor+others/translator+others}%
%\setunit{\printdelim{nametitledelim}}\newblock
\usebibmacro{title}%
\newunit
\printfield{subtitle}
\printlist{language}%
\newunit\newblock
\usebibmacro{byauthor}%
\newunit\newblock
\usebibmacro{byeditor+others}%
\newunit\newblock
\printfield{version}%
\newunit
\printfield{note}%
\newunit\newblock
\printlist{organization}%
\newunit\newblock
\iffieldundef{year}
{\mkbibnodate}
{\usebibmacro{date}}
\newunit\newblock
\iftoggle{bbx:eprint}
{\usebibmacro{eprint}}
{}%
\newunit\newblock
\usebibmacro{url+urldate}%
\newunit\newblock
\usebibmacro{addendum+pubstate}%
\setunit{\bibpagerefpunct}\newblock
\usebibmacro{pageref}%
\newunit\newblock
\iftoggle{bbx:related}
{\usebibmacro{related:init}%
\usebibmacro{related}}
{}%
\usebibmacro{finentry}}
% Bibliography style book, modified
\DeclareBibliographyDriver{book}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{author/editor+others/translator+others}%
\setunit{\printdelim{nametitledelim}}\newblock
\usebibmacro{maintitle+title}%
\newunit
\printfield{subtitle}
\printlist{language}%
\newunit\newblock
\usebibmacro{byauthor}%
\newunit\newblock
\usebibmacro{byeditor+others}%
\newunit\newblock
\printfield{edition}%
\newunit
\iffieldundef{maintitle}
{\printfield{volume}%
\printfield{part}}
{}%
\newunit
\printfield{volumes}%
\newunit\newblock
\usebibmacro{series+number}%
\newunit\newblock
\printfield{note}%
\newunit\newblock
\usebibmacro{publisher+location+date}%
\newunit\newblock
\usebibmacro{chapter+pages}%
\newunit
\printfield{pagetotal}%
\newunit\newblock
\usebibmacro{doi+eprint+url}%
\newunit\newblock
\usebibmacro{addendum+pubstate}%
\setunit{\bibpagerefpunct}\newblock
\usebibmacro{pageref}%
\newunit\newblock
\iftoggle{bbx:related}
{\usebibmacro{related:init}%
\usebibmacro{related}}
{}%
\usebibmacro{finentry}}
提前感谢您的帮助!
编辑:
梅威瑟:
\documentclass{article}
\usepackage[backend=biber,style=authortitle,citestyle=authortitle,hyperref=true,autocite=footnote,sortlocale=de_DE,dashed=false,maxnames=99]{biblatex}
\addbibresource{\jobname.bib}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@online{chickenlittle,
author = {Jesus Bisbal and Deirdre Lawless and Bing Wu and Jane Grimson and Vincent Wade and Ray Richardson and Donie O'Sullivan},
title = {A Survey of Research into Legacy System Migration},
shorttitle = {Legacy Migration},
institution = {Trinity College},
publisher = {Trinity College},
year = {1997},
url = {http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.50.9051},
urldate = {2018-07-11}
}
@online{incmigration,
author = {Michael L. Brodie and Michael Stonebraker},
title = {DARWIN: On the Incremental Migration of Legacy Information Systems 1},
shorttitle = {Incremental Migration},
year = {1993},
institution = {University of California},
publisher = {University of California},
month = {3},
urldate = {2018-07-11},
url = {http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.70.2950}
}
@online{porting,
author = "{Microsoft Corporation}",
title = {Porting to .NET Core from .NET Framework},
shorttitle = {Porting in .NET},
date = {2016-06-20},
url = {https://docs.microsoft.com/en-us/dotnet/core/porting/},
urldate = {2018-06-26}
}
@online{netframeworkfirstrelease,
author = "{Microsoft Corporation}",
title = {.NET Framework Versions and Dependencies},
shorttitle = {.NET Framework Initial Release},
date = {2018-05-31},
urldate = {2018-07-09},
url = {https://docs.microsoft.com/en-us/dotnet/framework/migration-guide/versions-and-dependencies}
}
@online{whatisdotnet,
author = "{Microsoft Corporation}",
title = {What is .NET?},
shorttitle = {What is .NET?},
date = {2018-07-06},
urldate = {2018-07-06},
url = {https://www.microsoft.com/net/learn/what-is-dotnet}
}
@online{azureiotedge,
author = "{Microsoft Corporation}",
title = {What is Azure IoT Edge},
shorttitle = {Azure IoT Edge},
date = {2018-06-12},
urldate = {2018-07-02},
url = {https://docs.microsoft.com/de-de/azure/iot-edge/about-iot-edge}
}
@online{netapianal,
author = "{Microsoft Corporation}",
title = {.NET API analyzer},
shorttitle = {.NET API analyzer},
date = {2018-07-02},
urldate = {2018-05-31},
url = {https://docs.microsoft.com/de-de/dotnet/standard/analyzers/api-analyzer}
}
\end{filecontents}
\makeatletter
\AtEveryBibitem{%
\global\undef\bbx@lasthash%
\clearfield{extrayear}}
\makeatother
% Adds ":" after authors.
\renewcommand{\labelnamepunct}{\addcolon\space}
% Commas between units
\renewcommand{\newunitpunct}{\addcomma\space}
% Delimiter between multiple authors:
\renewcommand{\multinamedelim}{\addsemicolon\space}
% Delimiter between last two authors:
\renewcommand{\finalnamedelim}{\addsemicolon\space}
% More space between entries
\setlength\bibitemsep{2\itemsep}
% Lastname, Firstname for all authors
\DeclareNameAlias{sortname}{family-given}
% Remove url prefix
\DeclareFieldFormat{url}{\url{#1}}
% o.J. if no date is given
\newcommand{\mkbibnodate}{\addcomma \space o\adddot J\adddot}
\renewbibmacro*{publisher+location+date}{%
\printlist{location}%
\iflistundef{publisher}
{\setunit*{\addcomma\space}}
{\setunit*{\addcolon\space}}%
\printlist{publisher}%
\setunit*{\addcomma\space}%
\iffieldundef{year}
{\mkbibnodate}
{\usebibmacro{date}}
\newunit}
% Makes title in this Format: (Shorttitle) Title
\renewbibmacro*{title}{%
\printfield[parens]{shorttitle}%
\setunit{\space}%
\printfield{title}%
\newunit}
% Bibliography style online, modified
\DeclareBibliographyDriver{online}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{author/editor+others/translator+others}%
\setunit{\printdelim{nametitledelim}}\newblock
\printtext{\newline}%
\usebibmacro{title}%
\newunit
\printfield{subtitle}
\printlist{language}%
\newunit\newblock
\usebibmacro{byauthor}%
\newunit\newblock
\usebibmacro{byeditor+others}%
\newunit\newblock
\printfield{version}%
\newunit
\printfield{note}%
\newunit\newblock
\printlist{organization}%
\newunit\newblock
\iffieldundef{year}
{\mkbibnodate}
{\usebibmacro{date}}
\newunit\newblock
\iftoggle{bbx:eprint}
{\usebibmacro{eprint}}
{}%
\newunit\newblock
\usebibmacro{url+urldate}%
\newunit\newblock
\usebibmacro{addendum+pubstate}%
\setunit{\bibpagerefpunct}\newblock
\usebibmacro{pageref}%
\newunit\newblock
\iftoggle{bbx:related}
{\usebibmacro{related:init}%
\usebibmacro{related}}
{}%
\usebibmacro{finentry}}
% Bibliography style book, modified
\DeclareBibliographyDriver{book}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{author/editor+others/translator+others}%
\setunit{\printdelim{nametitledelim}}\newblock
\printtext{\newline}%
\usebibmacro{maintitle+title}%
\newunit
\printfield{subtitle}
\printlist{language}%
\newunit\newblock
\usebibmacro{byauthor}%
\newunit\newblock
\usebibmacro{byeditor+others}%
\newunit\newblock
\printfield{edition}%
\newunit
\iffieldundef{maintitle}
{\printfield{volume}%
\printfield{part}}
{}%
\newunit
\printfield{volumes}%
\newunit\newblock
\usebibmacro{series+number}%
\newunit\newblock
\printfield{note}%
\newunit\newblock
\usebibmacro{publisher+location+date}%
\newunit\newblock
\usebibmacro{chapter+pages}%
\newunit
\printfield{pagetotal}%
\newunit\newblock
\usebibmacro{doi+eprint+url}%
\newunit\newblock
\usebibmacro{addendum+pubstate}%
\setunit{\bibpagerefpunct}\newblock
\usebibmacro{pageref}%
\newunit\newblock
\iftoggle{bbx:related}
{\usebibmacro{related:init}%
\usebibmacro{related}}
{}%
\usebibmacro{finentry}}
\begin{document}
\cite{porting}
\printbibliography
\end{document}
Biber/BibLaTeX 版本:最新版本
答案1
表格书目已整合到
biblatex-ext
。如果加载支持包,biblatex-ext-tabular
下面的代码将简化为\documentclass[british]{article} \usepackage{babel} \usepackage{csquotes} \usepackage[backend=biber, style=authortitle, autocite=footnote, dashed=false, maxnames=99]{biblatex} \usepackage{hyperref} \DeclareDelimFormat[bib,biblist]{nametitledelim}{\addcolon\space} \renewcommand{\newunitpunct}{\addcomma\space} \DeclareDelimFormat{multinamedelim}{\addsemicolon\space} \DeclareDelimAlias{finalnamedelim}{multinamedelim} \DeclareNameAlias{sortname}{family-given} \DeclareFieldFormat*{shorttitle}{\mkbibparens{#1}} \DeclareFieldFormat{url}{\url{#1}} \renewbibmacro*{date}{% \iffieldundef{year} {\printtext{\bibstring{nodate}}} {\printdate}} \makeatletter \usepackage{biblatex-ext-tabular} % sortname labels (a robust style should add provision for missing labelnames) \newbibmacro*{sortname}{% \ifnameundef{labelname} {\printtext[bold]{No name given.}% \PackageWarning{biblatex}{No labelname for entry \thefield{entrykey},\MessageBreak we need to think of something else}} {\printnames[sortname]{labelname}% \iffieldequalstr{labelnamesource}{editor} {\setunit{\printdelim{editortypedelim}}% \usebibmacro{editor+othersstrg}} {\iffieldequalstr{labelnamesource}{translator} {\setunit{\printdelim{translatortypedelim}}% \usebibmacro{translator+othersstrg}} {}}}} \usepackage{array} \newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}p{#1}} \newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}p{#1}} \newcolumntype{R}[1]{>{\raggedleft\let\newline\\\arraybackslash\hspace{0pt}}p{#1}} \usepackage{longtable} % demo new tabular bibliography format % I strongly prefer left-aligned with fixed width (L) % over justified (p) here % longtable for tables that break over pages \defbibtabular{bibtabular} {\def\arraystretch{2}% \begin{longtable}{@{}L{\dimexpr0.3\textwidth-\tabcolsep\relax}L{\dimexpr0.7\textwidth-\tabcolsep\relax}@{}}} {\end{longtable}} {\anchorlang{\usebibmacro{sortname}} & \driver{\usebibmacro{tabular:omitsortname}} \\} \renewbibmacro*{begentry}{% \printfield{shorttitle}% \printunit*{\addspace}} \usepackage{filecontents} \begin{filecontents}{\jobname.bib} @online{chickenlittle, author = {Jesus Bisbal and Deirdre Lawless and Bing Wu and Jane Grimson and Vincent Wade and Ray Richardson and Donie O'Sullivan}, title = {A Survey of Research into Legacy System Migration}, shorttitle = {Legacy Migration}, institution = {Trinity College}, publisher = {Trinity College}, year = {1997}, url = {http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.50.9051}, urldate = {2018-07-11} } @online{incmigration, author = {Michael L. Brodie and Michael Stonebraker}, title = {DARWIN: On the Incremental Migration of Legacy Information Systems 1}, shorttitle = {Incremental Migration}, year = {1993}, institution = {University of California}, publisher = {University of California}, month = {3}, urldate = {2018-07-11}, url = {http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.70.2950} } @online{porting, author = {{Microsoft Corporation}}, title = {Porting to .NET Core from .NET Framework}, shorttitle = {Porting in .NET}, date = {2016-06-20}, url = {https://docs.microsoft.com/en-us/dotnet/core/porting/}, urldate = {2018-06-26} } \end{filecontents} \addbibresource{\jobname.bib} \addbibresource{biblatex-examples.bib} \begin{document} \cite{porting,incmigration,chickenlittle, sigfridsson,ctan,westfahl:frontier, knuth:ct:a,knuth:ct:b,worman,geer,nussbaum} \printbibtabular \end{document}
这是一个基于的解决方案奥黛丽的回答到使用 biblatex 的表格书目。由于内部宏的更改,Audrey 的答案的代码略有更改。我还对您的代码进行了现代化改造,并尽可能缩短了代码。
\documentclass[british]{article}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[backend=biber, style=authortitle, autocite=footnote, dashed=false, maxnames=99]{biblatex}
\usepackage{hyperref}
\DeclareDelimFormat[bib,biblist]{nametitledelim}{\addcolon\space}
\renewcommand{\newunitpunct}{\addcomma\space}
\DeclareDelimFormat{multinamedelim}{\addsemicolon\space}
\DeclareDelimAlias{finalnamedelim}{multinamedelim}
\DeclareNameAlias{sortname}{family-given}
\DeclareFieldFormat*{shorttitle}{\mkbibparens{#1}}
\DeclareFieldFormat{url}{\url{#1}}
\renewbibmacro*{date}{%
\iffieldundef{year}
{\printtext{\bibstring{nodate}}}
{\printdate}}
\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@langstrings
\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}%
\csuse{blx@hook@bibinit@next}%
% 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
\endgroup% this closed a goup opened by \printbibtabular
}
\def\bbx@tab@label#1{%
\begingroup
\blx@getdata{#1}%
\blx@setdefaultrefcontext{#1}%
\blx@setoptions@type\abx@field@entrytype
\blx@setoptions@entry
\blx@thelabelnumber
\blx@initsep
\blx@namesep
\csuse{blx@hook@bibitem}%
\addtocounter{instcount}\@ne
\blx@anchor
\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
\blx@thelabelnumber
\csuse{blx@hook@bibitem}%
\csuse{blx@item@\blx@theenv}\relax
\blx@execute
\blx@initunit
\blx@beglangbib
\bibsentence
\blx@pagetracker
\blx@driver\abx@field@entrytype
\blx@postpunct
\blx@endlangbib
\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
% sortname labels (a robust style should add provision for missing labelnames)
\newbibmacro*{sortname}{%
\ifnameundef{labelname}
{\printtext[bold]{No name given.}%
\PackageWarning{biblatex}{No labelname for entry \thefield{entrykey},\MessageBreak
we need to think of something else}}
{\printnames[sortname]{labelname}%
\iffieldequalstr{labelnamesource}{editor}
{\setunit{\printdelim{editortypedelim}}%
\usebibmacro{editor+othersstrg}}
{\iffieldequalstr{labelnamesource}{translator}
{\setunit{\printdelim{translatortypedelim}}%
\usebibmacro{translator+othersstrg}}
{}}}}
% bibitem hook to suppress redundant sortname list
\newbibmacro*{omitsortname}{%
\ifnameundef{labelname}
{}
{\clearname{\thefield{labelnamesource}}}}
\usepackage{array}
\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}p{#1}}
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}p{#1}}
\newcolumntype{R}[1]{>{\raggedleft\let\newline\\\arraybackslash\hspace{0pt}}p{#1}}
\usepackage{longtable}
% demo new tabular bibliography format
% I strongly prefer left-aligned with fixed width (L)
% over justified (p) here
% longtable for tables that break over pages
\defbibtabular{bibtabular}
{\def\arraystretch{2}%
\begin{longtable}{@{}L{\dimexpr0.3\textwidth-\tabcolsep\relax}L{\dimexpr0.7\textwidth-\tabcolsep\relax}@{}}}
{\end{longtable}}
{\usebibmacro{sortname}}
{\usebibmacro{omitsortname}}
\renewbibmacro*{begentry}{%
\printfield{shorttitle}%
\printunit*{\addspace}}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@online{chickenlittle,
author = {Jesus Bisbal and Deirdre Lawless and Bing Wu and Jane Grimson and Vincent Wade and Ray Richardson and Donie O'Sullivan},
title = {A Survey of Research into Legacy System Migration},
shorttitle = {Legacy Migration},
institution = {Trinity College},
publisher = {Trinity College},
year = {1997},
url = {http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.50.9051},
urldate = {2018-07-11}
}
@online{incmigration,
author = {Michael L. Brodie and Michael Stonebraker},
title = {DARWIN: On the Incremental Migration of Legacy Information Systems 1},
shorttitle = {Incremental Migration},
year = {1993},
institution = {University of California},
publisher = {University of California},
month = {3},
urldate = {2018-07-11},
url = {http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.70.2950}
}
@online{porting,
author = {{Microsoft Corporation}},
title = {Porting to .NET Core from .NET Framework},
shorttitle = {Porting in .NET},
date = {2016-06-20},
url = {https://docs.microsoft.com/en-us/dotnet/core/porting/},
urldate = {2018-06-26}
}
\end{filecontents}
\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}
\begin{document}
\cite{porting,incmigration,chickenlittle,
sigfridsson,ctan,westfahl:frontier,
knuth:ct:a,knuth:ct:b,worman,geer,nussbaum}
\printbibtabular
\end{document}
表格书目更复杂,因为通常的设置假设书目最终是使用某种列表环境创建的。由于列表的填充方式与普通文本段落非常相似,因此没有什么特别之处。另一方面,使用表格则需要做一些额外的事情。
该解决方案允许完全定制两列表格书目,其中第一列通过定义\defbibtabular
,第二列由书目驱动程序像往常一样填充。