Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am using the pss(b) template, which starts with,

\documentclass[pss]{wiley2sp} % provides pss two-column style
\usepackage{amsmath}
%\usepackage{bm}              % uncomment these two packages if you
%\usepackage{w-greek}         % need extended greek-letter functionality in math mode

I always got this warning:

Package amsmath Warning: Unable to redefine math accent \vec.

Does anyone know how to fix this problem?

share|improve this question

migrated from stackoverflow.com Mar 14 '13 at 17:56

This question came from our site for professional and enthusiast programmers.

1 Answer 1

This "problem" is inherent to the class you're using.

Here's what's happening: You load wiley2sp, which sets up the document structure. It also (re)defines the macro \vec:

\if@mathematic
   \def\vec#1{\ensuremath{\mathchoice
                     {\mbox{\boldmath$\displaystyle\mathbf{#1}$}}
                     {\mbox{\boldmath$\textstyle\mathbf{#1}$}}
                     {\mbox{\boldmath$\scriptstyle\mathbf{#1}$}}
                     {\mbox{\boldmath$\scriptscriptstyle\mathbf{#1}$}}}}
\else
   \def\vec#1{\ensuremath{\mathchoice
                     {\mbox{\boldmath$\displaystyle#1$}}
                     {\mbox{\boldmath$\textstyle#1$}}
                     {\mbox{\boldmath$\scriptstyle#1$}}
                     {\mbox{\boldmath$\scriptscriptstyle#1$}}}}
\fi

This will print \vec{<stuff>} in bold math font. Yes, it actually redefines the macro from a former \mathaccent to the above.

Now you load amsmath, which cycles through a number of math accents and reconfigures them. Here's an extract from the actual code:

\def\@tempa#1{\@xp\@tempb\meaning#1\@nil#1}
\def\@tempb#1>#2#3 #4\@nil#5{%
  \@xp\ifx\csname#3\endcsname\mathaccent
    \@tempc#4?"7777\@nil#5%
  \else
    \PackageWarningNoLine{amsmath}{%
      Unable to redefine math accent \string#5}%
  \fi
}
\def\@tempc#1"#2#3#4#5#6\@nil#7{%
  \chardef\@tempd="#3\relax\set@mathaccent\@tempd{#7}{#2}{#4#5}}
\@tempa{\hat}
\@tempa{\check}
\@tempa{\tilde}
\@tempa{\acute}
\@tempa{\grave}
\@tempa{\dot}
\@tempa{\ddot}
\@tempa{\breve}
\@tempa{\bar}
\@tempa{\vec}

The above code is prefaced by the following documentation:

We redefine the standard math accent commands call \mathaccentV, using the mathgroup/encoding-number information embedded in their previous definitions. If the definition of an accent command does not have the expected form, we leave the accent command alone, but give a warning.

You'll notice the set of redefinitions require the former definition of the math accent to start with \mathaccent (as part of the \ifx condition in \@tempb). Since wiley2sp redefined \vec to mean something completely different (not a \mathaccent anymore), amsmath reports the warning.

A way around this would be to capture the definition of \vec before wiley2sp redefines it, and restore it before amsmath checks to redefine it. The following achieves this:

\let\oldvec\vec% Store \vec in \oldvec
\documentclass{wiley2sp}
\let\vec\oldvec% Restore \vec from \oldvec

Note that, if this is a publisher-related style or class, they most likely want their \vectors printed in a specific format. So, removing this formatting of \vectors is probably not advised.

share|improve this answer
    
It seems that this way can go around the problem. But it has new problem:! LaTeX Error: Option clash for package graphicx. See the LaTeX manual or LaTeX Companion for explanation. Type H <return> for immediate help. ... l.9 \usepackage {color} ? Here are my codes: \let\oldvec\vec% Store \vec in \oldvec \documentclass[pss]{wiley2sp} % provides pss two-column style \let\vec\oldvec% Restore \vec from \oldvec \usepackage{amsmath} \usepackage[dvips]{graphicx}% Include figure files % \usepackage{amsmath,array} \usepackage{color} –  user2045447 Mar 13 '13 at 6:56
    
Looks like it complains the packages I used below amsmath. –  user2045447 Mar 13 '13 at 7:00
    
@user2045447: Drop the [dvips] option for graphicx. It will figure out what driver you need based on the compilation sequence. For example, if you are using pdflatex, you can't use [dvips]. –  Werner Mar 13 '13 at 14:13

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.