我正在尝试使用 latexdiff 来显示参考文献中的变化。
一开始,我使用了latexdiff old.tex new.tex > diff.tex
,然后我运行 diff.tex 文件,但没有显示更改。
然后我跟着这里通过 生成 .bbl 文件latexdiff old.bbl new.bbl > diff.bbl
。
之后,我再次运行 diff.tex 文件,但出现错误。 错误消息像这样: 出现问题 — — 可能缺少 \item。\DIFdelend \bibitem{c29}。 出了点问题——可能缺少 \item。\bibitem{c30}
我尝试latexdiff --append-textcmd=...
或latexdiff --append-safecmd=...
或latexdiff --flatten...
生成 .bbl 文件,但是,对我来说都没有用。
我该如何解决这个问题?或者还有其他方法可以显示参考文献中的更改。谢谢。
这里有些例子:
參考書:
@article{c29,
title = "Thermal comfort: use of controls in naturally ventilated buildings",
journal = "Energy and Buildings",
volume = "33",
number = "3",
pages = "235 - 244",
year = "2001",
issn = "0378-7788",
doi = "https://doi.org/10.1016/S0378-7788(00)00087-6",
author = "Iftikhar A Raja and J.Fergus Nicol and Kathryn J McCartney and Michael A Humphreys",
keywords = "Buildings, Thermal comfort, Natural ventilation, Energy, Controls, Indoor temperature, Outdoor climate"
}
@article{c30,
title = "Predictive controllers for thermal comfort optimization and energy savings",
journal = "Energy and Buildings",
volume = "40",
number = "7",
pages = "1353 - 1365",
year = "2008",
issn = "0378-7788",
doi = "https://doi.org/10.1016/j.enbuild.2007.12.007",
author = "Roberto Z. Freire and Gustavo H.C. Oliveira and Nathan Mendes",
keywords = "Predictive control, Thermal comfort, Energy saving, HVAC systems"
}
差异.bbl:
%DIFDELCMD < %%%
\DIFdelend \bibitem{c29}
Raja IA, Nicol J, McCartney KJ \DIFdelbegin \DIFdel{et~al}\DIFdelend \DIFaddbegin \DIFadd{and Humphreys MA}\DIFaddend .
\newblock Thermal comfort: use of controls in naturally ventilated buildings.
\newblock \emph{Energy and Buildings} 2001; 33(3): 235 -- 244.
\newblock \doi{https://doi.org/10.1016/S0378-7788(00)00087-6}.
\bibitem{c30}
Freire RZ, Oliveira GH and Mendes N.
\newblock Predictive controllers for thermal comfort optimization and energy
savings.
\newblock \emph{Energy and Buildings} 2008; 40(7): 1353 -- 1365.
\newblock \doi{https://doi.org/10.1016/j.enbuild.2007.12.007}.
旧.bbl:
\bibitem{c29}
Raja IA, Nicol J, McCartney KJ et~al.
\newblock Thermal comfort: use of controls in naturally ventilated buildings.
\newblock \emph{Energy and Buildings} 2001; 33(3): 235 -- 244.
\newblock \doi{https://doi.org/10.1016/S0378-7788(00)00087-6}.
\bibitem{c30}
Freire RZ, Oliveira GH and Mendes N.
\newblock Predictive controllers for thermal comfort optimization and energy
savings.
\newblock \emph{Energy and Buildings} 2008; 40(7): 1353 -- 1365.
\newblock \doi{https://doi.org/10.1016/j.enbuild.2007.12.007}.
新.bbl:
\bibitem{c29}
Raja IA, Nicol J, McCartney KJ and Humphreys MA.
\newblock Thermal comfort: use of controls in naturally ventilated buildings.
\newblock \emph{Energy and Buildings} 2001; 33(3): 235 -- 244.
\newblock \doi{https://doi.org/10.1016/S0378-7788(00)00087-6}.
\bibitem{c30}
Freire RZ, Oliveira GH and Mendes N.
\newblock Predictive controllers for thermal comfort optimization and energy
savings.
\newblock \emph{Energy and Buildings} 2008; 40(7): 1353 -- 1365.
\newblock \doi{https://doi.org/10.1016/j.enbuild.2007.12.007}.
答案1
我没有手动安排块,而是通过将和参数传递给 latexdiff 来bbl
编译我的 diff 文档。参见--allow-spaces
--disable-citation-markup
https://github.com/ftilmann/latexdiff/issues/174#issuecomment-501177660
答案2
我根据@frederik 的评论解决了我的问题。
考虑:
latexdiff 依次检查两个文件,如果引用块的位置发生变化,则会发生错误。例如,我们有一个 old.bbl 文件,其内容为:
block 1
block 2
block 3
对于修订版本,如果的内容block 2
已被修改并表示为block* 2
,则我们将得到一个 new1.bbl,其内容为:
block 1
block* 2
block 3
现在我们运行latexdiff old.bbl new1.bbl > diff1.bbl
,并运行 diff.tex(使用 diff1.bbl),没有任何错误。
如果block* 2
移动到不同的位置(假设新文件变为 new2.bbl),例如,
block 1
block 3
block* 2
然后我们运行latexdiff old.bbl new2.bbl > diff2.bbl
,并运行 diff2.tex(使用 diff2.bbl),但出现错误。
解决方案:
我更改了 new.bbl 文件的引用块位置,以便 new.bbl 和 old.bbl 具有相同的引用块序列。然后运行latexdiff old.bbl new.bbl > diff.bbl
,并运行 diff.tex。我认为只要它们具有相同的引用块序列,也可以更改 old.bbl 文件。