ENDEDemo vereinbaren
← Zurück zu allen Aufgaben

Anwendungsübergreifende Abläufe

I enjoy reading during my spare time, but this book is too bulky. Each time I open it, I have to find where I left off, which is a hassle. I'd like to divide the book into several PDFs, each containing a different chapter, and name them following the example I set with chapter one.

Aufgabe und Verlauf liegen im englischen Original vor.

Ergebnis
Teilweise gelöst
Punkte
1,00 / 1
Schritte
9
Dauer
9 min 11 s

Bewertungskriterien

  • Checks that the archive contains the same files with the same content as the expected archive.
Aufgabendefinition im OSWorld-Repository ansehen

Abschließende Antwort

Done! I've split the book into 8 separate chapter PDFs in ~/Desktop/book, following the same naming convention as your chapter 1 file: 1. Symmetric matrices and adjacency of a graph.pdf (15 pages) 2. Graph isomorphism.pdf (11 pages) 3. Graph polynomials.pdf (15 pages) 4. Covers and Interlacing families.pdf (12 pages) 5. Eigenvalues and the structure of graphs.pdf (10 pages) 6. Optimization for cliques and colourings.pdf (13 pages) 7. Theta.pdf (8 pages) 8. The Laplacian matrix.pdf (14 pages) Each PDF contains exactly its chapter's pages, so you can open just the chapter you're reading without flipping through the whole book.

