Account Options

  1. Sign in
The old Google Groups will be going away soon.
Switch to the new Google Groups.
Google Groups Home
« Groups Home
Message from discussion how to fit image to page
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Kjell Magne Fauske  
View profile  
 More options Jun 19 2008, 4:05 am
From: "Kjell Magne Fauske" <kjel...@gmail.com>
Date: Thu, 19 Jun 2008 10:05:45 +0200
Local: Thurs, Jun 19 2008 4:05 am
Subject: Re: [dot2tex-users] how to fit image to page
Hi,

On Thu, Jun 19, 2008 at 9:18 AM, Vsevolod

<Vsevolod.Krishche...@gmail.com> wrote:

> Hi,

> first of all, dot2tex is nice :)

Thanks!

>I'm newbie with dot and I got a
> simple question: how to fit resulting image into latex page width
> automatically? Or how to scale it manually?

> It looks like \begin{figure}[width=15cm] does not work. I tried
> size="4,4" and page="5,5" attributes in dot file without any changes.
> I think that I missed some way to do it. My command to convert dot
> file:

> dot2tex -f tikz -t math --figonly --preproc --template Dots/
> dot_template.tex \
> dot-file.dot | dot2tex -f tikz -t math  --figonly > dot_file.tex

To avoid some typing, you can achieve the same writing:

> dot2tex -ftiks -tmath --figonly --autosize --template Dots/dot_template.tex > dot_file.tex
> And then I do something like this:

> \begin{figure}
> \centering
> \input{dot_file.tex}
> \end{figure}

Sizing the resulting graph can be a bit tricky. Here are your alternatives:

- Alter the graph size using DOT attributes. I have to admit that I'm
not very familiar with how the various attributes work, so you have to
take a look in the Graphviz documentation for more information.

- Creating a standalone PDF of you graph and include it using
\includegraphics[width=\textwidth]{..}.
You can do this relatively easy using:

> dot2tex -ftikz -tmath --autosize --crop --template Dots/dot_template.tex > dot_file.tex
> pdflatex dot_file

And then you can write:
\includegraphics[width=\textwidth]{dot_file}

- Scale the tikzpicture environment.The generated code is put inside a
tikzpicture environment:

\begin{tikzpicture}[options]
...
\end{tikzpicture}

To scale the graph you can use the options:
\begin{tikzpicture}[scale=2,transform shape]
...
\end{tikzpicture}
Since you use the tikz output format you can also do things like:
\begin{tikzpicture}[xscale=1.5,yscale=2]
...
\end{tikzpicture}
to stretch the graph without altering the node sizes. If you want to
scale the nodes, you have to add the transform shape option.

To add additional options to the tikzpicture environment you have two options:
1. Use the --graphstyle command line option:

> dot2tex --graphstyle="scale=2,transform shape" ...

2. Use the special d2tgraphstyle attribute:

digraph G{
d2tgraphstyle="scale=2,transform shape";
a -> b;

}

Hope this helps. For experimentation my dot2tex(i) latex package is
useful. Then you can do everything within your latex document:

% ---
\documentclass{article}
\usepackage{tikz}
\usepackage{dot2texi}

\begin{document}

\begin{tikzpicture}[scale=2,transform shape]
\begin{do2tex}[mathmode,autosize,codeonly]
digraph G {
a -> b -> c;

}

\end{tikzpicture}

\end{dot2tex}
\end{document}
%----

Hope this helps!

Regards,
Kjell Magne Fauske


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.