# How do I create image directly from latex [duplicate]

I want to include some figures that are created by tikz package. The figures are in pdf files. Then I convert them to images and include images in other tex files. The reason is that I only need to include part of pdf pages in other files.

I wonder if there is a way to create image directly from latex and tikz codes to save time. Thanks.

## Edit by ManuelKuehner

The user states in a comment that he uses Scientific WorkPlace (a WYSIWYG LaTeX-based word processor) which apparently does not support tikz and friends.

• Not obvious why this would be a problem: just use the bits of code you need. What else would you do? – cfr Feb 2 '18 at 3:42
• What do you mean? You said you have the code. You don't need to convert the image. – cfr Feb 2 '18 at 4:24
• Whatever code you have in a separate file that you're making a pdf out of, just put that code in these other tex files directly. Why produce an image separately and then include it - presumably (by your description) in some format that will also get rid of your ability to scale the image arbitrarily – Au101 Feb 2 '18 at 4:26
• Don't start from the image: start from the code. The figures are produced from TikZ, so use the TikZ code. This is really quite straightforward. Why would you make PDFs, take screenshots and then include them? It doesn't make sense. When you create the PDFs, you're compiling the TikZ code - just on its own. But you can equally easily put it in your .tex and compile it there. – cfr Feb 2 '18 at 5:13
• Perhaps something like this arara rule: tex.stackexchange.com/a/339227/101651 is what you're looking for. – CarLaTeX Feb 2 '18 at 5:57

• I am not sure that I understand what you mean.
• I think that you maybe want to know how to use a tikz within a figure environment: See the MWE below.
• I think that you currently take a screenshot of tikz pictures and include them afterward (pixel graphics) in your document in a figure environment.
• I suggest spending more time in formulating your question considering your past four questions (MWE, make clear what you currently do and what you want to achieve).

\documentclass{article}

\usepackage{tikz}
\usepackage{float}
\usepackage{blindtext}

\begin{document}
\blindtext

\begin{figure}[H]
\centering
% ---
% Taken from https://cremeronline.com/LaTeX/minimaltikz.pdf
\begin{tikzpicture}
\draw [blue] (0,0) rectangle (1.5,1);
\draw [red, ultra thick] (3,0.5) circle [radius=0.5];;
\draw [gray] (6,0) arc [radius=1, start angle=45, end angle= 120];
\end{tikzpicture}
% ---
\caption{Simple tikz example.}
\end{figure}

\blindtext
\end{document}

• Because I am using Scientific Workplace to create latex file, and SW does not support tikz, I have to find a way to incorporate tikz generated figures in SW tex file. Right now only way to do so is to generate tikz figure into pdf and then convert it to image, then imported in SW file. – hermes Feb 2 '18 at 17:47
• Or don't use scientific workplace... And this information would have been helpful in your question right from the beginning. – Dr. Manuel Kuehner Feb 2 '18 at 19:01
• I have all my files created in SW. So it can not be changed. SW offers good interface for typing and is virtually WYSWYG. But biggest problem seems that it can not support tikz. I think standalone package can meet my requirement. – hermes Feb 2 '18 at 19:34
• I am rather a LaTeX purist, don't ask me :) – Dr. Manuel Kuehner Feb 2 '18 at 20:35
• You're basically asking an impossible thing: "I have all my files created in SW. So it can not be changed." Of course it can be changed... you found the solution yourself, but it seems unpalatable to you. – Joseph Feb 2 '18 at 21:42