twilsonco / latexdiffcite

latexdiffcite is a wrapper around latexdiff to make citations diff properly
BSD 2-Clause "Simplified" License
26 stars 9 forks source link

fixes for apacite #7

Open jonbaron1944 opened 7 years ago

jonbaron1944 commented 7 years ago

The following issues prevent the use of apacite, and more generally APA style.

  1. While natbib's [] is a postnote unless followed by another [], apacite uses <> for a prenote and [] for a postnote. The relevant section of the code is "find prenote/postnote if present". (I could not figure out how to fix this.)

  2. APA style use ' and ' for sep_authors_last outside of parentheses, and it uses ' & ' inside of parentheses. One way to fix this is to allow set_authors_last to work inside of a command format in the configuration file. (I tried this. It does not generate an error message, but it doesn't do anything either.) I checked a few journals and books on my shelf, and it seems that many of them used this convention, regardless of who publishes them.

  3. In addition to recognizing cite, citep, and citet as references, the following would need to be added: citeA, citeauthor, citeyear, citeyearNP, and citeNP. Once this is done, everything else can be handled by the configuration file. (I'm not sure whether some of this works already. This is one of the things I need to test.)

I have a working example of a configuration file for APA style, which I will submit as soon as I test it some more, and know whether the above changes are possible.

I wish I had time to learn python, but I don't. If it helps, I can find someone who does, so let me know. I will be using this for the journal I edit and produce, and I know a few people who are eager to help with the technical aspects of the journal, and one of them must know python.

cmeeren commented 7 years ago

Thank you for the report. Unfortunately I don't have the time nor interest to add more features to latexdiffcite (I've added a note about this to the readme now).

Keeping this in mind, my answers are:

  1. Won't fix.

  2. Can't this be done in the config file, using per-cite-command specific configuration? Or do you need different behaviour in a single cite command based on other stuff? If that's the case, this is also "won't fix".

  3. Can't new cite commands be added in the config file?

Pull requests are always welcome, as long as they're fully covered by unit tests. Otherwise things are a nightmare to maintain.

jonbaron1944 commented 7 years ago

OK. Fair enough.

I will try to find someone else to fix it.

I assume that you would be willing to add the config file once I get it working. You have some other examples.

On 04/20/17 08:13, Christer van der Meeren wrote:

Thank you for the report. Keeping in mind that I don't have the time nor interest to add more features to latexdiffcite, my answers are:

  1. Won't fix.

  2. Can't this be done in the config file, using per-cite-command specific configuration? Or do you need different behaviour in a single cite command based on other stuff? If that's the case, this is also "won't fix".

I tried it, and it doesn't work. Maybe I did something wrong. The problem was that sep_authors_last is set globally and does not seem to change when I try to reset it with a new command in the cite-command part of the config file. (As I said, I don't get an error message when I do this. It just doesn't work.)

  1. Can't new cite commands be added in the config file?

Maybe. But I saw a line in the .py file that identifies relevant commands. Anyway, I'll try it.

Pull requests are always welcome, as long as they're fully covered by unit tests. Otherwise things are a nightmare to maintain.

-- You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub: https://github.com/cmeeren/latexdiffcite/issues/7#issuecomment-295773560 -- Jonathan Baron, Professor of Psychology, University of Pennsylvania Home page: http://www.sas.upenn.edu/~baron Editor: Judgment and Decision Making (http://journal.sjdm.org)

cmeeren commented 7 years ago

I assume that you would be willing to add the config file once I get it working. You have some other examples.

Certainly.

The problem was that sep_authors_last is set globally and does not seem to change when I try to reset it with a new command in the cite-command part of the config file. (As I said, I don't get an error message when I do this. It just doesn't work.)

I see what you mean now. You're right, the cite command parsers have no notion of sep_authors_last.

I saw a line in the .py file that identifies relevant commands.

Those are just the defaults that are used when there is no config file. I'm pretty sure you can add whichever commands you wish. :)

cmeeren commented 7 years ago

Wait a bit. Are you sure sep_authors_last isn't just userd for parsing the references in the bib file? Does it control the output of latexdiffcite?

jonbaron1944 commented 7 years ago

On 04/20/17 08:57, Christer van der Meeren wrote:

Wait a bit. Are you sure sep_authors_last isn't just userd for parsing the references in the bib file? Does it control the output of latexdiffcite?

Yes. I'm sure. I just tried it.

Maybe this is a bug rather than a feature request????

It is the hardest of my 3 issues to fix, since it requires knowledge of the entire structure of the script. The others are local problems.

If worse comes to worse, I could fix the <>[] problem by editing the tex file before running latexdiffcite, essentially using natbib's (kludgy) method of distinguishing prenote and postnote, which you very cleverly unravel. I could fix this, except that it requires even more cleverness.

And it does not seem to work to add citaA to the config file. It does not get recognized as a citaiton. (But I think even I could fix this one in latexdiffcite.py.)

Jon -- Jonathan Baron, Professor of Psychology, University of Pennsylvania Home page: http://www.sas.upenn.edu/~baron Editor: Judgment and Decision Making (http://journal.sjdm.org)