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 downloaded the Sweavel.sty-File from here: http://biostat.mc.vanderbilt.edu/wiki/pub/Main/SweaveTemplate/Sweavel.sty

Now, for a modern look, I would like to produce rounded corners in the R code listings, like so: Background overflows when using rounded corners for listings (package: `listings`)

How can I change the Sweavel.sty or Sweave.sty files to obtain the desired output?

I hope my question is clear. If not, please tell so.

Any direct help or linkage to other websites/posts is greatly appreciated. Thanks for your time.

share|improve this question
1  
You might consider the mdframed package. It's relatively recent, so you'd want the latest version. You can use the \surroundwithmdframed command to wrap pre-existing environments with frames. –  G. Poore Aug 10 '12 at 16:06
    
Thanks for your answer, @G.Poore. Would I have to wrap the \surroundwithmdframed in the .tex-file or in the Sweavel.sty? I first tried it in the .tex-file and had no luck. I checked the docu to the mdframed package but it was not clear to me how to use the \surroundwithmdframed environment. Can you please help me out further. Thanks –  Strohmi Aug 10 '12 at 16:44
    
I think you would want to use the command in your .tex file, leaving the .sty as-is. So you would want \surroundwithmdframed{Sinput}, \surroundwithmdframed{Scode}, etc. for all of the environments created in the .sty with \lstnewenvironment. Also, you would probably want to customize the mdframed frame by using optional arguments, for example, \surroundwithmdframed[linewidth=2pt]{Sinput}. And you would probably want to turn off background colors, etc. from listings (redo the styles created in the .sty with \lstdefinestyle). –  G. Poore Aug 10 '12 at 16:54
    
Thanks again, @G.Poore. It is working now. I put the code into the Sweavel.sty-file. Anyone who is interested in the code, can send me a message. I will then send the code. –  Strohmi Aug 10 '12 at 17:08
1  
@G.Poore Can you make a simple answer for this to be removed from the unanswered list? –  percusse Aug 10 '12 at 23:00
show 4 more comments

1 Answer

up vote 1 down vote accepted

Here's an answer based off of my comments.

The mdframed package can do what you want. It's relatively recent, so you should make sure you are using the latest version. You can use the \surroundwithmdframed command to wrap pre-existing environments with frames. So you would want \surroundwithmdframed{Sinput}, \surroundwithmdframed{Scode}, etc. for all of the environments that are created in Sweavel.sty via \lstnewenvironment. Also, you would probably want to customize the mdframed frame by using optional arguments, for example, \surroundwithmdframed[linewidth=2pt]{Sinput}. Depending on your needs, it might be simplest to define an mdframed style, so you can easily use the same style for multiple environments. And you would probably want to turn off background colors, etc. from listings (modify the listings styles created in Sweavel.sty with \lstdefinestyle).

I would recommend using the \surroundwithmdframed commands within your .tex file, rather than modifying Sweavel.sty. That will make your document more portable, since anyone can use it and get the same results; it won't depend on a custom version of Sweavel.sty. If you need these custom settings a lot, you could simply throw together your own .sty file. If it's primarily for personal use, you can just do something very quick and simple like this. For more on creating styles, see this.

share|improve this answer
add comment

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.