  The presence of a confining boundary can modify the local structure of a
liquid markedly. In addition, small samples of finite size are known to exhibit
systematic deviations of thermodynamic quantities relative to their bulk
values. Here, we consider the static structure factor of a liquid sample in
slab geometry with open boundaries at the surfaces, which can be thought of as
virtually cutting out the sample from a macroscopically large, homogeneous
fluid. This situation is a relevant limit for the interpretation of
grazing-incidence diffraction experiments at liquid interfaces and films. We
derive an exact, closed expression for the slab structure factor, with the bulk
structure factor as the only input. This shows that such free boundary
conditions cause significant differences between the two structure factors, in
particular at small wavenumbers. An asymptotic analysis of this result yields
the scaling exponent and an accurate, useful approximation of these finite-size
corrections. Furthermore, the open boundaries permit the interpretation of the
slab as an open system, supporting particle exchange with a reservoir. We
relate the slab structure factor to the particle number fluctuations and
discuss conditions under which the subvolume of the slab represents a grand
canonical ensemble with chemical potential $\mu$ and temperature $T$. Thus, the
open slab serves as a test-bed for the small-system thermodynamics in a $\mu T$
reservoir. We provide a microscopically justified and exact result for the size
dependence of the isothermal compressibility. Our findings are corroborated by
simulation data for Lennard-Jones liquids at two representative temperatures.
