1

I notice when I use the hyperref package, it creates two extra pages in the beginning of my pdf. I did find the info to remove the first page, but the second one is still there with just a '2' in the footer. I need to remove that page as well. Here's the code for the main book file. The packages, halfletter and moonfonts, are ones I wrote to help me with the required page size and typography. This book is unusual fiction and the typography is not conventional.

So what am I missing to clear those extra pages?

Here's the code for the main document:

\documentclass[12pt,openany]{book}
\usepackage{halfletter}
\usepackage{moonfonts}
\usepackage{hyperref}
\usepackage{atbegshi,multido,graphicx}
\AtBeginDocument{\AtBeginShipoutNext{\AtBeginShipoutDiscard}}
\usepackage[linktoc=all,pagebackref=true]{hyperref}
\hypersetup{
    colorlinks=false,
    linktoc=all}

\title{Nazi, Monkey, Séance}
\author{Tom Baker}
\pagestyle{plain}
\begin{document}
\frontmatter
\thispagestyle{empty}
\include{title}
\pagenumbering{roman}
\include{legal}
\clearpage
\tableofcontents
\mainmatter
\pagenumbering{arabic}
\include{authorsnote}
\include{system}
\include{myhometown}
\include{dog}
\include{library}
\include{federalreserve}
\include{patrolcar}
\include{soitwasnt}
\include{tigers}
\include{thesetigers}
\include{parsecsinoblivion}
\include{prey}
\include{inalltheirstrange}
\include{somewherehefancied}
\include{toughworld}
\include{heiswithhismother}
\include{reddeath}
\include{thatstone}
\include{youdigthis}
\include{shesfucking}
\include{skymaiden}
\include{bubwasplugging}
\include{ratman}
\include{dogeats}
\include{theywalkedback}
\include{sherriffsmutz}
\include{goatheadalbino}
\include{itwas}
\include{shewas}
\include{filmbegins}
\include{communistprop}
\include{graveyardmadonna}
\include{iwascertainly}
\include{irummaged}
\include{houseofsevensisters}
\include{itwassomesort}
\include{prisonlaundry}
\include{thisisdevil}
\include{nazimonkey}
\include{iamatchurch}
\include{imhungry}
\include{hehijacked}
\include{eclipse}
\include{onenight}
\include{andihave}
\include{ouryoungcouple}
\include{festival}
\include{runningdown}
\include{shereached}
\include{itwasnight}
\include{therewerepeople}
\include{happens}
\include{imsneaking}
\include{inmidst}
\include{somethingmightly}
\include{didherface}
\include{hotelroom}
\include{ourlittle}
\include{sherriffwas}
\include{theylookedlike}
\include{drivedown}
\include{ilookup}
\include{threedaysearlier}
\include{otherstuff}
\include{theyexplain}
\include{movie}
\include{somother}
\include{goingdown}
\include{shewent}
\include{butwhichdoors}
\include{sohereiam}
\include{severallargedogs}
\include{itwassummer}
\include{hesaw}
\include{stevemccloud}
\include{butthatcouldnt}
\include{timefordinner}
\include{whisperingonwind}
\include{shadow}
\include{hefelt}
\include{aftermuch}
\include{manseemed}
\include{screambrought}
\include{hereachedup}
\include{itisyoungwoman}
\include{sitting}
\include{guninhishand}
\include{lukegotout}
\include{theycorresponded}
\include{heknewclemwas}
\include{itisdark}
\include{helookedup}
\include{itsthatdamn}
\include{hesatatedge}
\include{hegrabbed}
\include{hereyeswork}
\include{shestoopslow}
\include{nullwashustled}
\include{nullisntsure}
\include{towakeup}
\include{backathouse}
\include{thiscousin}
\include{cloudsdarken}
\include{murdervictim}
\include{yeahisuppose}
\include{whitewalls}
\include{iknewhim}
\include{ihadnopart}
\include{thisgirl}
\include{heturned}
\include{firsttime}
\include{yesterdaytheyinvaded}
\include{okaysothisis}
\include{amidtallgrasses}
\include{reallybadidea}
\include{nextiwas}
\include{earliertheyhadbeen}
\include{largeempty}
\include{itslikedisneyland}
\include{exactlyhowmuch}
\include{twoyounggirls}
\include{poolwassituation}
\include{outofpool}
\include{hetookher}
\include{facecries}
\include{theyhadcollected}
\include{whenigotback}
\include{sceneshifts}
\include{butnow}
\include{turninghemoves}
\include{placeissmall}
\include{houseitself}
\include{hegotup}
\include{herolledover}
\include{theylie}
\include{theyhadbeenwaiting}
\include{okaysowegot}
\include{itwaslater}
\include{oneofthem}
\include{whentheyfound}
\include{heremembered}
\include{shewassomesort}
\include{nullwent}
\include{heavoided}
\include{theyweresitting}
\include{decapitationritual}
\include{hebrooded}
\include{later}
\include{wekeep}
\include{latertheymade}
\include{hesrollingaround}
\include{sotheystart}
\include{somewhere}

