22

The springer latex template is not working with Tikz. Link: https://www.springernature.com/gp/authors/campaigns/latex-author-support Output error:

l.16 \input
            pgfmathfunctions.code.tex
! Missing \endcsname inserted.
<to be read again> 
                   \let 

MWE:

\documentclass[referee,sn-basic]{sn-jnl}

\jyear{2021}%

\usepackage{tikz}

\begin{document}

\title[Article Title]{Article Title}

\author*[1,2]{\fnm{First} \sur{Author}}\email{[email protected]}

\affil*[1]{\orgdiv{Department}, \orgname{Organization}, \orgaddress{\street{Street}, \city{City}, \postcode{100190}, \state{State}, \country{Country}}}

\affil[2]{\orgdiv{Department}, \orgname{Organization}, \orgaddress{\street{Street}, \city{City}, \postcode{10587}, \state{State}, \country{Country}}}


\abstract{abc}

\maketitle

\section{Introduction}\label{sec1}


\end{document}

4 Answers 4

19

As Simon posted a second before me:-) This can be simplified to


\documentclass{article}
\usepackage{program}
%\catcode`\|=12\relax

\usepackage{tikz}



\begin{document}



\end{document}

The program package makes | active already in the preamble which is rather optimistic, uncommenting the catcode setting restores the standard behaviour. this is probably preferable than using a local copy of the class that will not work for submission.

4
  • 1
    \RequirePackage{tikz} solves the problem. So this is another example where \RequirePackage{} is actually useful.
    – A Mani
    Commented Sep 11, 2021 at 17:00
  • 1
    @AMani no. \RequirePackage is identical to \usepacklage they do not have two definitions one is literally a copy of the other using \let , usepackage is defined by \let\usepackage\RequirePackage oh, before the class, OK. (but it only works for this example, if you actually use | anywhere it will be broken by the program package,. Commented Sep 11, 2021 at 17:18
  • The program package is an absolute nightmare. Besides the active | which breaks its normal usage as a math delimiter, it redefines the standard \S and \P commands and hijacks many one-letter and other short macro names (\A, \B, \Q, ..., \d, \e, \p, ...), leading to a never-ending list of conflicts with user macros. The (recent, as far as I can tell) decision to forcefully include it in the Springer Nature classes is totally insane, as well as useless (they also redundantly include 4 other similar packages: algorithm, algorithmicx, algpseudocode, and listings). Commented Sep 21, 2022 at 9:04
  • @EmilJeřábek yes, you could try reporting it but I would not have much hope of change Commented Sep 21, 2022 at 9:16
18

\RequirePackage{tikz} before \documentclass{...} works

3
  • 1
    My saviour! Thanks.
    – Arne
    Commented Oct 22, 2021 at 8:50
  • @AMani, Hello ma'am.. It's been a long time. Hopefully, you'd see this! Actually I am facing the same issue at the moment. I tried your approach, but it's not working. Would you tell me what exactly did you do back then? Did you edit the class file as suggested by @Simon? Commented Apr 17, 2022 at 5:53
  • 1
    No I did not edit the class file. My preamble: \RequirePackage{tikz} \usetikzlibrary{shapes,arrows} \documentclass[referee,sn-mathphys]{sn-jnl} \usepackage{amsmath} etc
    – A Mani
    Commented Apr 18, 2022 at 16:22
3

It seems to be a conflict with the package program. Commenting the line #311 of the file sn-jnl.cls makes the problem go away.

And later adding \usepackage{program} after tikz works fine.

\documentclass[referee,sn-basic]{sn-jnl} %  using .cls edited

\jyear{2021}%


%\usepackage{program}% <<<<<<<<<<<<<this fails
\usepackage{tikz}
\usepackage{program}% <<<<<<<<<<<<< works OK

\begin{document}
    
    \title[Article Title]{Article Title}
    
    \author*[1,2]{\fnm{First} \sur{Author}}\email{[email protected]}
    
    \affil*[1]{\orgdiv{Department}, \orgname{Organization}, \orgaddress{\street{Street}, \city{City}, \postcode{100190}, \state{State}, \country{Country}}}
    
    \affil[2]{\orgdiv{Department}, \orgname{Organization}, \orgaddress{\street{Street}, \city{City}, \postcode{10587}, \state{State}, \country{Country}}}
    
    
    \abstract{abc}
    
    \maketitle
    
    \section{Introduction}\label{sec1}  
    
\end{document}

A

1
  • it only works to load program after you have edited the class not to load it (and you can't use an edited class for submission to Springer (you could try complaining to springer and getting them to not include the progtam package though) Commented Sep 11, 2021 at 14:21
0

Another workaround is to add the command \normalbaroutside after the program or one of the sn-* packages is loaded. Like this

\documentclass[sn-mathphys]{sn-jnl} % or \usepackage{program}
\normalbaroutside

\usepackage{tikz-cd} % or \usepackage{tikz}

This command neutralizes the conflicting behavior of | outside the {program} environment. It is documented within program.sty, but nowhere else it seems:

% program.sty, Version 3.3.14
% Version History:
  ...
% 3.3.4: Added \ifVBarOutsideProgram switch -- The command \normalbaroutside
%        makes | to act normally outside the program environment
  ...
% Set switch to false if you want | to act normally 
% outside the program environment:
\newif\ifVBarOutsideProgram \VBarOutsideProgramtrue
\def\normalbaroutside{\catcode`\|=12 \VBarOutsideProgramfalse}
  ...
1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .