Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I don't have anything to say about using <code>Hg</code>, but I thought I'd share some annoying issues I had with using <code>git</code> for my latex files (I presume hg will behave the same).</p> <p>VCS were probably originally designed for versioning code, and typically you have one sentence per line. However, with latex and other text documents, it is natural to write a full paragraph of text without breaking each line into a separate sentence. So any change in a word within the paragraph shifts the positions of all the other following words in the paragraph, and when you do a <code>diff</code>, it shows the entire paragraph has being changed. It gets annoying when you have a lot of text and you go do a revision and then <em>everything</em> is highlighted! Here's a small example:</p> <pre><code>\documentclass{article} \begin{document} Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque blandit lacus aliquet eros tempus non tristique nisl consectetur. Sed orci odio, viverra quis rutrum eu, eleifend eget risus. Nam elementum tempus auctor. Nunc tincidunt dui et mauris varius faucibus ultrices nulla iaculis. \end{document} </code></pre> <p>After making an initial commit and making a small change, here's the output of <code>diff</code>:</p> <p><img src="https://i.stack.imgur.com/hY1fX.png" alt="enter image description here"></p> <p>I can't tell what was the change that I made! A workaround is to use an optional <code>--color-words</code>, which will highlight only the words that have been changed. I usually set my <code>diff</code> to default to using this option. You can perhaps find out if mercurial has something similar. </p> <p><img src="https://i.stack.imgur.com/q6yGH.png" alt="enter image description here"></p> <p>Although git records the entire paragraph as being changed, it only highlights the words that have been changed, which is good enough for me. </p> <hr> <p>An alternate solution requires a small change in how you write your latex files. Consider this example, modified from the one above.</p> <pre><code>\documentclass{article} \begin{document} Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque blandit lacus aliquet eros tempus non tristique nisl consectetur. Sed orci odio, viverra quis rutrum eu, eleifend eget risus. Nam elementum tempus auctor. Nunc tincidunt dui et mauris varius faucibus ultrices nulla iaculis. \end{document} </code></pre> <p>Here each sentence gets its own line. If you compile both the latex examples, there will be no difference in the output. This is because latex automatically puts a space after a period, and ignores a single line break. Now when you make a change within a line and diff it, git will highlight only that line and not the entire paragraph. This is something I've slowly begun to do, although at first it was annoying to not be able to read a paragraph continuously.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload