4

How to remove the '.' after the organization's name as an author, i.e. 'NTIA (2010)' instead of 'NTIA. (2010), but keeping the dot when referencing real people, e.g., Nassri, A. (2015)?

I am using the following two reference entries with 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}
}

which give me the following bibliographic entries

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).

However, I would like to see:

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).

The MWE is as follows (pre-requisites are (1) apacite and (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
    Can you give us a fully compilable MWE? It is quite tiresome having to guess all the settings and packages you use in your document. – moewe Aug 13 '15 at 5:37
  • I have re-tagged your question as you mention apacite multiple times, but biblatex only in the tags. – moewe Aug 13 '15 at 5:41
  • @moewe, tnx. I will provide a MWE. – rvaneijk Aug 13 '15 at 7:51
  • Did you get around to creating a MWE or did the problem go away on its own? – moewe Sep 5 '15 at 6:02
  • @moewe, apologies for not getting back sooner on the MWE. I have not been able to solve the problem. Help is still welcome. – rvaneijk Oct 14 '15 at 20:41
4
+100

update: at bottom, variant to address an issue raised in comments. (for a few minutes the code was completely wrong: next time I will check the output before posting ;-)...)

Can you try this with your big document:

\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}

It appears that apacite always puts a dot, but the code above tests if the author name contains a comma. If it doesn't contain a comma, the dot is removed.

Not being familiar with apacite nor with bibtex any better, I can not vouch this is robust.

Here is the result:

enter image description here

This used file 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}
}

Due to my unfamiliarity with biblatex I had somewhat foolishly assumed on the basis of the sole two bibliographic datas above that a dot would always be present. But clearly at some point in creation of bbl file, a mechanism makes sure not to add a final dot to the author entry if one is already present. If this dot was between braces it could not be seen by the macro \rvaneijk@refauthstyle above.

Thus, here is an alternative which is supposed to fix that issue. Hopefully it doesn't break something else.

\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}

enter image description here

This was done with extra record

@MISC{foo:2013,
  author = {{Company, Inc.}},
  title = {Foolish company.},
  howpublished={{Homemade}},
    year = {2013},
  publisher={{Myself}},
  address={Nowhereland}
}
  • Thanks, it works. The pdf gets generated but produces an error that was not there before. I think is has to do with some errors in the large Reference.bib file which bibtex complains about and previously didn't. I will try to track down what it is and report back. – rvaneijk Oct 19 '15 at 20:15
  • All bibtex warnings are cleaned up now. The problem seems to be in pdftex. My workaround is to comment the changes when drafting, and uncomment the final version. – rvaneijk Oct 19 '15 at 22:22
  • 1
    Ideally the changes should not cause errors or warnings: have you examined the log file and check if the first error (usually on a line starting with an !) mentions something like the \APACrefauthstyle or the \rvaneijk@... macros from my proposal ? if yes, it would be nice to see that error message; you could try by dichotomy to build a mwe showing the problem but this can take time (this needs copying the big References.bib file in order to cut it to smaller and smaller pieces by dichotomy). – user4686 Oct 21 '15 at 6:20
  • SOLVED: I added '\errorcontextlines 10000' to the pre-amble to get some clues. Fortunately it did. One off the bib entries was slightly odd, i.e. 'author = {{Company, Inc.}}'. I Changed it to 'author = {{Company}}' to prevent your macro from breaking. The log showed: <to be read again> \endgroup \end ...use {@end@#1@hook}\csname end#1\endcsname \@checkend {#1}\expandafte... <argument> ...ologies, Inc.}}\end {APACrefauthors} \unskip \ – rvaneijk Oct 23 '15 at 15:22
  • Sorry that you have spent time about that. The problem arose from the fact that the dot in {{Company, Inc.}} is detected by biblatex, hence no extra dot is added, and my delimited macro caused the error (because the dot in {Company, Inc.} is hidden from view). I have added a new method which should work with the original unmodified References.bib file. – user4686 Oct 23 '15 at 17:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.