SmtC: Show me the Code
Ole Peter Smith
Instituto de Matemática e Estatística
Universidade Federal de Goiás
http://www.olesmith.com.br

TikZ (Palestra)
Como libertar um povo que preza seus correntes?
Niculau Maquiavel.
< $\LaTeX$ | Preamble | $\LaTeX$ >

Standalone Preamble for TiKZ Picture

  • Creates an 'Encapsulated PDF'...
  • Here's an example.
  • Free as in Free Software: pdf2svg
  • A few lines of python goes a looong way...
  • Script: tikz2pdf, tikz2svg
  • YES, I have a pdflatex.py as well...
    • TiKZ Preamble:
      TiKZ Listing: Head.tikz.tex. PDF   PNG   SVG   ZIP*  
      \documentclass[tikz,dvipsnames]{standalone}
      
      \usepackage{xcolor}
      \usepackage{graphicx}
      \usepackage{ifthen}
      \usepackage{xifthen}
      
      \usepackage{amssymb,amsmath,amsthm}
      
      \usepackage{pgfplots}
      
      \usepackage{tikz}
      \usepackage{tkz-euclide}
      %%!
      %%! For older versions of package tkz-euclide
      %%! you may need uncomment the following line:
      %   \usetkzobj{all}
      %%!
      
      \usetikzlibrary
          {
            shapes.geometric,
            arrows,
            calc,
            intersections,
            arrows.meta,
            decorations.markings,
            positioning,
            math,
            angles,
            quotes,
            patterns,3d,
            backgrounds,
            fillbetween
          }
      
      \makeatletter
      \newcommand{\gettikzxy}[3]{%
        \tikz@scan@one@point\pgfutil@firstofone#1\relax
        \edef#2{\the\pgf@x}%
        \edef#3{\the\pgf@y}%
      }
      \makeatother
      \pgfplotsset{compat=1.14}
      
      
      \begin{document}
      
      Script tikz2pdf, tikz2svg: Source (tgz): tikz2pdf.2020.08.21.tgz
      Python Listing: /usr/local/Python/bin/tikz2pdf.py.
      #!/usr/bin/python
      
      import sys,argparse
      
      sys.path.append("/usr/local/Python")
      
      from File import *
      from System import *
      from Latex import *
      from CGI import *
      
      
      
      ##
      ## Generates PDF or SVG or PNG from .tex or tikz.tex.
      ##
      ## Create symbolic links to this script:
      ##
      ## tikz2XXX: Treat as TiKZ:
      ##   use standalone docstyle and
      ##   insert begin/end tikzpicture.
      ## Will create encapsulated PDF.
      ##
      ## tikz2pdf: Just create the PDF.
      ## tikz2svg: Create PDF and run pdf2svg.
      ## tikz2png: Create PDF and run ghostscript to create a png.
      ##
      ## latex2pdf: Run latex generating fullpage PDF.
      
      
      ##
      ## Command line arguments: see with -h
      ##
      ## If runned as CGI script, be silent.
      ## Input file should be in GET File=.
      ##
      ## If runned from command line, process
      ## files listed as last arguments.
      ##
      
      
      #MAIN EXECUTION
      
      verbose=False
      noclean=False
      force=False
      silent=False
      
      
      test=False
      if (test):
          noclean=True
          force=True
          print "Content-type: text/html\n"
      
      
      if (CGI().CGI_Is()):
          import cgitb
          cgitb.enable()
      
      
      Latex().Latex_Process_Files()
      
      < $\LaTeX$ | Preamble | $\LaTeX$ >
Messages:
0 secs.