Hi! On Linux I try to produce pdf graphs with computer modern fonts so that they look nice in LaTeX documents. I run for example: ------ CM <- Type1Font( "CM", c("/usr/share/texmf-texlive/fonts/afm/public/cm-lgc/fcmr8a.afm", "/usr/share/texmf-texlive/fonts/afm/public/cm-lgc/fcmb8a.afm", "/usr/share/texmf-texlive/fonts/afm/public/cm-lgc/fcmri8a.afm", "/usr/share/texmf-texlive/fonts/afm/public/cm-lgc/fcmbi8a.afm", "./cmsyase.afm" ) ) pdfFonts(CM=CM) pdf( "test.pdf", width = 5, height = 4, family = "CM" ) plot(c(-1,0,1)) dev.off() ----- which works fine except that R has problems with the minus sign for the labels and axis and I get the following warnings: --- ... font width unknown for character 0x2d ... --- The minus signs are directly printed on the numbers, not in front of them. Does anybody know what I am doing wrong? Thanks already now, Markus. -- View this message in context: http://old.nabble.com/CM-Fonts-in-PDF-output-tp26389940p26389940.html Sent from the R help mailing list archive at Nabble.com.
Hi, Not answering your question, but the tikzDevice package is another option if you want to match LaTeX fonts seamlessly. HTH, baptiste 2009/11/17 Markus Jochmann <markus.jochmann at strath.ac.uk>:> > Hi! > > On Linux I try to produce pdf graphs with computer modern fonts so that they > look nice in LaTeX documents. I run for example: > > ------ > CM <- Type1Font( "CM", > c("/usr/share/texmf-texlive/fonts/afm/public/cm-lgc/fcmr8a.afm", > "/usr/share/texmf-texlive/fonts/afm/public/cm-lgc/fcmb8a.afm", > "/usr/share/texmf-texlive/fonts/afm/public/cm-lgc/fcmri8a.afm", > "/usr/share/texmf-texlive/fonts/afm/public/cm-lgc/fcmbi8a.afm", > "./cmsyase.afm" ) ) > pdfFonts(CM=CM) > pdf( "test.pdf", width = 5, height = 4, family = "CM" ?) > plot(c(-1,0,1)) > dev.off() > ----- > > which works fine except that R has problems with the minus sign for the > labels and axis and I get the following warnings: > > --- > ... font width unknown for character 0x2d ... > --- > The minus signs are directly printed on the numbers, not in front of them. > > Does anybody know what I am doing wrong? > > Thanks already now, > Markus. > > > > -- > View this message in context: http://old.nabble.com/CM-Fonts-in-PDF-output-tp26389940p26389940.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >
Since 0x2d = 45, it looks like those fonts are missing 'minus'. See ?postscript for more details on encodings (and 'minus' vs 'hyphen'). 'Linux' is too imprecise here. but I looked at my TeXLive 2009 installation (in a different place) and fcmr8a.afm did not contain 'minus'. On Tue, 17 Nov 2009, Markus Jochmann wrote:> > Hi! > > On Linux I try to produce pdf graphs with computer modern fonts so that they > look nice in LaTeX documents. I run for example: > > ------ > CM <- Type1Font( "CM", > c("/usr/share/texmf-texlive/fonts/afm/public/cm-lgc/fcmr8a.afm", > "/usr/share/texmf-texlive/fonts/afm/public/cm-lgc/fcmb8a.afm", > "/usr/share/texmf-texlive/fonts/afm/public/cm-lgc/fcmri8a.afm", > "/usr/share/texmf-texlive/fonts/afm/public/cm-lgc/fcmbi8a.afm", > "./cmsyase.afm" ) ) > pdfFonts(CM=CM) > pdf( "test.pdf", width = 5, height = 4, family = "CM" ) > plot(c(-1,0,1)) > dev.off() > ----- > > which works fine except that R has problems with the minus sign for the > labels and axis and I get the following warnings: > > --- > ... font width unknown for character 0x2d ... > --- > The minus signs are directly printed on the numbers, not in front of them.I suspect that you are not actually looking at the right font (given that it seems not to have a minus sign): how did you view the PDF?> Does anybody know what I am doing wrong? > > Thanks already now, > Markus.-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
Thanks Baptiste for your hint, I will try this at some point. I solved the issue thanks to Brian Ripley. I followed the instructions by Paul Murrell (http://www.stat.auckland.ac.nz/~paul/R/CM/CMR.html) but not exactly enough. Instead of downloading the font files from http://www.ctan.org/tex-archive/help/Catalogue/entries/cm-lgc.html I looked for them on my harddrive which led me to those that come with texlive from Ubuntu. These do not contain the minus sign, but the ones on CTAN do. Markus. baptiste auguie-5 wrote:> > Hi, > > Not answering your question, but the tikzDevice package is another > option if you want to match LaTeX fonts seamlessly. > > HTH, > > baptiste > > 2009/11/17 Markus Jochmann <markus.jochmann at strath.ac.uk>: >> >> Hi! >> >> On Linux I try to produce pdf graphs with computer modern fonts so that >> they >> look nice in LaTeX documents. I run for example: >> >> ------ >> CM <- Type1Font( "CM", >> c("/usr/share/texmf-texlive/fonts/afm/public/cm-lgc/fcmr8a.afm", >> "/usr/share/texmf-texlive/fonts/afm/public/cm-lgc/fcmb8a.afm", >> "/usr/share/texmf-texlive/fonts/afm/public/cm-lgc/fcmri8a.afm", >> "/usr/share/texmf-texlive/fonts/afm/public/cm-lgc/fcmbi8a.afm", >> "./cmsyase.afm" ) ) >> pdfFonts(CM=CM) >> pdf( "test.pdf", width = 5, height = 4, family = "CM" ?) >> plot(c(-1,0,1)) >> dev.off() >> ----- >> >> which works fine except that R has problems with the minus sign for the >> labels and axis and I get the following warnings: >> >> --- >> ... font width unknown for character 0x2d ... >> --- >> The minus signs are directly printed on the numbers, not in front of >> them. >> >> Does anybody know what I am doing wrong? >> >> Thanks already now, >> Markus. >> >> >> >> -- >> View this message in context: >> http://old.nabble.com/CM-Fonts-in-PDF-output-tp26389940p26389940.html >> Sent from the R help mailing list archive at Nabble.com. >> >> ______________________________________________ >> R-help at r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide >> http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. >> > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > >-- View this message in context: http://old.nabble.com/CM-Fonts-in-PDF-output-tp26389940p26397268.html Sent from the R help mailing list archive at Nabble.com.