I'm using Ubuntu Linux LTS and I like the auto-formatting that a2ps does. I just want to print several small files using as few pages as possible. Example: a2ps file1.c file2.c file3.c file4.c These will print out (depending on printer settings) on their four separate pages, or on opposite sides of two two-sided pages, like this:

--- page 1---

side 1: file1.c text blank column

side 2: file2.c text blank column

--- page 2 ---

side 1: file3.c text blank column

side 2: file4.c text blank column

I want to have them all on one sheet of paper:

--- page 1 ---

side 1: file1.c text file2.c text

side 2: file3.c text file4.c text

  • See math.grinnell.edu/mathlan/printing-with-a2ps.xhtml – user1929959 Feb 21 '13 at 23:28
  • a2ps -2 --sides=duplex almost does what I am looking for, but it still leaves each file on its own page. Is there a way to fill the missing column with the next file if the current file isn't long enough to extend into it? – Jed Schaaf Feb 22 '13 at 1:32

I solved a similar problem by generating eps files and including them in a latex file as figures. Latex places them on the same page if possible.

| improve this answer | |

You can use the -A flag of a2ps:

-- Option: -A MODE

-- Option: --file-align=MODE

Align separate files according to MODE. This option allows the printing of more than one file on the same page. MODE can be any one of:

  • virtual: Each file starts on the next available virtual page (i.e., leave no empty virtuals).
  • rank: Each file starts at the beginning of the next row or column depending on the --major setting.
  • page: Each file starts on a new page.
  • sheet: Each file starts on a new sheet. In Simplex mode, this is the same as page; in Duplex mode, files always start on a front side.
  • an integer NUM: Each file starts on a page which is a multiple of NUM plus 1. For instance, for 2, the files must start on odd pages.

For example:

a2ps -A virtual -- file1.c file2.c
| improve this answer | |
  • 2
    This answer could be improved by describing what the -A option does, and linking to a reference. – G-Man Says 'Reinstate Monica' Dec 3 '16 at 6:28
  • 1
    While this may answer the question, it would be a better answer if you could provide some explanation why it does so. – DavidPostill Dec 3 '16 at 13:45

a2ps --rows 1 --columns 2 yourFile1 yourFile2

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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