Linux

Using version control with the LyX document preparation program

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 use LyX. 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.

About

Scott Reeves has worked for Hewlett Packard on HP-UX servers and SANs, and has worked in similar areas in the past at IBM. Currently he works as an independent IT consultant, specializing in Wi-Fi networks and SANs.

1 comments
MaeIstrom
MaeIstrom

Sadly due to its Byzantine dependencies and inadequate support from most distros the dream of concentrating on the writing and forgetting about formatting is just that, a pipe dream. Most people will find themselves spending 10x, a 100x, even a 1000 times the effort they would have spent on formatting their document into getting that .lyx document onto the desktop of someone who can only read .doc files or out of a printer. One "cheat" I've had to resort to in the past is using the Print Preview (View PDF) function and cut'n'pasting the output into an openoffice window. Given that many of its niftier features like auto-updating menus can now be done by more mainstream editors and its antique gui time may have passed this editor by. It's a step up from editing latex files in emacs but a step down from most everything else. ps. Just tried installing the latest version on ubuntu to see if that very dubious claim about exporting to word or openoffice formats was true and clearly not, at least not out of the box. Just the usual list of html and pdf options, all of which fail. Obviously my fault for not spending months or years in research to know exactly which supporting software to configure and install but yeah anyone who has a deadline to hand in a piece of writing will want to give this a very wide berth.