* Using org to create a TOC for a compilation of separate PDF documents
@ 2013-05-23 20:21 John Hendy
2013-05-23 21:48 ` Marcin Borkowski
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: John Hendy @ 2013-05-23 20:21 UTC (permalink / raw)
To: emacs-orgmode
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Using org to create a TOC for a compilation of separate PDF documents
2013-05-23 20:21 Using org to create a TOC for a compilation of separate PDF documents John Hendy
@ 2013-05-23 21:48 ` Marcin Borkowski
2013-05-24 9:09 ` AW
2013-05-23 22:20 ` Suvayu Ali
2013-05-24 0:08 ` Rasmus
2 siblings, 1 reply; 6+ messages in thread
From: Marcin Borkowski @ 2013-05-23 21:48 UTC (permalink / raw)
To: emacs-orgmode
Dnia 2013-05-23, o godz. 15:21:56
John Hendy <jw.hendy@gmail.com> 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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Using org to create a TOC for a compilation of separate PDF documents
2013-05-23 20:21 Using org to create a TOC for a compilation of separate PDF documents John Hendy
2013-05-23 21:48 ` Marcin Borkowski
@ 2013-05-23 22:20 ` Suvayu Ali
2013-05-23 22:31 ` John Hendy
2013-05-24 0:08 ` Rasmus
2 siblings, 1 reply; 6+ messages in thread
From: Suvayu Ali @ 2013-05-23 22:20 UTC (permalink / raw)
To: emacs-orgmode
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.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Using org to create a TOC for a compilation of separate PDF documents
2013-05-23 22:20 ` Suvayu Ali
@ 2013-05-23 22:31 ` John Hendy
0 siblings, 0 replies; 6+ messages in thread
From: John Hendy @ 2013-05-23 22:31 UTC (permalink / raw)
To: Suvayu Ali; +Cc: emacs-orgmode
On Thu, May 23, 2013 at 5:20 PM, Suvayu Ali <fatkasuvayu+linux@gmail.com> 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.
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Using org to create a TOC for a compilation of separate PDF documents
2013-05-23 20:21 Using org to create a TOC for a compilation of separate PDF documents John Hendy
2013-05-23 21:48 ` Marcin Borkowski
2013-05-23 22:20 ` Suvayu Ali
@ 2013-05-24 0:08 ` Rasmus
2 siblings, 0 replies; 6+ messages in thread
From: Rasmus @ 2013-05-24 0:08 UTC (permalink / raw)
To: jw.hendy; +Cc: emacs-orgmode
John Hendy <jw.hendy@gmail.com> 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!
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Using org to create a TOC for a compilation of separate PDF documents
2013-05-23 21:48 ` Marcin Borkowski
@ 2013-05-24 9:09 ` AW
0 siblings, 0 replies; 6+ messages in thread
From: AW @ 2013-05-24 9:09 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 4396 bytes --]
Am Donnerstag, 23. Mai 2013, 23:48:03 schrieb Marcin Borkowski:
> Dnia 2013-05-23, o godz. 15:21:56
>
> John Hendy <jw.hendy@gmail.com> 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" <<EOF
\documentclass{article}%
\usepackage{pdfpages}%
\usepackage{grffile}%
\listfiles%
\begin{document}%
%\tableofcontents%
EOF
# Helperfunction
exist_pdf_files () {
[ $(find -L "$1" -name \*.pdf -o -name \*.PDF -type f 2>/dev/null|wc -l) -eq
0 ] && return 1
return 0
}
list_directories () {
find -L "$1" -maxdepth 1 -mindepth 1 -type d 2>/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,
[-- Attachment #2: book-from-PDF.sh --]
[-- Type: application/x-shellscript, Size: 2521 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-05-24 9:04 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-23 20:21 Using org to create a TOC for a compilation of separate PDF documents John Hendy
2013-05-23 21:48 ` Marcin Borkowski
2013-05-24 9:09 ` AW
2013-05-23 22:20 ` Suvayu Ali
2013-05-23 22:31 ` John Hendy
2013-05-24 0:08 ` Rasmus
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).