2

I'm using an overleaf springer nature latex template. It can be found here: I tried many packages to get this equation to appear right without success. It appears like this. If I use the Elsevier latex template overleaf or online equation editor the equation will appear just fine. Any help, please.

\documentclass[default,iicol]{sn-jnl}% Default with double column layout

\jyear{2021}%

%% as per the requirement new theorem styles can be included as shown below
\theoremstyle{thmstyleone}%
\newtheorem{theorem}{Theorem}%  meant for continuous numbers
%%\newtheorem{theorem}{Theorem}[section]% meant for sectionwise numbers
%% optional argument [theorem] produces theorem numbering sequence instead of independent numbers for Proposition
\newtheorem{proposition}[theorem]{Proposition}% 
%%\newtheorem{proposition}{Proposition}% to get separate numbers for theorem and proposition etc.

\theoremstyle{thmstyletwo}%
\newtheorem{example}{Example}%
\newtheorem{remark}{Remark}%

\theoremstyle{thmstylethree}%
\newtheorem{definition}{Definition}%

\raggedbottom
%%\unnumbered% uncomment this for unnumbered level heads

\begin{document}

\section{Equations}\label{sec1}

% EQUATION 1
\begin{equation}
\label{Eq.1}
P(h(x)|S) = \frac{P(h(x) \cdot P(S|h(x))}{P(S)}
\end{equation}

\end{document}
1
  • 2
    Welcome to tex.sx. I haven't tested this, but it looks like there are more opening parentheses than closing ones. Count them carefully to make sure they match, and try again. May 23, 2022 at 0:27

2 Answers 2

5
  • consider @Barbara Beeton comment, and
  • instead of | you had to use the \mid:
\documentclass[default,iicol]{sn-jnl}% Default with double column layout

\jyear{2021}%

\begin{document}

\section{Equations}
\label{sec1}

\begin{equation}\label{Eq.1}
P(h(x)\mid S) = \frac{P(h(x)) \cdot P(S\mid h(x))}{P(S)} %, 
\end{equation}

\end{document}

enter image description here

5
  • 2
    +1: Nice find! :). Related: tex.stackexchange.com/questions/52901 May 23, 2022 at 3:05
  • Regarding Barbara's comment: I did not see unbalanced brackets. May 23, 2022 at 3:06
  • 2
    @Dr.ManuelKuehner, She is right. Instead P(h(x) \cdot ... should be P(h(x)) \cdot ...)
    – Zarko
    May 23, 2022 at 3:10
  • Ah, I see, but I did not think that this is related to the problem. Thanks for the reply. May 23, 2022 at 3:11
  • 3
    @Dr.ManuelKuehner, apparently contributed. Without closed parenthesis I get error: missing $. It seems that sn-jnl is more pedantic and picky as article :-)
    – Zarko
    May 23, 2022 at 3:15
2

Works for me?! Please provide a complete code example, see here.

\documentclass{article}

\begin{document}

\begin{equation} 
P(h(x)|S) = \frac{P(h(x) \cdot P(S|h(x))}{P(S)}
\label{Eq.1}
\end{equation}

\end{document}

enter image description here

3
  • 1
    @AbdullaAburomman I recommend that you provide a compilable code example and include it in your question. That makes things much easier for others to help (less guesswork). The linked template seems complex - so please boil it down to the essentials regarding the problem. May 23, 2022 at 1:05
  • "I recommend that you provide a compilable code example and include it in your question". I did that by re-editing my post. May 23, 2022 at 13:27
  • Thank you very much, your solution works. :-) May 23, 2022 at 13:57

You must log in to answer this question.

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