Generalusing multiple packages

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
AQuinn1575
Posts: 2
Joined: Thu Sep 23, 2010 7:20 pm

using multiple packages

Post by AQuinn1575 »

I'm not sure where exactly my question should be asked.

Regardless, I am using multiple packages in a latex file that I am writing (they happen to be mathabx and amsfonts). The issue that I am having is that I need only a few commands from one package(in this case I only need the does not divide and divides symbols from mathabx), but since the two packages share a bunch of commands, every time I enter commands that they both share, the mathabx package receives precedence over amsfonts, and as a result, I am not getting the style of many symbols that I want.

I am curious, how do i tell latex that I want amsfonts to get precedence when both packages have the same commands in them?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

using multiple packages

Post by frabjous »

Normally, whichever package you load last takes precedence, but there are exceptions, and unfortunately this is one.

Maybe someone would have a better idea, but if you really only need those two symbols, you could leave out \usepackage{mathabx}, and instead put in:

Code: Select all

\DeclareFontFamily{U}{matha}{\hyphenchar\font45}
\DeclareFontShape{U}{matha}{m}{n}{
      <5> <6> <7> <8> <9> <10> gen * matha
      <10.95> matha10 <12> <14.4> <17.28> <20.74> <24.88> matha12
      }{}
\DeclareSymbolFont{matha}{U}{matha}{m}{n}
\DeclareMathSymbol{\divides}{3}{matha}{"17}
\DeclareMathSymbol{\notdivides}{3}{matha}{"1F} 
(That's just some code stolen from the mathabx package having to do with these two symbols in particular.)

Alternatively, since those symbols seem fairly easy to replicate by other means, you could try doing so, e.g., as a first stab:

Code: Select all

\newcommand{\divides}{\mathrel{\vert}}
\newcommand{\notdivides}{\negthinspace\mathrel{\not\vert}}
AQuinn1575
Posts: 2
Joined: Thu Sep 23, 2010 7:20 pm

Re: using multiple packages

Post by AQuinn1575 »

Thank you for the help. but another quick question, I realized that I am also using \pmod{} from the mathabx package (or at least my latex is sending errors when i remove mathabx), how could I re-define, or import that as well? im sorry, I have only used latex for a couple of weeks, so I am very new to it.
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

using multiple packages

Post by frabjous »

\pmod{} isn't defined by mathabx. It's actually defined in LaTeX itself, and should be available without any packages.

This is very mysterious. Would it be possible to provide a minimal working example that generates an error when you use it?

What exactly is the error you get?

You could try to define it. This is a reasonable substitute:

Code: Select all

\newcommand{\pmod}[1]{\ (\mathrm{mod\ }#1)}
(Possibly you'll need renewcommand instead.)

But I'm very confused as to why removing mathabx should produce an error here.
Post Reply