We find the exact finite size and lattice corrections, to the partition function
Z, of a continuous spin Gaussian model on a toroidal triangular lattice, with periods
L0 and
L1. The spins carry a representation of the fundamental group of the torus labeled by
u0 and
u1 and a mass
m. Summing ${Z}^{\ensuremath{-}1/2}$ over
ui gives the corresponding result for the Ising model. The limits $m\ensuremath{\rightarrow}0$ and ${u}_{i}\ensuremath{\rightarrow}0$ do not commute. With
m=0 and
ui nonzero the model exhibits a vortex critical phase. In the continuum limit, for arbitrary
m, the finite size corrections to $\ensuremath{-}\mathrm{ln}Z$ are modular invariant. In the limit ${L}_{1}\ensuremath{\rightarrow}\ensuremath{\infty}$ the ``cylinder charge''
c(u0,m2L02) ranges nonmonotonically from $2[{1+6u}_{0}({u}_{0}\ensuremath{-}1)]$ for
m=0 to zero for $m\ensuremath{\rightarrow}\ensuremath{\infty}$.
We present the finite-size scaling theory of one-dimensional quantum critical systems in the presence of boundaries. While the finite-size spectrum in the conformal limit, namely of a conformal field theory with conformally invariant boundary conditions, is related to the dimensions of boundary operators by Cardy, the actual spectra of lattice models are affected by both bulk and boundary perturbations and contain non-universal boundary energies. We obtain a general expression of the finite-size energy levels in the presence of bulk and boundary perturbations. In particular, a generic boundary perturbation related to the energy-momentum tensor gives rise to a renormalization of the effective system size. We verify our field-theory formulation by comparing the results with the exact solution of the critical transverse-field Ising chain and with accurate numerical results on the critical three-state Potts chain obtained by Density-Matrix Renormalization Group.