How to derive the Jensen-Shannon divergence from the f-divergence? The Jensen-Shannon divergence is defined as $$JS(p, q) = \frac{1}{2}\left(KL\left(p||\frac{p+q}{2}\right) + KL\left(q||\frac{p+q}{2}\right) \right).$$ In Wikipedia it says that it can be derived from the f-divergence $$D_f(p||q) = \int_{-\infty}^{\infty} q(x) \cdot f\left(\frac{p(x)}{q(x)}\right) dx$$ with $f(x) = -(1+x)\cdot \text{log}(\frac{1+x}{2}) + x \cdot \text{log} (x)$. However, when I try it I end up with $JS(p, q) = 2 \cdot D_f(p||q)$.
\begin{align*}
JS(p, q) &= \frac{1}{2}\left( KL \left( p|| \frac{p+q}{2} \right) + KL \left( q|| \frac{p+q}{2} \right) \right)\\
&= \frac{1}{2} \int_{-\infty}^{\infty} p(x) \cdot \text{log} \left( \frac{2 \cdot p(x)}{p(x)+q(x)} \right) + q(x) \cdot \text{log} \left( \frac{2 \cdot q(x)}{p(x)+q(x)} \right) dx\\ 
&= \frac{1}{2} \int_{-\infty}^{\infty} p(x) \cdot \left( \text{log} \left( 2 \right) + \text{log} \left( p(x) \right)  - \text{log} \left( p(x)+q(x) \right) \right) + q(x) \cdot \left( \text{log} \left( 2 \right) + \text{log} \left( q(x) \right)   \right) - \text{log} \left( p(x)+q(x) \right)  dx\\ 
&= \frac{1}{2} \int_{-\infty}^{\infty} (p(x)+q(x)) \cdot \text{log}\left(2 \right) - (p(x)+q(x)) \cdot \text{log}\left(p(x)+ q(x) \right)  + p(x) \cdot \text{log} \left(p(x)\right) + q(x) \cdot  \text{log}\left(q(x) \right)  dx \\
&= \frac{1}{2} \int_{-\infty}^{\infty} p(x) \cdot \text{log} \left(p(x)\right) + q(x) \cdot  \text{log}\left(q(x) \right) - (p(x)+q(x)) \cdot \text{log}\left(\frac{p(x)+ q(x)}{2} \right) dx 
\end{align*}
and
\begin{align*}
D_f(p||q) &= \int_{-\infty}^{\infty} q(x) \cdot f\left(\frac{p(x)}{q(x)}\right) dx \\
&= \int_{-\infty}^{\infty} q(x) \cdot \left(-(1+\frac{p(x)}{q(x)}) \cdot \text{log}\left(\frac{1+\frac{p(x)}{q(x)}}{2} \right) + \frac{p(x)}{q(x)} \cdot \text{log}\left(\frac{p(x)}{q(x)}\right) \right) dx \\
&= \int_{-\infty}^{\infty}  -(q(x)+p(x)) \cdot \text{log}\left(\frac{1+\frac{p(x)}{q(x)}}{2} \right) + p(x) \cdot \text{log}\left(\frac{p(x)}{q(x)}\right) dx \\
&= \int_{-\infty}^{\infty}  p(x) \cdot \text{log}\left(p(x) \right) - p(x) \cdot \text{log}\left(q(x)\right) - p(x) \cdot \text{log}\left(1+\frac{p(x)}{q(x)} \right) +  p(x) \cdot \text{log}\left(2 \right)  - q(x) \cdot \text{log}\left(1+\frac{p(x)}{q(x)} \right) +  q(x) \cdot \text{log}\left(2 \right) dx \\
&= \int_{-\infty}^{\infty}  p(x) \cdot \text{log}\left(p(x) \right) - p(x) \cdot \text{log}\left(q(x)\right) - p(x) \cdot \text{log}\left(\frac{p(x)+q(x)}{q(x)} \right) +  p(x) \cdot \text{log}\left(2 \right)  - q(x) \cdot \text{log}\left(\frac{p(x)+q(x)}{q(x)} \right) +  q(x) \cdot \text{log}\left(2 \right) dx \\
&= \int_{-\infty}^{\infty}  p(x) \cdot \text{log}\left(p(x) \right) - p(x) \cdot \text{log}\left(q(x)\right) - p(x) \cdot \text{log}\left(p(x)+q(x) \right) + p(x) \cdot \text{log}\left(q(x) \right)  +  p(x) \cdot \text{log}\left(2 \right)  - q(x) \cdot \text{log}\left(p(x)+q(x) \right) + q(x)\cdot \text{log}\left(q(x) \right) +  q(x) \cdot \text{log}\left(2 \right) dx \\
&= \int_{-\infty}^{\infty}  p(x) \cdot \text{log}\left(p(x) \right) - p(x) \cdot \text{log}\left(p(x)+q(x) \right) +  p(x) \cdot \text{log}\left(2 \right)  - q(x) \cdot \text{log}\left(p(x)+q(x) \right) + q(x)\cdot \text{log}\left(q(x) \right) +  q(x) \cdot \text{log}\left(2 \right) dx \\
&= \int_{-\infty}^{\infty} p(x) \cdot \text{log} \left(p(x)\right) + q(x) \cdot  \text{log}\left(q(x) \right)  - (p(x)+q(x)) \cdot \text{log}\left(p(x)+ q(x)\right) + (p(x)+q(x)) \cdot \text{log}\left(2\right) dx \\
&= \frac{2}{2} \int_{-\infty}^{\infty} p(x) \cdot \text{log} \left(p(x)\right) + q(x) \cdot  \text{log}\left(q(x) \right) - (p(x)+q(x)) \cdot \text{log}\left(\frac{p(x)+ q(x)}{2} \right) dx \\
&= 2 \cdot JS(p, q)
\end{align*}
Where is my mistake?
 A: Few observations:
