[Tex/LaTex] How to use the built-in DIFF feature of TeXStudio


It appears that TeXStudio has a built-in DIFF feature. For example, one can define the syntax highlighting used for differences in the options dialogue.

But if I have two files to compare, say article.tex and article_old.tex, how do I launch the DIFF mode?

The only way I found is to open article.tex and then use "Show differences between two files" item under "File -> SVN…" and then select "article_old.tex". But this behaves very strangely, for example it only hightlights things that are present in article.tex and not in article_old.tex, but not vice versa. (This seems to be the case simply because only lines that are contained in the currently open file are highlighted, and when more lines are present in the OTHER file, they cannot be hightlighted in the currently open one, simply because they are not there.)

The option "Show differences between two files (relative to original file)" behaves even less comprehensibly.

I was unable to find any documentation of the DIFF feature online, so I am asking here: What do I need to do to just get "normal" DIFF between two files, as one would expect?

Best Answer

I find the DIFF feature to be working differently from what the OP describes; mine works in a way that does indeed make sense. As I write this, the original question is only 3 months old, but maybe the feature has been added or fixed in that time?

  • UPDATE (1 day later):

    It does seem to visually show the differences between the two documents, but attempts at even simple edits while the DIFF feature is active have lead to unpredicted losses of text in sundry places. Perhaps that is what is meant by the feature being unsupported.

I'm using TeXstudio 2.11.2. My Syntax Highlighting scheme for Diff is the default: pink background with the Strikethrough option checked for diffDelete; green background for diffAdd; yellow background for diffReplace. I haven't installed SlickSVN or anything like it. I just have the default installation of TeXstudio.

When I have an open file and I select "Show differences between two files", then it appears TeXstudio treats the already-opened file as the old one. Therefore, I am going to use the OP's example, but switch the files

The currently opened file is "article_old.tex", and under "File -> SVN -> Show differences between two files" I select "article.tex". What I see in the open document (article_old.tex) is:

  • text that is present here but not in "article.tex" is shown with a pink background and strikethrough text

  • text that is absent in "article_old.tex" but present in "article.tex" is now shown here with a green background

  • some text has a yellow background which I haven't completely figured out; perhaps text that is roughly similar but not identical between the two documents.

Related Question