Alan's answer to a previous question gave me the idea to try something similar with a different field, but it's not working out quite like I expected.
Based upon this APA guidance (specifically, Chelsea wrote, "...only one piece of 'source information' is necessary per reference (the publisher name and location, the retrieval URL, or the DOI), so APA recommends you follow this practice."), I'd like to have the option of sometimes not printing the contents of the 'url' field for a book (or any reference type for that matter). But I don't want to delete the URL from my
.bib file to accomplish that goal. I'd like to keep that data in my
.bib file for other styles or just for my own use outside of
So following Alan's example, I added the following to my input file:
I don't use the 'pubstate' field, so I thought I would use it as Alan used the 'type' field. From this code sample, I'm sure it will be obvious that I'm no programmer in any language, but I thought his example was perhaps something that I could generalize, thus my attempt above.
But as I said, it didn't work out like I thought it would. When I don't want the URL to show up (and have the 'pubstate' field blank), it does suppress the printing of the URL itself, but it still prints the, "Retrieved from" as if it were printing the URL. And when I do want to print the URL, having the string, "PrintURL" in the 'pubstate' field does cause the URL to print like I want, but it doesn't do proper line-wrapping with the URL.
I have a feeling this is a really stupid mistake on my part because I don't have even the basics of programming in a
LaTeX input file. If anyone can point me to an introductory guide on this subject, I'd be very grateful.
And of course if anyone would like to point out my mistake here I'd be very grateful for that too.
PS. Thanks @matth for the comment. I think it's a great comment because reading it and experimenting with my input file in light of that question showed me that @PLK seems to have already implemented the solution (either that of @JosephWright or @lockstep or yet another unknown to me) to that question into the biblatex-apa style, and I never realized it before now. I say this because in my experimentation, I added a URL to one of my
.bib entries that already had a DOI, and found that for such entries containing data in both 'url' and 'doi' fields, only the doi appears in my generated list of references, whereas if I remove the DOI from the 'doi' field, then the URL shows up. Very nice!!
However, for APA style compliance, the same kind-of solution should (I think, based only on Chelsea's comment and my limited understanding) also address the presence or absence of data in (one of? both of?) the 'publisher' and 'location' fields somehow. Because I think she said in that blog comment that only one of the three pieces of 'source information' ((1) publisher name and location, or (2) the retrieval URL, or (3) the DOI) should be present in each source entry of APA-style compliant reference lists.
What I'm finding, though, is that I get both (1) publisher/location and (2) DOI or URL (whichever has data in it) appearing in my reference lists, which is why I asked this question in the first place. In asking it, I never imagined that the logic to handle at least a part of this issue was already in place. Props (and my thanks) to @PLK for having anticipated this problem and already implemented a solution to that part of it.