2

I'm trying to use the command latexdiff to provide markup on changes between two similar latex documents. I have used the achemso package and would like to continue doing so. It shows changes in the main text and figure captions but not author names, the title, nor the abstract. I provide below a mwe; old.tex is the original document and new.tex has five changes:

  • Change to title (NOT SHOWN on diff.pdf)
  • Change to author initial (NOT SHOWN on diff.pdf)
  • Change to abstract text (NOT SHOWN on diff.pdf)
  • Change to main text (markup shown)
  • Change to a reference (markup shown)

To get this result I run the following bash script (see below) in the same directory containing old.tex and new.tex. The essential command for latexdiff I am using is:

latexdiff --append-context2cmd="\twocolumn,\abstract,\@twocolumnfalse,\title" old.tex new.tex > diff.tex

I had tried the --append... option after reading some other resources online, but still have not managed to get the changes shown in the resulting diff.pdf file.

Thanks in advance for your help.

Contents of old.tex:

\documentclass[journal=jacsat,manuscript=communication]{achemso}
\setkeys{acs}{articletitle = true}
% manuscript title
\title{My title}
\SectionsOn
\SectionNumbersOff

% author list \author{A. N. Other} \affiliation[Latex]{Latex University} \altaffiliation{Contributed equally to this work}

\author{B. N. Other} \affiliation[Latex]{Latex University} \altaffiliation{Contributed equally to this work} \email{blank@blank.com}

\usepackage[hidelinks]{hyperref} % Provide convenient links throughout

\usepackage{achemso} % ACS formatting

\renewcommand*\titlesize{\Large} \let\oldmaketitle\maketitle \let\maketitle\relax

\begin{document}

\begin{filecontents}{oldrefs.bib}
    @article{ref1,
        title = {Paper Title},
        volume = {70},
        journal = {Nature},
        author = {Smith, J. H.},
        year = {1942},
        pages = {1--31},
    }
\end{filecontents}

\twocolumn[ \begin{@twocolumnfalse} \oldmaketitle \begin{abstract} My abstract. \end{abstract} \end{@twocolumnfalse} ]

\section*{Introduction}

Main text.\cite{ref1}

\bibliography{oldrefs}

\end{document}

Contents of new.tex:

\documentclass[journal=jacsat,manuscript=communication]{achemso}
\setkeys{acs}{articletitle = true}
% manuscript title
\title{My title has changed}
\SectionsOn
\SectionNumbersOff

% author list \author{A. N. Other} \affiliation[Latex]{Latex University} \altaffiliation{Contributed equally to this work}

\author{C. N. Other} \affiliation[Latex]{Latex University} \altaffiliation{Contributed equally to this work} \email{blank@blank.com}

\usepackage[hidelinks]{hyperref} % Provide convenient links throughout

\usepackage{achemso} % ACS formatting

\renewcommand*\titlesize{\Large} \let\oldmaketitle\maketitle \let\maketitle\relax

\begin{document}

\begin{filecontents}{newrefs.bib}
    @article{ref1,
        title = {Paper Title},
        volume = {70},
        journal = {Nature},
        author = {Smithsonian, J. H.},
        year = {1942},
        pages = {1--31},
    }
\end{filecontents}

\twocolumn[ \begin{@twocolumnfalse} \oldmaketitle \begin{abstract} My abstract has some new information. \end{abstract} \end{@twocolumnfalse} ]

\section*{Introduction}

Main TEXT.\cite{ref1}

\bibliography{newrefs}

\end{document}

script for producing result (diff.tex and diff.pdf):

#!/bin/bash

latex -src -interaction=nonstopmode old.tex bibtex old.aux latex -src -interaction=nonstopmode old.tex pdflatex -synctex=1 -interaction=nonstopmode old.tex latex -src -interaction=nonstopmode new.tex bibtex new.aux latex -src -interaction=nonstopmode new.tex pdflatex -synctex=1 -interaction=nonstopmode new.tex latexdiff --append-context2cmd="\twocolumn,\abstract,@twocolumnfalse,\title" old.bbl new.bbl > diff.bbl latexdiff --append-context2cmd="\twocolumn,\abstract,@twocolumnfalse,\title" old.tex new.tex > diff.tex latex -src -interaction=nonstopmode diff.tex pdflatex -synctex=1 -interaction=nonstopmode diff.tex

MikeG
  • 23
  • 1
    Tracked in https://github.com/ftilmann/latexdiff/issues/130 – ederag Nov 05 '23 at 16:00
  • @JoséCarlosSantos This is NOT a duplicate of that question. It concerns an issue with the use of latexdiff with particular classes, whereas that question is so vague it could be about anything. Unfortunately, there doesn't seem to be much progress on the linked bug, so it is hard to even know if this is off-topic as a bug report. Even if it is, I think it is reasonable to ask for a workaround here. – cfr Nov 06 '23 at 05:56

0 Answers0