In mathematics, a relatively compact subspace (or relatively compact subset, or precompact) Y of a topological space X is a subset whose closure is compact.
Since closed subsets of a compact space are compact, every subset of a compact space is relatively compact. In the case of a metric topology, or more generally when sequences may be used to test for compactness, the criterion for relative compactness becomes that any sequence in Y has a subsequence convergent in X.
Some major theorems characterise relatively compact subsets, in particular in function spaces. An example is the Arzelà–Ascoli theorem. Other cases of interest relate to uniform integrability, and the concept of normal family in complex analysis. Mahler's compactness theorem in the geometry of numbers characterises relatively compact subsets in certain non-compact homogeneous spaces (specifically spaces of lattices).
The definition of an almost periodic function F at a conceptual level has to do with the translates of F being a relatively compact set. This needs to be made precise in terms of the topology used, in a particular theory.
As a counterexample take any neighbourhood of the particular point of an infinite particular point space. The neighbourhood itself may be compact but is not relatively compact because its closure is the whole non-compact space.