我正在编写出版物列表,并使用\fullcite
将 bib 条目放在正文中。由于这是我的出版物列表,我想将标题放在首位(我假设读者对标题的兴趣会比对作者的兴趣更浓厚,作者一再重复)。我似乎找不到可以做到这一点的参考书目样式,而且 latex 也没有这个选项makebst
。下面包含了一个最小的非工作示例文本。我怎样才能将标题放在作者之前?
\documentclass{article}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@Book{test1,
author = {Goossens, Michel and Mittelbach,
Frank and Samarin, Alexander},
title = {The LaTeX Companion},
publisher = {Addison-Wesley},
location = {Reading, Mass.},
year = {1994},
}
\end{filecontents}
\usepackage{bibentry}
\usepackage{biblatex}
\nobibliography{\jobname.bib}
\begin{document}
\fullcite{test1}
\end{document}
答案1
您可以尝试类似
\AtNextCite{\def\do#1{\togglefalse{blx@use#1}}\dolistcsloop{blx@datamodel@names}}
\fullcite{companion}
对于更复杂的用途,最好定义一些辅助宏
\newcommand{\nameuse}[1]{%
\def\do##1{\settoggle{blx@use##1}{#1}}%
\dolistcsloop{blx@datamodel@names}}
\newcommand{\nameusesave}{%
\def\do##1{%
\providetoggle{blx@save@use##1}%
\iftoggle{blx@use##1}{\toggletrue{blx@save@use##1}}{\togglefalse{blx@save@use##1}}%
}%
\dolistcsloop{blx@datamodel@names}}
\newcommand{\nameuserestore}{%
\def\do##1{%
\iftoggle{blx@save@use##1}{\toggletrue{blx@use##1}}{\togglefalse{blx@use##1}}%
}%
\dolistcsloop{blx@datamodel@names}}
然后你可以使用
\nameusesave
\nameuse{false}
\fullcite{sigfridsson}
\nameuserestore
如果你正在编写出版物列表,你可能需要使用\printbibliography
过滤功能(例如基于类别)
\documentclass{article}
\usepackage{biblatex}
\addbibresource{biblatex-examples.bib}
\DeclareBibliographyCategory{mine}
\addtocategory{mine}{companion,sigfridsson}
\nocite{companion,sigfridsson}
\newcommand{\nameuse}[1]{%
\def\do##1{\settoggle{blx@use##1}{#1}}%
\dolistcsloop{blx@datamodel@names}}
\newcommand{\nameusesave}{%
\def\do##1{%
\providetoggle{blx@save@use##1}%
\iftoggle{blx@use##1}{\toggletrue{blx@save@use##1}}{\togglefalse{blx@save@use##1}}%
}%
\dolistcsloop{blx@datamodel@names}}
\newcommand{\nameuserestore}{%
\def\do##1{%
\iftoggle{blx@save@use##1}{\toggletrue{blx@use##1}}{\togglefalse{blx@use##1}}%
}%
\dolistcsloop{blx@datamodel@names}}
\begin{document}
\nameusesave
\nameuse{false}
\printbibliography[category=mine]
\nameuserestore
\printbibliography[category=mine]
\end{document}
鉴于标题在参考书目中排在第一位,需要更新,这个答案已经更新,以适应较新版本的biblatex
,请参阅早期代码的版本历史记录。
答案2
这是一个定义自定义引用命令的小例子。目前,它只适用于文章条目,但我用它来生成出版物列表。
\documentclass{article}
\usepackage{filecontents}
\usepackage[backend=biber]{biblatex}
\begin{filecontents*}{\jobname.bib}
@article{dummy2017,
title = {Formatting citations the way you want},
volume = {113},
number = {12},
urldate = {2015-05-05},
journal = {Nonexistant Review Letters},
author = {Smith, John and Doe, John},
year = {2017},
pages = {214221},
}
\end{filecontents*}
\addbibresource{\jobname.bib}
% Custom cite command with a newline for authors and journal
\DeclareCiteCommand{\mycite}
{\usebibmacro{prenote}}
{\usebibmacro{maintitle+title}
\newline\nopunct\newblock
\usebibmacro{author}
\newline\nopunct\newblock
\usebibmacro{journal+issuetitle}
}
{\multicitedelim}
{\usebibmacro{postnote}}
% Make the titles in bold
\DeclareFieldFormat
[article,book,inbook,incollection,inproceedings,patent,thesis,unpublished]
{title}{{\bf #1}}
\begin{document}
\noindent
\mycite{dummy2017}
\end{document}