  Titanium dioxide (TiO$_2$) presents a long-standing challenge for approximate
Kohn-Sham density-functional theory (KS-DFT), as well as to its
Hubbard-corrected extension, DFT+$U$. We find that a previously proposed
extension of first-principles DFT+$U$ to incorporate a Hund's $J$ correction,
termed DFT+$U$+$J$, in combination with parameters calculated using a recently
proposed linear-response theory, predicts fundamental band-gaps accurate to
well within the experimental uncertainty in rutile and anatase TiO$_2$. Our
approach builds upon established findings that Hubbard correction to both
titanium $3d$ and oxygen $2p$ subspaces in TiO$_2$, symbolically giving
DFT+$U^{d,p}$, is necessary to achieve acceptable band-gaps using DFT+$U$. This
requirement remains when the first-principles Hund's $J$ is included. We also
find that the calculated gap depends on the correlated subspace definition even
when using subspace-specific first-principles $U$ and $J$ parameters. Using the
simplest reasonable correlated subspace definition and underlying functional,
the local density approximation, we show that high accuracy results from using
a relatively uncomplicated form of the DFT+$U$+$J$ functional. For closed-shell
systems such as TiO$_2$, we describe how various DFT+$U$+$J$ functionals reduce
to DFT+$U$ with suitably modified parameters, so that reliable band gaps can be
calculated for rutile and anatase with no modifications to a conventional
DFT+$U$ code.
