Problem with \newcommand and \renewcommand

boldmacrosmath-moderenewcommand

enter image description hereI am trying to define a command called \vec{} that prints a bold and non-italic symbol in math environment.

\renewcommand{\vec}[1]{\mathbf{#1}}

usually works for me, but not in the documentclass ifacconf.
Instead,

\newcommand{\vect}[1]{\mathbf{#1}}

works here. Can someone please explain the difference to me?

Thank you! 🙂

MWE:

\documentclass{ifacconf}
\usepackage{natbib}        % required for bibliography
%% own packages
\usepackage{amsmath}
\usepackage{amssymb}

%% own commands
\renewcommand{\vec}[1]{\mathbf{#1}}
\newcommand{\vect}[1]{\mathbf{#1}}

\begin{document}
\begin{frontmatter}

\title{Title, preferably not more than 10 words}

\begin{abstract}                
Abstract of not more than 250 words.
\end{abstract}

\end{frontmatter}
\begin{verbatim}
\mathbf{A}
\end{verbatim} prints
\begin{equation}
\mathbf{A},
\end{equation}

\begin{verbatim}
\vec{A}
\end{verbatim} prints
\begin{equation}
\vec{A},
\end{equation}

\begin{verbatim}
\vect{A}
\end{verbatim} prints
\begin{equation}
\vect{A}
\end{equation}
\end{document}

Best Answer

I think the problem is simple: frontmatter overwrites your command. Solution: Just copy your line

\renewcommand{\vec}[1]{\mathbf{#1}}

and paste it after you ended frontmatter or even inside the frontmatter environment to get your command inside this environment there.

I hope this helps!

Cheers, Nick

Related Question