"fontsize" option in rmarkdown ==> PDF?

7,615 views
Skip to first unread message

Michael Hannon

unread,
Jul 23, 2014, 5:23:18 PM7/23/14
to kn...@googlegroups.com
Greetings.  I am not able to the the `fontsize` option to do anything when
using `rmarkdown::render()` to produce a PDF document.

I've tried a lot of permutations, but here's a simple example from the
"LaTeX Options" section of:


The two appended code segments call for "11pt" and "16pt" font size,
respectively.  So far as I can tell, the resulting PDF document is exactly the
same in both cases.

The things of interest to me are slightly more complicated.  See the end of
the message for an example of that.  And note that I've tried making the font
size 24pt, so as to eliminate any "eyeball" errors.  I.e., if `fontsize` were
doing what I want, I *would* recognize it.

Session and package information are also included below.

Any thoughts?  Thanks.

-- Mike


---
title: "Crop Analysis Q3 2013"
output: pdf_document
fontsize: 11pt
geometry: margin=1in
---

Four score and seven years ago our fathers brought forth on this continent a
new nation, conceived in liberty, and dedicated to the proposition that all
men are created equal.

########

---
title: "Crop Analysis Q3 2013"
output: pdf_document
fontsize: 16pt
geometry: margin=1in
---

Four score and seven years ago our fathers brought forth on this continent a
new nation, conceived in liberty, and dedicated to the proposition that all
men are created equal.

#########

> sessionInfo()
R version 3.1.0 (2014-04-10)
Platform: x86_64-redhat-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_US.utf8       LC_NUMERIC=C              LC_TIME=en_US.utf8       
 [4] LC_COLLATE=en_US.utf8     LC_MONETARY=en_US.utf8
LC_MESSAGES=en_US.utf8   
 [7] LC_PAPER=en_US.utf8       LC_NAME=C                 LC_ADDRESS=C             
[10] LC_TELEPHONE=C            LC_MEASUREMENT=en_US.utf8 LC_IDENTIFICATION=C      

attached base packages:
[1] stats     graphics  grDevices datasets  utils     methods   base     

other attached packages:
[1] rmarkdown_0.2.50

loaded via a namespace (and not attached):
[1] digest_0.6.4    evaluate_0.5.5  formatR_0.10    htmltools_0.2.4 knitr_1.6      
[6] stringr_0.6.2   tools_3.1.0     yaml_2.1.13    

#########

> library(help=rmarkdown)

                Information on package ‘rmarkdown’

Description:

Package:              rmarkdown
Type:                 Package
Title:                Dynamic Documents for R
Version:              0.2.50
Date:                 2014-05-31
Author:               RStudio Inc.
.
.
.

########## YAML of actual interest (title slightly edited) 

---
title: foo
author:
date:
fontsize: 24pt
output:
  html_document:
    theme: cosmo
    fig_caption: true
  pdf_document:
    highlight: tango
    pandoc_args: [
      "--variable=geometry:margin=0.75in"
    ]

---

Carl Boettiger

unread,
Jul 23, 2014, 5:44:44 PM7/23/14
to Michael Hannon, knitr
The standard latex classes (article, book, and report) accepts only 3
different font sizes: 10pt, 11pt, and 12pt.

(I suppose the the rmarkdown documentation could make that more
obvious https://github.com/rstudio/rmarkdown/blob/master/R/pdf_document.R#L53)

You'll need to use a custom latex class if you want size 24pt font.
(You may also look into telling rmarkdown to use xelatex, but you'll
still need to adjust the class).

Cheers,

Carl
> --
> You received this message because you are subscribed to the Google Groups
> "knitr" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to knitr+un...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--
Carl Boettiger
UC Santa Cruz
http://carlboettiger.info/

Michael Hannon

unread,
Jul 23, 2014, 7:35:14 PM7/23/14
to Carl Boettiger, knitr
Thanks, Carl. I used 24pt just to make sure I could get something
that was visually distinct from the default, but I did want something
larger than 12pt.

-- Mike
Reply all
Reply to author
Forward
0 new messages