Graphics, Figures & TablesWorking TikZ and Pgf figures as a graphic?

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
GenisToii
Posts: 19
Joined: Sat Nov 05, 2011 8:51 pm

Working TikZ and Pgf figures as a graphic?

Post by GenisToii »

Hi everyone!

These days I'm entering in the world of the TikZ and PGF and I have one doubt: it's wonderful to could create figures with commands by your own and that but...

How can I control the PLACE where it would appear? I mean like when you have \includegraphics and you can specify at right/center/left or if you want to put it near to the text or alone in a blank space of the sheet or with text around the figure.

I know that would be a usual and newbie question but I can't find the aswer anywhere so please, answer me and sorry for bothering.

Recommended reading 2024:

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

NEW: TikZ book now 40% off at Amazon.com for a short time.

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

Working TikZ and Pgf figures as a graphic?

Post by localghost »

GenisToii wrote:[…] How can I control the place where it would appear? I mean like when you have \includegraphics and you can specify at right/center/left or if you want to put it near to the text or alone in a blank space of the sheet or with text around the figure. […]
Can you elaborate what you exactly mean? At the moment I'm afraid I can't comprehend the problem.
  • What does "specify at right/center/left" mean here?
  • What does "near to the text" mean here?
  • What does "in a blank space of the sheet" mean here?
  • What does "with text around" mean here?
Finally you can put every stuff into a floating environment or similar environments or at any place that you put your included graphics in.


Thorsten
User avatar
Stefan Kottwitz
Site Admin
Posts: 10324
Joined: Mon Mar 10, 2008 9:44 pm

Working TikZ and Pgf figures as a graphic?

Post by Stefan Kottwitz »

You can put a TikZ picture just like \includegraphics within text and it would appear at that place. You can use it in text, between paragraphs, in tabular cells, in math, and of cause also in figure environments. Just try it.

TikZ pictures have also an overlay option so they could even overlay with text or be positioned at a certain place on the page behind the normal text, just to mention it.

Stefan
LaTeX.org admin
GenisToii
Posts: 19
Joined: Sat Nov 05, 2011 8:51 pm

Re: Working TikZ and Pgf figures as a graphic?

Post by GenisToii »

First for Localgosht, I created a basic pdf document with the same image in different places (it's attached to the reply). I would like to know how to make the same but with a tikz figures, to control the place where would be shown perfectly.

Second, thanks to Stefan_K. I hadn't got time to investigate the overlay opcion and to put it in a figure enviroment because I was really busy but I would try it, thanks for the info! I'll try it soon :)
Attachments
Example.pdf
(26.23 KiB) Downloaded 471 times
User avatar
Stefan Kottwitz
Site Admin
Posts: 10324
Joined: Mon Mar 10, 2008 9:44 pm

Re: Working TikZ and Pgf figures as a graphic?

Post by Stefan Kottwitz »

Could you post the code for your example document?

Stefan
LaTeX.org admin
GenisToii
Posts: 19
Joined: Sat Nov 05, 2011 8:51 pm

Working TikZ and Pgf figures as a graphic?

Post by GenisToii »

Here it is:

Code: Select all

\documentclass{article}
\usepackage[top=1.00cm]{geometry}
\usepackage{tikz}
\usepackage{wrapfig}

\begin{document}
\begin{figure}
\centering
\includegraphics[width=0.1\linewidth,height=0.1\textheight]{images.jpg}
\end{figure}

\begin{flushleft}
\includegraphics[width=0.1\linewidth,height=0.1\textheight]{images.jpg}
\end{flushleft}

\begin{flushright}
\includegraphics[width=0.1\linewidth,height=0.1\textheight]{images.jpg}
\end{flushright}

Dada una función  de una variable real  y un intervalo  de la recta real, la integral es igual al área de la región del plano  limitada entre la gráfica de , el eje , y las líneas verticales  y , donde son negativas las áreas por debajo del eje .

\begin{wrapfigure}{r}{0.2\textwidth}
  \begin{center}
    \includegraphics[width=0.5\linewidth,height=0.1\textheight]{images.jpg}
  \end{center}
  \caption{FIRE}
\end{wrapfigure}


La palabra "integral" también puede hacer referencia a la noción de primitiva: una función F, cuya derivada es la función dada . En este caso se denomina integral indefinida, mientras que las integrales tratadas en este artículo son las integrales definidas. Algunos autores mantienen una distinción entre integrales primitivas e indefinidas.
Los principios de la integración fueron formulados por Newton y Leibniz a finales del siglo XVII. A través del teorema fundamental del cálculo, que desarrollaron los dos de forma independiente, la integración se conecta con la derivación, y la integral definida de una función se puede calcular fácilmente una vez se conoce una antiderivada. Las integrales y las derivadas pasaron a ser herramientas básicas del cálculo, con numerosas aplicaciones en ciencia e ingeniería.
Bernhard Riemann dio una definición rigurosa de la integral. Se basa en un límite que aproxima el área de una región curvilínea a base de partirla en pequeños trozos verticales. A comienzos del siglo XIX, empezaron a aparecer nociones más sofisticadas de la integral, donde se han generalizado los tipos de las funciones y los dominios sobre los cuales se hace la integración. La integral curvilínea se define para funciones de dos o tres variables, y el intervalo de integración [a,b] se sustituye por una cierta curva que conecta dos puntos del plano o del espacio. En una integral de superficie, la curva se sustituye por un trozo de una superficie en el espacio tridimensional.

