How to cut the bounding box of a flowchart in TikZ

View: New views
3 Messages — Rating Filter:   Alert me  

How to cut the bounding box of a flowchart in TikZ

by Мариян Христов :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,
I have used TikZ  package for the flowchart itself, but now I need to
cut and remove the blank spots around it. Unfortunately I do not know
how, so I'll be very grateful if anyone could tell me how to do it.
Best regards: M. Hristov

Here the source code:

\documentclass{article}
\usepackage[T2A]{fontenc}
\usepackage[cp1251]{inputenc}
\usepackage[english,bulgarian]{babel}
\usepackage{pifont}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows,calc}

\begin{document}

% Define block styles
\tikzstyle{dia} = [diamond, draw, fill=blue!20,text width=5em, text
badly centered, node distance=2.5cm, inner sep=0pt,]
\tikzstyle{rec} = [rectangle, draw, fill=blue!20,text width=14em, text
centered, rounded corners, minimum height=2.5em]
\tikzstyle{line} = [draw, -latex']
\tikzstyle{round rec} = [draw, rounded
rectangle,fill=orange!20,draw=orange, thick, node distance=3cm,minimum
height=2em, text width=5em, text centered]
\tikzstyle{del} = [draw=none,fill=none, inner sep=-5pt, minimum
size=2pt, node distance=6.3em,minimum height=0.1mm]

\pgfsetendarrow{\pgfarrowlargepointed{2.5pt}}


\begin{tikzpicture}[node distance = 1.5cm, auto]

   % Place nodes
   \node [round rec] (A) {1 node};
   \node [rec, below of=A] (B) {PC \ding{213} 2 node};
   \node [rec, below of=B] (C) {3 node \ding{213} IR};
   \node [dia, below of=C] (D) {4 node};
   \node [dia, below left of=D, node distance=8em] (E) {6 node};
   \node [rec, below right of=D, node distance=8em, text width=6em] (F)
{7 node};
   \node [dia, below of=D, node distance=12em] (G) {8 node};
   \node [rec, below left of=G, text width=8em, node distance=8em] (H)
{PC = 9 node};
   \node [rec, below right of=G, text width=8em, node distance=8em] (I)
{PC = 10 node};
   \node [del, below of=E] (zero_1) {};
   \node [del, below of=F] (zero_2) {};
   \node [del, below of=H, node distance=4em] (zero_3) {};
   \node [del, below of=I, node distance=4em] (zero_4) {};
   \node [del, below of=A, node distance=2em] (zero_6) {};


   % Draw edges
   \path [line,thick] (A) -- (B);
   \path [line,thick] (B) -- (C);
   \path [line,thick] (C) -- (D);
   \path [line,thick] (D) -| node [near start,above] {yes} (E);
   \path [line,thick] (D) -| node [near start,above] {yes} (F);
   \path [line,thick] (E) -| node [near start] {no} (G);
   \path [line,thick] (E) -- node [near start, left] {no} (H);
   \path [line,thick] (G) -- node [near start] {yes}(zero_1);
   \path [line,thick] (F) -- (I);
   \path [line,thick] (G) -- node [near start] {no}(zero_2);
   \path [line,thick] (H) -- (zero_3);
   \path [line,thick] (I) -- (zero_4);
   \draw [line,thick] ($ (zero_3.south) + (0mm,0pt) $)-- ++(6.2,0) --
++(0,12)  |- ($ (zero_6.east) + (0mm,0pt) $);

\end{tikzpicture}

\end{document}




------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
pgf-users mailing list
pgf-users@...
https://lists.sourceforge.net/lists/listinfo/pgf-users

Re: How to cut the bounding box of a flowchart in TikZ

by Sebastián PEÑA SALDARRIAGA :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I think the preview package is what you need.

http://www.ctan.org/tex-archive/macros/latex/contrib/preview/

Sebastian

Мариян Христов a écrit :

> Hi,
> I have used TikZ  package for the flowchart itself, but now I need to
> cut and remove the blank spots around it. Unfortunately I do not know
> how, so I'll be very grateful if anyone could tell me how to do it.
> Best regards: M. Hristov
>
> Here the source code:
>
> \documentclass{article}
> \usepackage[T2A]{fontenc}
> \usepackage[cp1251]{inputenc}
> \usepackage[english,bulgarian]{babel}
> \usepackage{pifont}
> \usepackage{tikz}
> \usetikzlibrary{shapes,arrows,calc}
>
> \begin{document}
>
> % Define block styles
> \tikzstyle{dia} = [diamond, draw, fill=blue!20,text width=5em, text
> badly centered, node distance=2.5cm, inner sep=0pt,]
> \tikzstyle{rec} = [rectangle, draw, fill=blue!20,text width=14em, text
> centered, rounded corners, minimum height=2.5em]
> \tikzstyle{line} = [draw, -latex']
> \tikzstyle{round rec} = [draw, rounded
> rectangle,fill=orange!20,draw=orange, thick, node distance=3cm,minimum
> height=2em, text width=5em, text centered]
> \tikzstyle{del} = [draw=none,fill=none, inner sep=-5pt, minimum
> size=2pt, node distance=6.3em,minimum height=0.1mm]
>
> \pgfsetendarrow{\pgfarrowlargepointed{2.5pt}}
>
>
> \begin{tikzpicture}[node distance = 1.5cm, auto]
>
>    % Place nodes
>    \node [round rec] (A) {1 node};
>    \node [rec, below of=A] (B) {PC \ding{213} 2 node};
>    \node [rec, below of=B] (C) {3 node \ding{213} IR};
>    \node [dia, below of=C] (D) {4 node};
>    \node [dia, below left of=D, node distance=8em] (E) {6 node};
>    \node [rec, below right of=D, node distance=8em, text width=6em] (F)
> {7 node};
>    \node [dia, below of=D, node distance=12em] (G) {8 node};
>    \node [rec, below left of=G, text width=8em, node distance=8em] (H)
> {PC = 9 node};
>    \node [rec, below right of=G, text width=8em, node distance=8em] (I)
> {PC = 10 node};
>    \node [del, below of=E] (zero_1) {};
>    \node [del, below of=F] (zero_2) {};
>    \node [del, below of=H, node distance=4em] (zero_3) {};
>    \node [del, below of=I, node distance=4em] (zero_4) {};
>    \node [del, below of=A, node distance=2em] (zero_6) {};
>
>
>    % Draw edges
>    \path [line,thick] (A) -- (B);
>    \path [line,thick] (B) -- (C);
>    \path [line,thick] (C) -- (D);
>    \path [line,thick] (D) -| node [near start,above] {yes} (E);
>    \path [line,thick] (D) -| node [near start,above] {yes} (F);
>    \path [line,thick] (E) -| node [near start] {no} (G);
>    \path [line,thick] (E) -- node [near start, left] {no} (H);
>    \path [line,thick] (G) -- node [near start] {yes}(zero_1);
>    \path [line,thick] (F) -- (I);
>    \path [line,thick] (G) -- node [near start] {no}(zero_2);
>    \path [line,thick] (H) -- (zero_3);
>    \path [line,thick] (I) -- (zero_4);
>    \draw [line,thick] ($ (zero_3.south) + (0mm,0pt) $)-- ++(6.2,0) --
> ++(0,12)  |- ($ (zero_6.east) + (0mm,0pt) $);
>
> \end{tikzpicture}
>
> \end{document}
>
>
>
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> _______________________________________________
> pgf-users mailing list
> pgf-users@...
> https://lists.sourceforge.net/lists/listinfo/pgf-users
>  


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
pgf-users mailing list
pgf-users@...
https://lists.sourceforge.net/lists/listinfo/pgf-users

Re: How to cut the bounding box of a flowchart in TikZ

by Zerothi :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Or simply take a look at the externalize library which allows exporting a tikzpicture to a single pdf file cropped to the bounding box of the figure.
And then remember the path:
\path[use as bounding box] (0,0) rectangle (10,10);

to decide the bounding box of the picture.

Regards Nick

2009/11/7 Sebastián Peña Saldarriaga <sebastian.pena-saldarriaga@...>
I think the preview package is what you need.

http://www.ctan.org/tex-archive/macros/latex/contrib/preview/

Sebastian

Мариян Христов a écrit :
> Hi,
> I have used TikZ  package for the flowchart itself, but now I need to
> cut and remove the blank spots around it. Unfortunately I do not know
> how, so I'll be very grateful if anyone could tell me how to do it.
> Best regards: M. Hristov
>
> Here the source code:
>
> \documentclass{article}
> \usepackage[T2A]{fontenc}
> \usepackage[cp1251]{inputenc}
> \usepackage[english,bulgarian]{babel}
> \usepackage{pifont}
> \usepackage{tikz}
> \usetikzlibrary{shapes,arrows,calc}
>
> \begin{document}
>
> % Define block styles
> \tikzstyle{dia} = [diamond, draw, fill=blue!20,text width=5em, text
> badly centered, node distance=2.5cm, inner sep=0pt,]
> \tikzstyle{rec} = [rectangle, draw, fill=blue!20,text width=14em, text
> centered, rounded corners, minimum height=2.5em]
> \tikzstyle{line} = [draw, -latex']
> \tikzstyle{round rec} = [draw, rounded
> rectangle,fill=orange!20,draw=orange, thick, node distance=3cm,minimum
> height=2em, text width=5em, text centered]
> \tikzstyle{del} = [draw=none,fill=none, inner sep=-5pt, minimum
> size=2pt, node distance=6.3em,minimum height=0.1mm]
>
> \pgfsetendarrow{\pgfarrowlargepointed{2.5pt}}
>
>
> \begin{tikzpicture}[node distance = 1.5cm, auto]
>
>    % Place nodes
>    \node [round rec] (A) {1 node};
>    \node [rec, below of=A] (B) {PC \ding{213} 2 node};
>    \node [rec, below of=B] (C) {3 node \ding{213} IR};
>    \node [dia, below of=C] (D) {4 node};
>    \node [dia, below left of=D, node distance=8em] (E) {6 node};
>    \node [rec, below right of=D, node distance=8em, text width=6em] (F)
> {7 node};
>    \node [dia, below of=D, node distance=12em] (G) {8 node};
>    \node [rec, below left of=G, text width=8em, node distance=8em] (H)
> {PC = 9 node};
>    \node [rec, below right of=G, text width=8em, node distance=8em] (I)
> {PC = 10 node};
>    \node [del, below of=E] (zero_1) {};
>    \node [del, below of=F] (zero_2) {};
>    \node [del, below of=H, node distance=4em] (zero_3) {};
>    \node [del, below of=I, node distance=4em] (zero_4) {};
>    \node [del, below of=A, node distance=2em] (zero_6) {};
>
>
>    % Draw edges
>    \path [line,thick] (A) -- (B);
>    \path [line,thick] (B) -- (C);
>    \path [line,thick] (C) -- (D);
>    \path [line,thick] (D) -| node [near start,above] {yes} (E);
>    \path [line,thick] (D) -| node [near start,above] {yes} (F);
>    \path [line,thick] (E) -| node [near start] {no} (G);
>    \path [line,thick] (E) -- node [near start, left] {no} (H);
>    \path [line,thick] (G) -- node [near start] {yes}(zero_1);
>    \path [line,thick] (F) -- (I);
>    \path [line,thick] (G) -- node [near start] {no}(zero_2);
>    \path [line,thick] (H) -- (zero_3);
>    \path [line,thick] (I) -- (zero_4);
>    \draw [line,thick] ($ (zero_3.south) + (0mm,0pt) $)-- ++(6.2,0) --
> ++(0,12)  |- ($ (zero_6.east) + (0mm,0pt) $);
>
> \end{tikzpicture}
>
> \end{document}
>
>
>
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> _______________________________________________
> pgf-users mailing list
> pgf-users@...
> https://lists.sourceforge.net/lists/listinfo/pgf-users
>


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
pgf-users mailing list
pgf-users@...
https://lists.sourceforge.net/lists/listinfo/pgf-users


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
pgf-users mailing list
pgf-users@...
https://lists.sourceforge.net/lists/listinfo/pgf-users