Re: [knitr] each line on its own page in output

137 views
Skip to first unread message

Yihui Xie

unread,
Jul 3, 2012, 8:22:16 PM7/3/12
to mhc, kn...@googlegroups.com
That looks really weird. Can you post the Rnw source as well?

Regards,
Yihui
--
Yihui Xie <xiey...@gmail.com>
Phone: 515-294-2465 Web: http://yihui.name
Department of Statistics, Iowa State University
2215 Snedecor Hall, Ames, IA


On Tue, Jul 3, 2012 at 5:29 PM, mhc <re...@channing.harvard.edu> wrote:
> Hi,
>
> Wondering if anyone has seen this behavior in knitr.
> Fairly unremarkable code chunk, but knitr is putting only one line per page.
> eval=FALSE gets rid of the problem... but using tidy and comment don't get
> rid of the problem.
>
> Thanks in advance,
> Michael
>
>> sessionInfo()
> R version 2.15.0 (2012-03-30)
> Platform: x86_64-unknown-linux-gnu (64-bit)
>
> locale:
> [1] LC_CTYPE=en_US.iso885915 LC_NUMERIC=C
> [3] LC_TIME=en_US.iso885915 LC_COLLATE=en_US.iso885915
> [5] LC_MONETARY=en_US.iso885915 LC_MESSAGES=en_US.iso885915
> [7] LC_PAPER=C LC_NAME=C
> [9] LC_ADDRESS=C LC_TELEPHONE=C
> [11] LC_MEASUREMENT=en_US.iso885915 LC_IDENTIFICATION=C
>
> attached base packages:
> [1] stats graphics grDevices utils datasets methods base
>
> other attached packages:
> [1] knitr_0.6.3 xtable_1.7-0 pwr_1.1.1
>
> loaded via a namespace (and not attached):
> [1] codetools_0.2-8 digest_0.5.2 evaluate_0.4.2 formatR_0.5
> [5] highlight_0.3.2 parser_0.0-16 plyr_1.7.1 Rcpp_0.9.10
> [9] stringr_0.6 tools_2.15.0
>>
>
>

Michael Cho

unread,
Jul 4, 2012, 9:16:21 AM7/4/12
to Yihui Xie, kn...@googlegroups.com
Thanks Yihui.

Yes - attached are the .rnw and .tex files (I've tried taking out the <<init>> chunk and the output remains the same).

Thanks,
Michael
--
Michael H. Cho, M.D., M.P.H.
Channing Laboratory and Division of Pulmonary and Critical Care Medicine
Brigham & Women's Hospital
181 Longwood Ave. Rm. 451
Boston, MA 02115
Tel: 617-826-9246
Page: Partners 39922
test.rnw
test.tex

Yihui Xie

unread,
Jul 4, 2012, 2:57:32 PM7/4/12
to Michael Cho, kn...@googlegroups.com
It turns out to be a problem of the kframe environment again
(http://yihui.name/knitr/demo/framed/). The framed package does not
work well with the lineno package. If you comment out %\linenumbers,
everything works fine.

The other solution is to use the listings package by putting a chunk
like this in your document:

<<setup, include=FALSE>>=
render_listings()
@

In most cases the listings package is more robust. The framed package
is quite fragile.

Regards,
Yihui
--
Yihui Xie <xiey...@gmail.com>
Phone: 515-294-2465 Web: http://yihui.name
Department of Statistics, Iowa State University
2215 Snedecor Hall, Ames, IA


Reply all
Reply to author
Forward
0 new messages