Re: [O] Using org to create a TOC for a compilation of separate PDF documents
Am Donnerstag, 23. Mai 2013, 23:48:03 schrieb Marcin Borkowski: > Dnia 2013-05-23, o godz. 15:21:56 > > John Hendy napisał(a): > > I have a use case and am not sure if Org would help or not. I've > > downloaded a bunch of technical data sheets on various materials from > > a vendor. I'd like to create a "booklet" of them with a cover page > > table of contents. > > > > I can create the booklet very easily with Stapler (or similar), but am > > not sure on the best way to generate a clickable linked PDF of the > > individual materials contained in the compiled document.[1] What I'm > > not sure on is how to create a table of contents. > > > > Ideally, I could do something like generate a page count of each > > document and then use this to create the page numbers I'd use to > > create links to, which I thought I could do with Org. Even better > > would be to have [back to top] links as well, since this will end up > > being a multi-hundred page booklet (~100 documents of 2-4 pages each). > > > > Any thoughts on this? > > > > Is it easier to just generate a list of files and use Org to "include" > > them somehow via LaTeX instead of using Stapler to combine them? > > I'd just use LaTeX's pdfpages package, possibly with hyperref. (If you > encounter any problems, email me - I've done similar things before, so > I guess I could help you.) > You don't have to do that manually. Some time ago members of the German TEX-D- List put together a bash script, which takes all the PDFs recursivly and creates a *.tex file: #+begin_src bash #!/bin/bash # # pdfdir OUTPUT_FILE # # produces one big PDF file of all PDF files in . # if [ $# -ne 1 ] || [ -z "$1" ]; then echo "Syntax: pdfdir OUTPUT_FILE" exit 1 fi FILE="$(echo "$1"|sed -e 's/\.\(pdf\|tex\)$//')" for F in "$FILE" "$FILE.tex" "$FILE.pdf" "$FILE.aux" "$FILE.log" ; do if [ -e "$F" ]; then echo "$F already exists." exit 2 fi done cat >"$FILE.tex" /dev/null | sort } list_pdf_files () { # " around filenames: find -L "$1" -maxdepth 1 -mindepth 1 -name \*.pdf -o -name \*.PDF -type f 2>/dev/null | sort | \ sed -e 's/^/\\includepdf[pages=-]{"/; s/$/"}%/' # without " around filenames: # find -L "$1" -maxdepth 1 -mindepth 1 -name \*.pdf -o -name \*.PDF -type f 2>/dev/null | sort | \ # sed -e 's/^/\\includepdf[pages=-]{/; s/$/}%/' } tex_headline () { echo "$1" | sed -e 's/_/\\_/g' } # folder level were we are (level 0): list_pdf_files . >>"$FILE.tex" # level 1: list_directories . | while read -r DIR1; do # Are there PDF files a level down? exist_pdf_files "$DIR1" || continue # Yes... tex_headline "\section{${DIR1##*/}}%" # ... those are ...: list_pdf_files "$DIR1" # Level 2: list_directories "$DIR1" | while read -r DIR2; do exist_pdf_files "$DIR2" || continue tex_headline "\subsection{${DIR2##*/}}%" list_pdf_files "$DIR2" # Level 3: list_directories "$DIR2" | while read -r DIR3; do exist_pdf_files "$DIR3" || continue tex_headline "\subsubsection{${DIR3##*/}}%" list_pdf_files "$DIR3" # Level 4: list_directories "$DIR3" | while read -r DIR4; do exist_pdf_files "$DIR4" || continue tex_headline "\paragraph{${DIR4##*/}}%" list_pdf_files "$DIR4" # Level 5: list_directories "$DIR4" | while read -r DIR5; do exist_pdf_files "$DIR5" || continue tex_headline "\subparagraph{${DIR5##*/}}%" list_pdf_files "$DIR5" done done done done done >>"$FILE.tex" echo "\end{document}%" >>"$FILE.tex" echo "Compile source now? [J/n]" read -r ANSWER case "$ANSWER" in [JjYy]) ;; *) exit 0 ;; esac pdflatex "$FILE" [ $? -eq 0 ] && rm -f "$FILE.aux" "$FILE.log" "$FILE.tex" #+end_src I found that very helpfull, but I did not use it recently. Regards, Alexander > > Thanks for any suggestions! > > John > > Best, book-from-PDF.sh Description: application/shellscript
Re: [O] Using org to create a TOC for a compilation of separate PDF documents
John Hendy writes: > I have a use case and am not sure if Org would help or not. I've > downloaded a bunch of technical data sheets on various materials from > a vendor. I'd like to create a "booklet" of them with a cover page > table of contents. You can use pdfpages for this. There's a command for inserting page links and everything. There's also a booklet option for this which I haven't used in a while. Also, do try pdfjam. It is the most amazing thing that has come out of Warwick! (And Warwick is good :) > I can create the booklet very easily with Stapler (or similar), but am > not sure on the best way to generate a clickable linked PDF of the > individual materials contained in the compiled document.[1] What I'm > not sure on is how to create a table of contents. If you want a more hackish solution you can adapt the stuff I post in the end for your needs. What you'll need is just to incorporate hyperref which I think you can do with pdfpages or perhaps even vanilla hyperref. Let me know if it's causing trouble 'cause I did it some years back. . . > Ideally, I could do something like generate a page count of each > document and then use this to create the page numbers I'd use to > create links to, which I thought I could do with Org. Even better > would be to have [back to top] links as well, since this will end up > being a multi-hundred page booklet (~100 documents of 2-4 pages each). Go out should be easy. Page count is easy. For a get home key you might overlay a button with tikz and hyperref. . . I show how to make an overlay on all sites. You'd somehow want to only do it on the first side perhaps. You'd do this by inducing to pdfpages commands and only have a pageCommand on the first page (for instance). OR add hyperlinks and have a site bar/index curtisy of hyperref. > Is it easier to just generate a list of files and use Org to "include" > them somehow via LaTeX instead of using Stapler to combine them? I used to do stuff like this in LaTeX. I'm quite happy to organize it in Org via tables. I've included two examples in the following gist. Note, I wrote them quickly and I didn't know (and still don't) any Emacs Lisp. The LaTeX functions are super ugly as well, but they get stuff done. Hopefully you can find some inspiration. https://gist.github.com/anonymous/5640444 –Rasmus -- El Rey ha muerto. ¡Larga vida al Rey!
Re: [O] Using org to create a TOC for a compilation of separate PDF documents
On Thu, May 23, 2013 at 5:20 PM, Suvayu Ali wrote: > On Thu, May 23, 2013 at 03:21:56PM -0500, John Hendy wrote: >> >> Is it easier to just generate a list of files and use Org to "include" >> them somehow via LaTeX instead of using Stapler to combine them? > > I would use a shell script to write an Org file with headlines derived > from the filenames and include the PDFs with pdfpages. > Thanks to your and Martin. I've not used that package, so I'll check it out and let you know if I have any issues (perhaps off-line to Martin if I end up not actually using Org). But using babel to just generate the LaTeX code would be great! Thanks again, John > Hope this helps, > > -- > Suvayu > > Open source is the future. It sets us free. >
Re: [O] Using org to create a TOC for a compilation of separate PDF documents
On Thu, May 23, 2013 at 03:21:56PM -0500, John Hendy wrote: > > Is it easier to just generate a list of files and use Org to "include" > them somehow via LaTeX instead of using Stapler to combine them? I would use a shell script to write an Org file with headlines derived from the filenames and include the PDFs with pdfpages. Hope this helps, -- Suvayu Open source is the future. It sets us free.
Re: [O] Using org to create a TOC for a compilation of separate PDF documents
Dnia 2013-05-23, o godz. 15:21:56 John Hendy napisał(a): > I have a use case and am not sure if Org would help or not. I've > downloaded a bunch of technical data sheets on various materials from > a vendor. I'd like to create a "booklet" of them with a cover page > table of contents. > > I can create the booklet very easily with Stapler (or similar), but am > not sure on the best way to generate a clickable linked PDF of the > individual materials contained in the compiled document.[1] What I'm > not sure on is how to create a table of contents. > > Ideally, I could do something like generate a page count of each > document and then use this to create the page numbers I'd use to > create links to, which I thought I could do with Org. Even better > would be to have [back to top] links as well, since this will end up > being a multi-hundred page booklet (~100 documents of 2-4 pages each). > > Any thoughts on this? > > Is it easier to just generate a list of files and use Org to "include" > them somehow via LaTeX instead of using Stapler to combine them? I'd just use LaTeX's pdfpages package, possibly with hyperref. (If you encounter any problems, email me - I've done similar things before, so I guess I could help you.) > Thanks for any suggestions! > John Best, -- Marcin Borkowski http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski Adam Mickiewicz University
[O] Using org to create a TOC for a compilation of separate PDF documents
I have a use case and am not sure if Org would help or not. I've downloaded a bunch of technical data sheets on various materials from a vendor. I'd like to create a "booklet" of them with a cover page table of contents. I can create the booklet very easily with Stapler (or similar), but am not sure on the best way to generate a clickable linked PDF of the individual materials contained in the compiled document.[1] What I'm not sure on is how to create a table of contents. Ideally, I could do something like generate a page count of each document and then use this to create the page numbers I'd use to create links to, which I thought I could do with Org. Even better would be to have [back to top] links as well, since this will end up being a multi-hundred page booklet (~100 documents of 2-4 pages each). Any thoughts on this? Is it easier to just generate a list of files and use Org to "include" them somehow via LaTeX instead of using Stapler to combine them? Thanks for any suggestions! John [1] https://github.com/fwenzel/stapler