# [R-pkg-devel] Using the amsmath package in a vignette.

Rolf Turner r@turner @end|ng |rom @uck|@nd@@c@nz
Thu Mar 4 09:34:57 CET 2021

On Thu, 4 Mar 2021 07:39:31 +0100
Göran Broström <goran.brostrom using umu.se> wrote:

> Hi Rolf,
>
> On 2021-03-04 03:51, Rolf Turner wrote:
> >
> > I am trying to create a vignette in a package (basically just using
> > LaTeX code; no R calculations or data are involved).
> >
> > The LaTeX code involves the use of the align* environment from the
> > amsmath package.  When I try to run Sweave() on the *.Rnw file I get
> > a corresponding *.tex file, but then when I run pdflatex on that
> > file I get an error:
> >
> >> ! LaTeX Error: Command \iint already defined. Or name \end...
> >> illegal, see p.192 of the manual.
> >>
> >> See the LaTeX manual or LaTeX Companion for explanation. Type  H
> >> <return>  for immediate help. ...
> >>
> >> l.649 ...d{\iint}{\DOTSI\protect\MultiIntegral{2}}
> >
> > which is completely opaque to me.
>
> Shouldn't be;

Well I guess it's not opaque when you are sufficiently comfortable with
what you are doing.  But when every <expletive deleted> thing is
bewilderingly arcane it is difficult to sift out the few simple things
that actually are comprehensible.

> the amsmath package defines \iint, and the error
> message says that it was already defined, probably in another package
> you have loaded. Easily found by googling. My first hit was
>

It turned out that I had \usepackage{wasysym} in the preamble.  I guess
it got there because I copied a prototype from somewhere ... long ago,
to use in another package that I maintain.  Then I copied the *.Rmw
file over from that other package and modified it, not changing those
things about which I hadn't a clue --- like wasysym.  I first
tried \usepackage[nointegrals]{wasysym} as suggested at the URL that
you pointed me to, and that worked fine.  Then I tried commenting
it out completely and that worked fine too.  So I never needed wasysym
in the first place.  But there are so *many* bits and pieces that it is
impossible to tell what is needed and what isn't.

<SNIP>

Anyhow, I seem to be good to go now.  Thanks.

cheers,

Rolf

--
Honorary Research Fellow
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276