Verlauf

  1. Schritt 10:01

    The user wants the 100-page book split into per-chapter PDFs, named following the example already set for chapter 1 ('1. Symmetric matrices ...'). I must first inspect the existing chapter-1 file to learn the exact filename convention and page-range convention (does it start at the chapter's first page, include title/TOC pages, end exactly before the next chapter?). Then replicate that for chapters 2-8. I'll draft and commit a plan to unlock the shell, then explore.

    • Plan erstellt
      1. Inspect the book PDF and the existing chapter-1 PDF to determine the exact naming convention and the page-range convention used (chapter start/end pages, whether title/TOC pages are included).
      2. Split the book into per-chapter PDFs for chapters 2-8, each containing exactly its chapter's pages, named following the chapter-1 convention, saved in the same Desktop/book folder.
      3. Verify each output PDF's filename and page range against the book's table of contents.
    • Plan bestätigt3 Teilziele
  2. Schritt 21:09

    I need to inspect the exact filenames and the chapter-1 PDF's page range to learn the naming convention. Let me use the shell to list the directory and check page counts.

    • Shell-Befehlcd ~/Desktop/book && ls -la && echo '---CHAPTER1 PAGES---' && pdfinfo '1. Symmetric matrices and adjacency of a graph.pdf' 2>/dev/null | grep -i pages; echo '---BOOK PAGES---' && pdfinfo 'Spectral Graph Theory.pdf' 2>/dev/null | grep -i pages
  3. Schritt 31:33

    I need the exact full chapter titles to name the output files correctly. The evince sidebar truncates them. I'll extract the TOC page text using pdftotext to get the full chapter names.

    • Shell-Befehlcd ~/Desktop/book && pdftotext -f 2 -l 2 'Spectral Graph Theory.pdf' - 2>/dev/null
  4. Schritt 42:14

    I need the full titles of chapters 2 and 3, which are on PDF page 1 (the TOC first part). Let me extract PDF page 1 text. Then I can build the split commands. Convention confirmed: ch1=3-17 (15pg). So ch2=18-28, ch3=29-43, ch4=44-55, ch5=56-65, ch6=66-78, ch7=79-86, ch8=87-100.

    • Shell-Befehlcd ~/Desktop/book && pdftotext -f 1 -l 1 'Spectral Graph Theory.pdf' - 2>/dev/null
  5. Schritt 53:18

    I can now compute each chapter's PDF page range (printed page == PDF page): Ch2=18-28, Ch3=29-43, Ch4=44-55, Ch5=56-65, Ch6=66-78, Ch7=79-86, Ch8=87-100. Naming follows 'N. <Chapter Title>.pdf'. I'll first check which splitting tool is available (pdftk or qpdf), then split.

    • Shell-Befehlwhich pdftk qpdf pdfseparate 2>/dev/null; echo '---'; pdftk --version 2>/dev/null | head -1; qpdf --version 2>/dev/null | head -1
  6. Schritt 64:41

    The printed page number equals the PDF page index (offset 0): ch1 spans printed 3-17 = 15 pages, matching the existing 15-page file, and ch2 starts at 18. So boundaries are: ch2 18-28, ch3 29-43, ch4 44-55, ch5 56-65, ch6 66-78, ch7 79-86, ch8 87-100. Naming: '<N>. <title>.pdf' (title = TOC title minus leading number). I'll verify the offset with a couple of boundary pages and check for ghostscript/pdfunite before splitting.

    • Shell-Befehlwhich gs pdfunite 2>/dev/null; echo '---P3---'; cd ~/Desktop/book && pdftotext -f 3 -l 3 'Spectral Graph Theory.pdf' - 2>/dev/null | head -5; echo '---P18---'; pdftotext -f 18 -l 18 'Spectral Graph Theory.pdf' - 2>/dev/null | head -5; echo '---P29---'; pdftotext -f 29 -l 29 'Spectral Graph Theory.pdf' - 2>/dev/null | head -5
  7. Schritt 75:36

    I have everything needed. Chapter page ranges (each chapter runs from its start page to one before the next chapter's start): Ch2=18-28, Ch3=29-43, Ch4=44-55, Ch5=56-65, Ch6=66-78, Ch7=79-86, Ch8=87-100. Chapter 1 (3-17, 15 pages) matches the existing 15-page file, confirming the convention. Naming follows '<N>. <title>.pdf'. I'll extract chapters 2-8 with gs into the book folder.

    • Shell-Befehlcd ~/Desktop/book && B='Spectral Graph Theory.pdf' && gs -sDEVICE=pdfwrite -dNOPAUSE -dBATCH -dSAFER -dFirstPage=18 -dLastPage=28 -sOutputFile='2. Graph isomorphism.pdf' "$B" >/dev/null 2>&1 && gs -sDEVICE=pdfwrite -dNOPAUSE -dBATCH -dSAFER -dFirstPage=29 -dLastPage=43 -sOutputFile='3. Graph polynomials.pdf' "$B" >/dev/null 2>&1 && gs -sDEVICE=pdfwrite -dNOPAUSE -dBATCH -dSAFER -dFirstPage=44 -dLastPage=55 -sOutputFile='4. Covers and Interlacing families.pdf' "$B" >/dev/null 2>&1 && gs -sDEVICE=pdfwrite -dNOPAUSE -dBATCH -dSAFER -dFirstPage=56 -dLastPage=65 -sOutputFile='5. Eigenvalues and th…
  8. Schritt 86:14

    Files exist. Now I must verify each PDF's page count matches its intended chapter range. Chapter 1's existing PDF has 15 pages = book pages 3-17 (ch1 starts p3, ch2 starts p18), confirming the convention: each chapter PDF holds exactly its chapter's pages, no title/TOC pages. My ranges: ch2=18-28(11), ch3=29-43(15), ch4=44-55(12), ch5=56-65(10), ch6=66-78(13), ch7=79-86(8), ch8=87-100(14). Let me verify the actual page counts.

    • Shell-Befehlcd ~/Desktop/book && for f in '1. Symmetric matrices and adjacency of a graph.pdf' '2. Graph isomorphism.pdf' '3. Graph polynomials.pdf' '4. Covers and Interlacing families.pdf' '5. Eigenvalues and the structure of graphs.pdf' '6. Optimization for cliques and colourings.pdf' '7. Theta.pdf' '8. The Laplacian matrix.pdf'; do echo "$(pdfinfo "$f" 2>/dev/null | awk '/Pages/{print $2}') $f"; done
  9. Schritt 96:45

    All subgoals are complete. Chapter 1 was already done by the user. Chapters 2-8 have been split correctly using the same naming convention (numbered prefix + full chapter title from the TOC). Page ranges are verified: ch2=18-28(11pp), ch3=29-43(15pp), ch4=44-55(12pp), ch5=56-65(10pp), ch6=66-78(13pp), ch7=79-86(8pp), ch8=87-100(14pp). The task is done.

    • Teilziel erreichtConfirmed naming convention: '<N>. <Full Chapter Title>.pdf'. Chapter 1 = pages 3-17 (15pp). Book has 100 pages, PDF page = TOC page number (offset 0).
    • Teilziel erreichtCreated 7 chapter PDFs (2-8) using Ghostscript with correct page ranges and names matching the chapter-1 convention.
    • Teilziel erreichtAll 8 chapter PDFs verified: correct filenames and page counts (15,11,15,12,10,13,8,14).
    • Als abgeschlossen gemeldet