# What's the fastest way to preview changes as I learn TeX?

So I am learning LaTeX and I find it slow to test changes. So I'd edit the .tex file, then go to command line, and run pdflatex, wait for it to complete, and then open total commander, and then open the .pdf file. Does anyone know a faster way to test changes? (WYSIWYG?)

-
The ldflatex is a typo isn't it? You mean pdflatex, right? Then you should write "learning LaTeX". TeX would be plainTeX which is quite different from it. –  Martin Scharrer Apr 29 '11 at 8:16
This just sounds like the question of using a dedicated editor with built-in viewing. –  Joseph Wright Apr 29 '11 at 8:35
Which editor are you using? –  Loop Space Apr 29 '11 at 8:40
Which operating system are you using? –  MostlyHarmless Apr 29 '11 at 10:34
Using Vim with MikTex on Windows. –  Peteris Krumins Apr 30 '11 at 23:23

Quite a few PDF viewers support SyncTex or can simply reload the document when it is modified. This is the case of Evince, Okular, among others.

I don't know what editor you're using. I'm personally used to vim, so I can just build from within it (and the PDF can be refreshed automatically as stated before).

There are also TeX specialized editors with a build button and integrated PDF viewer, so you don't need to go to command line and open the PDF yourself. TeXworks (shipped with both MikTeX and TeX Live) is one of them. On KDE, there's Kile which is also an excellent product.

As far as WYSIWYG goes, LyX is a program that wraps around LaTeX to make the whole experience more "WYSIWYG". You can use a WYSIWYG editor, or a LaTeX editor, as you wish. Afaik, it's not pure LaTeX though (it needs some converting).

-
TeXworks works not only on Windows but also on Mac (TeXworks 0.2.3, for Mac OS 10.5 and up on x86_64: TeXworks 0.4.0) and GNU/Linux. –  ipavlic Apr 29 '11 at 8:29
@ipavlic: Good to know –  ℝaphink Apr 29 '11 at 8:36
LyX also provides an online preview of the resulting LaTeX code, which can become quite handy for learning LaTeX. So you can edit, for instance, a complex formula or table in the respective LyX WYSIWYM editors and dirctly observe "how todo this woth LaTeX". –  Daniel Mar 14 '13 at 10:04

I personally use latexmk with the -pvc (preview, continuously) to recompile the document every time it is saved. It also (re-)opens the PDF viewer of your choice automatically for you. This should work well under Windows, Linux and on the Mac.

Usage:

latexmk -pdf -pvc mainfilename

-
does latexmk work with xelatex? –  pmav99 Apr 29 '11 at 11:45
@pmav: latexmk -pdf -pdflatex=xelatex 〈file〉. –  Caramdir May 1 '11 at 1:06

I know of two options with emacs.

Whizzytex, which uses the advi viewer, though it does not seem to be widely used. The way it works is, advi starts up (though I think other viewers with the necessary support can also be used) and then as you move around in the buffer, the document is compiled and updated in advi on the fly and also your current position in the buffer is highlighted in advi. It is in Debian at least. As you can see, it is not a very active project.

A more popular option is of course preview, originally written by David Kastrup, which is now part of AUCTeX.

-
Both WhizzyTeX and ADvi have updates dating from autumn 2011 so the "not a very active project" is not strictly true. I've just discovered them (thanks to another question on this site) and think that they have distinct potential for usefulness! –  Loop Space May 2 '12 at 19:53
@andrewstacey i spent some time trying to raise responses from the whizzytex/advi people, so as to get them to “come into the fold”, and allow us to distribute via ctan. answer came there none; i’ve forgotten the precise detail of the offering, but if they’re still using dvi format they're only really targeting tex users of the early '90s and earlier still. not many of us are up to changing direction at this stage... ;-) –  wasteofspace Nov 21 '12 at 10:22

In addition of all the "desktop" solutions provided, you also have some "cloud" alternatives, which can be specially useful while learning. A few I'm aware of are:

The two first allow for trying the service without registration. Both feature instant preview with automatic refreshing, pdf export, and (with subscription) the posibility of saving your tex in the cloud, among other interesting features (such as sharing or collaborative edition). Also they have a pretty complete TeX installation with most of the usual packages available.

The other two require registration to login, so I didn't tried them (hence no screenshot).

-
SpanDeX is being discontinued –  deimi Aug 20 '13 at 10:58
@deimi Thank you, updated answer –  JLDiaz Aug 22 '13 at 16:13

