We generalize the f(R) type gravity models by assuming that the
gravitational Lagrangian is given by an arbitrary function of the Ricci scalar
R and of the matter Lagrangian Lm. We obtain the gravitational field
equations in the metric formalism, as well as the equations of motion for test
particles, which follow from the covariant divergence of the energy-momentum
tensor. The equations of motion for test particles can also be derived from a
variational principle in the particular case in which the Lagrangian density of
the matter is an arbitrary function of the energy-density of the matter only.
Generally, the motion is non-geodesic, and takes place in the presence of an
extra force orthogonal to the four-velocity. The Newtonian limit of the
equation of motion is also considered, and a procedure for obtaining the
energy-momentum tensor of the matter is presented. The gravitational field
equations and the equations of motion for a particular model in which the
action of the gravitational field has an exponential dependence on the standard
general relativistic Hilbert--Einstein Lagrange density are also derived.Comment: 6 pages, no figures; minor modifications, references added; accepted
for publication in EPJ