我需要使用自定义格式列出引用,并使用标签显示条目类型(@article
、@book
等)并在表格环境中标记固定/可变字段。我已经成功实现了这一点(请参阅下面的 MWE),但我仍然需要控制/改进某些方面:
- 避免计数(我怎样才能抑制
[1]
MWE[2]
中的?) - 垂直位置参考文献的数量及其标签(“文章”)。如何将两者移至顶部(未旋转)或与第一个字段处于同一级别,但两者均旋转,以节省左侧空间?
- 如何正确居中主标签(文章)当旋转 90º 时,就像在 MWE 中一样?
- 如何避免多余的标签
DOI
和URL
?
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{textcomp}
\usepackage{xcolor}
\usepackage{csquotes}
\usepackage{rotating}
\usepackage[backend=biber, maxnames=99, sorting=none, hyperref=true]{biblatex}
\usepackage[colorlinks=true]{hyperref}
\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},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\AtEveryBibitem{
\ifentrytype{article}{\begin{sideways}Article\end{sideways}}{}
}
% \DeclareNameFormat[article]{author}{\dotfill #1 \dotfill}
\DeclareFieldFormat[article,incollection]{title}{\bf #1\isdot}
\DeclareFieldFormat{journaltitle}{\emph{#1}}
\DeclareFieldFormat[article,incollection]{volume}{#1}
\DeclareFieldFormat[article]{number}{#1}
\DeclareFieldFormat{pages}{#1}
\DeclareFieldFormat{year}{#1}
\DeclareBibliographyDriver{article}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\begin{tabular}{lp{0.75\textwidth}} \\
\textcolor{gray}{Authors:} & \printnames{author} \\
\textcolor{gray}{Title:} & \printfield{title} \\
\textcolor{gray}{Year:} & \printfield{year} \\
\textcolor{gray}{Journal:} & \printfield{journaltitle} \\
\textcolor{gray}{Volume:} & \printfield{volume} \\
\textcolor{gray}{Number:} & \printfield{number} \\
\textcolor{gray}{Pages:} & \printfield{pages} \\
\iffieldundef{url}{}{\textcolor{gray}{\sc url:} & \printfield{url} \\}%
\iffieldundef{doi}{}{\textcolor{gray}{\sc doi:} & \printfield{doi} \\}%
\end{tabular}
\vspace{1em}
\hrule
\usebibmacro{finentry}}
\begin{document}
\nocite{*}
\printbibliography[title=My example articles]
\end{document}
答案1
为了避免使用计数style=authoryear
作为选项之一biblatex
Article
对于标签的垂直位置\rotatebox[origin=c]{90}{Article}
而不是sideways
环境(我不清楚您是否想要带有文章的参考编号)
要删除 DOI 和 URL,请\DeclareFieldFormat{x}{\printtext[bibhyperref]{#1}}
使用x
或。url
doi
为了保留参考编号并使其(垂直旋转)与文章标签一起,一个选项是重新定义bibliography
\defbibenvironment{bibliography}
{\list
{\ifentrytype{article}
{\rotatebox[origin=c]{90}{
\printtext[labelnumberwidth]{%
\printfield{prefixnumber}%
\printfield{labelnumber}}%
\addspace%
\MakeSentenceCase{\thefield{entrytype}}}}
{\printtext[labelnumberwidth]{%
\printfield{prefixnumber}%
\printfield{labelnumber}}}}
{\setlength{\labelwidth}{\labelnumberwidth}%
\setlength{\leftmargin}{\labelwidth}%
\setlength{\labelsep}{\biblabelsep}%
\addtolength{\leftmargin}{\labelsep}%
\setlength{\itemsep}{\bibitemsep}%
\setlength{\parsep}{\bibparsep}}%
\renewcommand*{\makelabel}[1]{\hss##1}}
{\endlist}
{\item}
具体来说,我们更改了第一个参数,其中更改了\list
定义默认标签的参数。使用此解决方案,无需使用 at \AtEveryBibitem
,而可以使用numeric
选项 for style
(或省略style
)