[Bioc-devel] BiocStyle and fonts

Martin Morgan mtmorgan at fhcrc.org
Wed Mar 12 01:58:55 CET 2014


On 03/11/2014 10:38 AM, Laurent Gatto wrote:
>
> Dear all,
>
> Compiling the following with Sweave
>
> \documentclass{article}
> <<style, eval=TRUE, echo=FALSE, results=tex>>=
> BiocStyle::latex()
> @
> \bioctitle{Hello world}
> \begin{document}
> \maketitle
> \section{Section}
> Some text
> <<pxdata>>=
> print("Hello world")
> @
> \end{document}
>
> $ R CMD Sweave --engine=utils::Sweave --pdf test.Rnw
>
> and this one with knitr
>
> \documentclass{article}
> <<style, eval=TRUE, echo=FALSE, results='asis'>>=
> BiocStyle::latex()
> @
> \bioctitle{Hello world}
> \begin{document}
> \maketitle
> \section{Section}
> Some text
> <<pxdata>>=
> print("Hello world")
> @
> \end{document}
>
> $R CMD Sweave --engine=knitr::knitr --pdf test.Rnw
>
> produces two pdf documents with different fonts.
>
> As a positive control, using the two engines without BiocStyle result in
> pdf files with identical fonts.
>
> Is this a documented side effect of BiocStyle?

Hi Laurent --

Here's a latex document to play with, via R CMD Sweave --pdf test.Rnw

\documentclass{article}
\usepackage{helvet}
\renewcommand{\familydefault}{\sfdefault}
\usepackage[noae]{Sweave}
\title{Hello world}
\begin{document}
\maketitle
\section{Section}
Some text
\end{document}

Seems like an interaction between the 'helvet' package (used by BiocStyle) and 
the 'ae' package (used by Sweave). Get  knitr-like output with either 
\usepackage[noae]{Sweave} or by placing \usepackage{Sweave} before 
\usepackage{helvet} (i.e., before the BiocStyle() chunk).

I think the ae package forces use of sans serif computer modern fonts, which you 
can 'see' from the output of pdflatex test.tex with ae

...

[1{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] (./sweave.aux) )</usr/sh
are/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmss10.pfb></usr/share/te
xlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmss12.pfb></usr/share/texlive/
texmf-dist/fonts/type1/public/amsfonts/cm/cmss17.pfb></usr/share/texlive/texmf-
dist/fonts/type1/public/amsfonts/cm/cmssbx10.pfb>

versus without

[1{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] (./sweave.aux) ){/usr/sh
are/texlive/texmf-dist/fonts/enc/dvips/base/8r.enc}</usr/share/texlive/texmf-di
st/fonts/type1/urw/helvetic/uhvb8a.pfb></usr/share/texlive/texmf-dist/fonts/typ
e1/urw/helvetic/uhvr8a.pfb>

Not really sure where that takes us; the helvetica fonts look better IMO.

Martin

>
> Thank you very much in advance.
>
> Best wishes,
>
> Laurent
>
> _______________________________________________
> Bioc-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/bioc-devel
>


-- 
Computational Biology / Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N.
PO Box 19024 Seattle, WA 98109

Location: Arnold Building M1 B861
Phone: (206) 667-2793



More information about the Bioc-devel mailing list