$\rm [I] ~(p. 90)$ defines Jensen-Shannon divergence for $P, Q, ~P\ll Q$ as
$$\mathrm{JS}(P,~Q) := D\left(P\bigg \Vert \frac{P+Q}{2}\right)+D\left(Q\bigg \Vert \frac{P+Q}{2}\right)\tag 1\label 1$$
and the associated function to generate $\rm JS(\cdot,\cdot) $ from $D_f(\cdot\Vert\cdot) $ is
$$f(x) :=x\log\frac{2x}{x+1}+\log\frac{2}{x+1}. \tag 2$$
The definition of Jensen-Shannon in $\eqref{1}$ lacks the constant $1/2,$ however in the original paper $\rm [II]~ (sec. IV, ~ p. 147)$ it wasn't defined so.
In $\rm [III], $ the authors noted the corresponding function $g(t), ~t:=p_i(x) /q_j(x) $ as
$$ g(t) := \frac12\left(t\log\frac{2t}{t+1}+\log\frac{2}{t+1}\right).\tag 3\label 3$$
Also in $\rm [IV] ~(p. 4)$ the author mentioned the required function to be $\frac12\left(u\log u -(u+1)\log\left(\frac{u+1}{2}\right)\right)  $ which is equivalent to $\eqref 3.$

In $\rm [II] ~(p. 147),$ the author noted that the $K$ divergence, defined in terms of the Kullback $I$ (in author's terminology)
$$K(p_1, p_2) := I\left(p_1,\frac12(p_1+p_2)\right),\tag 4$$
coincides with the $f$ divergence for $$x\mapsto x\log\frac{2x}{1+x}.\tag a\label a$$
The symmetrised version of $K$ is
$$L(p_1, p_2) := K(p_1, p_2)+K( p_2, p_1). \tag 5$$
As the author subsequently defined $\rm JS_{\pi}(\cdot,\cdot);$ for $\pi=\frac12, $
$$\mathrm{JS}_\frac{1}{2}(p_1,p_2)=\frac12 L(p_1,p_2).\tag 6\label 6$$
Now, using $\eqref{a}, $
\begin{align}\frac12 L(p, q) &=\frac12[K(p,q)+K(q,p)]\\ &=\frac12\left[\int q~\frac{p}{q}\log\frac{\frac{2p}{q}}{1+\frac{p}{q}}~\mathrm d\mu+ \int p~\frac{q}{p}\log\frac{\frac{2q}{p}}{1+\frac{q}{p}}~\mathrm d\mu\right]\\ &= \frac12\left[\int p\log\frac{2p}{q+p}~\mathrm d\mu+ \int q\log\frac{2q}{p+q}~\mathrm d\mu\right]\\&= \frac{1}{2}\left[\int q~\frac{p}{q}\log\frac{2\frac{p}{q}}{\frac{p}{q}+1}~\mathrm d\mu + \int q \log\frac{2}{1+\frac{p}{q}}~\mathrm d\mu\right]\tag 7\label 7\\&=\int q~f_{\rm{JS}}\left(\frac{p}{q}\right)~\mathrm d\mu,\end{align}
where, from $\eqref{7}, $
$$f_{\rm{JS}} (x) :=\frac12\left[x\log\frac{2x}{1+x}+ \log\frac{2}{1+x}\right] .\tag 8 $$

References:
$\rm [I]$ Information Theory:
From Coding to Learning, Yury Polyanskiy, Yihong Wu, Cambridge University Press.
$\rm [II]$ Divergence Measures Based on the Shannon Entropy, Jianhua Lin, IEEE, Vol. $37$, No. $\rm I,$ January $1991.$
$\rm [III]$ $f$-Divergence is a Generalized Invariant Measure Between Distributions, Yu Qiao, Nobuaki Minematsu, DOI:$10.21437/\rm Interspeech.2008-393.$
$\rm [IV]$ On a generalization of the Jensen-Shannon divergence and the
JS-symmetrization of distances relying on abstract means, Frank Nielsen, May $2019, $ DOI:$10.3390/\rm e21050485.$
