为了完成我的硕士论文,我将引用包从harvard
with改为bibtex
with biblatex-chicago
and authordate
,bibtex8
主要是因为我需要 babel 将我的参考书目翻译成挪威语。但我怀念包\possessivecite
中的命令harvard
,而且我在文档中没有找到类似的命令biblatex-chicago
。
制作如下命令
\newcommand{\posscite}[1]{\citeauthor{#1}'s \autocite*{#1}}
可以解决这个问题,但我将无法引用某个页面
\posscite[135]{key})
我非常想这么做。因为我用挪威语写作,所以'
当作者的名字以 s/sh/sj/rs/z 结尾时,我也需要所有格(与英语非常相似),而s
在其他情况下则只需(没有撇号)。我该怎么做?
答案1
通过检查标签的最后几个字符可以生成适当的所有格后缀。使用包可以很容易地做到这一点xstring
。
英语中的所有格引用命令更容易构造。标准作者年份格式下的示例在另一个问题。
作者年份及其变体
为了回应关于所有格引用的功能请求,Philipp Lehman 演示了如何labelname
使用格式别名生成英语所有格。下面的代码将此方法扩展到其他类型的标签和挪威语所有格。它应该适用于标准作者年份样式的所有变体。
\documentclass{article}
\usepackage[norsk]{babel}
\usepackage[style=authoryear-comp]{biblatex}
\usepackage{xstring}
\usepackage{filecontents}
\newrobustcmd*{\mkbibpossess}[1]{%
\IfEndWith{#1}{s}
{'}
{\IfEndWith{#1}{sh}
{'}
{\IfEndWith{#1}{sj}
{'}
{\IfEndWith{#1}{z}
{'}
{s}}}}}
\DeclareNameFormat{labelname:poss}{% Based on labelname from biblatex.def
\ifcase\value{uniquename}%
\usebibmacro{name:last}{#1}{#3}{#5}{#7}%
\or
\ifuseprefix
{\usebibmacro{name:first-last}{#1}{#4}{#5}{#8}}
{\usebibmacro{name:first-last}{#1}{#4}{#6}{#8}}%
\or
\usebibmacro{name:first-last}{#1}{#3}{#5}{#7}%
\fi
\usebibmacro{name:andothers}%
\ifthenelse{\value{listcount}=\value{liststop}}
{\ifmorenames
{s}
{\StrRemoveBraces{#1}[\cbxnobraces]%
\IfEndWith{\cbxnobraces}{s}
{'}
{\IfEndWith{\cbxnobraces}{sh}
{'}
{\IfEndWith{\cbxnobraces}{sj}
{'}
{\IfEndWith{\cbxnobraces}{z}
{'}
{s}}}}}}
{}}
\DeclareFieldFormat{shorthand:poss}{%
\ifnameundef{labelname}{#1\mkbibpossess{#1}}{#1}}
\DeclareFieldFormat{citetitle:poss}{\mkbibemph{#1}\mkbibpossess{#1}}
\DeclareFieldFormat{label:poss}{#1\mkbibpossess{#1}}
\newrobustcmd*{\posscitealias}{%
\AtNextCite{%
\DeclareNameAlias{labelname}{labelname:poss}%
\DeclareFieldAlias{shorthand}{shorthand:poss}%
\DeclareFieldAlias{citetitle}{citetitle:poss}%
\DeclareFieldAlias{label}{label:poss}}}
\newrobustcmd*{\posscite}{%
\posscitealias%
\textcite}
\newrobustcmd*{\Posscite}{\bibsentence\posscite}
\newrobustcmd*{\posscites}{%
\posscitealias%
\textcites}
\begin{filecontents}{\jobname.bib}
@Book{kish,
author = {Kish, Leslie},
title = {Survey Sampling},
publisher = {John Wiley and Sons},
address = {New York},
year = {1965}}
@Online{hss,
author = {{U.S. Dept. of Health and Human Services}},
url = {http://www.hhs.gov},
year = {2011}}
@Report{nasa,
title = {Fiscal Year 2012 Budget Estimates},
author = {{National Aeronautics and Space Administration}},
shortauthor = {NASA},
year = {2011}}
@Book{shorthand,
shorthand = {Shorthand sj},
year = {2010},
publisher = {Anonymous Press},
location = {New York}}
@Book{label,
label = {Label z},
year = {2011},
publisher = {Anonymous Press},
location = {New York}}
@Book{noauthors,
title = {A Book without Authors},
year = {2011},
publisher = {Anonymous Press},
location = {New York}}
@Book{noauthor,
title = {A Book with No Author},
year = {2011},
publisher = {Anonymous Press},
location = {New York}}
@Manual{dyna:browser,
title = {Dynatext, Electronic Book Indexer/Browser},
organization = {Electronic Book Technology Inc.},
address = {Providence, RI},
year = {1991}}
\end{filecontents}
\addbibresource{\jobname.bib}
\bibliography{biblatex-examples}
\renewcommand{\baselinestretch}{1.25}
\begin{document}
\subsection*{label ending in s/sh/sj/z}
Author ending in sh: \posscite[45--68]{kish} \\
Author ending in s: \posscite[45--68]{gillies} \\
Corporate author ending in s: \posscite{hss}
No author, title ending in s: \posscite[45--68]{noauthors} \\
No author or title; shorthand ending in sj: \posscite[45--68]{shorthand} \\
Author ending in z: \posscite[45--68]{gonzalez} \\
No author, title or shorthand; label ending in z: \posscites{label}{gillies}
\subsection*{label ending in other characters}
Manual by organization: \posscite{dyna:browser} \\
Shortauthor: \posscite[45--68]{nasa} \\
Shorthand: \posscite[45--68]{kant:ku} \\
No author: \posscite[45--68]{noauthor} \\
Compact labelname: \posscites{aristotle:physics}{aristotle:poetics}
\end{document}
芝加哥作者日期
这种样式的方法类似,但当标签由参考书目宏生成时,cite:label
它可以采用多种不同的格式,具体取决于条目类型和可用字段。因此,下面的代码在本地重新定义了宏,以供所有格引用命令使用。
\documentclass{article}
\usepackage[norsk]{babel}
\usepackage[authordate]{biblatex-chicago}
\usepackage{xstring}
\usepackage{filecontents}
\newrobustcmd*{\mkbibpossess}[1]{%
\IfEndWith{#1}{s}
{'}
{\IfEndWith{#1}{sh}
{'}
{\IfEndWith{#1}{sj}
{'}
{\IfEndWith{#1}{z}
{'}
{s}}}}}
\DeclareNameFormat{labelname:poss}{% Based on labelname from biblatex.def
\ifcase\value{uniquename}%
\usebibmacro{name:last}{#1}{#3}{#5}{#7}%
\or
\ifuseprefix
{\usebibmacro{name:first-last}{#1}{#4}{#5}{#8}}
{\usebibmacro{name:first-last}{#1}{#4}{#6}{#8}}%
\or
\usebibmacro{name:first-last}{#1}{#3}{#5}{#7}%
\fi
\usebibmacro{name:andothers}%
\ifthenelse{\value{listcount}=\value{liststop}}
{\ifmorenames
{s}
{\StrRemoveBraces{#1}[\cbxnobraces]%
\IfEndWith{\cbxnobraces}{s}
{'}
{\IfEndWith{\cbxnobraces}{sh}
{'}
{\IfEndWith{\cbxnobraces}{sj}
{'}
{\IfEndWith{\cbxnobraces}{z}
{'}
{s}}}}}}
{}}
\DeclareListFormat{organization:poss}{%
\usebibmacro{list:delim}{#1}%
#1\isdot
\usebibmacro{list:andothers}%
\ifthenelse{\value{listcount}=\value{liststop}}
{\ifmoreitems
{s}
{\StrRemoveBraces{#1}[\cbxnobraces]%
\IfEndWith{\cbxnobraces}{s}
{'}
{\IfEndWith{\cbxnobraces}{sh}
{'}
{\IfEndWith{\cbxnobraces}{sj}
{'}
{\IfEndWith{\cbxnobraces}{z}
{'}
{s}}}}}}
{}}
\DeclareFieldFormat{shorthand:poss}{%
#1\mkbibpossess{#1}}
\DeclareFieldFormat{possess}{\mkbibpossess{#1}}
\newbibmacro*{cite:label:poss}{% Based on cite:label from chicago-authordate.cbx
\iffieldundef{label}%
{\iffieldequalstr{entrysubtype}{magazine}%
{\printtext[bibhyperref]{%
\printfield[journaltitle]{journaltitle}%
\printfield[possess]{journaltitle}}}%
{\iffieldequalstr{entrytype}{manual}%
{\printtext[bibhyperref]{\printlist{organization}}}%
{\printtext[bibhyperref]{%
\printfield[citetitle]{labeltitle}%
\printfield[possess]{labeltitle}}}}}%
{\printtext[bibhyperref]{%
\printfield{label}%
\printfield[possess]{label}}}}
\newrobustcmd*{\posscitealias}{%
\AtNextCite{%
\renewbibmacro*{cite:label}{\usebibmacro{cite:label:poss}}%
\DeclareNameAlias{labelname}{labelname:poss}%
\DeclareListAlias{organization}{organization:poss}%
\DeclareFieldAlias{shorthand}{shorthand:poss}}}
\newrobustcmd*{\posscite}{%
\posscitealias%
\textcite}
\newrobustcmd*{\Posscite}{\bibsentence\posscite}
\newrobustcmd*{\posscites}{%
\posscitealias%
\textcites}
\begin{filecontents}{\jobname.bib}
@Book{kish,
author = {Kish, Leslie},
title = {Survey Sampling},
publisher = {John Wiley and Sons},
address = {New York},
year = {1965}}
@Online{hss,
author = {{U.S. Dept. of Health and Human Services}},
url = {http://www.hhs.gov},
year = {2011}}
@Report{nasa,
title = {Fiscal Year 2012 Budget Estimates},
author = {{National Aeronautics and Space Administration}},
shortauthor = {NASA},
year = {2011}}
@Book{shorthand,
shorthand = {Shorthand sj},
year = {2010},
publisher = {Anonymous Press},
location = {New York}}
@Book{label,
label = {Label z},
year = {2011},
publisher = {Anonymous Press},
location = {New York}}
@Book{noauthors,
title = {A Book without Authors},
year = {2011},
publisher = {Anonymous Press},
location = {New York}}
@Book{noauthor,
title = {A Book with No Author},
year = {2011},
publisher = {Anonymous Press},
location = {New York}}
@Manual{dyna:browser,
title = {Dynatext, Electronic Book Indexer/Browser},
organization = {Electronic Book Technology Inc.},
address = {Providence, RI},
year = {1991}}
\end{filecontents}
\addbibresource{\jobname.bib}
\bibliography{biblatex-examples}
\renewcommand{\baselinestretch}{1.25}
\begin{document}
\subsection*{label ending in s/sh/sj/z}
Author ending in sh: \posscite[45--68]{kish} \\
Author ending in s: \posscite[45--68]{gillies} \\
Corporate author ending in s: \posscite{hss}
No author, title ending in s: \posscite[45--68]{noauthors} \\
No author or title; shorthand ending in sj: \posscite[45--68]{shorthand} \\
Author ending in z: \posscite[45--68]{gonzalez} \\
No author, title or shorthand; label ending in z: \posscites{label}{gillies}
\subsection*{label ending in other characters}
Manual by organization: \posscite{dyna:browser} \\
Shortauthor: \posscite[45--68]{nasa} \\
Shorthand: \posscite[45--68]{kant:ku} \\
No author: \posscite[45--68]{noauthor} \\
Compact labelname: \posscites{aristotle:physics}{aristotle:poetics}
\end{document}
答案2
不幸的是,我对此了解甚少,无法biblatex
从技术层面上回答,但我很理解这个问题,因为我也使用biblatex-chicago
法语。
我想说,传递一个命令来解决该问题可能超出了 LaTeX 的结构标记逻辑:您应该在文本中对这些区别进行硬编码,尤其是因为如果您必须将文档转换为另一种格式,它将为您提供正确的服务。
换句话说,在抽象层面上,我不确定 LaTeX 是否应该提供一种方法让你的引用命令如此依赖于你的内容;在我看来,这似乎违反了语言的核心逻辑。