Pages

Kamis, 17 Mei 2012

Using version control with the LyX document preparation program


Takeaway: Scott Reeves introduces the LyX document prep program with a GUI front-end that makes formatting easy.
Document preparation programs such as LyX and LaTeX have been used in the scientific, engineering and mathematics communities for a while. They are particularly well-suited for presenting technical and scientific documents where the proper formatting for mathematical equations is needed. For this reason, they are superior to the standard word-processing programs. LyX is essentially a GUI front end to LaTeX and has the added advantage that it does most of the formatting for you. As someone who writes regularly in my spare time, I prefer to useLyX. The uses of LyX are not limited to writing theses or scientific papers, however. As the web page says, you could use it to write a book or a theater play. I have not written either, but I have used it to construct other documents, including several of my posts to this website.
My introduction to LyX came via using LaTeX. The reason I used LaTeX in the first place was LaTeX’s superior capacity in typesetting mathematical formulas and equations. LyX has a large number of templates. A few well-known ones are the thesis and IEEE templates, but there are also templates for articles, letters and even presentations. With LyX you do not have to worry about the formatting, leaving you to (hopefully) concentrate on the content.
LyX is very useful in being able to export files into other formats. I frequently export a document into portable document format for printing. You can, if you want, export to Open Document, Word, HTML, or plain text formats.
A feature I really like about LyX is the integration with Revision Control System (RCS). I will assume most people will have some familiarity with RCS. RCS (along with CVS and SVN) is a version control system. This is handy for software developers (for whom it was originally developed). However, version control systems are also very useful for other purposes; in this case, checking in revisions of documents.
RCS can be used on the command line; the two commands that are probably all you will ever need to use are ci (for Check In) and co (for Check Out). If you were to use it on the command line you would use co with a -l option. The -l option locks the file, preventing other users from accessing it. Checking in a file is easy as well; you can put comments stating, in brief, any changes made. The LyX GUI runs the ci and co commands in the background, which makes the process much simpler.
Here is a short rundown on how to check in a file and check it out using LyX. The menu items to follow for checking in a document are File | Version Control | Register. This brings up the dialog box shown in Figure A. You can type in a description in the dialog box, such as “First Edit”. Each check in will allow you to enter a short description of changes made.

Figure A

Click to enlarge.
Once you have saved a document, you can then check it in. The menu commands to use are File | Version Control | Check in Changes. If you want to check it out again, then File | Version Control | Check out for Edit enables you to start editing the file. There are other options under Version Control, such as checking out previous versions or comparing different versions of a document. This can be very useful if you want to revert to a previous version in a hurry.
Overall, LyX is a better-than-handy tool for documentation. Its features let you get on with the job of writing. The ability to integrate version control using RCS makes it much easier to control your documentation. It is something I cannot imagine not having since I started using it.