Closed yihui closed 13 years ago
I agree that there is not currently an elegant solution to this currently. And this has been an annoyance for me as well. I will consider it for an option if I can get it to work. Currently this does not work for me.
Does centering like this even work for you? I cannot use any centering or \hfill{}
to get graphic to be centered when they are surrounded by externalization commands. The only thing that works for me is to use \hspace
which is a pain. It does work without externalization.
I remember this worked for me (even with externalization). I will double check later.
Sorry, it does not work for me either with externalization, but I have found another solution.
For external = FALSE
, just insert the figure in the center
environment like:
\begin{center} \input{figure/Rfig-test1.tikz} \end{center}
For external = TRUE
, an additional minipage
environment can help kill the beast:
\begin{center} \begin{minipage}{\linewidth} \beginpgfgraphicnamed{newfile1-test2} \input{newfile1-test2.tikz} \endpgfgraphicnamed \end{minipage} \end{center}
Ok this is good to know, I will put this on my todo list.
I found things were not so complicated as I thought. The reason I failed on the first example seems to be I should put \begin{center}
outside of \beginpgfgraphicnamed
. I tested with a simple modification on pgfSweaveRuncode
and it worked (at least under my Ubuntu).
Fixed.
I might have asked this before, but recently I feel it is important again with the highlight package. I wish there could be an option to control the alignment of the graphics. This could be implemented as a hidden option as well (like the option
keep.blank.line
), e.g. ifisTRUE(getOption('center.graphics'))
, then wrap the graphics with\begin{center}
and\end{center}
. This gives us the flexibility to align texts and graphics separately, which is impossible (or at least tedious) in the current Sweave setting.Finally the output will look like this: