Update on Tex editors

Nearly three years ago, I wrote about a comparison of LaTeX editors. Soon after, I began to use a third editor which, if you are a latex expert, you almost certaintly would have heard about, and are probably in fact using TeXStudio, an editor that has been around for close to a decade, but never appeared to show up on Linux installation packages. The editors that showed up, at least for me, were LyX and TeXmacs.

TeXstudio, once I discovered it, I installed it everywhere I could: on my Windows 10 and 7 machines, on my Linux installations, and even on Cygwin, even though they already had a Windows installation. To this day I have not seen any difference in output or functionality. All invocations of TeXstudio require a lot of time and packages for an installation of enough features.

This is TeXstudio, with the horizontal toolbars shown, along with part of the workspace. There are two vertical toolbars there, also partially shown.

First thing’s first: the editor. In LyX and TeXmacs, I needed to bail out of the editor, and export the code to LaTeX whenever I needed to do any serious equation editing or table editing or the like. In contrast, TeXstudio leaves me with no reason to ever leave the editor. First of all, the editor allows for native latex code to be entered. If there are pieces of Latex code that you don’t know, or have a fuzzy knowledge about, there is probably an icon or menu item that covers it. For document formatting, a menu item leads to a form dialog where you can fill in the form with sensible information pertaining to your particular document, default font size, paper size, margins, and so on. The ouput of this dialog is the preamble section to the LaTeX source file. To the rest of that source file, you add your document and formatting codes.¬† It is a kind of “notepad” for LaTeX, with syntax highlighting and shortcut buttons, menus and dialogs. It comes close to being WYSIWYG, in that “compiling” the code and pressing¬† the green “play” button brings up a window with the output of the existing code you are editing. It is not a live update, but it saves you the agony of saving, going on the command line compiling the code, and viewing in seeminly endless cycles. Now you can view the formatted document at the press of the play button.

Latex editors: a comparison

If you are using Lyx or Texmacs, this book is still an absolute must. It is THE bible for this language.

Latex is a math typesetting markup language which has been around for about 30 years. It is about as old as HTML, and runs on pretty much any kind of computer that can support a Latex compiler. I have written many term papers in it, and continue to use it to write documents. Its best feature is its ability to handle mathematical and scientific notation. It is also the official typesetting language of the American Mathematical Society. A Stanford professor named Dr. Donald Knuth invented a lower-level markup language called Tex as far back as 1976, and Latex, designed in 1985 by Leslie Lamport, was and is just a bunch of Tex macros, sophisticated enough in itself to amount to a higher-level language. You can edit complete documents and even entire books with only a background in Latex. Latex is therefore robust enough that that is all I ever use for math and science documents.

Latex documents are known for their distinctive roman font, and its clean presentation of even the most complicated formulae. The WordPress editor used in making this blog article can show formulae using the distinctive Latex fonts: m = \frac{m_0}{\sqrt{1-\frac{v^2}{c^2}}} is the way Einstein’s relative mass formula is presented on my editor. This is identical to how it would appear in a Latex paper document. Unfortunately, this editor only displays inline math, so I can’t show you how it would display “presentation-style” math, where the fonts would be larger.

Over the decades, there have been editors in existence that mimic Latex in presentation of fonts and formulae. Two that I have encountered are Lyx and Texmacs.

Both Lyx and Texmacs try to distance themselves from being just WYSIWYG wrappers for the Tex/Latex language. While the metafonts displayed are the distinctive fonts known to exist in Latex are those displayed by default in these editors, saving the files saves to the format native to these separate editors. If you want Latex, you have to export your work into Latex format.

Examples of output from Texmacs. Not bad for math, (especially if you know the Latex math codes) but not so easy to use when not in math mode.

First I’ll discuss Texmacs, since my experience with it is the most recent. I discovered Texmacs by surprise when browsing through my Cygwin menus on my laptop. While one would think that going by the name, Texmacs must have some combination of Tex and Emacs, it has dependence on neither. The editor has no resemblance to Emacs (neither in the user interface nor the keystrokes), and a selection of document options appear on the toolbar and in the menus that appear to be in line with Latex document and font options. Texmacs produces its own Texmacs code by default, and while Latex can be exported, the document in Latex may not end up looking the same. I have found that many font changes were lost, for instance.

