2
votes

I'm using knitr to weave .Rnw files in RStudio on Mac OSX 10.8.1. When I compile the PDF (either with the button in RStudio, or Cmd-Shift-i), the default RStudio PDF viewer appears, and the view is set to "Auto". Is there a way that I can set this view to open to "Page Fit", e.g.? Below are the contents of a small working .Rnw file.

Thanks, RTM

\documentclass[12pt]{article}

\title{Sweave Min}

\author{RTM}

\begin{document}

<<setup, include=FALSE, cache=FALSE>>=
  opts_chunk$set(fig.path='figs/', fig.align='center', fig.show='hold', echo=FALSE, include=FALSE)
options(replace.assign=TRUE, width=90)
@

\maketitle

<<min, include=TRUE>>= 
  x <- 1+1
print(x)
@

$x = \Sexpr{x}$

\end{document}
1

1 Answers

4
votes

Depending on if you want the page to fit horizontally or vertically, you can use the LaTeX package hyperref, e.g.

\usepackage{hyperref}
\hypersetup{pdfstartview=FitH}

It also depends on whether RStudio's PDF viewer recognizes this setting.

Or you can configure your own PDF viewer to set the default view to "Page Fit" instead of using RStudio's viewer.