ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Marco Pessotto <melmothx@gmail.com>
To: ntg-context@ntg.nl
Subject: Imposition with signatures (pdfpages/psbook emulation -- kind of announce)
Date: Sun, 16 Jan 2011 18:44:23 +0100	[thread overview]
Message-ID: <87mxn0wxoo.fsf@universe.krase.net> (raw)


Hello there.

I deal very often with imposition, useful for zinesters and to create
home-made booklets. ConTeXt by itself seems not to manage signatures,
i.e., given a text long 200 pages, it should be imposed in smaller
booklets of 50 pages each. (Or at least I didn't find anything about it)

At the beginning I was using psbook. But this requires a slow
processing (pdf -> ps; psbook ; ps -> pdf). 

Then I found out that pdfpages does the same thing (and better), and
started using that. Now that I switched to ConTeXt, I found that I
cannot use pdfpages without a latex installation.

So I wrote a script and a module to do the same thing without having to
install texlive. It uses MkIV and lua.

The code is stored at 

http://gitorious.org/the-anarchist-library-tools/the-anarchist-library-tools/trees/master/context-imposition

A minimal example and (minimal) documentation is provided.

The code does basically 2 things:

1) the module, using the \alibraryflushpages commands, fills the output
pdf (not imposed) with white pages, until it reach a “good” number,
multiple of 4. The signature is calculated at runtime, so you can
specify a minimum or a maximum (depends on your staple, if you can trim
the paper, and so on).

E.g., if the original pages are 128, no problem, the signature is 64 (16
sheets) and you can impose it without problems.

But, if the original pages are 129, the optimal signature is 44, so the
module will add 3 pages during the PDF compiling.


2) the perl script (which uses only standard perl libraries) creates a
temporary context file, gets the number of signatures provided by the
module (or passed as option if only the imposition is required against a
pdf without tex sources), and does the actual imposing (the algorithm is
taken from the psbook sources (the same used by pdfpages), including the
pages in the right order.

I'm not a real programmer, so it's a piece of spaghetti code. But seems
to work.

I'm posting this here because it's aimed to people that use the Minimals
only, as TeXLive already ships pdfpages, psbook and pdfpages to do the
same thing. (Well, the signature is not calculated on the fly by these
tools).

*If* there are people interested, I'd like to clean it up, improve it,
document it a bit better and so on. If not, well, sorry for the noise.

Bests

-- 
Marco

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

                 reply	other threads:[~2011-01-16 17:44 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87mxn0wxoo.fsf@universe.krase.net \
    --to=melmothx@gmail.com \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).