\begin{wrapfigure}{i}{0.2\textwidth}
  \begin{center}
    \includegraphics[width=0.5\linewidth,height=0.1\textheight]{images.jpg}
  \end{center}
  \caption{FIRE}
\end{wrapfigure}

Las integrales de las formas diferenciales desempeñan un papel fundamental en la geometría diferencial moderna. Estas generalizaciones de la integral surgieron primero a partir de las necesidades de la física, y tienen un papel importante en la formulación de muchas leyes físicas cómo, por ejemplo, las del electromagnetismo. Los conceptos modernos de integración se basan en la teoría matemática abstracta conocida como integral de Lebesgue, que fue desarrollada por Henri Lebesgue.

\end{document}
Last edited by Stefan Kottwitz on Sun Mar 31, 2013 3:10 pm, edited 1 time in total.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10324
Joined: Mon Mar 10, 2008 9:44 pm

Working TikZ and Pgf figures as a graphic?

Post by Stefan Kottwitz »

Perhaps simply try what I said. In your example, I replaced the \includegraphics line by a test picture:

Code: Select all

\documentclass[demo]{article}
\usepackage[top=1.00cm]{geometry}
\usepackage{tikz}
\usepackage{wrapfig}

\begin{document}
\begin{figure}
  \centering
  \begin{tikzpicture}
    \node[rectangle,draw] {Test};
  \end{tikzpicture}
\end{figure}

\begin{flushleft}
  \begin{tikzpicture}
    \node[rectangle,draw] {Test};
  \end{tikzpicture}
\end{flushleft}

\begin{flushright}
  \begin{tikzpicture}
    \node[rectangle,draw] {Test};
  \end{tikzpicture}
\end{flushright}

Dada una función  de una variable real  y un intervalo  de la recta real, la integral es igual al área de la región del plano  limitada entre la gráfica de , el eje , y las líneas verticales  y , donde son negativas las áreas por debajo del eje .

\begin{wrapfigure}{r}{0.2\textwidth}
  \begin{center}
    \begin{tikzpicture}
      \node[rectangle,draw] {Test};
    \end{tikzpicture}
  \end{center}
  \caption{FIRE}
\end{wrapfigure}


La palabra "integral" también puede hacer referencia a la noción de primitiva: una función F, cuya derivada es la función dada . En este caso se denomina integral indefinida, mientras que las integrales tratadas en este artículo son las integrales definidas. Algunos autores mantienen una distinción entre integrales primitivas e indefinidas.
Los principios de la integración fueron formulados por Newton y Leibniz a finales del siglo XVII. A través del teorema fundamental del cálculo, que desarrollaron los dos de forma independiente, la integración se conecta con la derivación, y la integral definida de una función se puede calcular fácilmente una vez se conoce una antiderivada. Las integrales y las derivadas pasaron a ser herramientas básicas del cálculo, con numerosas aplicaciones en ciencia e ingeniería.
Bernhard Riemann dio una definición rigurosa de la integral. Se basa en un límite que aproxima el área de una región curvilínea a base de partirla en pequeños trozos verticales. A comienzos del siglo XIX, empezaron a aparecer nociones más sofisticadas de la integral, donde se han generalizado los tipos de las funciones y los dominios sobre los cuales se hace la integración. La integral curvilínea se define para funciones de dos o tres variables, y el intervalo de integración [a,b] se sustituye por una cierta curva que conecta dos puntos del plano o del espacio. En una integral de superficie, la curva se sustituye por un trozo de una superficie en el espacio tridimensional.

\begin{wrapfigure}{i}{0.2\textwidth}
  \begin{center}
    \begin{tikzpicture}
      \node[rectangle,draw] {Test};
    \end{tikzpicture}
  \end{center}
  \caption{FIRE}
\end{wrapfigure}

Las integrales de las formas diferenciales desempeñan un papel fundamental en la geometría diferencial moderna. Estas generalizaciones de la integral surgieron primero a partir de las necesidades de la física, y tienen un papel importante en la formulación de muchas leyes físicas cómo, por ejemplo, las del electromagnetismo. Los conceptos modernos de integración se basan en la teoría matemática abstracta conocida como integral de Lebesgue, que fue desarrollada por Henri Lebesgue.

\end{document}
As you can see, no problem:
tikz-images.png
tikz-images.png (24.33 KiB) Viewed 7489 times
Stefan
LaTeX.org admin
GenisToii
Posts: 19
Joined: Sat Nov 05, 2011 8:51 pm

Re: Working TikZ and Pgf figures as a graphic?

Post by GenisToii »

Mmmmm... I feel kind of stupid xd But I think there was a sintax of tikz that gave me errors with wrapfigure. Well, thank you Stefan_K and sorry for that silly question then. If I find again with some syntax problem I would ask directly.
Post Reply