[luatex] combining files with pure LuaTeX

Reinhard Kotucha reinhard.kotucha at web.de
Mon Sep 27 01:38:43 CEST 2010

On 26 September 2010 Pablo Rodríguez wrote:

 > On 09/26/2010 04:17 PM, Reinhard Kotucha wrote:
 > >
 > > I did this with pdftex a week ago, but it works with luatex too.  The
 > > first step is to place the image on a single A4 page and call this file
 > > background.pdf
 > >
 > > Then copy the stuff below to a file called add-background.tex.
 > Many thanks for your help, Reinhard.
 > It works fine with some images, but if the image is too small (as 
 > http://www.ousia.tk/stamp.pdf) the resulting files are wrong 
 > (http://www.ousia.tk/add-background.pdf).

Yes, you have to create an A4 page containing the stamp at the
desired position.  Actually, it's not limited to A4 but both files
must have the same page size, otherwise you probably don't get what
you expect.

 > How can I place the stamp.pdf on a different position? Actually I
 > need to be able to move the stamp position in different pages.

I just adapted the code in order to allow the background file to have
more than one page.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: add-background.tex
Type: application/octet-stream
Size: 1366 bytes
Desc: not available
URL: <http://tug.org/pipermail/luatex/attachments/20100927/77bd20c7/attachment.obj>
-------------- next part --------------

If the background file has less pages than the other file, the last
page of the background file is used repeatedly.

When comiling the example


I get:

(./add-background.tex) [1.1 <./background.pdf> <./joining.pdf>] [2.2
<./background.pdf> <./joining.pdf>] [3.3 <./background.pdf>
<./joining.pdf>] [4.4 <./background.pdf> <./joining.pdf>] [5.4
<./background.pdf> <./joining.pdf>] [6.4 <./background.pdf>
Output written on add-background.pdf (6 pages, 270100 bytes).

Look at the page numbers.  The first number denotes the page number of
the foreground file, the second one that of the background file.  In
this case the foreground file has six pages, the background file only
four.  Page 4 of the background file is then used repeatedly.

In order to create such background files I formerly used LaTeX, but
since you don't want to install a whole TeX distribution, I created a
plain TeX file.  I must admit that I like the plain TeX solution much
more.  The macro which places the stamp on the page was derived from
an example in Appendix D of The TeXbook, but I adapted it so that you
can use all units supported by TeX.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: background.tex
Type: application/octet-stream
Size: 636 bytes
Desc: not available
URL: <http://tug.org/pipermail/luatex/attachments/20100927/77bd20c7/attachment-0001.obj>
-------------- next part --------------


Reinhard Kotucha			              Phone: +49-511-3373112
Marschnerstr. 25
D-30167 Hannover	                      mailto:reinhard.kotucha at web.de
Microsoft isn't the answer. Microsoft is the question, and the answer is NO.

More information about the luatex mailing list