1. Vedran Miletić
  2. beamer
  3. Issues
Issue #180 resolved

Do not load Amssymb unconditionally

Anonymous created an issue

Could you please make the loading of amssymb in beamerbasefont.sty optional? Amssymb clashes sometimes with other font packages, and you'll get errors such as

! LaTeX Error: Command `\mathfrak' already defined.

I'm having this issue with a handout class that uses MinionPro.sty (when loading beamerarticle.sty).

Comments (15)

  1. Anonymous

    I understand that AMS might be needed for presentation mode, but couldn't you at least allow to disable the auto-loading in article mode? AFAIR beamerarticle never auto-loaded amssymb automatically until some releases ago. Since this was released, all my old article documents are broken :-(

    I think an option which allows to disable autoloading (and is off by default) will not break things for anybody.

  2. Anonymous

    FWIW, here's a patch that might make clearer what I mean. I do not see any drawback, and we can add a note to the documentation that users who use this option will have to take care themsellves if they use AMS symbols. (BTW my name is Jürgen Spitzmüller in case you bother. I just do not want to set up yet another account)

    --- usr/local/texlive/current/texmf-dist/tex/latex/beamer/beamerarticle.sty 2012-02-24 01:10:37.000000000 +0100 +++ home/jspitzm/texmf/tex/latex/beamer-addons/beamerarticle.sty 2012-04-09 14:43:20.000000000 +0200 @@ -21,7 +21,6 @@ \DeclareOption{noxcolor}{\PassOptionsToPackage{noxcolor}{beamerbasearticle}} \DeclareOption{notheorems}{\PassOptionsToPackage{notheorems}{beamerbasearticle}} \DeclareOption{noamsthm}{\PassOptionsToPackage{noamsthm}{beamerbasearticle}} +\DeclareOption{noamssymb}{\PassOptionsToPackage{noamssymb}{beamerbasearticle}} \DeclareOption{envcountsect}{\PassOptionsToPackage{envcountsect}{beamerbasearticle}} \DeclareOption{activeospeccharacters}{\PassOptionsToPackage{activeospeccharacters}{beamerbasearticle}}

    --- usr/local/texlive/current/texmf-dist/tex/latex/beamer/beamerbasearticle.sty 2012-02-24 01:10:37.000000000 +0100 +++ home/jspitzm/texmf/tex/latex/beamer-addons/beamerbasearticle.sty 2012-04-09 14:47:54.000000000 +0200 @@ -23,16 +23,12 @@ \newif\ifbeamer@articleactive \beamer@articleactivefalse

    +\newif\ifbeamer@amssymb +\beamer@amssymbtrue + \DeclareOption{utf8}{\beamer@articleutftrue} \DeclareOption{hyperref}{\beamer@articlehyperreftrue} \DeclareOption{noxcolor}{\beamer@articlexcolorfalse} \DeclareOption{nodefaultblocks}{\beamer@blocksfalse}% obsolete. use notheorems \DeclareOption{notheorems}{\beamer@blocksfalse} \DeclareOption{noamsthm}{\beamer@blocksfalse\beamer@amsfalse} +\DeclareOption{noamssymb}{\beamer@amssymbfalse} \DeclareOption{envcountsect}{\beamer@countsecttrue} \DeclareOption{activeospeccharacters}{\beamer@articleactivetrue}

    --- usr/local/texlive/current/texmf-dist/tex/latex/beamer/beamerbasefont.sty 2012-02-24 01:10:37.000000000 +0100 +++ home/jspitzm/texmf/tex/latex/beamer-addons/beamerbasefont.sty 2012-04-09 14:50:19.000000000 +0200 @@ -10,14 +10,10 @@

    \ProvidesPackageRCS $Header: /Users/joseph/Documents/LaTeX/beamer/base/beamerbasefont.sty,v f39336aafb3c 2010/10/26 18:09:31 rivanvx $

    +\ifbeamer@amssymb \RequirePackage{amssymb} % For \blacktriangleright; not explicitly required by article, but can cause % weird situations if users find that symbols works in presentation, but not % in article mode. +% However, some classes or font packages clash with amssymb, so allow to +% disable auto-loading optionally. +\fi

    \mode <presentation>

  3. Norman Gray

    This patch appears to make amssymb optional only for beamerarticle -- would it be possible to make it optional for the beamer class, too? The rationale for this is the same as Jürgen's above: I want to include a style (specifically mtpro2) which itself includes amssymb, and this causes an error if beamer has already loaded it.

    My MWE is:

    \documentclass{beamer} \usepackage{mtpro2} \begin{document} Hello \end{document}

    This produces the error

    (/usr/local/texlive/2012/../texmf-local/tex/latex/mtpro2/mtpro2.sty ! LaTeX Error: Command \Bbbk already defined. Or name \end... illegal, see p.192 of the manual.

    This would need the same documentation fix as currently exists with beamerarticle. I found the noamssymb option in the manual, and noted the stipulation that if an author uses this option, they are responsible for loading amssymb by some other route. That seems fair.

    Perhaps the underlying problem is that amssymb shouldn't collapse if it's loaded twice, but I don't know if that's feasible.

    If you agree this would be useful, I can create a suitable new issue here.

  4. Joseph Wright

    Could you open this as a separate issue and link to this one? I need to think about it, and it seems to be distinct. The problem is that beamer really does expect amssymb to be loaded (for itemize lists), so it's not quite so straight-forward to avoid loading it. I might be able to fiddle with the load order, however.

  5. Norman Gray

    Done: see issue #219

    One solution would be to simply let beamer explode if the user has added the noamssymb option and not thereafter included a package that loads amssymb. If the only place the noamssymb option was documented made it very briefly clear that replacing amssymb was vital, then the user has no-one to blame but themself. However that does rely on said user actually reading the manual, even to the extent of reading the remainder of a paragraph, so we know that wouldn't happen. It does, all the same, provide the cover of 'I told you so'....

    Another option might be to have the command(s) that depends on amssymb be booby-trapped so that it checks whether amssymb is loaded the first time it's expanded, fails with an error message if not, and re-\lets itself to the proper value if all's well. Much like the `\@onlypreamble` and `\@noprerr` mechanism, though in reverse. Though I haven't looked at the beamer code, so don't know if that's actually reasonable.

  6. Log in to comment