[R] Sweave documents have corrupted double quotes

Paul Johnson pauljohn32 at gmail.com
Sun Jan 18 04:34:31 CET 2009


On Sat, Jan 17, 2009 at 4:00 PM, Duncan Murdoch <murdoch at stats.uwo.ca> wrote:
> On 17/01/2009 4:29 PM, Ben Bolker wrote:
>>
>> Duncan Murdoch <murdoch <at> stats.uwo.ca> writes:
>>
>>
>>> R is open source, so this is no mystery:  if you use [noae] then Sweave
>>> won't use the ae package in LaTeX.  The problem you were having with quotes
>>> is that the ae package doesn't define those.  If you choose not to use it,
>>> then you won't get the symbols that it does define.
>>>
>>> Duncan Murdoch
>>>
>>
>>  So if this is a LaTeX bug, should we report it upstream
>> to the maintainer (Lars Engebretsen, http://sites.engebretsen.ch/lars/ ) ?
>
> It is documented in the README for the ae package, so I don't think a new
> report is needed.
>
> Duncan Murdoch
>
>  >  Defending Paul a little bit: from his point of view, Sweave
>>
>> is what broke things, and although the bug isn't in Sweave it
>> would take a certain amount of digging to discover that ...
>>>
>>> From the ae-unaware user's point of view, adding Sweave is
>>
>> necessary and sufficient to produce the unwanted behavior.
>>
>>  cheers
>>  Ben Bolker
>>

Maybe bug is not the right word.  What do you call an undocumented
effect in software that does not produce a pleasant result? :)

The Sweave user manual makes no mention of the ae font. If you don't
believe me, grab this:
http://www.stat.uni-muenchen.de/~leisch/Sweave/Sweave-manual.pdf and
search for "ae".   It does not mention the [noae] option. I never
realized  any ae fonts were used until this problem emerged. The ae
readme  http://www.ctan.org/get/fonts/ae/README doesn't have a warning
about double quotes. "The characters missing are mainly: eth, thorn,
and the sami letter eng. Sometimes the £ character is also missing.
For the typewriter fonts, the situation is worse."  If it had said
"typewriter font is missing quotation marks" it would have gotten my
attention,  but I would have had no reason to be reading the ae font
README because there's nothing about ae in the Sweave manual. Claiming
that I brought this on myself by using the ae font is just wrong.

The claim that the ae font is widely known to be lacking in some
symbols is interesting, however. If so, Sweave should not place
\usepackage{ae} at the end of every preamble by default.

Here is where I think the question lies.  Given ae's weaknesses, what
should Sweave do?   Is there any reason why Sweave should prefer to
insert the ae fonts where I had Latin Modern?  I don't think so, if
these authors are correct:
http://www.dante.de/dante/events/eurotex/papers/TUT09.pdf

If there is a good reason to use ae for the serif and nonserif fonts,
we could protect the typewriter font by having Sweave insert this:

\usepackage{ae,aecompl}
\renewcommand{\ttdefault}{lmtt}
\usepackage[T1]{fontenc}

I think we could even do better by having a conditional check on
availability of lmtt before using the package, and if it is not
available use cm-super or just cm. I'd just like to set Sweave's
default as close to good as possible so more political science
professors don't have to go through this same hassle.

For the time being, I'm protecting users by applying this patch to
Sweave.sty, which makes [noae] the default situation.

$ diff Sweave.sty Sweave.sty-new
8c8
< \setboolean{Sweave at ae}{true}
---
> \setboolean{Sweave at ae}{false}

I'll see what symbols now show up as big black boxes.  Actually, those
don't scare me so much as the ones that fail to appear at all.  Almost
impossible to proof read for that kind of trouble. (Ever accidentally
put ~ in ordinary text in a latex document? It just disappears in the
output.)


pj
-- 
Paul E. Johnson
Professor, Political Science
1541 Lilac Lane, Room 504
University of Kansas




More information about the R-help mailing list