Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- lstdefinestyle{Routstyle}{%
- fancyvrb=false,
- literate={~}{{$sim$}}1{R^2}{{$R^{2}$}}2{^}{{$^{scriptstylewedge}$}}1{R-squared}{{$R^{2}$}}2,%
- frame=single,
- framerule=0.2pt,
- framesep=1pt,
- basicstyle=RoutcolorRoutsizettfamily,%
- backgroundcolor=Routbackground}
- lstdefinestyle{Routstyle}{%
- language=R,%
- basicstyle={RoutcolorSweavesizettfamily},
- backgroundcolor=Routbackground,%
- }
- documentclass{tufte-book}
- usepackage{Sweavel}
- usepackage{amsthm}
- usepackage{mathtools}
- usepackage{soul}
- %%%%%%%%%%
- % R example
- %%%%%%%%%%
- newtheoremstyle{rex}{}{}{}{.45textwidth}{}{}{1 mm}{}
- theoremstyle{rex}
- newtheorem{rexample}{R example}[chapter]
- %%%%%%%%%%
- % boxes
- %%%%%%%%%%
- usepackage[framemethod=TikZ]{mdframed}
- mdfdefinestyle{style2}{
- backgroundcolor=gray!10,
- }
- usepackage[strict]{changepage}
- %%%%%%%%%%
- %%%%%%%%%%
- % crossref
- %%%%%%%%%%
- usepackage[capitalize,noabbrev]{cleveref}
- crefname{rexample}{Example}{Examples}%
- %%%%%%%%%%
- %%%%%%%%%%
- % layout
- %%%%%%%%%%
- newcommand{blankpage}{newpagehbox{}thispagestyle{empty}newpage}
- %%%%%%%%%%
- %%%%%%%%%%
- % listings
- %%%%%%%%%%
- newcommand{indexfunction}[1]{index{#1@texttt{#1}}}
- usepackage{listings}
- lstset{language = R,
- frame = single,
- }
- defRcolor{color{black}}
- defRoutcolor{color{black}}
- defRcommentcolor{color{red}}
- defRbackground{color[rgb]{0.992, 0.965, 0.894}}
- defRoutbackground{color[rgb]{0.894, 0.965, 0.992}}
- definecolor{lightYellow}{rgb}{0.992, 0.965, 0.894}
- sethlcolor{lightYellow}
- %%%%%%%%%%
- lstdefinestyle{Routstyle}{% <==========================================
- language=R,%
- basicstyle={RoutcolorSweavesizettfamily},
- backgroundcolor=Routbackground,%
- } % <===================================================================
- %%%%%%%%%%
- % book metadata
- %%%%%%%%%%
- title[]{}
- author[]{}
- publisher{}
- %%%%%%%%%%
- begin{document}
- begin{Schunk}
- begin{rexample}
- label{set1}hfill{}
- begin{Sinput}
- setS <- letters[1:5] %>% print()
- end{Sinput}
- begin{Soutput}
- [1] "a" "b" "c" "d" "e"
- end{Soutput}
- end{rexample}
- end{Schunk}
- begin{Schunk}
- begin{rexample}
- label{set2}hfill{}
- begin{Sinput}
- "e" %in% setS
- end{Sinput}
- begin{Soutput}
- [1] TRUE
- end{Soutput}
- begin{Sinput}
- "f" %in% setS
- end{Sinput}
- begin{Soutput}
- [1] FALSE
- end{Soutput}
- end{rexample}
- end{Schunk}
- end{document}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement