I'm planning to write my master thesis using LyX. In order to keep track of recent changes, I want to export the LyX source files to normal LaTeX source files and put these in a Git repository. In the LaTeX source files, I want each sentence to be on its own line so that I can track changes of my text in a more fine-grained way.

Is there maybe a macro or a command with which I can tell LyX to put each sentence on its own line in the exported LaTeX source files? If not, is there a way to write my own macro which can achieve that? Thank you very much in advance!

  • My first thought is to write a script that will search the .tex file for periods and insert a `\\` after each one to create a new line. The result probably won't be perfect but it should be a decent enough starting point. Are you comfortable in any scripting languages?
    – Dennis
    Commented Jan 1, 2013 at 19:00
  • Have you seen latexdiff?
    – user10274
    Commented Jan 1, 2013 at 19:59
  • @Dennis Inserting a \\ doesn't help here because I don't want each sentence to be on a separate line in the generated PDF file but only in the LaTeX source file.
    – pemistahl
    Commented Jan 2, 2013 at 10:52
  • @MarcvanDongen I know latexdiff but it's not as nice as a real version control system. Besides that, it's not an answer to my question.
    – pemistahl
    Commented Jan 2, 2013 at 10:54
  • @PeterStahl Without some form of coding convention, version control is impossible. Personally I always format the LaTeX input by hand. Putting every sentence on one line may be regarded as a coding convention, but it'll be one that's going to make it very difficult to find bugs.
    – user10274
    Commented Jan 2, 2013 at 11:33

1 Answer 1


You can also use Version Control in LyX. (At least in the Mac version there is a menuitem under File menu.) I have just tried it today and it works nicely, I can smoothly compare my newer submissions with older ones, with the modified interface in Version Control.

Im not sure what is the case in other systems, but on mac using the built-in Version Control is far better than using git.


But be prepared for frequent of check-ins and outs as I have checked-in stuff after two days and it started counting the differences... I waited up to 5000, that was in 5mins and closed the comparison... :(

  • Ah, thanks for the note. I'm using the Mac version and wasn't aware that rcs is used for version control. I thought that svn would have been used instead. Since there doesn't seem to be a solution for my problem, I will probably stick to the LyX-internal version control and put the respective master file (extension *.lyx,v) in my Git repository. That should work as well.
    – pemistahl
    Commented Jan 3, 2013 at 14:12
  • Yeah, I have just had some surprise :S Anyway, you can still use svn or git, with the .lyx files, since the actual text in .lyx files is quite well readable if you do not turn on compression. So you have a good chance at being able to see the differences. Commented Jan 3, 2013 at 17:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .