  We approximate $d$-variate periodic functions in weighted Korobov spaces with
general weight parameters using $n$ function values at lattice points. We do
not limit $n$ to be a prime number, as in currently available literature, but
allow any number of points, including powers of $2$, thus providing the
fundamental theory for construction of embedded lattice sequences. Our results
are constructive in that we provide a component-by-component algorithm which
constructs a suitable generating vector for a given number of points or even a
range of numbers of points. It does so without needing to construct the index
set on which the functions will be represented. The resulting generating vector
can then be used to approximate functions in the underlying weighted Korobov
space. We analyse the approximation error in the worst-case setting under both
the $L_2$ and $L_{\infty}$ norms. Our component-by-component construction under
the $L_2$ norm achieves the best possible rate of convergence for lattice-based
algorithms, and the theory can be applied to lattice-based kernel methods and
splines. Depending on the value of the smoothness parameter $\alpha$, we
propose two variants of the search criterion in the construction under the
$L_{\infty}$ norm, extending previous results which hold only for product-type
weight parameters and prime $n$. We also provide a theoretical upper bound
showing that embedded lattice sequences are essentially as good as lattice
rules with a fixed value of $n$. Under some standard assumptions on the weight
parameters, the worst-case error bound is independent of $d$.
