如何删除作者组织名称后的“。”?(apacitex)

如何删除作者组织名称后的“。”?(apacitex)

如何删除作者组织名称后的“。”,即“NTIA (2010)”而不是“NTIA。 (2010)”,但在引用真实人物时保留点,例如 Nassri, A. (2015)?

我使用以下两个参考条目apacitex

@MISC{haradopters:2015,
  author = {Nassri, Ahmad},
  title = {{HAR} Resources: {A} community curated list of resources, tools, projects and applications that support {HTTP Archive (HAR)}.},
  year = {2015},
  howpublished={[Github]},
  url={https://github.com/ahmadnassri/har},
  urldate={28 June 2015}
} 

@MISC{ntia:2010,
  author = {{NTIA}},
  title = {Commercial Data Privacy and Innovation in the Internet Economy: {A} Dynamic Policy Framework.},
  howpublished={{IPTF Privacy Green Paper}},
    year = {2010},
  publisher={{National Telecommunications and Information Administration (NTIA)}},
  address={Washington, DC}
}

这给了我以下书目条目

Nassri, A. (2015). HAR resources: A community curated list of re-
   sources, tools, projects and applications that support HTTP Archive
   (HAR). [Github]. Retrieved 28 June 2015, from https://
   github.com/ahmadnassri/har
NTIA. (2010). Commercial data privacy and innovation in the internet
   economy: A dynamic policy framework. IPTF Privacy Green Paper.
   Washington, DC: National Telecommunications and Informa-
   tion Administration (NTIA).

然而,我希望看到:

Nassri, A. (2015). HAR resources: A community curated list of re-
    sources, tools, projects and applications that support HTTP Archive
    (HAR). [Github]. Retrieved 28 June 2015, from https://
    github.com/ahmadnassri/har
NTIA (2010). Commercial data privacy and innovation in the internet
    economy: A dynamic policy framework. IPTF Privacy Green Paper.
    Washington, DC: National Telecommunications and Informa-
    tion Administration (NTIA).

MWE 如下(先决条件为 (1) apacite 和 (2) classicthesis,http://mirrors.ctan.org/macros/latex/contrib/classicthesis.zip

\documentclass{scrreprt}

\PassOptionsToPackage{parts}{classicthesis}                                     
\PassOptionsToPackage{natbibapa,index}{apacite}
\usepackage{apacite}
\usepackage{subfig} 
\usepackage{classicthesis} 

\begin{document}

\citep{haradopters:2015}
\citep{ntia:2010}

\bibliographystyle{apacitex}
\bibliography{References} 

\end{document}

答案1

更新:在底部,变体解决了评论中提出的一个问题。(几分钟后代码完全错误:下次我将在发布之前检查输出;-)......)

你可以对你的大型文档尝试一下这个吗:

\documentclass{scrreprt}

\PassOptionsToPackage{parts}{classicthesis}                                     
\PassOptionsToPackage{natbibapa,index}{apacite}
\usepackage{apacite}
\usepackage{subfig} 
\usepackage{classicthesis} 

\makeatletter
\renewcommand{\APACrefauthstyle}{\rvaneijk@refauthstyle}%
\def\rvaneijk@refauthstyle #1.%
    {\rvaneijk@refauthstyle@a #1,,\@@rvaneijk {#1}}%
\def\rvaneijk@refauthstyle@a  #1,#2,#3\@@rvaneijk #4%
    {\if\relax\detokenize{#2}\relax {#4}\else {#4}.\fi}
\makeatother

\begin{document}

\citep{haradopters:2015}
\citep{ntia:2010}

\bibliographystyle{apacitex}
\bibliography{References} 

\end{document}

看起来总是apacite会放一个点,但上面的代码会测试作者姓名是否包含逗号。如果不包含逗号,则删除该点。

由于不熟悉apacite也不了解bibtex任何更好的方法,我无法保证这是可靠的。

结果如下:

在此处输入图片描述

此使用的文件References.bib

@MISC{haradopters:2015,
  author = {Nassri, Ahmad},
  title = {{HAR} Resources: {A} community curated list of resources, tools, projects and applications that support {HTTP Archive (HAR)}.},
  year = {2015},
  howpublished={[Github]},
  url={https://github.com/ahmadnassri/har},
  urldate={28 June 2015}
} 

@MISC{ntia:2010,
  author = {{NTIA}},
  title = {Commercial Data Privacy and Innovation in the Internet Economy: {A} Dynamic Policy Framework.},
  howpublished={{IPTF Privacy Green Paper}},
    year = {2010},
  publisher={{National Telecommunications and Information Administration (NTIA)}},
  address={Washington, DC}
}

由于我对 不熟悉,biblatex我曾愚蠢地基于上述仅有的两个书目数据假设 adot始终存在。但显然在创建bbl文件的某个时刻,如果作者条目已经存在,则机制会确保不添加最后的点。如果这个点dot在括号之间,上面的宏就看不到它\rvaneijk@refauthstyle

因此,这里有一个替代方案,应该可以解决这个问题。希望它不会破坏其他东西。

\documentclass{scrreprt}

\PassOptionsToPackage{parts}{classicthesis}                                     
\PassOptionsToPackage{natbibapa,index}{apacite}
\usepackage{apacite}
\usepackage{subfig} 
\usepackage{classicthesis} 

\makeatletter
\renewcommand{\APACrefauthstyle}{\rvaneijk@refauthstyle}%

\catcode`Z 3
\def\rvaneijk@refauthstyle #1\AX
% first check if a dot is present at the end
% this dot will possibly arise after brace stripping of #1
% I assume here the \AX is always present as in my three examples...
   {\rvaneijk@refauthstyle@aa #1Z.Z.X\@@rvaneijk #1\AX}%
\def\rvaneijk@refauthstyle@aa #1.Z.#2#3\@@rvaneijk
% if a dot is detected (it should always be, either in the original 
% record, or inserted by biblatex)
% we then apply our macro which checks if the entry contains a comma.
% if a comma is found, the dot will be left. If no comma is found,  
% the dot is gobbled and not reinserted. As I think the dot is
% always found, I am not too worried by the possible brace-stripping 
% of #1 above, because braces are added below anyhow in all cases.
   {\ifx Z#2\expandafter\rvaneijk@refauthstyle@a\fi}%
\catcode`Z 11
\def\rvaneijk@refauthstyle@a #1.%
    {\rvaneijk@refauthstyle@b #1,,\@@rvaneijk {#1}}%
\def\rvaneijk@refauthstyle@b  #1,#2,#3\@@rvaneijk #4%
    {\if\relax\detokenize{#2}\relax {#4}\else {#4}.\fi}%  
\makeatother

\begin{document}

\citep{haradopters:2015}
\citep{ntia:2010}
\citep{foo:2013}

\bibliographystyle{apacitex}

\bibliography{References} 

\end{document}

在此处输入图片描述

这是通过额外的记录完成的

@MISC{foo:2013,
  author = {{Company, Inc.}},
  title = {Foolish company.},
  howpublished={{Homemade}},
    year = {2013},
  publisher={{Myself}},
  address={Nowhereland}
}

相关内容