how do i render an actual a6 paper size in R Bookdown?

Viewed 32

Hi I am trying to render a book in R bookdown- and have installed all the prereqs. The standard pdf rendering is a4. I am trying to render it to a6 which is closer to a published book format rather than a handbook of size a4.

Below is my index.rmd

--- 
title: "A Minimal Book Example"
author: "Lyndon Sundmark"
date: "`r Sys.Date()`"
site: bookdown::bookdown_site
documentclass: book
papersize: a6paper
bibliography: [book.bib, packages.bib]
# url: your book url like https://bookdown.org/yihui/bookdown
# cover-image: path to the social sharing image like images/cover.jpg
description: |
  This is a minimal example of using the bookdown package to write a book.
  The HTML output format for this example is bookdown::gitbook,
  set in the _output.yml file.
link-citations: yes
github-repo: rstudio/bookdown-demo
---

AND

Below is my output.yml

bookdown::gitbook:
  css: style.css
  config:
    toc:
      before: |
        <li><a href="./">A Minimal Book Example</a></li>
      after: |
        <li><a href="https://github.com/rstudio/bookdown" target="blank">Published with bookdown</a></li>
    edit: https://github.com/USERNAME/REPO/edit/BRANCH/%s
    download: ["pdf", "epub"]
bookdown::pdf_book:
  includes:
    in_header: header.tex
  number_sections: yes
  toc: yes
  toc_depth: 3
  papersize: a6
  latex_engine: xelatex
  citation_package: natbib
  keep_tex: yes
bookdown::epub_book: default

When I render the pdf it still creates 8.5 by 11 inches.

How do I force it to re-layout content to a6 size?

Thanks for any help in advance...

Most google searches so far continue to point back to papersize as the key- but they dont seem to work

2 Answers

Setting papersize in the YAML of index.Rmd should be fine. I think that a6paper is not a valid option since bookdown glues the value passed to papersize and paper and then sets the result as the document class in the header of the tex document that is compiled to PDF.

So papersize: a6paper yields

\documentclass[
  a6paperpaper,
]{book}

Using papersize: a6 should work.

The simplest way I've found is to include a preamble.tex file with the following:

% DEFINE PHYSICAL DOCUMENT SETTINGS HD
% media settings
\usepackage[paperwidth=4.13in, paperheight=5.83in]{geometry}
\geometry{left=.5in}
\geometry{right=.5in}
\geometry{bottom=.75in}
\geometry{top=.75in}

The geometry measurements are the margins.

Related