Say, I want the first line to have no indentation, but then subsequent lines to have a set amount of indentation. And I don't want to have to type "\" at the end of each line to break it. I'd also like to shorten the \begin{...} code.
So I want something like:
\BE
this is
my custom
enviro code
\EE
to output to pdf this:
this is my custom enviro code I know how to create custom environments and commands, at least at a novice level by following other examples.
Basically, I am looking for a way to reproduce multiline R code exactly as it looks in the Console in RStudio with minimal typing on my part. So any suggestions as to how to do that are appreciated.
I also realize that R Markdown is probably the best option, but I'm trying to keep with traditional latex at the moment. Feel free to try and convince me otherwise as well. I also cannot get the "knit to pdf" working in RStudio, but that is a separate issue.
Here is a minimal working example:
\documentclass{article} \usepackage{color} \newcommand{\bR}{\ttfamily\color{blue}$>$ } \newcommand{\eR}{\color{black}\rmfamily} \begin{document} Here is how I'd like to be able to type the latex code: \bR xbar=mean(x) summary(x) hist(x) \eR But here is what will give me the formatting that I want: \bR xbar=mean(x)\\ \hspace*{0.32in} summary(x) \\ \hspace*{0.32in} hist(x) \\ \eR \end{document} One solution would be to have a separate command for subsequent lines (probably easiest fix). Another option would be to create a custom list environment. I could probably make those happen. I'm just hoping to figure out the best and most efficient way to achieve what I want.
===
EDIT: Using the answer below, I was able to make a slight edit that I am happy with.
\newenvironment{realR}{\obeylines\parindent5mm\noindent\ttfamily\color{blue}}{} \newcommand{\rcp}{\noindent $>$ } \begin{realR} \rcp x = c() mean(x) summary(x) \end{realR} 

