11

Tools like firebug allow a developer to immediately view the results of changes they make to the HTML of a webpage. Has anyone taken a similar strategy with LaTeX, so that an entire compile cycle is not required between markup-change and rendered result?

This question is motivated by increasing compile times associated with my thesis ;)

5
  • 1
    duplicate? tex.stackexchange.com/questions/16914/…
    – pmav99
    Jun 27, 2011 at 22:02
  • If you're looking to speed up the compilation the following question will be of interest tex.stackexchange.com/questions/8791/…
    – N.N.
    Jun 27, 2011 at 22:06
  • @pmav99: That's not a duplicate. Here I'm asking if there is a live rendering approach for LaTeX. The question you refer to is related, in that it's asking for faster preview times, but is less specific than my question. Jun 28, 2011 at 19:01
  • 1
    Given that TeX requires compilation, a real live update is out of the question (at least for normal computers). Auto-compilation and preview-like functionality is propably the best you can get.
    – pmav99
    Jun 28, 2011 at 19:26
  • This was the aim of whizzytex, see cristal.inria.fr/whizzytex. I have never used it. Sep 5, 2017 at 11:19

7 Answers 7

3

latexmk can also be used for autorebuilds if you don't want to use texclipse as suggested in other answers as it is editor independent.

3

Gummi http://gummi.midnightcoding.org/ is the closest you can get to WYSIWYG in LaTeX but it isn't good for long documents, such as a thesis. It's great for short documents only.

As Lexiel indicates, to shorten the compile time on a thesis you put each chapter in a separate file. Your problem of having a long compile time is addressed under the "Big Projects" section of http://en.wikibooks.org/wiki/LaTeX/Basics where they suggest using the \include{} statement is better than \input{}.

3

TeXlipse seems to do something like that, I observed that recompilation is quicker than full compilation.

I should add that by default, it autocompiles at regular interval and everytime you save changes to a file. So the compilation is often "hidden" and most pdf readers auto refresh when the file is changed, so you are very close to live updates. But I'm currently only writing my prelim proposal, so it's substantially smaller, I can't guarantee its behavior with a full thesis.

Things worth looking into are partial compilation though (it's a feature in TeXlipse) and I figure you can do that manually too, commenting out the \input{...} in your main file to only compile and preview the sections/chapters you are currently working on.

I have been meaning to ask a similar question for some time.
I'm sure that looking into the different .aux, .log, .bbl files, a smart makefile could minimize/optimize compilation time.

2

There's a very similar question on StackOverflow: https://stackoverflow.com/q/311118/695132

I'll copy my answer to that one here:

It's possible to make something like this yourself. Here's a description of the setup I use on Windows:

What you need:

  1. A text editor that can perform an action each time the document has changed
  2. A fast way to recompile LaTeX (e.g. precompile the preamble)
  3. A viewer that can quickly reload the document.

I used gVim as the text editor, latexdaemon as the compilation engine, and Sumatra as the PDF viewer.

  1. In Vim, issue the command :au! CursorHoldI,CursorHold <buffer> silent! :update to make it auto-save the document every time you stop typing. Also :set updatetime=800 to set the timeout after which saving happens to a low value.

  2. latexdaemon will auto-compile the document in an efficient way every time it's changed. Use the following at the beginning of the file to make it produce PDF:

    %Daemon> ini=pdflatex
    

    Or just start it with latexdaemon -ini=pdflatex.

  3. Sumatra will automatically re-load the file every time it is changed, and it will not lock the PDF (so it can be recompiled without closing Sumatra first).

This recipe will give you an almost real-time preview, but it takes some effort to set up, and is not without issues. For example, you might not want to continuously auto-save, in case you'd want to revert to an earlier version.

There's a lot to improve on this, but I've been using it for some time (after reading your question), and thought putting the recipe out here might be useful for others too.

Since I was lazy, I just put everything to set this up into a .bat file:

@start C:\Path\To\Sumatra\SumatraPDF.exe %1.pdf
@start latexdaemon -ini=pdflatex %1.tex
@gvim -c ":au! CursorHoldI,CursorHold <buffer> silent! :update" -c ":set updatetime=800" %1.tex
2
  • 2
    This is not really an answer as-written: we prefer answers here to be self-contained. Consider editing your answer to include the information you've linked to.
    – Joseph Wright
    Aug 31, 2011 at 18:16
  • @Joseph, the questions are almost the same, and I linked to another SE site (i.e. not really an outside resource), so I thought linking would be better here (in case one answer is edited/updated ...)
    – Szabolcs
    Sep 1, 2011 at 8:29
1

I guess the only real solution to your problem is a "what you see is what you get editor" like LyX. I do not think that there is another way to get a live preview.

I am using Eclipse (with the texlipse plugin) with a pdf viewer that does not block the pdf(e.g. SumatraPDF for Windows) to create my documents. Whenever I save the document texlipse is building it automatically and the pdf viewer is reloading the document. When I press alt+tab to change the window the process is most likely already done.

Texlipse provides two enhancements for the compiling performance. First it checks the output of the compile process for special words, like when a second run is necessary to get references right. So it compile twice if needed, once if not. And second it provides a feature, to partially build your project. It extracts the current file from the whole document and puts it between \begin/end{document}. This way you only need to compile the current file but still have your normal layout. This is scaling very good with big projects as the size of one file should never become too large.

Maybe there are better solutions for your problem, or you don't want to change your editor, but this is actually my solution for this problem and it works very well for me.

2
  • I was looking for something that wouldn't require me to leave my text editor behind. Thanks anyway. Jun 28, 2011 at 19:04
  • @Robert Yes, I understand that. I wouldnt change away from Eclipse either. Just giving a hint what I know exists. Maybe it will help you anytime later or anyone else who is reading it.
    – Frank
    Jun 29, 2011 at 21:53
1

WriteLatex.com does exactly that. It's an online Latex editor with automatic refresh. I'm writing my undergraduate thesis there, and it has been perfect so far. Plus, there are several advantages about having it online. You should definitely try it out!

-1

I had the same problem in windows. Try ubuntu (or any other Linux platform) install TeXLive or anything else and compile again. 5 minutes in windows -> 5 sec in ubuntu in the same computer. I dont know is that happening why but it helped me complete my thesis...

0

You must log in to answer this question.

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