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

Problem with Bibliography #174

Closed
JoTrab opened this issue Jun 11, 2019 · 4 comments
Closed

Problem with Bibliography #174

JoTrab opened this issue Jun 11, 2019 · 4 comments

Comments

@JoTrab
Copy link

JoTrab commented Jun 11, 2019

I noticed that difflatex has problems with the bibliography. For me the pdflatex output failed when I added a new entry to the .
Each field in the bibitem is added through \DIFadd which seems to result in the error.
Enclosing the whole entry into DIFadd manually works.

Example:

\bibitem [{\DIFadd{\mbox{%DIFAUXCMD
		\citenamefont }\hspace{0pt}%DIFAUXCMD
		}{\DIFadd{Nocedal}}\DIFadd{\ and\ \mbox{%DIFAUXCMD
		\citenamefont
		  }\hspace{0pt}%DIFAUXCMD
		}{\DIFadd{Wright}}\DIFadd{(1999)}}]{\DIFadd{Nocedal1999}}%DIF > 
		  \BibitemOpen
		  \bibfield  {\DIFadd{author}} {\bibinfo {\DIFadd{author}} {\bibfnamefont {\DIFadd{Jorge}}\DIFadd{\ }\bibnamefont
		  {\DIFadd{Nocedal}}}\DIFadd{\ and\ }\bibinfo {\DIFadd{author}} {\bibfnamefont {\DIFadd{S. J.}}\DIFadd{\ }\bibnamefont
		  {\DIFadd{Wright}}}\DIFadd{,\ }} {\emph {\bibinfo {\DIFadd{title}} {{\DIFadd{Numerical Optimization}}}}}\DIFadd{,\
		  }\href {\DIFadd{https://doi.org/10.1121/1.417106}} \bibinfo {\DIFadd{volume}} {\DIFadd{17}}\DIFadd{\ 
		  (}\bibinfo  {\DIFadd{publisher}} {\DIFadd{Springer New York}}\DIFadd{,\ }\bibinfo {\DIFadd{year}}
		  {\DIFadd{2006}}\DIFadd{)}\BibitemShut {\DIFadd{NoStop}}
		\DIFaddend 

fails

but

\DIFaddbegin 
\bibitem [{\citenamefont {Nocedal}\ and\ \citenamefont
  {Wright}(1999)}]{Nocedal1999}%
  \BibitemOpen
  \DIFadd{
  \bibfield  {author} {\bibinfo {author} {\bibfnamefont {Jorge}\ \bibnamefont
  {Nocedal}}\ and\ \bibinfo {author} {\bibfnamefont {S. J.}\ \bibnamefont
  {Wright}},\ } {\emph {\bibinfo {title} {{Numerical Optimization}}}},\
  \href {https://doi.org/10.1121/1.417106} \bibinfo {volume} {17}\ 
  (\bibinfo  {publisher} {Springer New York},\ \bibinfo {year}
  {2006})}\BibitemShut {NoStop}
\DIFaddend  		
@ftilmann
Copy link
Owner

Thanks for the report. This is something that works out of the box for me with natbib package, e.g. this is what latexdiff generates automatically for a citation for me:

\DIFaddbegin \bibitem[{Juli\`a et~al.(2000)Juli\`a, Ammon, Herrmann, and
  Correig}]{julia2000joint}
\DIFadd{Juli\`a, J., Ammon, C.~J., Herrmann, R.~B., Correig, A.~M., 2000. }{\DIFadd{Joint
  inversion of receiver function and surface wave dispersion observations}}\DIFadd{.
  Geophys. J. Int. 143, 99--112, doi:10.1046/j.1365-246x.2000.00217.x.
}

\DIFaddend 

So you have to be a more specific what packages you use exactly for preparing your bibliography.
Maybe you can post a complete MWE, i.e. including the full tex for a very simple document (old and new versions, along with any needed sequence). I might not deal with this issue immediately, but if the package is popular, and more people report in with this problem, this would bubble up in priority.

Just looking at your text I can see two possible issues:

  • There is a space between \bibitem and its argument, so latexdiff will not recognise the argument as such and thinks it's a new token. This is true of the other commands as well. (try --allow-spaces as workaround, but as latexdiff does not know about the other \bibxxx commands they will all be excluded from the highlighting)
  • latexdiff thinks any command beginning with \cite is an in-text citation command, which needs some special treatment at least in natbib format and ulem-based markup style. It then applies this special treatment erroneously to \citenamefont (possible workaround --disable-citation-markup but this will probably also stop in-text highlighting of new/deleted citations).

The best work-around for you might be to put all the citations in separate file and not process it with latexdiff, but include as-is. Of course, you lose the highlighting. Or switch to natbib but I guess that might not be acceptable for you.

@JoTrab
Copy link
Author

JoTrab commented Jun 12, 2019

Thanks for the quick answer. I usually use natbib, so great to hear that it works. In this specific case I actually copied the created bibliography into the texfile (required for submission to a scientific journal, apparently to be sure not to have any problems for compilation on their servers). The bibliography itself was created through revtex, I'll try to put together a MWE soon. For the moment I´l just l continue putting the citations in a separate file for latexdiff.

@chponte
Copy link

chponte commented Jan 16, 2020

I am facing the same issue, although I may be using a different latex template than @JoTrab. In my case I have the bibliography on a separate file, and citing the references with \cite{#TAG}. The result is the same highlighted here:

\DIFdelbegin %DIFDELCMD < \cite{Wei2014a}%%%
\DIFdelend \DIFaddbegin \cite
{\DIFadd{Wei2014a}}\DIFaddend

The journal template used is this one: cabios-template.zip. I can work around the error if I use the argument --allow-spaces previously suggested.

I hope this helps in finding the cause! Cheers!

@rashigeek
Copy link

I am facing the same issue, although I may be using a different latex template than @JoTrab. In my case I have the bibliography on a separate file, and citing the references with \cite{#TAG}. The result is the same highlighted here:

\DIFdelbegin %DIFDELCMD < \cite{Wei2014a}%%%
\DIFdelend \DIFaddbegin \cite
{\DIFadd{Wei2014a}}\DIFaddend

The journal template used is this one: cabios-template.zip. I can work around the error if I use the argument --allow-spaces previously suggested.

I hope this helps in finding the cause! Cheers!

Super helpful! Thanks!

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

No branches or pull requests

4 participants