Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.21 KB | None | 0 0
  1. lstdefinestyle{Routstyle}{%
  2. fancyvrb=false,
  3. literate={~}{{$sim$}}1{R^2}{{$R^{2}$}}2{^}{{$^{scriptstylewedge}$}}1{R-squared}{{$R^{2}$}}2,%
  4. frame=single,
  5. framerule=0.2pt,
  6. framesep=1pt,
  7. basicstyle=RoutcolorRoutsizettfamily,%
  8. backgroundcolor=Routbackground}
  9.  
  10. lstdefinestyle{Routstyle}{%
  11. language=R,%
  12. basicstyle={RoutcolorSweavesizettfamily},
  13. backgroundcolor=Routbackground,%
  14. }
  15.  
  16. documentclass{tufte-book}
  17.  
  18. usepackage{Sweavel}
  19.  
  20. usepackage{amsthm}
  21. usepackage{mathtools}
  22. usepackage{soul}
  23.  
  24. %%%%%%%%%%
  25. % R example
  26. %%%%%%%%%%
  27. newtheoremstyle{rex}{}{}{}{.45textwidth}{}{}{1 mm}{}
  28. theoremstyle{rex}
  29. newtheorem{rexample}{R example}[chapter]
  30.  
  31. %%%%%%%%%%
  32. % boxes
  33. %%%%%%%%%%
  34. usepackage[framemethod=TikZ]{mdframed}
  35. mdfdefinestyle{style2}{
  36. backgroundcolor=gray!10,
  37. }
  38. usepackage[strict]{changepage}
  39. %%%%%%%%%%
  40.  
  41. %%%%%%%%%%
  42. % crossref
  43. %%%%%%%%%%
  44. usepackage[capitalize,noabbrev]{cleveref}
  45. crefname{rexample}{Example}{Examples}%
  46. %%%%%%%%%%
  47.  
  48. %%%%%%%%%%
  49. % layout
  50. %%%%%%%%%%
  51. newcommand{blankpage}{newpagehbox{}thispagestyle{empty}newpage}
  52. %%%%%%%%%%
  53.  
  54.  
  55. %%%%%%%%%%
  56. % listings
  57. %%%%%%%%%%
  58. newcommand{indexfunction}[1]{index{#1@texttt{#1}}}
  59. usepackage{listings}
  60. lstset{language = R,
  61. frame = single,
  62. }
  63. defRcolor{color{black}}
  64. defRoutcolor{color{black}}
  65. defRcommentcolor{color{red}}
  66. defRbackground{color[rgb]{0.992, 0.965, 0.894}}
  67. defRoutbackground{color[rgb]{0.894, 0.965, 0.992}}
  68. definecolor{lightYellow}{rgb}{0.992, 0.965, 0.894}
  69. sethlcolor{lightYellow}
  70. %%%%%%%%%%
  71.  
  72. lstdefinestyle{Routstyle}{% <==========================================
  73. language=R,%
  74. basicstyle={RoutcolorSweavesizettfamily},
  75. backgroundcolor=Routbackground,%
  76. } % <===================================================================
  77. %%%%%%%%%%
  78. % book metadata
  79. %%%%%%%%%%
  80. title[]{}
  81. author[]{}
  82. publisher{}
  83. %%%%%%%%%%
  84.  
  85.  
  86. begin{document}
  87.  
  88. begin{Schunk}
  89. begin{rexample}
  90. label{set1}hfill{}
  91. begin{Sinput}
  92. setS <- letters[1:5] %>% print()
  93. end{Sinput}
  94. begin{Soutput}
  95. [1] "a" "b" "c" "d" "e"
  96. end{Soutput}
  97. end{rexample}
  98. end{Schunk}
  99.  
  100. begin{Schunk}
  101. begin{rexample}
  102. label{set2}hfill{}
  103. begin{Sinput}
  104. "e" %in% setS
  105. end{Sinput}
  106. begin{Soutput}
  107. [1] TRUE
  108. end{Soutput}
  109. begin{Sinput}
  110. "f" %in% setS
  111. end{Sinput}
  112. begin{Soutput}
  113. [1] FALSE
  114. end{Soutput}
  115. end{rexample}
  116. end{Schunk}
  117.  
  118. end{document}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement