7. Given $\sin ^{2}\left(x+\frac{\pi}{8}\right)-\cos ^{2}\left(x-\frac{\pi}{8}\right)=$ $\frac{1}{4}$, and $x \in\left(\frac{\pi}{4}, \frac{\pi}{2}\right)$. Then the value of $\tan x$ is $\qquad$ .
$$
=7 . \frac{2 \sqrt{14}+\sqrt{7}}{7} \text {. }
$$

From the problem, we know
$$
\frac{1}{2}\left[1-\cos \left(2 x+\frac{\pi}{4}\right)\right]-\frac{1}{2}\left[1+\cos \left(2 x-\frac{\pi}{4}\right)\right]=\frac{1}{4} \text {, }
$$

which means $\cos \left(2 x+\frac{\pi}{4}\right)+\cos \left(2 x-\frac{\pi}{4}\right)=-\frac{1}{2}$.
Then $\sqrt{2} \cos 2 \mathrm{x}=-\frac{1}{2}, \cos 2 x=-\frac{\sqrt{2}}{4}$.
Given $x \in\left(\frac{\pi}{4}, \frac{\pi}{2}\right), 2 x \in\left(\frac{\pi}{2}, \pi\right)$, we have $\tan 2 x=-\sqrt{7}$.
Thus $\frac{2 \tan x}{1-\tan ^{2} x}=-\sqrt{7}$, which means
$$
\sqrt{7} \tan ^{2} x-2 \tan x-\sqrt{7}=0 \text {. }
$$

Solving this, we get $\tan x=\frac{2 \sqrt{14}+\sqrt{7}}{7}$.