11

I have a document (my Ph.D. dissertation) that I wrote in 1984-1985 time frame using Plain TeX (not LaTeX). I need to create a PDF out of it. Back in 1985, my figures were generated using Pascal programs to generate printer files that were inserted using \special{include filename.qms}. The printer files were obviously specific to the printer that was available to me back then, but luckily that printer (QMS?) was using HP plotter commands (Pen Up, Pen Down, Absolute, Relative, ....). So it was rather easy.

I still have those Pascal programs. But what should I be using to generate an image (JPG, PNG, whatever) or something else, that will work more generically than a printer-specific file? Particularly if I want to use pdftex? But I will consider using tex, dvips, and ps2pdf if I need to go that route.

I also have photographs (they were glued to the paper back then, one dissertation copy at a time (about 5-6 photographs times 10 copies), that I need to scan into JPG or PDF.

I have googled for how to include a JPG in a TeX document and all the results point to LaTeX, but I am using Plain TeX. So how do I include an image in Plain TeX? If I have to convert images to PS or EPS format, I can do that with ImageMagick or similar.

Thanks for your assistance.

3
  • Do you have a short sample qms file we could use?
    – Teepeemm
    Jan 22, 2020 at 16:03
  • 1
    you can use the latex graphics package with plain but really I probably wouldn't, if you are committing to pdftex then use pdf for vector drawings jpg for pictures and jpg or png for scans, including them is easy enough in a couple of lines of code, the main benefit of the latex interface is abstracting away syntax differences so it works with pdftex or latex+dvips or luatex with the same document syntax, but you do not need that. Jan 22, 2020 at 16:14
  • @teepeemm No, I no longer have the .qms files. I didn't keep them, knowing they were printer specific. They could be generated again if I were to compile my Pascal programs, something I have yet to do, as I was using Turbo Pascal vack then. I would need to find a compatible compiler (I know there is one, the name of which escapes me right now). However it appears David Carlisle answer brings a solution I need to explore.
    – Pierre
    Jan 22, 2020 at 16:33

1 Answer 1

11

see texdoc pdftex section 9 on graphics inclusion, but a simple example including a png file (jpg or pdf are similar)

one

    \pdfximage{man.png}
    \pdfrefximage\pdflastximage

two


    \pdfximage width .25\hsize{man.png}
    \pdfrefximage\pdflastximage

three

\bye

enter image description here

8
  • 5
    +1 for the stunning artwork! Jan 22, 2020 at 16:30
  • 6
    @StevenB.Segletes One I made for an earlier answer here. If you speak to my legal team I'm sure you could licence it for use if you need to use it in your documents. Jan 22, 2020 at 16:32
  • 2
    @DavidCarlisle David, you came to the rescue, as usual. Thank you. \pdfximage width \hsize{image.jpg} \pdfrefximage\pdflastximage did the trick for me. Out of curiosity, what does \pdfrefximage\pdflastximage do? Now up to finding a way to generate PDF or JPG files out of my vector-oriented Pascal programs.
    – Pierre
    Jan 22, 2020 at 17:19
  • 3
    @Pierre pdf would be better than jpg if you can for vector drawings, the command names match the internal PDF structure \pdfximage is just a save operation (a pdf xform) and returns an internal object number, as \pdflastximage (which you could save in a count register etc, then \pdfrefximage <a number> displays that object, so you can display an image many times but only load it once (eg a logo in your page head) Jan 22, 2020 at 17:24
  • 3
    Converting HPGL should work fine. Keep us posted or better: write an article e.g. for TUGboat describing your experience. Jan 22, 2020 at 21:11

You must log in to answer this question.

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