\end{document}
3
  • 1
    Why do you include hyperref twice and set the toc options twice?
    – cfr
    Jan 16, 2014 at 0:11
  • A minimal working example would help.
    – A.G.
    Jan 16, 2014 at 0:21
  • I didn't catch including both hyperref and toc options twice. I have simplified now. Jan 16, 2014 at 16:17

2 Answers 2

1

Since I don't have the files you're using to create your document, the following 10-page minimal document should have to suffice:

\documentclass{article}
\usepackage{lipsum}% http://ctan.org/pkg/lipsum
\begin{document}
\lipsum[1-50]
\end{document}

Here are two ways of removing the first two pages that are shipped out:

  1. pagesel:

    \usepackage[3-]{pagesel}% http://ctan.org/pkg/pagesel
    
  2. atbegshi and afterpage:

    \usepackage{atbegshi,afterpage}% http://ctan.org/pkg/{atbegshi,afterpage}
    \AtBeginDocument{%
      \AtBeginShipoutNext{\AtBeginShipoutDiscard}% Remove page 1
      \afterpage{\AtBeginShipoutNext{\AtBeginShipoutDiscard}}% Remove page 2
      }
    
0
1

I am working with a template that has automatic filler cards and a cover page that I have to remove. Using the upper solutions, I had a blank page inserted when using the pagesel solution, and it only removed the first page. Using the atbegshi and afterpage approach, I could only get rid of the first page (no blank page inserted with this method). What has worked for me:

\usepackage{atbegshi}
\AtBeginDocument{\AtBeginShipoutNext{\AtBeginShipoutDiscard}}
\AtBeginShipoutNext{\AtBeginShipoutNext{\AtBeginShipoutDiscard}}

Another take on the problem from here: Compiling only a page range or page selection

\documentclass{article}
\usepackage{lipsum,atbegshi,etoolbox}% http://ctan.org/pkg/{lipsum,atbegshi,etoolbox}
\makeatletter
\newcommand{\discardpages}[1]{% \discardpages{<csv list>}
  \xdef\discard@pages{#1}% Store pages to discard
  \AtBeginShipout{% At shipout, decide whether to discard page/not
    \renewcommand*{\do}[1]{% How to handle each page entry in csv list
      \ifnum\value{page}=##1\relax%
        \AtBeginShipoutDiscard% Discard page/not
        \gdef\do####1{}% Do nothing further
      \fi%
    }%
    \expandafter\docsvlist\expandafter{\discard@pages}% Process list of pages to discard
  }%
}
\newif\ifkeeppage
\newcommand{\keeppages}[1]{% \keeppages{<csv list>}
  \xdef\keep@pages{#1}% Store pages to keep
  \AtBeginShipout{% At shipout, decide whether to discard page/not
    \keeppagefalse%
    \renewcommand*{\do}[1]{% How to handle each page entry in csv list
      \ifnum\value{page}=##1\relax%
        \keeppagetrue% Page should be kept
        \gdef\do####1{}% Do nothing further
      \fi%
    }%
    \expandafter\docsvlist\expandafter{\keep@pages}% Process list of pages to keep
    \ifkeeppage\else\AtBeginShipoutDiscard\fi% Discard page/not
  }%
}
\makeatother
\discardpages{1,3,5,7,9,29,35,40}% Discard these pages.
%\keeppages{2,4,6}% Keep these pages.
\begin{document}
\lipsum[1-50]\lipsum[1-50]\lipsum[1-50]\lipsum[1-50]\lipsum[1-50]
\end{document} 
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.