latexdiff icon indicating copy to clipboard operation
latexdiff copied to clipboard

merged paragraph are still separate in diff

Open RafalSkolasinski opened this issue 8 years ago • 2 comments

After merging two paragraphs they are still rendered by latexdiff as separated. Similar issue is also discussed here.

RafalSkolasinski avatar Nov 06 '17 09:11 RafalSkolasinski

When there is actually a deleted text the paragraph breaks should be retained in the deleted text I think (this behaviour is also consistent with the change highlighting in Word and OpenOffice). The merger of a paragraph is an extreme case of this. Here I agree that the diff file should probably just show the text as merged (i.e., this change would only be visible in the source, at least in the standard markup style), as the deleted paragraph break is not distinguishable from a non-deleted one. So the feature request would essentially be to supress deleted paragraph breaks if that is the only change. How about if there are deleted words before but not after the paragraph break?

It would help if you could construct an MWE (minimum working example) demonstrating various edge cases and the desired behaviour. But in the end one probably also has to also accept that change-highlighting will mess a bit with the formatting.

ftilmann avatar Nov 06 '17 10:11 ftilmann

Hi @ftilmann. I am mostly interested in having in generated diff merged paragraph together. Some minimal example.

old.tex:

\documentclass{article}

\begin{document}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras in consequat sem. Vestibulum turpis neque, tempus sit amet ipsum et, tempus convallis turpis.

Donec auctor commodo orci, dapibus congue augue congue ut. Etiam blandit malesuada ipsum.
\end{document}

old.pdf

2017_11_06_11 38 25

new.text:

\documentclass{article}

\begin{document}
Some change. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras in consequat sem. Vestibulum turpis neque, tempus sit amet ipsum et, tempus convallis turpis. Change. Donec auctor commodo orci, dapibus congue augue congue ut. Etiam blandit malesuada ipsum. Some other change.
\end{document}

new.pdf

2017_11_06_11 38 50

generated diff.tex

\documentclass{article}
%DIF LATEXDIFF DIFFERENCE FILE
%DIF DEL old.tex   Mon Nov  6 11:34:56 2017
%DIF ADD new.tex   Mon Nov  6 11:35:59 2017
%DIF PREAMBLE EXTENSION ADDED BY LATEXDIFF
%DIF UNDERLINE PREAMBLE %DIF PREAMBLE
\RequirePackage[normalem]{ulem} %DIF PREAMBLE
\RequirePackage{color}\definecolor{RED}{rgb}{1,0,0}\definecolor{BLUE}{rgb}{0,0,1} %DIF PREAMBLE
\providecommand{\DIFadd}[1]{{\protect\color{blue}\uwave{#1}}} %DIF PREAMBLE
\providecommand{\DIFdel}[1]{{\protect\color{red}\sout{#1}}}                      %DIF PREAMBLE
%DIF SAFE PREAMBLE %DIF PREAMBLE
\providecommand{\DIFaddbegin}{} %DIF PREAMBLE
\providecommand{\DIFaddend}{} %DIF PREAMBLE
\providecommand{\DIFdelbegin}{} %DIF PREAMBLE
\providecommand{\DIFdelend}{} %DIF PREAMBLE
%DIF FLOATSAFE PREAMBLE %DIF PREAMBLE
\providecommand{\DIFaddFL}[1]{\DIFadd{#1}} %DIF PREAMBLE
\providecommand{\DIFdelFL}[1]{\DIFdel{#1}} %DIF PREAMBLE
\providecommand{\DIFaddbeginFL}{} %DIF PREAMBLE
\providecommand{\DIFaddendFL}{} %DIF PREAMBLE
\providecommand{\DIFdelbeginFL}{} %DIF PREAMBLE
\providecommand{\DIFdelendFL}{} %DIF PREAMBLE
%DIF END PREAMBLE EXTENSION ADDED BY LATEXDIFF

\begin{document}
\DIFaddbegin \DIFadd{Some change. }\DIFaddend Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras in consequat sem. Vestibulum turpis neque, tempus sit amet ipsum et, tempus convallis turpis. \DIFdelbegin %DIFDELCMD < 

%DIFDELCMD < %%%
\DIFdelend \DIFaddbegin \DIFadd{Change. }\DIFaddend Donec auctor commodo orci, dapibus congue augue congue ut. Etiam blandit malesuada ipsum\DIFaddbegin \DIFadd{. Some other change}\DIFaddend .
\end{document}

diff.pdf

2017_11_06_11 39 05

As you see there are still two different paragraphs. Merging paragraph is not even highlighted in anyway. What I would expect to see is for example

\documentclass{article}
%DIF LATEXDIFF DIFFERENCE FILE
%DIF DEL old.tex   Mon Nov  6 11:34:56 2017
%DIF ADD new.tex   Mon Nov  6 11:35:59 2017
%DIF PREAMBLE EXTENSION ADDED BY LATEXDIFF
%DIF UNDERLINE PREAMBLE %DIF PREAMBLE
\RequirePackage[normalem]{ulem} %DIF PREAMBLE
\RequirePackage{color}\definecolor{RED}{rgb}{1,0,0}\definecolor{BLUE}{rgb}{0,0,1} %DIF PREAMBLE
\providecommand{\DIFadd}[1]{{\protect\color{blue}\uwave{#1}}} %DIF PREAMBLE
\providecommand{\DIFdel}[1]{{\protect\color{red}\sout{#1}}}                      %DIF PREAMBLE
%DIF SAFE PREAMBLE %DIF PREAMBLE
\providecommand{\DIFaddbegin}{} %DIF PREAMBLE
\providecommand{\DIFaddend}{} %DIF PREAMBLE
\providecommand{\DIFdelbegin}{} %DIF PREAMBLE
\providecommand{\DIFdelend}{} %DIF PREAMBLE
%DIF FLOATSAFE PREAMBLE %DIF PREAMBLE
\providecommand{\DIFaddFL}[1]{\DIFadd{#1}} %DIF PREAMBLE
\providecommand{\DIFdelFL}[1]{\DIFdel{#1}} %DIF PREAMBLE
\providecommand{\DIFaddbeginFL}{} %DIF PREAMBLE
\providecommand{\DIFaddendFL}{} %DIF PREAMBLE
\providecommand{\DIFdelbeginFL}{} %DIF PREAMBLE
\providecommand{\DIFdelendFL}{} %DIF PREAMBLE
%DIF END PREAMBLE EXTENSION ADDED BY LATEXDIFF

\begin{document}
\DIFaddbegin \DIFadd{Some change. }\DIFaddend Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras in consequat sem. Vestibulum turpis neque, tempus sit amet ipsum et, tempus convallis turpis.
\DIFdelend \DIFaddbegin \DIFadd{Change. }\DIFaddend Donec auctor commodo orci, dapibus congue augue congue ut. Etiam blandit malesuada ipsum\DIFaddbegin \DIFadd{. Some other change}\DIFaddend .
\end{document}

expected.pdf

2017_11_06_11 44 01

RafalSkolasinski avatar Nov 06 '17 10:11 RafalSkolasinski