TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have about a hundred images named 001.png to 123.png. I want to create a document which includes each image in center of a page. i.e. a 123 page document with each image on a single page.

I know that doing this is possible using macros but I have no clue how to do that. Any help is appreciated.

share|improve this question
Welcome to TeX.SX! Will the document contain other things or just the images? – egreg Sep 27 '12 at 10:34
Here is a very similar question with a lot of approaches: tex.stackexchange.com/q/53458/10570 – Holle Sep 27 '12 at 10:47
@Holle They are aimed at printing all files in some directories. Here the situation is simpler. – egreg Sep 27 '12 at 10:50
@egreg Thanks :) No, I don't need anything else other than the images. – Asghar Sep 27 '12 at 11:09
up vote 10 down vote accepted

If you need only the images in the center of the page, just loop:



    \\[12pt]\texttt{\current.png} % comment if you don't want the file name here
  \ifnum\value{#1}<100 0\fi\ifnum\value{#1}<10 0\fi\arabic{#1}%

I used the demo option for graphicx just to avoid the need to populate my folder with mock images.

share|improve this answer
Thanks, exactly what I needed . – Asghar Sep 27 '12 at 12:38

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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