Comments on: LaTex: Continous Background Compilation http://www.terminally-incoherent.com/blog/2014/06/09/latex-continous-background-compilation/ I will not fix your computer. Tue, 04 Aug 2020 22:34:33 +0000 hourly 1 https://wordpress.org/?v=4.7.26 By: Agn0sis http://www.terminally-incoherent.com/blog/2014/06/09/latex-continous-background-compilation/#comment-109530 Wed, 11 Jun 2014 03:25:32 +0000 http://www.terminally-incoherent.com/blog/?p=17224#comment-109530

@ Luke Maciak:

Luke Maciak wrote:

@ gruntless:
Does latexmk use pdflatex or just latex?

latexmk can use basically whatever tool you want. Many of the programs to use are going to be inferred by latexmk itself, some of them can be specified with options when executing it, and some of them can be specified in a config file. For example, to compile and watch changes each time I save the file, I create a config file named .latexmkrc with the contents:


$pdf_previewer = 'start okular %O %S';

where okular is the pdf viewer I’ll use, but you can use whatever you want.

The I just run:


latexmk -xelatex -pvc world_domination

In my work directory, the main latex file is world_domination.tex

-pvc is the option to tell the program to keep compiling and updating the pdf, and -xelatex is … well, an option to specify that I work with that tool instead of the pure latex.

latexmk is usually intelligent enough to know what programs to call and how many times (for cross-referencing)

Reply  |  Quote
]]>
By: Philipp http://www.terminally-incoherent.com/blog/2014/06/09/latex-continous-background-compilation/#comment-109350 Tue, 10 Jun 2014 08:41:57 +0000 http://www.terminally-incoherent.com/blog/?p=17224#comment-109350

@ Luke Maciak:
You should really learn about make and do a series about it.
If people new more about make they would not waste so much time setting up complex build tools for small projects when a make file and some simple scripts would do the job.

If it is powerful enough for the Linux kernel it is probably powerful enough four you.

Reply  |  Quote
]]>
By: Luke Maciak http://www.terminally-incoherent.com/blog/2014/06/09/latex-continous-background-compilation/#comment-109116 Mon, 09 Jun 2014 19:48:04 +0000 http://www.terminally-incoherent.com/blog/?p=17224#comment-109116

@ Chris Wellons:

Ah, got it. Makes perfect sense now. :)

Reply  |  Quote
]]>
By: Chris Wellons http://www.terminally-incoherent.com/blog/2014/06/09/latex-continous-background-compilation/#comment-109113 Mon, 09 Jun 2014 19:44:45 +0000 http://www.terminally-incoherent.com/blog/?p=17224#comment-109113

@ Luke Maciak:

The $< is an automatic variable that is equal to the first prerequisite (in this case it’s “output.tex”). I used it to stay DRY. Think of is like the less-than bracket in a Unix shell, providing stdin from a file. The command to build the target becomes “pdflatex output.tex” with the variables filled in.

Note that there’s a tab not being displayed in my example Makefile code block, so that second line should be tabbed out. Here’s a more elaborate pastebin version with proper formating: http://pastebin.com/hDaacnJ1.

The PDF isn’t recompiled every second simply because make will see that the .pdf file is newer than the .tex file. It will only perform the build when a prerequisite is updated, otherwise it just checks the timestamps and exits. This is one of make’s core features.

Reply  |  Quote
]]>
By: Luke Maciak http://www.terminally-incoherent.com/blog/2014/06/09/latex-continous-background-compilation/#comment-109095 Mon, 09 Jun 2014 18:37:42 +0000 http://www.terminally-incoherent.com/blog/?p=17224#comment-109095

@ gruntless:

Does latexmk use pdflatex or just latex?

@ Chris Wellons:

Wow, that’s much simpler and much more unixy. :P Thanks.

Btw, can you explain $< ensure that the file is not recompiled every second? I don’t think I’ve seen this makefile/shell idiom before.

Reply  |  Quote
]]>
By: Chris Wellons http://www.terminally-incoherent.com/blog/2014/06/09/latex-continous-background-compilation/#comment-109055 Mon, 09 Jun 2014 16:03:38 +0000 http://www.terminally-incoherent.com/blog/?p=17224#comment-109055

Call me old fashioned, but I’d use the “watch” command for this. :-) I always set up a Makefile anyway.


output.pdf : output.tex
$(PDFLATEX) $<

So running “watch -n1 make” is trivial. The Makefile ensures the PDF only updates as needed, and, as you mentioned, Evince (my favorite PDF viewer), will automatically refresh when the PDF updates. Usually I don’t want the automatic updates, though, and instead I run make from within Emacs with a keystroke, which is immediately reflected in the adjacent Evince window.

If watch is too much of a hack for you, you can always use an inotify command line program instead.

Reply  |  Quote
]]>
By: gruntless http://www.terminally-incoherent.com/blog/2014/06/09/latex-continous-background-compilation/#comment-109052 Mon, 09 Jun 2014 15:55:44 +0000 http://www.terminally-incoherent.com/blog/?p=17224#comment-109052

To live-compile a LaTeX document I just do: latexmk -pvc and preview in Mac OS X’s Preview.

Reply  |  Quote
]]>