Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

\DIFadd & \DIFdel seem to work within \citep #17

Closed
slayoo opened this issue Apr 7, 2015 · 9 comments · Fixed by #299
Closed

\DIFadd & \DIFdel seem to work within \citep #17

slayoo opened this issue Apr 7, 2015 · 9 comments · Fixed by #299

Comments

@slayoo
Copy link

slayoo commented Apr 7, 2015

Hello,

Trying to troubleshoot overly-long \mboxes introduced by latexdiff when handling changes within optional arguments to natbib's \citep[], I've realised that the mboxes seem not to be needed:

\citep[\DIFadd{a}\DIFdel{b}][]{KK07}

works fine.

How to force latexdiff to behave like that? (i.e., I guess there's no such option, but perhaps it's doable with a short patch?).

Thanks for help,
Sylwester

@ftilmann
Copy link
Owner

ftilmann commented Apr 7, 2015

Unfortunately, this is not trivial, as normally only the last argument of a command can be treated as non-atomic text. For now there is only the option to disable markup in citations completely (using --disable-citation-markup option) or choose a different markup style without underlining (e.g. -t CFONT)
I will leave this issue open, as eventually there might be more flexibility in defining text commands, and your use case will actually work. But in any case the \mbox'es would still be needed where the actual reference as changed.
(a 'hacky' way to achieve this would be to preprocess the text such that \citep[arg1][arg2]{ref} is transformed to \CITEPMOD{ref}{arg2}{arg1}, and then define \CITEPMOD as textcmd), then post-process to transform back to initial version (but this will only deal with changes in arg1 not in arg2, so I don't think I will implement it that way - if you know Perl and want to have a go subroutines preprocess and postprocess would need to be modified).

@slayoo
Copy link
Author

slayoo commented Apr 11, 2015

Thanks for help! The "-t CFONT" option solved the issue for me.

@cmeeren
Copy link

cmeeren commented Jun 8, 2015

If you want to use latexdiff with strikethrough/underline style and still get nice citation diffs, check out latexdiffcite. :)

@ftilmann
Copy link
Owner

ftilmann commented Jun 9, 2015 via email

@cmeeren
Copy link

cmeeren commented Jun 9, 2015

👍

@slayoo
Copy link
Author

slayoo commented Feb 20, 2017

Two years later I happened to Google my own question :) ... but that's not the point.
@cmeeren Trying out latexdiffcite I have encountered a problem parsing a document containing

\citep[text text $\dot{T}$][text text]{label}.

The parser exits with:

Traceback (most recent call last):
  File "/usr/local/bin/latexdiffcite", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/dist-packages/latexdiffcite/latexdiffcite.py", line 163, in main
    run(parsed_args)
  File "/usr/local/lib/python2.7/dist-packages/latexdiffcite/latexdiffcite.py", line 296, in run
    process_revision('old')
  File "/usr/local/lib/python2.7/dist-packages/latexdiffcite/latexdiffcite.py", line 353, in process_revision
    get_capture_groups_from_bbl(oldnew)
  File "/usr/local/lib/python2.7/dist-packages/latexdiffcite/latexdiffcite.py", line 432, in get_capture_groups_from_bbl
    raise ValueError('No match in bbl file for reference ' + ref + ' using regex ' + exp)
ValueError: No match in bbl file for reference T using regex \\bibitem\[{((?:(?!^$).)*?)\(((?:(?!^$).)*?)(?:{\\natexlab{(.?)}})?\)((?:(?!^$).)*?)}\]{T}

HTH,
Sylwester

@cmeeren
Copy link

cmeeren commented Feb 20, 2017

@slayoo Since this is not related to latexdiff (which I'm not affiliated with in any way) but rather to latexdiffcite, and since it seems to be the same issue as twilsonco/latexdiffcite#2, please post there. And see my most recent comment in that thread - enable debug logging or terminal output and let me know what it says.

@ftilmann
Copy link
Owner

I will close this as @cmeeren correctly points out that this is an issue for latexdiffcite (sorry for not yet following up on my earlier promise to somehow work on integration or at least highlight latexdiffcite in the docs - it's not forgotten, though)

@slayoo
Copy link
Author

slayoo commented Feb 20, 2017

Thanks for your replies!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants