Code Monkey home page Code Monkey logo

mwe-latexmk-tikz-preamble's Introduction

Minimum Working Example of LaTeX compilation using latexmk with tikz externalization and a pre-compiled preamble which includes the tikz package.

This MWE shows three techniques for making your latex compilation super-fast, I mean unbelievably fast.

latexmk

This has more to do with saving you time compiling that latex document repeatedly, as many times as it takes to get the final output. 'latexmk' is a perl script that enhances 'make' for LaTeX compilation. All you will have to do is issue the 'make' command once and it will compile only what is needed, as many times as is needed to get the output.

It is configured through the Makefile.

Tikz externalization

Those of you who use tikz know that it is an extremely powerful and impressive tool. However if used naively all your tikz images will be compiled every time you compile the document. That is an enormous waste of time and computing cycles. With tikz externalization every 'tikzpicture' is first compiled in to a separate pdf file (also useful if you want to use some figure somewhere else).

Now when you compile your document tikz first checks if the tikzpicture has changed. If not the pre-compiled pdf is inserted automatically and your time and power is saved.

preamble

Anyone who uses pdflatex naively should know that the verbose output produced by the compiler is mostly about loading various packages. Why repeat this process over an over again. Place the preamble (all the '\usepackage{}' commands) in a separate preamble.tex file, compile it once, and then simply load it every time you compile the document. The time saved is enormous.

Again, if used naively, tikz externalization doesn't use the pre-compied preamble, so your images are compiled as slowly as before. But judicious placement of just two commands in the dynamic (non-pre-compiled) preamble allows tikz externalization to use the preamble making your image compilation lightning fast as well.

Outcome

With this configuration you will only have to compile the bare minimum part of your document (only the part that you have actually changed) when you compile your document. You won't believe how fast your compilation goes.

Testing

To test this simply clone this repo and run 'scons'. Now change just one thing, say some text in the document, and run 'scons'. The image will not be recompiled. Change just one image and recompile. Only that image will be compiled, the other one will remain as it is. Additionally the tikz package won't be loaded every time. You will see a decrease in both the log output and time taken because the compiler will have less to do.

mwe-latexmk-tikz-preamble's People

Contributors

abid-mujtaba avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.