6

I have a master style file of macros, which I use for all of my documents. Is there something I can add to the preamble of a particular file so that it ignores some specific macro from my style file?

For example. My style file includes my custom shortcut \foo. Now I am writing a specific document, and I want to use some unusual symbol that is part of some random package I never use. So I add this package to the preamble of this document, to get the command for the unusual symbol. But this package happens to use the command \foo for some other thing I don't care about, and so now I get the \foo already defined error when I try to compile. I would like to add something to the preamble of this document so that it ignores \foo in my style file. Is this possible?

  • \renewcommand{\foo}{} or for a symbol savesymbol package – user31729 May 14 '16 at 14:17
  • @ChristianHupfer It's a symbol, which I assume is why \renewcommand{\foo}{} doesn't work. I am not familiar with the savesymbol package, and I couldn't figure out how to implement it. However, when searching for info on savesymbol, I found this question, which provides an answer. In particular, I add \let\foo\relax to the preamble between \usepackage{mymacros} and \usepackage{randompacakge}. Should I delete the question? – Gabe Conant May 14 '16 at 14:30
  • 1
    \let\foo\relax can work but you won't be able to access the original definition then – user31729 May 14 '16 at 14:45
  • 1
    I made an error as well: The name is savesym, not savesymbol, but the command is called that way, sorry about! – user31729 May 14 '16 at 14:50
8

Here is the savesym way of getting rid of this problem:

\savesymbol{foo} should work, after that say \origfoo to access the old version.

The classical conflict appears for example with bbding and marvosym packages:

\documentclass{article}


\usepackage{savesym}

\usepackage{bbding}
\savesymbol{Cross}

\usepackage{marvosym}


\begin{document}

Original version: \origCross

Redefined version: \Cross


\end{document}

enter image description here

  • 1
    Thanks for spelling out how to use the savesym package. – Gabe Conant May 14 '16 at 14:49
  • @Gabe: You're welcome! Happy TeXing! – user31729 May 14 '16 at 14:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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