Graphics, Figures & TablesAuto-sizing pages or graphics

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
smennicke
Posts: 2
Joined: Wed Mar 16, 2011 7:59 pm

Auto-sizing pages or graphics

Post by smennicke »

Hi,

I'm tikzing my figures for my purposes. My current workflow is to tikz a figure in a separate file and include it into my document via '\input{<..>}'. I wish to tikz the figures and compile them into PDF. Afterwards, I want to use the '\includegraphics{<..>}' command on the PDF file.

Problem is that my tikzpicture have different sizes. Is there any fancy package I can use to automatically increase the size of the figure to the page size or a package that automatically adjusts the page size to that of my figure? I'd prefer the latter.

Thanks,
Stephan.
Last edited by smennicke on Thu Mar 17, 2011 9:46 am, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Auto-sizing pages or graphics

Post by localghost »

Use the standalone document class for every single picture. Here's an example from my archives.

Code: Select all

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{automata,positioning,shapes.geometric}

\begin{document}
  \begin{tikzpicture}[%
    ->,
    shorten >=2pt,
    >=stealth,
    auto,
    node distance=1cm,
    noname/.style={%
      ellipse,
      minimum width=5em,
      minimum height=3em,
      draw
    }
  ]
    \node[noname] (1)                                             {1};
    \node[noname] (2) [below=of 1]                                {2};
    \node[noname] (4) [node distance=1cm and 3mm,below left=of 2] {4};
    \node[noname] (3) [left=of 4]                                 {3};
    \node[noname] (5) [below=of 4]                                {5};
    \node[noname] (6) [node distance=2cm,right=of 5]              {6};

    \path (1) edge                   node       {a} (2)
          (2) edge                   node[swap] {b} (3)
          (2) edge                   node       {c} (4)
          (2) edge                   node       {d} (6)
          (3) edge                   node       {e} (5)
          (4) edge                   node       {f} (5)
          (5) edge [bend right=20pt] node[swap] {g} (2);
  \end{tikzpicture}
\end{document}
I would prefer to scale the pictures themselves.

Code: Select all

\begin{tikzpicture}[scale=2]
% picture content
\end{tikzpicture}
In opposite to the other method this way the font size is kept.


Best regards and welcome to the board
Thorsten
smennicke
Posts: 2
Joined: Wed Mar 16, 2011 7:59 pm

Re: Auto-sizing pages or graphics

Post by smennicke »

Thanks a lot! I was looking for that for like million queries ;)
Post Reply