Just use a tex editor/IDE like Texmaker or TexnicCenter. Although it isn't WYSIWYG, they will integrate with your latex installation and pdf viewer, so all you have to do is press one button, and they will compile and open the pdf.

If you use SumatraPDF for viewing, you can set up forward and inverse search with DDE commands

-

Not an answer to your question, but if you are also planning to use TikZ package, KtikZ editor might be useful for learning.

It autocompletes, autocompiles and is handy for quick creation of TikZ images independently from your LaTeX document. When you are satisfied with the result TikZ code can be included to your main document.

-
+1 for ktikz, although it is not only for tikz pictures. It compiles every valid tex document, math tex included. If you need you can change the template file in order to include more packages in the preamble. The only problem is that you won't enjoy auto-completion for anything else but tikz code. –  pmav99 Apr 29 '11 at 10:33

There is also gummi. It is an editor that recompiles, every time you stop typing or every N seconds (check the settings).

-

I use a program named Latexian that has a feature called Live Preview which obviously compiles the document every time it is changed and displays the PDF output in the same window. I have not seen a better solution yet.

Latexian is available for Mac OS X and is available on a 30-day trial basis prior to purchase.

-
Latexian is not available anymore. :( –  Daniel Lyons Jun 18 at 4:31

LEd has also a 2-way-dvi preview. Not live, but helps to easily compare your code with the result.

-
Unfortunately, LEd development is abandoned and has a lot of serious bugs. It's best not to use it anymore. TeXMaker has the same feature. –  percusse Nov 21 '12 at 1:07
Which bugs? For me it is the best LaTeX Editor in Windows and i've tried a lot. –  Megachip Nov 21 '12 at 2:27
It was mine too but it crashes quite unexpectedly and is not reliable (on my system at least). There were a lot of bug reports but couldn't find it where it was. However point is that it's replaced by many more advanced editors and this feature you have mentioned is already in TeXMaker and possibly many others. –  percusse Nov 21 '12 at 2:30
Another problem is that the workflow has been shifted quite a lot to PDFLaTeX, LuaLaTeX and XeLaTeX so DVI is (almost) not a feature anymore. –  percusse Nov 21 '12 at 2:37
@percusse -- sad that dvi is "going away". at least when using the default fonts, it's lots faster than pdf. –  barbara beeton Mar 30 '14 at 5:14

On Unix/Linux, it is easy to do in vi. In your .exrc file, add the following:

map [CTRL V][F2] :w[CTRL V][Enter]:!latex %[CTRL V][Enter]

where the keys in square brackets are the actual keys on keyboard (without the square brackets). Before you start editing the file, open a viewer with xdvi on the file. Then, while editing, you can pres the F2 key which will recomple your LaTeX file. Clicking in the xdvi renderer will repaint the screen.

-

You have the following optoins:

1. Linux/Mac/Windows, free: Gummi, supports PdfTex/XeTeX/Rubber/Latexmk

2. Linux/Mac, free: whizzytex + Emacs (only for latex not pdflatex); watch this demo

3. Windows/Mac/Linux, non-free: BaKoMa TeX

There is a review on WYSIWYG latex editors here, though Gummi was not in the list

-
Gummi is a great 'previewer'. Under Linux it is the only one to reload the resulting pdf smoothly without flickering or clumsy reloading. But because of its lack of shortcuts, macros, in short of all the things that make editing easy I would not really call it *TeX 'Editor'. –  permaneder Mar 14 '13 at 8:39

When I was learning LaTex I used Texmaker. It has a built in PDF viewer as well as many symbols available as quick buttons to add into the document fast with the nice side benefit of learning them quickly as you go.

For pure speed, I don't think there is anything faster than using Sublime Text 2 with Skim (OS X only). PDF's compile so fast. You don't get bells and whistles like you do in Texmaker but it sure hums.

-

While the above answers are fine, they mostly force you to use a particular environment/editor. I'd tell you to do it the old-fashioned way: Use your regular editor, save the file and process it as you are accustomed (latexmk is nice, but a simple pdflatex should do), and have some PDF viewer that reloads automatically (or can be done to reload with a simple key).

Better don't get into some straightjacket environment that later is hard to move away from.

-

Live preview exists ; look at LateXian on mac. But not so nice for big works because pretty long to 'live' compile. Or use include statements.

-
Welcome to TeX.SX! Note that LaTeXian was already mentioned by Harold Cavendish. (tex.stackexchange.com/a/16920/586) –  Torbjørn T. Jun 6 '14 at 17:24