1

I want to minimize the image size in latex i tried so many times with different codes but non gave me the required result. here is my code:

\begin{figure}
\centering % l b r t
\includegraphics[trim=0.0cm 0cm 0cm 0cm, clip=true,
 width=\linewidth]
{Files/PN.pdf}
\caption{Petri nets components}
\label{fig:bb}
\end{figure} 

enter image description here

  • 4
    I don't exactly understand your question, but you can try using either scale=<scale factor or height/width = <desired size in one of the SI units> within the options of includegrapics. Also welcome to TeX.SE, please add a fully compilable MWE. – Raaja Dec 26 '18 at 20:47
  • Welcome between our community TeX.SE. – Sebastiano Dec 26 '18 at 21:10
  • 2
    you are trimming 0cm off each edge, so that has exactly no effect at all, what do you want to do? – David Carlisle Dec 26 '18 at 23:39
  • 1
    You can use the pdfcrop tool to create a minimized version of the PDF and then include this one. – Martin Scharrer Dec 28 '18 at 18:42
  • 2
    Or you could spend five minutes and redraw that image in tikz. – JPi Dec 28 '18 at 18:52
1

for exercise (of using petri library) i redraw your image:

enter image description here

it can be scaled by changing scale from 1 to desired size. The image was generated with the following code:

\documentclass[tikz, crop]{standalone}
\usetikzlibrary{arrows.meta,
                automata,
                petri,
                positioning}

\begin{document}
    \begin{tikzpicture}[scale=1, % <--- here you can adjust image size
    transform shape,
    node distance = 8mm,
                > = Triangle,
     place/.style = {circle, semithick, draw, minimum size=6mm},
transition/.style = {thick, draw, minimum size=6mm},
pre/.append style = {shorten <=0pt}
                        ]
\node [place,tokens=2,
       pin=80:Place ]   (n1)    {};
\node [transition,pin={[xshift=-2.2mm]80:Transition},
       right=of n1]     (n2)    {}
            edge [pre]  (n1);
\node [place,
       right=of n2]  (n3) [] {}
            edge [pre]  (n2);
\path ([xshift=1.2mm] n1) coordinate[pin=280:Token] (aux)
      (n2) -- coordinate[pin=280:Arc] (aux)   (n3);
    \end{tikzpicture}
\end{document}

(it take me slightly more than 5 minutes, since i use petri library first time :-) ). this code can be used inside figure environment:

\begin{figure}
    \centering % l b r t
\begin{tikzpicture}[... ]
<image code>
\end{tikzpicture}
\caption{Petri nets components}
\label{fig:bb}
\end{figure} 

or store above code as PN.tex and generated pdf file include in document with

\begin{figure}
    \centering 
\includegraphics{Files/PN.pdf}
\caption{Petri nets components}
    \label{fig:bb}
\end{figure}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.