Coder Social home page Coder Social logo

deric / graphviz-sty Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mprentice/graphviz-sty

4.0 3.0 0.0 345 KB

graphviz.sty - A library for using GraphViz dot files in LaTeX

Home Page: http://mark.aufflick.com/blog/2007/03/25/embedding-graphviz-in-latex-documents

graphviz-sty's Introduction

graphviz.sty - A LaTeX library for GraphViz

graphviz.sty allows you to write GraphViz code directly in your LaTeX source.

Prerequisites

You must have the GraphViz program in your path. See http://graphviz.org for more details.

Installation

Copy graphviz.sty to your texmf directory.

LaTeX distribution folder can be found

  • On Mac OS X with the MacTeX distribution: ~/Library/texmf/tex/latex
  • On Linux it's usually: /usr/share/texmf-texlive/tex/latex/
  1. Copy graphviz.sty to you LaTeX distribution folder
  2. run $ texhash

Usage

Add the following lines to your preamble:

\usepackage[pdftex]{graphicx}
\usepackage{graphviz}

If the options "[pdflatex]" is causing troubles, replace it with

\PassOptionsToPackage{pdftex}{graphicx}
\usepackage{graphicx}

graphviz.sty supports two environments, digraph (which produces oriented graphs):

\begin{digraph}[scale=0.5]{MyDiGraph}
rankdir=LR; 
a->b; 
b->c;
\end{digraph}

and graphviz for non-oriented graphs:

\begin{graphviz}{MyGraph}
a--b; 
b--c;
\end{graphviz}

Parameters for digraph or graphviz environment:

  1. optional parameters:
    • scale -- default value is "scale=1"
    • layout -- for changing graphviz layout filter (possible values "layout=dot|neato|twopi|circo|fdp|sfdp" see graphviz documentation for more details), default is "layout=dot"
    • output -- default is pdf, you can use "output=ps|png|pdf" or which everformat \includegraphics supports. When output is tex graph is converted with dot2tex tool (you have to add tikz package to your preamble) -- this is an experimental feature
  2. name of the digraph. This is obligatory argument, it's the name produced output file. If you have two environments with same name file will be overwritten by the later.

To include an external GraphViz dot file named mydotfile.dot:

\includedot[scale=0.5]{mydotfile}

Parameters for \includedot :

  1. optional arguments (in [args]) are the same as above
  2. name of the dot file (w/out file extension, which must be ".dot")

How to compile

You must use the -shell-escape option for pdflatex. This enables LaTeX to execute system commnds which is for security reasons disabled in most LaTeX distributions by default.

$ pdflatex -shell-escape *.tex

If you are having problems with generating output see LaTeX *.log for this:

runsystem(bash -c "dot -Tpdf graph1.dot > graph1.pdf")...executed.

Using regular LaTeX

To modify this command for regular latex change output to ps

\begin{digraph}[output=ps]{MyGraph}
rankdir=LR; 
a->b; 
b->c;
\end{digraph}

Contributors

graphviz.sty is based on graphviz.tex by Derek Rayside (2003).

2006-03-25: Modified by Mark Aufflick

2011-02-21: Modified by Mike Prentice

  • use of PDF output directly from dot.
  • added includedot layout.

2012-02-17: Modified by Tomas Barton

  • Improved check for generated file, allowed backslash and other "unsafe" characted in digraph code
  • Added output option
  • changed \digraph command to digraph and graph environment which follows much more LaTeX conventions
  • supports conversion with dot2tex

graphviz-sty's People

Contributors

deric avatar mprentice avatar

Stargazers

Adrian Imboden avatar Angus H. avatar Jan Vajda Attorney at Law Namestovo, Slovakia, Europe avatar  avatar

Watchers

 avatar James Cloos 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.