We propose a general formalism to study the static properties of a system c
omposed of particles with nearest neighbor interactions that are located on
the sites of a one-dimensional lattice confined by walls ("confined Takaha
shi lattice gas"). Linear recursion relations for generalized partition fun
ctions are derived, from which thermodynamic quantities, as well as density
distributions and correlation functions of arbitrary order can be determin
ed in the presence of an external potential. Explicit results for density p
rofiles and pair correlations near a wall are presented for various situati
ons. As a special case of the Takahashi model we consider in particular the
hard rod lattice gas, for which a system of nonlinear coupled difference e
quations for the occupation probabilities has been presented by Robledo and
Varea. A solution of these equations is given in terms of the solution of
a system of independent linear equations. Moreover, for zero external poten
tial in the hard-rod system we specify various central regions between the
confining walls, where the occupation probabilities are constant and the co
rrelation functions are translationally invariant in the canonical ensemble
. In the grand canonical ensemble such regions do not exist.