# Using plain TeX to get text flowing around included images

I'm looking to have a page full of text, with an embedded image aligned left, another embedded image aligned right, the two images not necessarily at the same height.

Here is an image showing the sort of thing I mean.

I freely recognise that this is probably stupidly simple and that I've missed the obvious, and I apologise in advance if that's the case. I thought this would be a simple question, but I've been searching for some time, and my search-fu has failed me entirely. I have a poor solution in LaTeX, but it is heavily restricted, and I'm hoping that perhaps plain TeX will let me do what I'm after. I would normally include all the things I've tried looking for, but there are too many, and it's now all a fog.

I'm using absolutely vanilla TeX on Ubuntu 14 (soon to be upgraded through 16 to 18).

This is assuming pdftex for the image inclusion but otherwise is just using the \parshape tex primitive to specify the cutouts.

\parshape takes a list of pairs, left indent and length of line segment.


\def\z{one two three four five six seven eight nine ten elevel twelve}
\def\zz{Red \z. Green yellow \z. Blue black orange\z}
\def\zzz{\zz. \zz. \zz}

\parshape 29
0pt \hsize 0pt \hsize 0pt \hsize 0pt \hsize 0pt \hsize 0pt \hsize 0pt \hsize  0pt \hsize
.3\hsize .7\hsize .3\hsize .7\hsize .3\hsize .7\hsize .3\hsize .7\hsize .3\hsize .7\hsize
.3\hsize .7\hsize .3\hsize .7\hsize
.3\hsize .4\hsize .3\hsize .4\hsize .3\hsize .4\hsize
0pt .7\hsize 0pt .7\hsize 0pt .7\hsize 0pt .7\hsize 0pt .7\hsize
0pt .7\hsize 0pt .7\hsize 0pt .7\hsize 0pt .7\hsize 0pt .7\hsize
0pt \hsize
\noindent
\hbox to 0pt{\vbox to 0pt{%
\vskip6\baselineskip
\pdfximage  width .25\hsize{man.png}
\pdfrefximage\pdflastximage
\vss}\hss}%
\hbox to 0pt{\hskip.75\hsize
\vbox to 0pt{%
\vskip14\baselineskip
\pdfximage  width .25\hsize{man2.png}
\pdfrefximage\pdflastximage
\vss}\hss}%
\indent
\zzz. \zz. \zzz. \zz. \zzz. \zz.
\zzz. \zzz.

\bye

• Thanks for the reply ... I've copied the text, but I'm getting "Undefined control sequence." for \pdfximage ... Feb 5, 2020 at 22:13
• @RiderOfGiraffes as I said, I assumed pdftex. You gave no indication of which tex engine you were using, and pdftex is by far the most common. What are you using? Feb 5, 2020 at 22:16
• @RiderOfGiraffes if you are using luatex or xetex for example, equivalent image inclusion commands exist, one of the benefits of using latex is that it can hide these difference behind a common i\includegraphics interface, but you asked for plain TeX. Feb 5, 2020 at 22:29
• Sorry, it wasn't clear to me that the statement about "pdftex" was critical. I'm just typing "tex <filename>" on the command line. (a) How can I find out what engine that is? (b) What command would you recommend I use instead? I'm on vanilla Ubuntu 14.04. Feb 5, 2020 at 22:45
• I asked for plain text because my extensive attempts to use LaTex for this have failed. It seems to be impossible to have images offset but overlapping in vertical placement. If you can tell me how to get images in LaTex without them requiring paragraphs all to themselves, and with vertical placement overlap, then that would also be useful (although not for this specific task). ... and thank you. Feb 5, 2020 at 22:46