Skip to content

[Bioc-devel] BiocStyle and fonts

10 messages · Martin Morgan, Andrzej Oleś, Kasper Daniel Hansen +1 more

#
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?

Thank you very much in advance.

Best wishes,

Laurent
#
On 03/11/2014 10:38 AM, Laurent Gatto wrote:
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

  
    
#
[...]
[...]
Thanks for the clarifications, Martin. Might be worth documenting this
in the vignette. I'm personally not too keen on the helvetica font.

Best wishes,

Laurent
#
Hi Laurent, Martin,

thank you for bringing this up! As pointed out by Martin, currently
the 'helvet' package gets overridden by Sweave, so this setting
affects only the knitr output.

My feeling is that the default font style should be the same
regardless of the engine used. Too keep thing simple, I would suggest
removing from Bioconductor.sty the following line forcing a particular
font:
\RequirePackage{helvet}

It doesn't help in case of Sweave documents anyway, and setting a
different font in knitr (e.g. helvetica) is straightforward and can be
done manually by simply adding \usepackage{helvet} to the vignette
source if desired.

When it comes to font styles, that's of course a matter of taste and I
don't want to start a war here. However, I think the Latex already
provides a decent default sans serif font and there is no particular
need for BiocStyle to override it.

Cheers,
Andrzej
On Wed, Mar 12, 2014 at 1:58 AM, Martin Morgan <mtmorgan at fhcrc.org> wrote:
#
Definitely. The difference in fonts is what prompted my enquiry in the
first place, not the choice of font per se.

Best wishes,

Laurent
#
Should we then just drop \RequirePackage{helvet} from BiocStyle?

Cheers,
Andrzej

On Wed, Mar 12, 2014 at 3:27 PM, Kasper Daniel Hansen
<kasperdanielhansen at gmail.com> wrote:
#
That seems a reasonable solution to me.

Laurent
#
On 03/12/2014 08:18 AM, Laurent Gatto wrote:
yep! Martin

  
    
#
Done!
On Wed, Mar 12, 2014 at 5:01 PM, Martin Morgan <mtmorgan at fhcrc.org> wrote: