[R] Sweave documents have corrupted double quotes

Duncan Murdoch murdoch at stats.uwo.ca
Sun Jan 18 12:53:28 CET 2009


On 17/01/2009 10:34 PM, Paul Johnson wrote:
> 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? :)

I call it a bug.

> 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.

But I didn't claim that:  I said that blaming Sweave for this is unfair. 
  It's a LaTeX bug.  There are a lot of problems in LaTeX, and you 
really need to read their documentation to find them:  Sweave docs can't 
be expected to keep up with them all.

> 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.

I didn't claim that, either.  I said it's missing some symbols, and they 
know it, so no new bug report is needed.  I think they should fix this, 
but I don't know enough about the situation to know why they haven't.

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

That suggests you should propose a patch for Sweave.sty, which you do 
below. Thank you.  I don't know know why ae was used in the first place, 
so I'm certainly not going to accept your patch.  Someone else might, if 
you get in contact with the right person (Fritz Leisch?) to find out why 
ae was used, then convince him that there are now better solutions. 
It's been used since Fritz added Sweave.sty in 2002, with the noae 
option added a couple of years ago.

You probably want to move this discussion to R-devel if you're 
discussing a patch.

Duncan Murdoch

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




More information about the R-help mailing list