Dear useRs,
How does one include graphics created with Xfig with LaTeX fonts into
Sweave?
If I create a graphic with Xfig with some Computer Modern fonts, I
choose to export it as combined PDF and LaTeX. So I get two files, one
foo.pdf with the drawings without the text and foo.pdftex with some
LaTeX code that ensures the text lands in the right place together with
the drawing. I'm supposed to \input{} this file in my LaTeX document.
Trouble is that Sweave defines (with \setkeys) the default width of
\includegraphics to be 0.8 times the \textwidth. The result is that the
graphic is scaled, but not the text.
I was looking for a way to temporarily undefine the default width of
included graphics, but without success. Does anyone know how to undo a
definition that has been set with \setkeys?
Or does anyone has another workaround for including xfig graphics with
LaTeX text in Sweave?
Looking forward to your help,
--
--------------------------------------------------
David Lindel?f
Station 18
LESO-PB/EPFL
1015 Lausanne
tel +41-21-693.5556
mob +41-79-415.6641
fax +41-21-693.2722
e-mail david.lindelof at epfl.ch
url http://lesowww.epfl.ch/doctorants/lindelof/
weblog http://visnet.ch/~lindelof/smartbuildings/
--------------------------------------------------
In the force if Yoda's so strong, construct a sentence with words in
the proper order then why can't he?
Sweave, Xfig, pdflatex and \setkeys
4 messages · David Lindelöf, Kevin E. Thorpe, Friedrich Leisch
David Lindel?f wrote:
Dear useRs,
How does one include graphics created with Xfig with LaTeX fonts into
Sweave?
If I create a graphic with Xfig with some Computer Modern fonts, I
choose to export it as combined PDF and LaTeX. So I get two files, one
foo.pdf with the drawings without the text and foo.pdftex with some
LaTeX code that ensures the text lands in the right place together with
the drawing. I'm supposed to \input{} this file in my LaTeX document.
Trouble is that Sweave defines (with \setkeys) the default width of
\includegraphics to be 0.8 times the \textwidth. The result is that the
graphic is scaled, but not the text.
I was looking for a way to temporarily undefine the default width of
included graphics, but without success. Does anyone know how to undo a
definition that has been set with \setkeys?
Or does anyone has another workaround for including xfig graphics with
LaTeX text in Sweave?
Looking forward to your help,
If you knew what setting you needed, you could try
\setkeys{Gin}{width=whatever}
before your include, and set it back to the default afterward with
\setkeys{Gin}{width=0.8\textwidth}
I have run into this myself, but since I was also using beamer, it
wasn't at all obvious what I should try for the setting, so I don't
know if this will work. I have used this to rescale the imported
graphics from R. Fortunately, the graphic I created in xfig could
be completely specified in LaTeX, and so I exported it in that format
and imported it with \scalebox{0.5}{\input{xfigfile.latex}}
Kevin E. Thorpe Biostatistician/Trialist, Knowledge Translation Program Assistant Professor, Department of Public Health Sciences Faculty of Medicine, University of Toronto email: kevin.thorpe at utoronto.ca Tel: 416.864.5776 Fax: 416.864.6057
On Tue, 2006-12-12 at 13:22 -0500, Kevin E. Thorpe wrote:
Trouble is that Sweave defines (with \setkeys) the default width of \includegraphics to be 0.8 times the \textwidth. The result is that the graphic is scaled, but not the text. I was looking for a way to temporarily undefine the default width of included graphics, but without success. Does anyone know how to undo a definition that has been set with \setkeys?
If you knew what setting you needed, you could try
\setkeys{Gin}{width=whatever}
before your include, and set it back to the default afterward with
\setkeys{Gin}{width=0.8\textwidth}
Yes, but the trouble is that for arbitrary figures created with Xfig I cannot know what the correct width is going to be. And I could not find any help on how to undefine variables set with \setkeys.
I have run into this myself, but since I was also using beamer, it
wasn't at all obvious what I should try for the setting, so I don't
know if this will work. I have used this to rescale the imported
graphics from R. Fortunately, the graphic I created in xfig could
be completely specified in LaTeX, and so I exported it in that format
and imported it with \scalebox{0.5}{\input{xfigfile.latex}}
But then you are severly limited, aren't you? For instance, you cannot draw lines with slopes other that multiples of 45 degrees? Cheers, -- -------------------------------------------------- David Lindel?f Station 18 LESO-PB/EPFL 1015 Lausanne tel +41-21-693.5556 mob +41-79-415.6641 fax +41-21-693.2722 e-mail david.lindelof at epfl.ch url http://lesowww.epfl.ch/doctorants/lindelof/ weblog http://visnet.ch/~lindelof/smartbuildings/ -------------------------------------------------- COBOL: An exercise in Artificial Inelegance.
On Wed, 13 Dec 2006 12:38:04 +0100, David Lindel?f (DL) wrote:
> On Tue, 2006-12-12 at 13:22 -0500, Kevin E. Thorpe wrote:
>> > Trouble is that Sweave defines (with \setkeys) the default width of
>> > \includegraphics to be 0.8 times the \textwidth. The result is that the
>> > graphic is scaled, but not the text.
>> >
>> > I was looking for a way to temporarily undefine the default width of
>> > included graphics, but without success. Does anyone know how to undo a
>> > definition that has been set with \setkeys?
>> If you knew what setting you needed, you could try
>>
>> \setkeys{Gin}{width=whatever}
>>
>> before your include, and set it back to the default afterward with
>>
>> \setkeys{Gin}{width=0.8\textwidth}
> Yes, but the trouble is that for arbitrary figures created with Xfig I
> cannot know what the correct width is going to be. And I could not find
> any help on how to undefine variables set with \setkeys.
Yes, I should document Sweave.sty much better ...
\usepackage[nogin]{Sweave}
in your .Rnw file will do the trick, i.e., not set any Gin keys.
HTH,
Fritz
----------------------------------------------------------------------- Prof. Dr. Friedrich Leisch Institut f?r Statistik Tel: (+49 89) 2180 3165 Ludwig-Maximilians-Universit?t Fax: (+49 89) 2180 5308 Ludwigstra?e 33 D-80539 M?nchen http://www.stat.uni-muenchen.de/~leisch