  Given a positive integer $M$ and a real number $q >1$, a \emph{$q$-expansion}
of a real number $x$ is a sequence $(c_i)=c_1c_2\cdots$ with $(c_i) \in
\{0,\ldots,M\}^\infty$ such that \[x=\sum_{i=1}^{\infty} c_iq^{-i}.\]
  It is well known that if $q \in (1,M+1]$, then each $x \in
I_q:=\left[0,M/(q-1)\right]$ has a $q$-expansion. Let
$\mathcal{U}=\mathcal{U}(M)$ be the set of \emph{univoque bases} $q>1$ for
which $1$ has a unique $q$-expansion.
  The main object of this paper is to provide new characterizations of
$\mathcal{U}$ and to show that the Hausdorff dimension of the set of numbers $x
\in I_q$ with a unique $q$-expansion changes the most if $q$ "crosses" a
univoque base.
  Denote by $\mathcal{B}_2=\mathcal{B}_2(M)$ the set of $q \in (1,M+1]$ such
that there exist numbers having precisely two distinct $q$-expansions. As a
by-product of our results, we obtain an answer to a question of Sidorov (2009)
and prove that \[\dim_H(\mathcal{B}_2\cap(q',q'+\delta))>0\quad\textrm{for
any}\quad \delta>0,\] where $q'=q'(M)$ is the Komornik-Loreti constant.
