On 09/14/2012 03:13 AM, Tim Head wrote:
Hello all,
I have a large document consisting of one master document and several
child documents. Is there a convenient way to export all child
documents to separate documents?
Currently I open each child document and export it to (say) pdf
separately. I then have chapter1.pdf, chapter2.pdf chapter3.pdf etc.
This is a bit tedious so I was wondering if there was a way to define
a shortcut to do this or use the lyx-server?
Personally, if I had to do this, I'd export the whole thing and then use
pdftk to slice up the resulting pdf. I've attached a very simple script
I have to do this kind of thing (just because I can never remember the
pdftk syntax needed). Of course, the page numbers etc will be those in
the whole document. But maybe that's better. This solution needs to have
pdftk installed, though. I'll guess you can get it through MacPorts.
You could presumably also do something from the command line, e.g.:
for i in *.lyx; do lyx -e pdf2 $i; done
will export all the LyX files in the current directory to "PDF (pdflatex)".
There's a new buffer-forall LFUN, I believe, though only in trunk, that
allows one to do something for every buffer from within LyX. But I don't
think it will turn up in branch.
Richard
#!/bin/bash
INFILE="$1";
PAGES="$2";
OUTFILE="$3";
if [ -z "$OUTFILE" ]; then
echo "pdfextract INFILE PAGES OUTFILE";
exit 1;
fi
pdftk "$1" cat $2 output "$3"