Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am using Sweave to produce my tex. In addition I use lstlisting to highlight the source code as below.

\begin{lstlisting}[caption={Computation $\widehat Y_4$ and its Residue},label=list:5computationYpredict,captionpos=b]
\begin{Schunk}
\begin{Sinput}
> options(width = 80, continue = " ", size = "scriptsize")
> formula(mdl)
\end{Sinput}
\end{Schunk}
\end{lstlisting}

Is this possible to skip the \begin{Schunk}, \begin{Sinput}, \end{Sinput}, and \end{Schunk} from the output of the lstlisting? I need output as follows:

> options(width = 80, continue = " ", size = "scriptsize")
> formula(mdl)

after compile the tex.

Thanks

Satria

share|improve this question

1 Answer 1

up vote 10 down vote accepted
\documentclass{minimal}
\usepackage{listings}
\begin{document}

\begin{lstlisting}[linerange=\\begin\{Sinput\}-\\end\{Sinput\},includerangemarker=false]
\begin{Schunk}
\begin{Sinput}
> options(width = 80, continue = " ", size = "scriptsize")
> formula(mdl)
\end{Sinput}
\end{Schunk}
\end{lstlisting}

\end{document}
share|improve this answer
    
Thanks, It works. –  user3243 Jan 31 '11 at 7:08
3  
Sorry to keep nagging, Herbert, but again I think that one or two sentences of explanation would be great. –  Hendrik Vogt Jan 31 '11 at 13:26

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.