I'm sorry, if my question is less clear. I mean is how to simplify the writing of syntax in main.tex to display images with the same settings,

    \caption{Picture 1}

with just write, maybe,



I am writing an ebook that contains some of graphics. Some of them generated by code (using TikZ), for example pic1.tex. I think it will be easier to edit if they save in a separated file. I drop all graphics in a folder named Pictures. I named all graphics with the same prefix pic, for example pic2.png, pic3.jpg, etc.

How to include them with a minimal code, say:



    \caption{Picture 1}
  • If you don't want/need your graphics to float, you don't need to wrap them in a figure environment. You can just use the includegraphics command, thus saving some typing. Wether that's very useful is another different question :) Commented Jun 28, 2013 at 10:37
  • 1
    \include is for bigger pieces of text and it always emits a \clearpage, so it's definitely not good for such usages; \input is what you're looking for.
    – egreg
    Commented Jun 28, 2013 at 10:45
  • 1
    \includegraphics is for embedding driver dependent non-TeX graphic files (Postscript, PDF, PNG, etc.), which are not processed by TeX. TikZ code is TeX code and needs to be digested by TeX. Therefore \inlcudegraphics doesn't work here.
    – AlexG
    Commented Jun 28, 2013 at 10:56
  • @AlexG: Oh, I didn't know that includegraphics can't be used for TikZ code ... Thanks! Commented Jun 28, 2013 at 12:31

1 Answer 1


If you want to be a best practitioner, consider the following. Let your files and folders hierarchy be as follows.

enter image description here

  • main.tex in Project.
  • rules.jpg is in SubDir.
  • behaviors.jpg is in ParentSiblingDir.
% main.tex


\Insert{scale=.2}{behaviors}{Students' behaviors}{fig:behaviors}
\Insert{scale=.2}{rules}{Father's rules}{fig:rules}

enter image description here


  • Use \graphicspath to register folders (directories) from which the images will be included or imported. The format is \graphicspath{{<relative path1>}{<relative path2>}{<relative path...>}}. Each path must be followed by /.

  • The remaining code should be clear enough!

  • @EdyJo: If you are satisfied with this answer, please accept it by clicking the check mark button (below the down vote button). You can optionally up vote it as well. Terima kasih. Commented Jun 30, 2013 at 3:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .