diff --git a/lib/examples/knitr.lyx b/lib/examples/knitr.lyx index 9e4fbf0524..2034851c2b 100644 --- a/lib/examples/knitr.lyx +++ b/lib/examples/knitr.lyx @@ -1,5 +1,5 @@ #LyX 2.3 created this file. For more info see http://www.lyx.org/ -\lyxformat 541 +\lyxformat 544 \begin_document \begin_header \save_transient_properties true @@ -55,6 +55,7 @@ knitr \suppress_date false \justification true \use_refstyle 1 +\use_minted 0 \index Index \shortcut idx \color #008000 @@ -68,16 +69,17 @@ knitr \paragraph_separation indent \paragraph_indentation default \is_math_indent 0 +\math_numbering_side default \quotes_style english +\dynamic_quotes 0 \papercolumns 1 \papersides 1 \paperpagestyle default -\tracking_changes true +\tracking_changes false \output_changes false \html_math_output 0 \html_css_as_file 0 \html_be_strict false -\author 2047637253 "Guillaume Munch" \end_header \begin_body @@ -208,13 +210,9 @@ knitr \series default ; many of the examples have links to the \SpecialChar LyX source documents. -\change_inserted 2047637253 1483899260 - \end_layout \begin_layout Standard - -\change_inserted 2047637253 1483899275 Since \SpecialChar LyX 2.3, it is necessary to enable the use of \emph on @@ -231,8 +229,6 @@ Converters knitr \series default . -\change_unchanged - \end_layout \begin_layout Standard @@ -246,24 +242,16 @@ knitr \end_layout \begin_layout Standard - -\change_inserted 2047637253 1483899195 \begin_inset Flex Chunk status open \begin_layout Plain Layout -\change_inserted 2047637253 1483899204 - \begin_inset Argument 1 status open \begin_layout Plain Layout - -\change_inserted 2047637253 1483899200 show-off -\change_unchanged - \end_layout \end_inset @@ -273,47 +261,6 @@ show-off \begin_layout Plain Layout -\change_inserted 2047637253 1483899204 - -rnorm(5) -\end_layout - -\begin_layout Plain Layout - -\change_inserted 2047637253 1483899204 - -df=data.frame(y=rnorm(100), x=1:100) -\end_layout - -\begin_layout Plain Layout - -\change_inserted 2047637253 1483899204 - -summary(lm(y~x, data=df)) -\change_unchanged - -\end_layout - -\end_inset - - -\change_unchanged - -\end_layout - -\begin_layout Standard - -\change_deleted 2047637253 1483899208 -\begin_inset ERT -status open - -\begin_layout Plain Layout - -<>= -\end_layout - -\begin_layout Plain Layout - rnorm(5) \end_layout @@ -327,16 +274,9 @@ df=data.frame(y=rnorm(100), x=1:100) summary(lm(y~x, data=df)) \end_layout -\begin_layout Plain Layout - -@ -\end_layout - \end_inset -\change_unchanged - \end_layout \begin_layout Standard diff --git a/lib/examples/sweave.lyx b/lib/examples/sweave.lyx index 78ab805ab3..342630e164 100644 --- a/lib/examples/sweave.lyx +++ b/lib/examples/sweave.lyx @@ -1,5 +1,5 @@ #LyX 2.3 created this file. For more info see http://www.lyx.org/ -\lyxformat 541 +\lyxformat 544 \begin_document \begin_header \save_transient_properties true @@ -67,6 +67,7 @@ sweave \suppress_date false \justification true \use_refstyle 0 +\use_minted 0 \index Index \shortcut idx \color #008000 @@ -80,36 +81,31 @@ sweave \paragraph_separation indent \paragraph_indentation default \is_math_indent 0 +\math_numbering_side default \quotes_style english +\dynamic_quotes 0 \papercolumns 1 \papersides 1 \paperpagestyle default -\tracking_changes true +\tracking_changes false \output_changes false \html_math_output 0 \html_css_as_file 0 \html_be_strict false -\author 2047637253 "Guillaume Munch" \end_header \begin_body \begin_layout Standard - -\change_inserted 2047637253 1483897614 \begin_inset Note Note status open \begin_layout Plain Layout - -\change_inserted 2047637253 1483897614 \begin_inset Flex Sweave Options status open \begin_layout Plain Layout -\change_inserted 2047637253 1483897614 - prefix=TRUE,prefix.string=sweave-prefix,keep.source=FALSE \end_layout @@ -121,8 +117,6 @@ prefix=TRUE,prefix.string=sweave-prefix,keep.source=FALSE \end_inset -\change_unchanged - \end_layout \begin_layout Standard @@ -259,13 +253,9 @@ https://github.com/downloads/yihui/lyx/sweave.pdf \end_inset . -\change_inserted 2047637253 1483898587 - \end_layout \begin_layout Standard - -\change_inserted 2047637253 1483899123 Since \SpecialChar LyX 2.3, it is necessary to enable the use of \emph on @@ -278,8 +268,6 @@ File Handling\SpecialChar menuseparator Converters \family default in order to compile with Sweave. -\change_unchanged - \end_layout \begin_layout Section @@ -347,21 +335,15 @@ bin \end_layout \begin_layout Standard - -\change_inserted 2047637253 1483897627 \begin_inset Flex Chunk status open \begin_layout Plain Layout -\change_inserted 2047637253 1483897627 - \begin_inset Argument 1 status open \begin_layout Plain Layout - -\change_inserted 2047637253 1483897627 where-is-R-bin,eval=FALSE \end_layout @@ -372,16 +354,12 @@ where-is-R-bin,eval=FALSE \begin_layout Plain Layout -\change_inserted 2047637253 1483897627 - R.home('bin') \end_layout \end_inset -\change_unchanged - \end_layout \begin_layout Standard @@ -416,21 +394,15 @@ Sweave.sty \end_layout \begin_layout Standard - -\change_inserted 2047637253 1483897639 \begin_inset Flex Chunk status open \begin_layout Plain Layout -\change_inserted 2047637253 1483897639 - \begin_inset Argument 1 status open \begin_layout Plain Layout - -\change_inserted 2047637253 1483897639 sweave-sty,eval=FALSE \end_layout @@ -441,16 +413,12 @@ sweave-sty,eval=FALSE \begin_layout Plain Layout -\change_inserted 2047637253 1483897639 - file.path(R.home('share'), 'texmf', 'tex', 'latex') \end_layout \end_inset -\change_unchanged - \end_layout \begin_layout Standard @@ -524,37 +492,20 @@ echo=FALSE \begin_layout Standard To write R code in \SpecialChar LyX -, you can first -\change_inserted 2047637253 1483898412 -insert -\change_deleted 2047637253 1483898419 -switch to the -\change_unchanged - +, you can first insert \family typewriter Chunk \family default - -\change_inserted 2047637253 1483898437 -insets from + insets from \family sans Insert\SpecialChar menuseparator Custom Insets\SpecialChar menuseparator Chunk -\change_deleted 2047637253 1483898459 - \family default -environment in the layout styles list (droplist in the top-left corner in - the toolbar) -\change_unchanged , or you can simply open a \SpecialChar TeX code environment and write Sweave code chunks in it. - -\change_deleted 2047637253 1483898024 -The latter approach is recommended since it is more stable. -\change_inserted 2047637253 1483961753 -However, \SpecialChar LyX + However, \SpecialChar LyX provides a summary of all the \family typewriter Chunk @@ -570,8 +521,6 @@ View\SpecialChar menuseparator Outline Pane \family default menus. -\change_unchanged - \end_layout \begin_layout Standard @@ -591,21 +540,15 @@ useFancyQuotes \end_layout \begin_layout Standard - -\change_inserted 2047637253 1483897653 \begin_inset Flex Chunk status open \begin_layout Plain Layout -\change_inserted 2047637253 1483897653 - \begin_inset Argument 1 status open \begin_layout Plain Layout - -\change_inserted 2047637253 1483897653 setup, keep.source=TRUE \end_layout @@ -616,15 +559,11 @@ setup, keep.source=TRUE \begin_layout Plain Layout -\change_inserted 2047637253 1483897653 - ## the option 'digits' can set the (approximate) number of digits \end_layout \begin_layout Plain Layout -\change_inserted 2047637253 1483897653 - options(width = 70, useFancyQuotes = FALSE, digits = 4) \end_layout @@ -634,21 +573,15 @@ options(width = 70, useFancyQuotes = FALSE, digits = 4) \end_layout \begin_layout Standard - -\change_inserted 2047637253 1483897653 \begin_inset Flex Chunk status open \begin_layout Plain Layout -\change_inserted 2047637253 1483897653 - \begin_inset Argument 1 status open \begin_layout Plain Layout - -\change_inserted 2047637253 1483897653 sweave-manual, eval=FALSE, keep.source=TRUE \end_layout @@ -659,23 +592,17 @@ sweave-manual, eval=FALSE, keep.source=TRUE \begin_layout Plain Layout -\change_inserted 2047637253 1483897653 - ## view the Sweave vignette (requires R >= 2.13.0) \end_layout \begin_layout Plain Layout -\change_inserted 2047637253 1483897653 - vignette("Sweave", package = "utils") \end_layout \end_inset -\change_unchanged - \end_layout \begin_layout Standard @@ -683,21 +610,15 @@ A simple example that will run in any S engine: \end_layout \begin_layout Standard - -\change_inserted 2047637253 1483897659 \begin_inset Flex Chunk status open \begin_layout Plain Layout -\change_inserted 2047637253 1483897659 - \begin_inset Argument 1 status open \begin_layout Plain Layout - -\change_inserted 2047637253 1483897659 print-integers, keep.source=TRUE \end_layout @@ -708,15 +629,11 @@ print-integers, keep.source=TRUE \begin_layout Plain Layout -\change_inserted 2047637253 1483897659 - ## the integers from 1 to 10 are \end_layout \begin_layout Plain Layout -\change_inserted 2047637253 1483897659 - 1:10 \end_layout @@ -726,21 +643,15 @@ print-integers, keep.source=TRUE \end_layout \begin_layout Standard - -\change_inserted 2047637253 1483897659 \begin_inset Flex Chunk status open \begin_layout Plain Layout -\change_inserted 2047637253 1483897659 - \begin_inset Argument 1 status open \begin_layout Plain Layout - -\change_inserted 2047637253 1483897659 hide-results, results=hide \end_layout @@ -751,23 +662,17 @@ hide-results, results=hide \begin_layout Plain Layout -\change_inserted 2047637253 1483897659 - ## intentionally hide the output by setting results=hide \end_layout \begin_layout Plain Layout -\change_inserted 2047637253 1483897659 - print(1:20) \end_layout \end_inset -\change_unchanged - \end_layout \begin_layout Standard @@ -775,21 +680,15 @@ We can also emulate a simple calculator: \end_layout \begin_layout Standard - -\change_inserted 2047637253 1483897665 \begin_inset Flex Chunk status open \begin_layout Plain Layout -\change_inserted 2047637253 1483897665 - \begin_inset Argument 1 status open \begin_layout Plain Layout - -\change_inserted 2047637253 1483897665 calculator \end_layout @@ -800,23 +699,17 @@ calculator \begin_layout Plain Layout -\change_inserted 2047637253 1483897665 - 1 + pi \end_layout \begin_layout Plain Layout -\change_inserted 2047637253 1483897665 - sin(pi/6) \end_layout \end_inset -\change_unchanged - \end_layout \begin_layout Standard @@ -824,21 +717,15 @@ Now we look at some Gaussian data: \end_layout \begin_layout Standard - -\change_inserted 2047637253 1483897670 \begin_inset Flex Chunk status open \begin_layout Plain Layout -\change_inserted 2047637253 1483897670 - \begin_inset Argument 1 status open \begin_layout Plain Layout - -\change_inserted 2047637253 1483897670 rnorm \end_layout @@ -849,37 +736,27 @@ rnorm \begin_layout Plain Layout -\change_inserted 2047637253 1483897670 - set.seed(123) # for reproducibility \end_layout \begin_layout Plain Layout -\change_inserted 2047637253 1483897670 - x <- rnorm(20) \end_layout \begin_layout Plain Layout -\change_inserted 2047637253 1483897670 - print(x) \end_layout \begin_layout Plain Layout -\change_inserted 2047637253 1483897670 - t1 <- t.test(x) \end_layout \end_inset -\change_unchanged - \end_layout \begin_layout Standard @@ -975,21 +852,15 @@ iris \end_layout \begin_layout Standard - -\change_inserted 2047637253 1483897677 \begin_inset Flex Chunk status open \begin_layout Plain Layout -\change_inserted 2047637253 1483897677 - \begin_inset Argument 1 status open \begin_layout Plain Layout - -\change_inserted 2047637253 1483897677 iris-summary \end_layout @@ -1000,16 +871,12 @@ iris-summary \begin_layout Plain Layout -\change_inserted 2047637253 1483897677 - summary(iris[,-5]) \end_layout \end_inset -\change_unchanged - \end_layout \begin_layout Standard @@ -1039,24 +906,16 @@ name "tab:xtable-demo" \end_inset -\change_inserted 2047637253 1483897685 - \begin_inset Flex Chunk status open \begin_layout Plain Layout -\change_inserted 2047637253 1483897698 - \begin_inset Argument 1 status open \begin_layout Plain Layout - -\change_inserted 2047637253 1483897692 xtable-demo,results=tex,echo=FALSE -\change_unchanged - \end_layout \end_inset @@ -1066,33 +925,23 @@ xtable-demo,results=tex,echo=FALSE \begin_layout Plain Layout -\change_inserted 2047637253 1483897699 - if (require('xtable')) { \end_layout \begin_layout Plain Layout -\change_inserted 2047637253 1483897699 - print(xtable(sapply(iris[,-5], quantile)), floating=FALSE) \end_layout \begin_layout Plain Layout -\change_inserted 2047637253 1483897699 - } else cat('the xtable package is not available! please install.packages("xtable" )') -\change_unchanged - \end_layout \end_inset -\change_unchanged - \end_layout \end_inset @@ -1179,24 +1028,16 @@ Both eps and pdf are set to true so that both latex and pdflatex work. \begin_layout Plain Layout \align center - -\change_inserted 2047637253 1483897765 \begin_inset Flex Chunk status open \begin_layout Plain Layout -\change_inserted 2047637253 1483897772 - \begin_inset Argument 1 status open \begin_layout Plain Layout - -\change_inserted 2047637253 1483897770 iris-pairs,fig=TRUE,width=4.5,height=4.5,eps=TRUE,pdf=TRUE -\change_unchanged - \end_layout \end_inset @@ -1206,18 +1047,12 @@ iris-pairs,fig=TRUE,width=4.5,height=4.5,eps=TRUE,pdf=TRUE \begin_layout Plain Layout -\change_inserted 2047637253 1483897776 - pairs(iris, col = iris$Species) -\change_unchanged - \end_layout \end_inset -\change_unchanged - \end_layout \begin_layout Plain Layout @@ -1256,21 +1091,15 @@ status open \begin_layout Plain Layout \align center - -\change_inserted 2047637253 1483897883 \begin_inset Flex Chunk status open \begin_layout Plain Layout -\change_inserted 2047637253 1483897883 - \begin_inset Argument 1 status open \begin_layout Plain Layout - -\change_inserted 2047637253 1483897883 iris-boxplots,fig=TRUE,width=7,height=2,keep.source=F,eps=T,pdf=T \end_layout @@ -1281,23 +1110,17 @@ iris-boxplots,fig=TRUE,width=7,height=2,keep.source=F,eps=T,pdf=T \begin_layout Plain Layout -\change_inserted 2047637253 1483897883 - par(mar=c(4,5,.1,.3), las=1) \end_layout \begin_layout Plain Layout -\change_inserted 2047637253 1483897883 - boxplot(Sepal.Length~Species,data=iris,horizontal=TRUE,xlab='Sepal.Length') \end_layout \end_inset -\change_unchanged - \end_layout \begin_layout Plain Layout @@ -1337,8 +1160,6 @@ R/S code R CMD Stangle \family default . -\change_inserted 2047637253 1483898877 - \end_layout \begin_layout Section @@ -1699,17 +1520,9 @@ label= \end_layout \begin_layout Standard -Another -\change_deleted 2047637253 1483899012 -known -\change_unchanged - issue -\change_inserted 2047637253 1483898966 -with the \SpecialChar TeX - code environment -\change_unchanged -is the Sweave code chunk may fail when we change the alignment of the chunk - paragraph in \SpecialChar LyX +Another issue with the \SpecialChar TeX + code environment is the Sweave code chunk may fail + when we change the alignment of the chunk paragraph in \SpecialChar LyX (using \family sans Paragraph settings @@ -1761,36 +1574,10 @@ This is not a legitimate Sweave code chunk, since <<>>= \family default must start in a new line with nothing before it. - -\change_inserted 2047637253 1483899083 This does not happen when using the Chunk inset instead of the \SpecialChar TeX code environmen t. - -\change_unchanged -\change_deleted 2047637253 1483898988 -Therefore we recommend you to double check the real source code via -\family sans -View\SpecialChar menuseparator -View Source -\family default - when changing the alignment of a chunk paragraph, and make sure -\family typewriter -<<>>= -\family default - appears in a new line. - This explains why we manually added an empty line in the code chunk in - Table -\begin_inset CommandInset ref -LatexCommand ref -reference "tab:xtable-demo" - -\end_inset - -. -\change_unchanged - \end_layout \begin_layout Section