A few years ago I needed a program able to concatenate two or more dvi files (I was attempting to produce a single document with the text of all final exams I had given in my control theory classes). After a disapointing search on the World Wide Web, I decided to make one able to concatenate or superimpose dvi files (giving proper attention to the special commands related to the inclusion of PostScript files). Fortunately, the description of the dvi file format, which is in the public domain, is very easy to work with. In a single afternoon I was able to make a working program, which was latter slightly refined. As a way to thank all TeX and LaTeX developers, I make this program available for general non-commercial use.
dvi_tool v0.5b (c) 2000-2005, Tomás Oliveira e Silva usage: dvi_tool [global options] command file_data [file_data] ... * the global options are * -o(utput) file_name the default output file name is c.dvi for the -c command and s.dvi for the -s command * -v(erbose) * -p(sfile_dir) dir_name copy all PostScript files found in "psfile=" and "header=" specials to the given directory (which is created if it does not exist), giving them names of the form NNN.ps, where NNN is a number starting at 000; the "psfile=" and "header=" specials of the output file will refer to the new PostScript files; files with the same name but residing in different directories will be given different numbers * -m(od) a[,b] adds zero or more blank pages at the end of every input file to make the number of pages congruent to b modulo a; by default b=0 * -b(oundingbox) w,h forces the width and height of the bounding box reported in the postamble of the dvi file to be, respectively, w and h millimeters (warning: bounding boxes may be incorrect) * command is either -c(oncatenate) or -s(uperimpose) the -c command concatenates the selected pages of one or more dvi files the -s command superimposes the selected pages of the second file on the selected pages of the first file; the number of output pages will be the number of selected pages of the first file; surplus pages of the second file will be ignored and missing pages will be replaced by blank pages (see, however, option -c below) * file_data, which must appear one or more times for the -c command and exactly two times for the -s command, is of the form file_name [-m(od) a[,b]] [-p(ages) list_of_pages] [-c(yclic)] [-r(everse)] [-o(ffset) dx[,dy]] * -m a,b adds zero or more blank pages at the end to make the number of pages congruent to b modulo a; by default b=0 * if no -p options are given, all pages are selected; otherwise no pages are initially selected * list_of_pages is a comma separated list of page ranges, each of which of the form [+-][a].[b].[c] + selects the pages and - deselects the pages; a is the first page, b is the page increment, which must be positive, and c is the last page; by default, the pages are to be selected, a is 0 (the first page), b is 1, and c is the number of pages minus 1 (the last page) * the -c option is only valid for the second file_data of a -s command; when used, the pages of the second file are repeated cyclically * the -r option reverses the order of the pages (note that subsequent -p options are affected by the -r option) * if the -o option is used all pages of the corresponding file will be offset by dx,dy millimeters; by default, dy=0 notes: * the global options are applied before the file_data options * only the last value given to a global option is used * file_data options are processed sequentially; the same option may appear several times
Software (last update made on January 5, 2008)
Source code of a program [17KiB, gziped tar archive] able to concatenate or superimpose dvi files. This source code is released under the version 2 (or any later version) of the GNU general public license. Please do not bother me if you are unable to compile the program in your computer (I do not distribute executables), or if it does not work as advertised on your computer. It was developed on a GNU/Linux system. It should compile with none or very few modifications in Unix systems. Other operating systems are not supported.