ftilmann / latexdiff

Compares two latex files and marks up significant differences between them. Releases on www.ctan.org and mirrors
GNU General Public License v3.0
514 stars 72 forks source link

Typesetting an accessibility friendly diff-metric for changes per paragraph between two TeX documents #159

Open krishnakumarg1984 opened 6 years ago

krishnakumarg1984 commented 6 years ago

I am partially colour-blind and my eyes take a bit of stress to look at a document full of colours in the text. It is really helpful if an accessible solution of some metric like "a boxed value indicating the percentage change on the margin notes for each paragraph". is made available.

Can I ask for this feature enhancement to latexdiff.pl .

Please see this stackexchange post for an overview of the background and context.

ftilmann commented 6 years ago

Thanks for the feature request. Regarding accessibility: The colours can be turned off easily by just removing the \color{blue} and \color{red} statements from the preamble. '-t FONTSTRIKE' selects a markup style not using colors although the font-change only way to mark additions is not ideal for your use case; '-t BOLD' just highlights additions in bold (deletions are not visible) - this might be the best choice for your use case. Adding new styles is trivial, either using --preamble option or by hard-coding your own within latexdiff (styles are defined at the end of the source code). If you find making a pull request too daunting, you can just paste the modified preamble and a suggested name for the markup-style and I can easily implement it.

Regarding the actual request for per-paragraph statistics: I still think that a black and white underlined and crossed-out text would better serve your use case, as the human eye is much better than latexdiff to pick up on the significance of changes. latexdiff does not process its input files on a per-paragraph level, rather the paragraph break is treated as just another token. So the suggestion is non-trivial to implement. After the diff'ing the text could be broken up into paragraphs, and then re-tokenized to allow per-paragraph counting of added, removed and unchanged material. Then for the margin paragraph one would need to add checks that they are possible (e.g. in figure caption they generally to not work well. I will be honest that I will not engage in making this change because I am not convinced it is useful for many people. I leave the issue open, though, maybe you are lucky and somebody else will implement it (or there is great support for your idea, which might make me reconsider my assessment)