Document Classes ⇒ \newcommand in a style file and older documents
\newcommand in a style file and older documents
thought I posted it before, but it did not show up.
Perhaps I forgot a subject.
By way of background, I'm a long-time user of TeX and
LaTeX (since 1988), but have only recently acquired a
need to come to grips with writing and editing class
and style files (doing it right now, in fact), and am
unaware of how some of the internal stuff works, or of
the best place to find documentation on it. (I'm
looking in "The LaTeX Companion" and am thinking it may
be the best there is.)
Meanwhile, my immediate need is as follows: We use a
command called \sanitize that gets defined in about 50%
of our documents. It makes sense to me to put it in our
main style file. However, if I do that, it will break
backward compatibility with older documents, i.e., if I
add \newcommand{\sanitize}{foo} to the style file, then
run a three-year-old document through latex that has
that same \newcommand in the preamble, it will not
build. I can't define it in the style file using
\renewcommand because it's not defined, and I'm
unwilling to go through hundreds of old documents for
instances of the declaration to change them to
\renewcommand. Does someone know a way around this?
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
Re: \newcommand in a style file and older documents
not a technical one but managerial, and often simple.
Instead of adding the \newcommand{\sanitize}{...} I added
the same identical code but called it \cleanup. That way
no legacy files have to be touched, the new name is more
obvious regarding its intent, and it's one less letter to
type as well.
Problem resolved.