Continuous injective function that fails to map open sets to open sets I'm studying metric spaces and have just proved that continuous maps preserve open sets under pre-image. The book I'm learning from says to beware of what this theorem does not say: that a continuous map sends the forward image of an open set to an open set.
I found these counterexamples:

*

*any constant map $f:\mathbb{R}\to \mathbb{R}$. Since singletons are closed in $\mathbb{R}$ under usual metric.

*$f:\mathbb{R}\to \mathbb{R}$; $f(x)=x^2$, since $f((-1,1))=[0,1)$ but $[0,1)$ is not open in $\mathbb{R}$.

Reflecting on these it seems that both fail to be injective. So I have been trying to find a continuous injective function that fails to map forward open sets to open sets but am at a loss. Any ideas?

Consider $f:\Bbb R\to\Bbb R^2$, $x\mapsto(x,0)$.
$\Bbb R$ is open in $\Bbb R$ but $f(\Bbb R)$ is not open in $\Bbb R^2$, and $f$ is certainly a continuous injection (be careful: if you change the domain to $\Bbb R\times\{0\}$ as a subspace of $\Bbb R^2$, then $f$ is open!)
N.B. If you only deal with Euclidean spaces, you will find no counterexamples where $f:A\to B$ has $A$ a closed and bounded subset of $\Bbb R^n$ for compactness reasons. You can use reasoning like this to deduce Eric's comment that any continuous injection $\Bbb R\to\Bbb R$ is also open.
