Graphics, Figures & TablesProblem with Tikz

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
Estabilo
Posts: 12
Joined: Tue May 12, 2015 11:08 am

Problem with Tikz

Post by Estabilo »

Hello friends.
I am a boy from Spain. In Spain there are not forums for that reason I am here

Sorry for my english and thank for help.

My problem is this:
I want to put the same image of code just below of this.

This code do

Code: Select all

\documentclass[border=3mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{shadows,arrows,positioning}

\begin{document}
\begin{tikzpicture}[scale=0.75, transform shape]
      \tikzset{every node/.style={minimum height=2em},
        proc/.style={draw=black, fill=blue!15, drop shadow},
      }

\newcounter{pos}
\setcounter{pos}{0}

\foreach \process/\width in {2/3,3/3,1/24}
{
   \node [draw, proc, minimum width=\width em,  anchor=west] (p\process) at (\thepos em,0) {P\process};
    \addtocounter{pos}{\width}
    \node [below=of p\process.east] {\thepos} edge [draw] (p\process.east);
}
\node [below=of p2.west] {0}  edge [draw] (p2.west); 

\end{tikzpicture}

\end{document}
IMAGE:1

I want this:
IMAGE:2


Thank you all for the help.
Attachments
I want this.
I want this.
2.png (8.09 KiB) Viewed 2871 times
1.png
1.png (3.61 KiB) Viewed 2871 times

Recommended reading 2024:

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

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

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

mas
Posts: 226
Joined: Thu Dec 04, 2008 4:39 am

Problem with Tikz

Post by mas »

Welcome to the LaTeX Community :-)

As I understand you want the image on the top. You can repeat the code with a negative yshift as shown below:

Code: Select all

\documentclass[border=3mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{shadows,arrows,positioning}

\begin{document}
\begin{tikzpicture}[scale=0.75, transform shape]
      \tikzset{every node/.style={minimum height=2em},
        proc/.style={draw=black, fill=blue!15, drop shadow},
      }

\newcounter{pos}
\setcounter{pos}{0}

\node at (-0.5,0) {\large\textit{cpu}} ;

\foreach \process/\width in {2/3,3/3,1/24}
{
   \node [draw, proc, minimum width=\width em,  anchor=west] (p\process) at (\thepos em,0) {P\process};
    \addtocounter{pos}{\width}
    \node [below=of p\process.east] {\thepos} edge [draw] (p\process.east);
}
\node [below=of p2.west] {0}  edge [draw] (p2.west);

\setcounter{pos}{0}

\begin{scope}[yshift=-2.3cm]
\foreach \process/\width in {2/3,3/3,1/24}
{
   \node [draw, proc, minimum width=\width em,  anchor=west] (p\process) at (\thepos em,0) {P\process};
    \addtocounter{pos}{\width}
    \node [below=of p\process.east] {\thepos} edge [draw] (p\process.east);
}
\node [below=of p2.west] {0}  edge [draw] (p2.west);
\end{scope}

\end{tikzpicture}

\end{document}
The above yields the following:
x.png
x.png (5.64 KiB) Viewed 2847 times
Is this what you wanted?

OS: Debian/GNU Linux; LaTeX System : TeXLive; Editor : Vim
Estabilo
Posts: 12
Joined: Tue May 12, 2015 11:08 am

Re: Problem with Tikz

Post by Estabilo »

YESSSSSSSSSS!!!!!!
THANK YOU!!!!!
I am very grateful!!!
Post Reply