For one who has worked with Latex for close to 30 years, I can say that nearly all of the resemblance to Latex as well as its ease of use lie in the editor’s use of math commands, although there is more dependence on the GUI. One finds that you can’t enter “\frac{3}{4}” to get \frac{3}{4}, but there is a Texmacs icon you can click that handles that.¬† Its weakness lay in its handling of the rest of the document. Tables were not well implemented. It appears incapable of inserting gridlines forming the borders for the table cells, for instance, even though the command for it appears to be there in the GUI. I found I needed to export the Latex code, bail out of Texmacs and edit the Latex code directly in a text editor. Another drawback of Texmacs is that while the icons cover nearly anything you would like to do in math, the fact remains that your choices of math expressions are largely limited to the buttons provided. If you are going to do something more complicated, you are going to find reason to edit the Latex code directly by hand again in a text editor. And once you do, importing the *.tex file back into Texmacs to continue editing will not guarantee that your new Latex code will be understood the way you want it. One thing that Texmacs does rather well is change fonts. Latex/Tex has ways of changing fonts internal to its language, but you are limited to only a small number of standard Tex fonts, unless you know your way around the preamble, or header part of the code. Texmacs leaves you more open to alternative installed fonts, allowing you to take advantage of the diversity of Tex fonts of which there are hundreds, created over the last 10 or more years. In fact Texmacs is the only way I know of to take advantage of alternative fonts outside of the Roman/Helvetica/monospace fonts that are at the core of Tex in a way that is even remotely as easy as a word processor. Texmacs documents will have a Latex look and feel, with greater flexibility in font choices, but as said earlier, all this is great as long as you are sticking largely to simple math or math in the toolbars, or as long as you avoid typesetting constructs outside of the math markup, such as tables.

An older version of the Lyx editor.

Lyx is, I believe a much older editor. It claims to use Latex for its typesetting, but my experience with it (although admittedly years ago) was that for serious math applications, you have to export Latex code and edit it by hand if you want to get what you want. Make sure you have Leslie Lamport’s Latex book beside you at the time. After decades of working on and off with Latex, I can never completely get the language and all its nuances in my head, and need the constant assistance of Lamport’s Latex book at my side. This also ends up being the case for Texmacs, since even basic formatting has to be changed under that editor.

In the end, these editors can save a lot of time to get the basic look and feel down for your document, but in the end you need to, at some point, hunker down and edit Latex code directly, using a text editor. I use vi, where I constantly need to bail out and compile the code and run xdvi on the compiled *.dvi file to see what it looks like and what Latex code I need to tweak next.

Both Texmacs and Lyx are on the GPL.
Texmacs source code: http://savannah.gnu.org/svn/?group=texmacs
Lyx source code: http://www.lyx.org/Download

Updating or installing Cygwin always a headache

I wanted to update Cygwin, since I was playing around with WindowMaker on another computer, and saw that it wasn’t on my laptop. When I did this, I decided to update latex as well. My advice to those who want to do this, if all you are doing is updating, don’t ever update the font collection. If you select latex as a package to install, the default is to install everything in sight that has anything to do with latex. The update will happen fairly quixckly, but the postinstall phase of latex will take upwards of 8 hours. At any rate, whenever I use latex, I never see what fonts are installed outside of the usual Times Roman, Italic, or Sans Serif. Not altogether sure why all these fonts are needed, since I never see them in any document I edit. Certainly, any attempt to install latex or any of its latex-like couterparts such as LyX must always be accompanied by a de-selection of all fonts you know you will never use, such as, in my case, Chinese, Korean, Japanese, Cyrillic — I don’t speak the languages that would use them, so no point in installing these.

I have heard on many discussion forums that a big reason for the slow postinstall is due to interference with antivirus software. I can say that this does not appreciably affect the (slow) speed of the install, since mine was turned off. I am not sure why the effect of antivirus software would be relevant, since latex does not need an Internet connection to operate. No other software would take this long to install, with or without antivirus software.