# [OS X TeX] \newcommand problem with sn-jnl.cls

Roussanka Loukanova rl.stpuu at gmail.com
Mon Sep 19 08:19:48 EDT 2022

Dear Manfred,

On Mon, Sep 19, 2022 at 8:56 AM Manfred Braun <manfred.braun at uni-due.de> wrote:
...
> It is a general problem that publishers insist on their own style files, while authors want to use their personal macros. It depends very much on the publisher what they allow to change.
>
> To solve your special problem just write
> \renewcommand{\R}{\mathbb{R}}
> \newcommand{\R}{\mathbb{R}}
> This will overwrite the previous definition.
>
> Sometimes, it may be advisable to keep the original meaning before redefining it. This can be done by
> \let\Rorig=\R
> \renewcommand\R{…}
> Then the “old” \R is still available under the name \Rorig.

This seems to be a good way to dothe  it, because I'm reluctant to
exclude predefined commands.

> The command \R is apparently introduced by the package “program” included in the publisher's cls file, see the README at
> https://ctan.org/pkg/program?lang=en
> If you don’t need program documentation in your article you could comment out the
> \usepackage{program}%
> from the sn-jnl.cls file and get rid of the predefined \R. I, personally, use the \R command just in your sense.

Commenting out

%\usepackage{program}%
%\newcommand{\state}[1]{#1}%

sems to do, at least for typesetting a paper on my side. I have my own
.sty with many definitions.

But when submitting the sources, the journal publisher may run LaTeX
on their side. Thus, for various commands, which I've defined, I may
need to use \renewcommand.

I vaguely guessed that it might be something with predefined commands
by sn-jnl.cls. But I didn't believe that because I got the errors for
so many of them, including for $\lar$, $\state$, etc.
Thanks a lot!

Best Regards,
Roussanka

> Best regards,
> Manfred
>
> On 19. Sep 2022, at 03:50, Roussanka Loukanova <rl.stpuu at gmail.com> wrote:
>
> Dear All,
>
> I have a question that is off the list, but I hope to get it resolved
>
> I have to use Springer's style for journals  <sn-jnl.cls> from the
> Springer package:
> sn-article-template
> https://www.springernature.com/gp/authors/campaigns/latex-author-support#c17590862
>
> I have my own style file of defined \newcommand{...}{...} and
> \DeclareMathOperator{...}{...}.
>
> Typesetting (by pdflatex) .tex files that use Springer's cluster
> \documentclass[sn-mathphys]{sn-jnl}
> produces errors adding my own definitions in .tex files, by:
>
> I get the error even if I add a single definition
> \newcommand{\R}{\mathbb{R}}
> in the preamble of Springer's  template file  <sn-article.tex>.
> I get the following error:
>
> ==
> ERROR: LaTeX Error: Command \R already defined.
>
> --- TeX said ---
>               Or name \end... illegal, see p.192 of the manual.
> ==
>
> I would appreciate help.
>
> Best Regards,
> Roussanka
> ----------- Please Consult the Following Before Posting -----------
> TeX FAQ: https://www.tug.org/mactex/faq/index.html
> List Reminders and Etiquette: https://sites.esm.psu.edu/~gray/TeX/
> List Archives: http://dir.gmane.org/gmane.comp.tex.macosx
>                https://email.esm.psu.edu/pipermail/macosx-tex/
> TeX on Mac OS X Website: https://www.tug.org/mactex/index.html
> List Info: https://email.esm.psu.edu/mailman/listinfo/macosx-tex
>
>
> ----------- Please Consult the Following Before Posting -----------
> TeX FAQ: https://www.tug.org/mactex/faq/index.html
> List Reminders and Etiquette: https://sites.esm.psu.edu/~gray/TeX/
> List Archives: http://dir.gmane.org/gmane.comp.tex.macosx
>                 https://email.esm.psu.edu/pipermail/macosx-tex/
> TeX on Mac OS X Website: https://www.tug.org/mactex/index.html
> List Info: https://email.esm.psu.edu/mailman/listinfo/macosx-tex