我需要使用biblatex
包含标签、作者、标题和其他信息列的 Alpha 样式来按照以下样式自定义我的参考文献。
到目前为止,在您的帮助下,我已经可以将方括号改为斜线。
我目前的代码是:
\documentclass[12pt]{scrartcl}
.
.
\usepackage[%
natbib = true,
backend = bibtex8, %bibtex, biber
style = alphabetic,
%citestyle = alphabetic,
maxcitenames = 2,
mincitenames = 1,
%bibstyle = alphabetic, %authoryear, %draft, %,
sorting = nyvt,
maxbibnames = 6,
minbibnames = 6,
language = ngerman,
date = long,
backref = false,
backrefstyle = none, % none, three, two, two+, three+, all+
firstinits=true
]{biblatex}
\usepackage[babel,german=quotes]{csquotes}
\bibliography{input/literatur}
\newrobustcmd{\mkbibslashes}[1]{/#1/}
\DeclareFieldFormat{labelalphawidth}{\mkbibslashes{#1}}
\DeclareFieldFormat{shorthandwidth}{\mkbibslashes{#1}}
\DeclareCiteCommand{\cite}[\mkbibslashes]
{\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
\usebibmacro{cite}}
{\multicitedelim}
{\usebibmacro{postnote}}
\renewcaptionname{ngerman}{\refname}{Literaturverzeichnis}
.
.
.
再次感谢
答案1
嗯,你的问题可能并不像你想象的那么简单。
您正在使用biblatex
和样式。因此, alphabetic
您需要检查文件standard.bbx
、,最后(如果需要)您必须检查并在路径(对于 MiKTeX)中搜索相关信息。alphabetic.bbx
alphabetic.cbx
C:\Program Files\MiKTeX 2.9\tex\latex\biblatex
在文件中,standard.bbx
你可以找到文章、书籍等的布局定义。例如,我们在驱动程序中查找article
:
\DeclareBibliographyDriver{article}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{author/translator+others}%
\setunit{\labelnamepunct}\newblock
\usebibmacro{title}%
\newunit
\printlist{language}%
\newunit\newblock
\usebibmacro{byauthor}%
\newunit\newblock
\usebibmacro{bytranslator+others}%
\newunit\newblock
\printfield{version}%
\newunit\newblock
\usebibmacro{in:}%
\usebibmacro{journal+issuetitle}%
\newunit
\usebibmacro{byeditor+others}%
\newunit
\usebibmacro{note+pages}%
\newunit\newblock
\iftoggle{bbx:isbn}
{\printfield{issn}}
{}%
\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}}
基于相关问题您现在可以使用以下代码(我仅为文章这样做!如果您的bib
文件包含book
等,您也必须添加相关的驱动程序):
\RequirePackage{filecontents}
\begin{filecontents}{\jobname.bib}
@ARTICLE{mwe2012,
author = {Smith, A. and Johnson, B. and Willians, C.},
title = {The three most common surnames in the United States of America},
journal = {Review of Useless Knowledge},
year = {2012},
volume = {8},
number = {1},
pages = {290--290},
}
@ARTICLE{mwe2011,
author = {Miller, J. and Brown, D.},
title = {Most used surnames in fake passports},
journal = {Journal of Nosense Ranks},
year = {2011},
volume = {5},
number = {3},
pages = {1--130},
pmid = {1234567},
url = {http://www.mwe.com/mwe2011},
doi = {http://dx.doi.org/10.1016/jnr.2011.01.01},
}
@Book{Goossens,
author = {Goossens, Michel and Mittelbach, Frank and
Samarin, Alexander},
title = {The LaTeX Companion},
edition = {1},
publisher = {Addison-Wesley},
location = {Reading, Mass.},
year = {1994},
}
@Book{adams,
title = {The Restaurant at the End of the Universe},
author = {Douglas Adams},
series = {The Hitchhiker's Guide to the Galaxy},
publisher = {Pan Macmillan},
year = {1980},
}
article{einstein,
author = {Albert Einstein},
title = {{Zur Elektrodynamik bewegter K{\"o}rper}. ({German})
[{On} the electrodynamics of moving bodies]},
journal = {Annalen der Physik},
volume = {322},
number = {10},
pages = {891--921},
year = {1905},
DOI = {http://dx.doi.org/10.1002/andp.19053221004},
}
\end{filecontents}
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{textcomp}
\usepackage[ngerman]{babel}
\usepackage{showframe}
\usepackage{array} % > in table
\usepackage{ragged2e} % \RaggedRight in table
\usepackage{xcolor}
\usepackage{csquotes}
\usepackage{rotating}
\usepackage[%
backend = biber,
maxnames = 99,
sorting = nyvt,
hyperref = true,
maxcitenames = 2,
mincitenames = 1,
natbib = true,
giveninits = true, % firstinits
style = alphabetic
]{biblatex}
\addbibresource{\jobname.bib}
\usepackage{microtype}
\usepackage[colorlinks=true,breaklinks]{hyperref}
\newrobustcmd{\mkbibslashes}[1]{/#1/}
\DeclareFieldFormat{labelalphawidth}{\mkbibslashes{#1}}
\DeclareFieldFormat{shorthandwidth}{\mkbibslashes{#1}}
\DeclareFieldFormat{mkbibslashes}{\mkbibslashes{#1}}
\renewcommand*{\newunitpunct}{\addcomma\space}
\renewcommand*{\finentrypunct}{} % no punct after entry
\DeclareCiteCommand{\cite}[\mkbibslashes]
{\usebibmacro{prenote}}
{\usebibmacro{citeindex}\usebibmacro{cite}}
{\multicitedelim}
{\usebibmacro{postnote}}
\defbibenvironment{bibliography}
{\list
{\ifentrytype{article}
{\rotatebox[origin=c]{90}{
\printtext[labelalphawidth]{% mkbibslashes
\printfield{prefixnumber}%
\printfield{labelalpha}%
\printfield{extraalpha}}%
%\addspace%
%\MakeSentenceCase{\thefield{entrytype}}%
}}
{\printtext[labelalphawidth]{% mkbibslashes
\printfield{prefixnumber}%
\printfield{labelalpha}%
\printfield{extraalpha}}}}
{\setlength{\labelwidth}{\labelnumberwidth}%\labelnumberwidth or \labelalphawidth
\setlength{\leftmargin}{\labelwidth}%
\setlength{\labelsep}{\biblabelsep}%
\addtolength{\leftmargin}{\labelsep}%
\setlength{\itemsep}{\bibitemsep}%
\setlength{\parsep}{\bibparsep}}%
\renewcommand*{\makelabel}[1]{##1\hss}}% \hss##1
{\endlist}
{\item}
\DeclareFieldFormat{doi}{\printtext[bibhyperref]{#1}}
\DeclareFieldFormat{url}{\printtext[bibhyperref]{#1}}
% \DeclareNameFormat[article]{author}{\dotfill #1 \dotfill}
%\DeclareFieldFormat[article,incollection]{title}{\bf #1\isdot}
\DeclareFieldFormat[article,incollection]{title}{\enquote{#1}}%\isdot}
\DeclareFieldFormat{journaltitle}{\emph{#1}}
\DeclareFieldFormat[article,incollection]{volume}{#1}
\DeclareFieldFormat[article]{number}{#1}
\DeclareFieldFormat{pages}{S.~#1}
\DeclareFieldFormat{year}{#1}
\DeclareBibliographyDriver{article}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\begin{tabular}{>{\RaggedRight}p{0.2\textwidth}>{\RaggedRight}p{0.68\textwidth}}\\
\printnames{author} &
\printfield{title}\newunit \printfield{year}\newunit
\printfield{journaltitle}\newunit \printfield{volume}\newunit
\printfield{number}\newunit \printfield{pages}\newunit
\printfield{url}\newunit \printfield{doi}\newunit \\%
\end{tabular}
\vspace{1em}% 1em
\hrule
\usebibmacro{finentry}}
\begin{document}
\nocite{*} \cite{mwe2011}
\printbibliography[title=My example articles]
\end{document}
为了节省一点空间,最好将标签旋转 90 度。如果您不想这样做,请更改代码
{\rotatebox[origin=c]{90}{
\printtext[labelalphawidth]{% mkbibslashes
\printfield{prefixnumber}%
\printfield{labelalpha}%
\printfield{extraalpha}}%
%\addspace%
%\MakeSentenceCase{\thefield{entrytype}}%
}}
到
{%\rotatebox[origin=c]{90}{
\printtext[labelalphawidth]{% mkbibslashes
\printfield{prefixnumber}%
\printfield{labelalpha}%
\printfield{extraalpha}}%
%\addspace%
%\MakeSentenceCase{\thefield{entrytype}}%
}%}
并改变行
{\setlength{\labelwidth}{\labelnumberwidth}%\labelnumberwidth or \labelalphawidth
到
{\setlength{\labelwidth}{\labelalphawidth}%\labelnumberwidth or \labelalphawidth
我添加了一些bib
条目来向您显示您需要添加相关的驱动程序book
等等。
使用代码
\begin{tabular}{>{\RaggedRight}p{0.2\textwidth}>{\RaggedRight}p{0.68\textwidth}}\\
\printnames{author} &
\printfield{title}\newunit \printfield{year}\newunit
\printfield{journaltitle}\newunit \printfield{volume}\newunit
\printfield{number}\newunit \printfield{pages}\newunit
\printfield{url}\newunit \printfield{doi}\newunit \\%
\end{tabular}
我根据您的需要定义了所需的表格。请注意,您必须调整两列的宽度p{0.2\textwidth}
和p{0.68\textwidth}
。{\RaggedRight}
我强制使用左边两列的布局均合理(更好,因为行变得很短)。
这两条线
\renewcommand*{\newunitpunct}{\addcomma\space}
\renewcommand*{\finentrypunct}{} % no punct after entry
将单位之间的符号更改为逗号(如屏幕截图所示)并删除每个条目的结束标点。
最后两行
\vspace{1em}% 1em
\hrule
用水平线分隔每个打印条目。我个人不喜欢这样,会删除它。
您需要为其他类型的条目添加类似的驱动程序...
然后我得到结果:
请注意,这是一个起点,您需要完成它。但是有了给定的信息,应该可以……