6

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

11
\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}
| improve this answer | |
  • 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

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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