  A rank-adaptive integrator for the dynamical low-rank approximation of matrix
and tensor differential equations is presented. The fixed-rank integrator
recently proposed by two of the authors is extended to allow for an adaptive
choice of the rank, using subspaces that are generated by the integrator
itself. The integrator first updates the evolving bases and then does a
Galerkin step in the subspace generated by both the new and old bases, which is
followed by rank truncation to a given tolerance. It is shown that the adaptive
low-rank integrator retains the exactness, robustness and symmetry-preserving
properties of the previously proposed fixed-rank integrator. Beyond that, up to
the truncation tolerance, the rank-adaptive integrator preserves the norm when
the differential equation does, it preserves the energy for Schr\"odinger
equations and Hamiltonian systems, and it preserves the monotonic decrease of
the functional in gradient flows. Numerical experiments illustrate the
behaviour of the rank-adaptive integrator.
