0

I have a document that frequently uses the \vec command from the amsmath package. I decided I wanted to make all the vectors boldfaced, so I added the following \renewcommand:

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

Now when I try to compile the document (using Texmaker), it says, 'Process started,' indefinitely; no errors appear. At first I thought that it might be caused by the document having to update all the existing \vec commands already, but I don't believe that would cause compile times like this (its been trying to compile for several minutes now)

If I remove the \renewcommand then it compiles near instantaneously.

Does anybody know what may be causing this?

Edit: I just tried using the following \newcommand

\newcommand{\vecbf}[1]{\vec{\mathbf{#1}}}

and then I replaced all existing \vec commands with \vecbf. This solution works and compiles very quickly. I can continue using this solution, but I don't understand why renew command doesn't work.

Edit 2: I think I know why \renewcommand doesn't work in the way I used it, but I'm not positive. I believe it is because I'm using the command I'm renewing in the renewed definition, causing a sort of infinite loop.

2
  • 2
    \let\oldvec\vec\renewcommand{\vec}[1]{\oldvec{\mathbf{#1}}}. – user240002 Apr 18 at 4:05
  • @user240002 This solution works perfectly. Thank you! – VirtuallyRealistic Apr 18 at 4:36