Skip to content

Instantly share code, notes, and snippets.

@diegoferigo
Last active August 15, 2022 12:29
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save diegoferigo/a6544bfbec40f29cf7c05c5dd2ceaffc to your computer and use it in GitHub Desktop.
Save diegoferigo/a6544bfbec40f29cf7c05c5dd2ceaffc to your computer and use it in GitHub Desktop.
Export TIKZ figures of a manuscript to PDF

When submitting a paper, often publishers do not support manuscripts with TIKZ figures. These figures must be converted and substituted before the submission.

In order to preserve the quality and not lose the vector format, either EPS or PDF types are good candidates. Since most of the times we use pdflatex to build manuscripts, we'll use PDF. If you need an EPS, PDF files can be converted.

  1. Add in the preamble of your manuscript the following:
    \usetikzlibrary{external}
    \tikzexternalize
  2. Compile your manuscript with: pdflatex -shell-escape ms.tex
  3. You should find the converted images in the manuscript folder with names like ms-figure0.pdf
  4. Optional: rename the pdf files to the original name <tikz_filename>.pdf
  5. Convert all your \input{filename.tikz} to \includegraphics{<tikz_filename>.pdf}
  6. Comment out the additional lines of step 1
  7. Compile again with the regular pdflatex manuscript.tex
  8. Inspect the final manuscript

Note that using latex instead of pdflatex you can get directly EPS files, though I faced problems with shadings and fadings, which are not supported.

References:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment