2

I am using the fancyvrb package to add an RFC to my appendix. RFCs are preformatted with a defined site layout. I am using the Verbatim environment with the samepage=true option, to avoid breaking up the fixed pages and splitting them over multiple pages.

However, this option does insert an empty page before the appendix chapter. Here is a minimal working example, please ignore the malformed formatting:

\documentclass{book}
\usepackage{fancyvrb}
\begin{document}
\chapter{Lorem polorem}
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua.\par
\chapter{Ipsum popipsum}
\begin{Verbatim}[samepage=true]
Lorem Ipsum Translation                                       H. Rackham
Internet-Draft                                     Lorem Ipsum Institute
Intended status: Official                               October 18, 1914
Expires: December 31, 9999


                         Lorem Ipsum Translation
                     draft-ietf-lorem-ipsum-spec-1914

Translation

   But I must explain to you how all this mistaken idea of denouncing
   pleasure and praising pain was born and I will give you a complete
   account of the system, and expound the actual teachings of the great
   explorer of the truth, the master-builder of human happiness.  No one
   rejects, dislikes, or avoids pleasure itself, because it is pleasure,
   but because those who do not know how to pursue pleasure rationally
   encounter consequences that are extremely painful.  Nor again is there

   anyone who loves or pursues or desires to obtain pain of itself,
   because it is pain, but because occasionally circumstances occur in
   which toil and pain can procure him some great pleasure.  To take a
   trivial example, which of us ever undertakes laborious physical
   exercise, except to obtain some advantage from it? But who has any
   right to find fault with a man who chooses to enjoy a pleasure that has

   right to find fault with a man who chooses to enjoy a pleasure that has
   no annoying consequences, or one who avoids a pain that produces no
   resultant pleasure?

Status of This Memo

   This Internet-Draft is submitted in full conformance with the
   provisions of BCP 1878 and BCP 1879.

   Internet-Drafts are working documents of the Internet Engineering
   Task Force (IETF).  Note that other groups may also distribute
   working documents as Internet-Drafts.  The list of current Internet-
   Drafts is at http://datatracker.ietf.org/drafts/current/.

   Internet-Drafts are draft documents valid for a maximum of six months
   and may be updated, replaced, or obsoleted by other documents at any
   time.  It is inappropriate to use Internet-Drafts as reference
   material or to cite them other than as "work in progress."

   This Internet-Draft will expire on December 31, 9999.





Rackham                  Expires December 31, 9999              [Page 1]
\end{Verbatim}
\end{document}

Telling verbatim to use a scriptsize font makes that page to fit on one page. But I am in no way able to remove the empty page which gets inserted before the appendix.

Setting the Verbatim environment to samepage=false removes the empty page but splits the RFC page and moves the last lines to a new page, which I do not want.

Any idea how to work around that issue?

1
  • Just have a look into the log file: Overfull \vbox (249.0pt too high) ... On the first page of the appendix (or of chapter 2 in your MWE) there is not enough space for the heading and the complete page of the RFC. If you wrap the verbatim stuff into {\tiny ...} it will fit (but will be probably too small).
    – gernot
    Commented Jan 13, 2017 at 11:41

1 Answer 1

2

The log file shows that you are 250pt too large, so you just have to make some choices to make it fit.

I made some arbitrary ones here, just checking at each stage how overful the page was.

  • Reduced the verbatim font size to \small

  • Copied the definition of \@makechapteread from book.cls and gratuitously attacked it to take up less space.

  • added \enlargethispage to get rid of the final warning about overfull box.

With all that it just scrapes in above the page number

enter image description here

\documentclass{book}
\usepackage{fancyvrb}
\begin{document}
\chapter{Lorem polorem}
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua.\par

\makeatletter
\def\@makechapterhead#1{%
%  \vspace*{50\p@}%
   \vspace*{-60pt}
  {\parindent \z@ \raggedright \normalfont
    \huge\bfseries \@chapapp\space \thechapter
    \quad #1\par\nobreak
%    \vskip 40\p@
    \vskip 10\p@
  }}

\chapter{Ipsum popipsum}
\enlargethispage{80pt}
\begin{Verbatim}[samepage=true,fontsize=\small]
Lorem Ipsum Translation                                       H. Rackham
Internet-Draft                                     Lorem Ipsum Institute
Intended status: Official                               October 18, 1914
Expires: December 31, 9999


                         Lorem Ipsum Translation
                     draft-ietf-lorem-ipsum-spec-1914

Translation

   But I must explain to you how all this mistaken idea of denouncing
   pleasure and praising pain was born and I will give you a complete
   account of the system, and expound the actual teachings of the great
   explorer of the truth, the master-builder of human happiness.  No one
   rejects, dislikes, or avoids pleasure itself, because it is pleasure,
   but because those who do not know how to pursue pleasure rationally
   encounter consequences that are extremely painful.  Nor again is there

   anyone who loves or pursues or desires to obtain pain of itself,
   because it is pain, but because occasionally circumstances occur in
   which toil and pain can procure him some great pleasure.  To take a
   trivial example, which of us ever undertakes laborious physical
   exercise, except to obtain some advantage from it? But who has any
   right to find fault with a man who chooses to enjoy a pleasure that has

   right to find fault with a man who chooses to enjoy a pleasure that has
   no annoying consequences, or one who avoids a pain that produces no
   resultant pleasure?

Status of This Memo

   This Internet-Draft is submitted in full conformance with the
   provisions of BCP 1878 and BCP 1879.

   Internet-Drafts are working documents of the Internet Engineering
   Task Force (IETF).  Note that other groups may also distribute
   working documents as Internet-Drafts.  The list of current Internet-
   Drafts is at http://datatracker.ietf.org/drafts/current/.

   Internet-Drafts are draft documents valid for a maximum of six months
   and may be updated, replaced, or obsoleted by other documents at any
   time.  It is inappropriate to use Internet-Drafts as reference
   material or to cite them other than as "work in progress."

   This Internet-Draft will expire on December 31, 9999.





Rackham                  Expires December 31, 9999              [Page 1]
\end{Verbatim}
\end{document}

But it just occurred to me that you might be asking why it is on page 3 not page 2, chapter openings are on the right hand (odd) pages by default, add [openany] option to \documentclass if you do not need that.

2
  • Thanks for your answer, yes I was asking about why it opens on page 3, and no, it's not because of openright: if you add enough text to chapter 1 to span two pages, the chapter 2 will open left on page 4. Does \@makechapteread change the chapter headings document-wide?
    – q9f
    Commented Jan 13, 2017 at 19:13
  • @5chdn book is openright by default so no chapter will open on an even page unless you change that setting. \@makechapterhead is the formatting used for all non-starred chapters that was why I suggested changing it just before teh appendix, not at teh start, but it doesn't control the odd/even page choice Commented Jan 13, 2017 at 21:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .