pgfSweave
pgfSweave copied to clipboard
Options to customize highlighted output
It would be nice to have the same option to surround the source code with a frame as in the highlight package. Possible niceties would include settings for
- the box colour and fill
- the type of box (U, O, L, ...) and the linetype (single, double)
- an optional title (as in your vignettes)
The LaTeX package listings [*] could be useful for these (and more) options; however I don't know if it can play well with external highlighting.
[*] ftp://ftp.tex.ac.uk/tex-archive/macros/latex/contrib/listings/listings.pdf
Changing the name of this issue to a more general feature.
In general it would also be nice to have options to customize highlighted output. Currently there is no easy way to customize highlighted output (such as different colors and backgrounds).
I'd like also to be able to change font size as R code eats space on the page
So I basically found out you cant really customize the color output, but You can change the font size currently by editing the Hinput
environment.
I don't see any Hinput in output tex file generated. I'm using 1.2.1 version. Did you mean Houtput? So if I define mine, pgfSweave won't insert the following by itself?
\newenvironment{Houtput}{\raggedright}{% % }
My bad, in the cran version it is called Houtput but in the Github version it is called Hinput to be consistant with Sweave's Sinput.
pgfSweave will put it in regardless if you have it or not. It will always put the definition below you documentclass command so you can use renewenvironment
and you should be safe.
BTW, the dev version devines the environment as:
\newenvironment{Hinput}{\begin{trivlist}\item}{\end{trivlist}}
which can help with some spacing problems. You may want to work off of that.
I confirm that the following after documentclass did the trick with cran version
\renewenvironment{Houtput}{\footnotesize\begin{trivlist}\item}{\end{trivlist}}
Is there an easy way to prevent hanging code so I don't have single line on the next page/column to force LaTeX to keep R chunks on a single page if possible?
Hmm, I dont know an obvious easy way, that will probably require some LaTeX trickery, maybe try re-defining the environment as a float?
\renewenvironment{Houtput}{
\begin{samepage}
\footnotesize
\begin{trivlist}
\item}
{\end{trivlist}
\end{samepage}
}
Did the trick for me.
I'm not sure if it makes sense to add pgfSweave parameter to force certain blocks to be on the same page so it spits samepage environment around the block if defined.
Cool! Yeah, I'm not sure if I would make this the default but that would be a great global option. Thanks for the suggestion.
I didn't ask for defaults :-) I like original approach that used Sweave.sty so all the formatting is defined there instead of being pushed into .tex.
I guess it just a matter of taste ;) I prefer it all be in the .tex file, I think Sweave.sty causes more problems than its worth.
Heh. Yet another idea is not to dump definitions if Sweave.sty is included. I'm not sure about implementation details as I see things changed since I used pgfSweave last time. Anyway, enough for offtopic :-)
I see \hlnormalsizeboxclosebrace
, \hltinyboxclosebrace
and alike in generated tex file.
What option do I use to get tiny size instead of normal in highligthed output? Curly braces and some operators look disproportional when I have highlight=TRUE
and change font size by renewing Houtput environment. Is it still work in progress?