我使用 biblatex 进行引用,它提供了诸如\citetitle
和 之类的内容\fullcite
。\fullcite
这几乎就是我想要的,但它以作者开头,而不是标题。\citetitle
只会引用标题,而不会引用记录的其他数据。有没有办法先按标题完全引用 bibkey:
“一种新颖的方法...”,F. Bar,B. Foo,在:“新颖的新方法”,1656 年。
考虑以下代码:
\documentclass{article}
\usepackage{lipsum}
\usepackage{biblatex}
\usepackage{filecontents}
\begin{filecontents}{foobar.bib}
@article{foobar,
author={Bar Foo and Foo Bar},
title={A novel approach for citations},
journal={FOOBAR},
volume={23},
year={2042},
}
\end{filecontents}
\addbibresource{foobar.bib}
\begin{document}
This chapter is based on: \fullcite{foobar}\vspace{1cm}
This chapter is based on: \citetitle{foobar}\vspace{1cm}
But I still want to have it in normal mode as this \textcite{foobar}.
\printbibliography
\end{document}
其结果如下:
我想要的是,保留参考文献(和 bib 样式)和文本引用,但更改\fullcite{foobar}
为以标题开头(或模拟这种行为):
答案1
这应该很容易
\makeatletter
\DeclareCiteCommand{\bfullcite}
{\usebibmacro{prenote}}
{\renewcommand*{\newunitpunct}{\addcomma\space}%
\settoggle{blx@useauthor}{false}%
\settoggle{blx@useeditor}{false}%
\settoggle{blx@usetranslator}{false}%
\usedriver
{\DeclareNameAlias{sortname}{default}}
{\thefield{entrytype}}}
{\multicitedelim}
{\usebibmacro{postnote}}
\makeatother
我们定义一个新的命令\bfullcite
(当然你可以覆盖\fullcite
)和(本地和临时)切换useauthor
,useeditor
并将usetranslator
为false,因此它们的名称出现在标题之后。
然而,这可能无法满足您对编辑姓名的要求,因此我们采用了以下非常丑陋的修改
\makeatletter
\DeclareCiteCommand{\bfullcite}
{\usebibmacro{prenote}}
{\renewbibmacro*{byeditor}{%
\ifnameundef{editor}
{}
{\printnames[byeditor]{editor}%
\setunit{\addcomma\space}%
\usebibmacro{bytypestrg}{editor}{editor}%
\newunit}%
\usebibmacro{byeditorx}}%
\renewbibmacro*{byeditorx}{%
\ifnameundef{editora}
{}
{\printnames[byeditor]{editor}%
\setunit{\addcomma\space}%
\usebibmacro{bytypestrg}{editor}{editor}%
\newunit}%
\ifnameundef{editorb}
{}
{\printnames[byeditorb]{editorb}%
\setunit{\addcomma\space}%
\usebibmacro{bytypestrg}{editorb}{editor}%
\newunit}%
\ifnameundef{editorc}
{}
{\printnames[byeditorc]{editorc}%
\setunit{\addcomma\space}%
\usebibmacro{bytypestrg}{editorc}{editor}%
\newunit}}%
\renewbibmacro*{bytranslator}{%
\ifnameundef{translator}
{}
{\printnames[bytranslator]{translator}%
\setunit{\addcomma\space}%
\bibstring{bytranslator}}}%
\renewbibmacro*{byeditor+others}{%
\ifnameundef{editor}
{}
{\printnames[byeditor]{editor}%
\clearname{editor}%
\setunit{\addcomma\space}%
\usebibmacro{byeditor+othersstrg}%
\newunit}%
\usebibmacro{byeditorx}%
\usebibmacro{bytranslator+others}}%
\renewbibmacro*{bytranslator+others}{%
\ifnameundef{translator}
{}
{\printnames[bytranslator]{translator}%
\clearname{translator}%
\setunit{\addcomma\space}%
\usebibmacro{bytranslator+othersstrg}%
\newunit}%
\usebibmacro{withothers}}%
\renewbibmacro*{bytypestrg}[2]{%
\iffieldundef{#1type}
{\bibstring{#2}}
{\ifbibxstring{\thefield{#1type}}
{\bibstring{\thefield{#1type}}}
{\printtext{\thefield{#1type}}}}}
\makeatletter
\renewbibmacro*{byeditor+othersstrg}{%
\iffieldundef{editortype}
{\def\abx@tempa{editor}}
{\edef\abx@tempa{\thefield{editortype}}}%
\let\abx@tempb=\empty
\ifnamesequal{editor}{translator}
{\appto\abx@tempa{tr}%
\appto\abx@tempb{\clearname{translator}}}
{}%
\ifnamesequal{editor}{commentator}
{\appto\abx@tempa{co}%
\appto\abx@tempb{\clearname{commentator}}}
{\ifnamesequal{editor}{annotator}
{\appto\abx@tempa{an}%
\appto\abx@tempb{\clearname{annotator}}}
{}}%
\ifnamesequal{editor}{introduction}
{\appto\abx@tempa{in}%
\appto\abx@tempb{\clearname{introduction}}}
{\ifnamesequal{editor}{foreword}
{\appto\abx@tempa{fo}%
\appto\abx@tempb{\clearname{foreword}}}
{\ifnamesequal{editor}{afterword}
{\appto\abx@tempa{af}%
\appto\abx@tempb{\clearname{afterword}}}
{}}}%
\ifbibxstring{\abx@tempa}
{\printtext{\bibstring{\abx@tempa}}\abx@tempb}
{\usebibmacro{bytypestrg}{editor}{editor}}}%
\renewbibmacro*{bytranslator+othersstrg}{%
\def\abx@tempa{translator}%
\ifnamesequal{translator}{commentator}
{\appto\abx@tempa{co}%
\clearname{commentator}}
{\ifnamesequal{translator}{annotator}
{\appto\abx@tempa{an}%
\clearname{annotator}}
{}}%
\ifnamesequal{translator}{introduction}
{\appto\abx@tempa{in}%
\clearname{introduction}}
{\ifnamesequal{translator}{foreword}
{\appto\abx@tempa{fo}%
\clearname{foreword}}
{\ifnamesequal{translator}{afterword}
{\appto\abx@tempa{af}%
\clearname{afterword}}
{}}}%
\bibstring{\abx@tempa}}%
\renewcommand*{\newunitpunct}{\addcomma\space}%
\settoggle{blx@useauthor}{false}%
\settoggle{blx@useeditor}{false}%
\settoggle{blx@usetranslator}{false}%
\usedriver
{\DeclareNameAlias{sortname}{default}}
{\thefield{entrytype}}}
{\multicitedelim}
{\usebibmacro{postnote}}
\makeatother
其中编辑器宏被制作为打印“Eddie Ditorm,ed。”而不是“由Eddie Ditor编辑”。
平均能量损失
\documentclass[british,a4paper,12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{babel}
\usepackage{csquotes}
\usepackage{biblatex}
\usepackage{hyperref}
\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@article{foobar,
author={Bar Foo and Foo Bar},
title={A novel approach for citations},
journal={FOOBAR},
volume={23},
year={2042},
}
\end{filecontents*}
\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}
\makeatletter
\DeclareCiteCommand{\bfullcite}
{\usebibmacro{prenote}}
{\renewbibmacro*{byeditor}{%
\ifnameundef{editor}
{}
{\printnames[byeditor]{editor}%
\setunit{\addcomma\space}%
\usebibmacro{bytypestrg}{editor}{editor}%
\newunit}%
\usebibmacro{byeditorx}}%
\renewbibmacro*{byeditorx}{%
\ifnameundef{editora}
{}
{\printnames[byeditor]{editor}%
\setunit{\addcomma\space}%
\usebibmacro{bytypestrg}{editor}{editor}%
\newunit}%
\ifnameundef{editorb}
{}
{\printnames[byeditorb]{editorb}%
\setunit{\addcomma\space}%
\usebibmacro{bytypestrg}{editorb}{editor}%
\newunit}%
\ifnameundef{editorc}
{}
{\printnames[byeditorc]{editorc}%
\setunit{\addcomma\space}%
\usebibmacro{bytypestrg}{editorc}{editor}%
\newunit}}%
\renewbibmacro*{bytranslator}{%
\ifnameundef{translator}
{}
{\printnames[bytranslator]{translator}%
\setunit{\addcomma\space}%
\bibstring{bytranslator}}}%
\renewbibmacro*{byeditor+others}{%
\ifnameundef{editor}
{}
{\printnames[byeditor]{editor}%
\clearname{editor}%
\setunit{\addcomma\space}%
\usebibmacro{byeditor+othersstrg}%
\newunit}%
\usebibmacro{byeditorx}%
\usebibmacro{bytranslator+others}}%
\renewbibmacro*{bytranslator+others}{%
\ifnameundef{translator}
{}
{\printnames[bytranslator]{translator}%
\clearname{translator}%
\setunit{\addcomma\space}%
\usebibmacro{bytranslator+othersstrg}%
\newunit}%
\usebibmacro{withothers}}%
\renewbibmacro*{bytypestrg}[2]{%
\iffieldundef{#1type}
{\bibstring{#2}}
{\ifbibxstring{\thefield{#1type}}
{\bibstring{\thefield{#1type}}}
{\printtext{\thefield{#1type}}}}}
\makeatletter
\renewbibmacro*{byeditor+othersstrg}{%
\iffieldundef{editortype}
{\def\abx@tempa{editor}}
{\edef\abx@tempa{\thefield{editortype}}}%
\let\abx@tempb=\empty
\ifnamesequal{editor}{translator}
{\appto\abx@tempa{tr}%
\appto\abx@tempb{\clearname{translator}}}
{}%
\ifnamesequal{editor}{commentator}
{\appto\abx@tempa{co}%
\appto\abx@tempb{\clearname{commentator}}}
{\ifnamesequal{editor}{annotator}
{\appto\abx@tempa{an}%
\appto\abx@tempb{\clearname{annotator}}}
{}}%
\ifnamesequal{editor}{introduction}
{\appto\abx@tempa{in}%
\appto\abx@tempb{\clearname{introduction}}}
{\ifnamesequal{editor}{foreword}
{\appto\abx@tempa{fo}%
\appto\abx@tempb{\clearname{foreword}}}
{\ifnamesequal{editor}{afterword}
{\appto\abx@tempa{af}%
\appto\abx@tempb{\clearname{afterword}}}
{}}}%
\ifbibxstring{\abx@tempa}
{\printtext{\bibstring{\abx@tempa}}\abx@tempb}
{\usebibmacro{bytypestrg}{editor}{editor}}}%
\renewbibmacro*{bytranslator+othersstrg}{%
\def\abx@tempa{translator}%
\ifnamesequal{translator}{commentator}
{\appto\abx@tempa{co}%
\clearname{commentator}}
{\ifnamesequal{translator}{annotator}
{\appto\abx@tempa{an}%
\clearname{annotator}}
{}}%
\ifnamesequal{translator}{introduction}
{\appto\abx@tempa{in}%
\clearname{introduction}}
{\ifnamesequal{translator}{foreword}
{\appto\abx@tempa{fo}%
\clearname{foreword}}
{\ifnamesequal{translator}{afterword}
{\appto\abx@tempa{af}%
\clearname{afterword}}
{}}}%
\bibstring{\abx@tempa}}%
\renewcommand*{\newunitpunct}{\addcomma\space}%
\settoggle{blx@useauthor}{false}%
\settoggle{blx@useeditor}{false}%
\settoggle{blx@usetranslator}{false}%
\usedriver
{\DeclareNameAlias{sortname}{default}}
{\thefield{entrytype}}}
{\multicitedelim}
{\usebibmacro{postnote}}
\makeatother
\begin{document}
\bfullcite{wilde}
\bfullcite{foobar}
\bfullcite{matuz:doody}
\printbibliography
\end{document}