Overleaf math mode misplacing bug

math-modeoverleaf

Not sure how to describe my problem since the situation is weird . Recently I found that Overleaf would automatically "misplace" the math mode . For example
" $ \lim_{ n \to \infty} a_n $ " will become " lim n→∞ an \lim_{n \to infty} a_n " , the dollar symbol is removed and the symbols are copied pasted . I'm sure
this is not typo becuse it happens so frequently . Did anyone also encounter this problem ?

Here is a part of my code (automatically misplaced version)

 \documentclass{article}
 \usepackage[utf8]{inputenc}
 \usepackage{CJKutf8}
 \usepackage{amsmath} 
 \usepackage{bm}
 \usepackage{amssymb} 
 \usepackage{graphicx}
 \usepackage{cancel}
 \usepackage[margin=2cm]{geometry}
 \title{AP exercise ch10}
 \date{}
 \begin{document}
 \maketitle\noindent
 \textbf{Exercise 10.1.4} \\
 We observe that if x<12x < \frac{1}{2} , ψ(x)=2x<1\psi(x) = 2x < 1 
 and if 12<x<1 \frac{1}{2} < x < 1 , ψ(x)=2x−1\psi(x) = 2x - 1 .
 So for any [a,b]⊂[0,1)[a,b] \subset [ 0 , 1 ) , we separate 
 ψ−1([a,b])\psi^{-1}([a,b]) into
 two parts i.e 
\begin{align*}
 \psi^{-1}( [ a , b ] ) \cap [0 , \frac{1}{2} ) & =
\{ x \in [ 0 , 1 ) \; \rvert \;
x < \frac{1}{2} \; , \; x \in
[ \frac{a}{2}  , \frac{b}{2}] \}
= [\frac{a}{2} , \frac{b}{2}] 
\\
\psi^{-1}( [ a , b ] ) \cap (\frac{1}{2} , 1 ) &= 
\{ x \in [ 0 , 1 ) \; \rvert \;
\frac{1}{2} < x < 1 \; , \; x \in
[ \frac{1+a}{2}  , \frac{1+b}{2}] \}
= [\frac{1+a}{2} , \frac{1+b}{2}]
\end{align*}
Hence $\mu(\psi^{-1}([a,b])) =
\mu( [\frac{a}{2} , \frac{b}{2} ])
+ \mu([\frac{1+a}{2} , \frac{1+b}{2}] ) = b- a = \mu([b,a])$ .

Best Answer

My guess is that you really need to check your browser settings: Not only have lots of instances of $ gone missing, but there are also (at least) six instances -- in just the code fragment you've posted -- of inline math expressions having been "doubled up". E.g., ψ(x)=2x<1 is prefixed to \psi(x) = 2x < 1, 12<x<1 is prefixed to \frac{1}{2} < x < 1, etc.

Not being much on Overleaf user myself, all I can suggest is that you contact their helpdesk directly and ask them for assistance in fixing your browser settings.

Anyway, after supplying the missing instances of $, commenting out the funky code doublets, and addressing other, slightly odd aspects of your code -- e.g., by replacing \; \rvert \; with \bigm\vert -- one is left with the following code, which may be close to what you actually want.

enter image description here

\documentclass{article}
 %\usepackage[utf8]{inputenc} % that's the default nowadays
 \usepackage{CJKutf8} % are you sure you need this?
 \usepackage{amsmath} 
 \usepackage{bm}
 \usepackage{amssymb} 
 \usepackage{graphicx}
 \usepackage{cancel}
 \usepackage[margin=2cm]{geometry}

\begin{document}

\noindent
\textbf{Exercise 10.1.4}

\noindent
We observe that if 
%x<12  %% huh?! #1
$x < \frac{1}{2}$, 
%ψ(x)=2x<1  %% huh?! #2
$\psi(x) = 2x < 1$ 
and if 
%12<x<1   %% huh?! #3
$\frac{1}{2} < x < 1$, 
%ψ(x)=2x−1  %% huh?! #4
$\psi(x) = 2x - 1$.
So for any 
%[a,b]⊂[0,1)  %% huh?! #5
$[a,b] \subset [ 0 , 1 )$, 
we separate 
%ψ−1([a,b])  %% huh?! #6
$\psi^{-1}([a,b])$ 
into two parts, i.e.,
\begin{align*}
\psi^{-1}( [ a , b ] ) \cap \bigl[0 , \tfrac{1}{2} \bigr) 
&=
\bigl\{ x \in [ 0 , 1 ) 
%\; \rvert \; 
\bigm\vert
0 < x < \tfrac{1}{2} 
%\; , \; 
,\ x \in
  \bigl[ \tfrac{a}{2} , \tfrac{b}{2}\bigr] \bigr\}
= \bigl[ \tfrac{a}{2} , \tfrac{b}{2}\bigr] 
\\
\psi^{-1}( [ a , b ] ) \cap \bigl(\tfrac{1}{2} , 1 \bigr) 
&= 
\bigl\{ x \in [ 0 , 1 ) 
%\; \rvert \;
\bigm\vert
\tfrac{1}{2} < x < 1 
%\; , \; 
,\ x \in
  \bigl[ \tfrac{1+a}{2} , \tfrac{1+b}{2}\bigr] \bigr\}
= \bigl[ \tfrac{1+a}{2} , \tfrac{1+b}{2}\bigr]
\end{align*}
Hence $\mu\bigl(\psi^{-1}([a,b])\bigr) =
\mu\bigl( \bigl[\frac{a}{2} , \frac{b}{2} \bigr]\bigr)
+ \mu\bigl(\bigl[\frac{1+a}{2} , \frac{1+b}{2}\bigr] \bigr) 
= b- a = \mu([b,a])$.

\end{document}
Related Question