Equations – Fixing Fraction Equation Out of the Fraction Line in Overleaf

equationsoverleaf

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}

Best Answer

  • 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