Q:

Holding in an atmosphere primarily using a magnetic field

Assuming it was possible to create an artificial magnetic shield on the moon, would it be possible that a sufficiently powerful field could hold onto an atmosphere despite the low gravity.
Thanks

A:

Shorter answer: No. Magnetic fields don't hold electrically neutral gases and almost all of the gases in the atmosphere except ozone are electrically neutral. 
You'd have to come up with some other solution. 
Now, if you are talking about "the Moon" rather than a moon, I'm not sure that the gravity is too low to support some sort of atmosphere under the right circumstances. 
The Moon still has one-sixth of Earth gravity and an escape velocity of 2.38 km/s v. 11.2 km/s for Earth.
The moon has 85% of the gravity of Titan (which has a thick hydrocarbon atmosphere).
Chris in a prior stack exchange post (shit my apologies, I closed it before getting the link) noted that:

The escape velocity at the moon's surface is about 2.4 km/s. The mean
  speed of oxygen at 293 K is about 0.48 km/s.
A commonly quoted rule of thumb says that the escape velocity needs to
  be 6 times the gas's mean velocity in order for that gas to remain
  captive to gravity and the values I quoted are related by a factor of
  only 5. The air would contain water (since dry air is very
  uncomfortable to breath) and carbon dioxide (as a by-product if not
  also needed to sustain the cyanobacteria/plants you would want in
  place of planetary size mechanical carbon dioxide scrubbers, then
  there are the nutrients you would need to sustain those) which would
  readily exacerbate an atmospheric greenhouse effect and, with the moon
  being at about the same distance from the sun as is earth, you would
  expect the air to warm up to similar to earth temperatures, though
  without the moderating effect of oceans, and so cause the oxygen to
  dissipate. As nitrogen is lighter it's mean speed at the same temp is
  higher, v_rms something like 0.51 km/s IIRC, so it too would dissipate
  as would water vapour.
In short, it doesn't seem likely that it would be possible on the
  moon.

But, while everything he says is true, I think the conclusion doesn't follow automatically because 273 K and 760 mmHG pressure are not reasonable assumptions for the Moon. While the Moon's gravity could not sustain an atmosphere at close to room temperature on Earth, it could sustain a cooler atmosphere that was still warm enough to have gas form oxygen.
W = 3kT/2 where W is average kinetic energy, k is the boltzmann constant (=1.38x10^(-23) J/K or 8.617x10^(-5) eV/K) and T is temperature (K).
W = m*v^2/2 where m is the molecular mass and v is the average molecular speed. 
So basically temperature in kelvin is proportional to speed squared. To reduce speed to the 5/6th of Earth speed necessary to allow the Moon to hold an atmosphere, you need to reduce temperature to 25/36th of 273 K, which is about 190 K (i.e. about -83 °C). This is Antarctica winter cold, but not uninhabitable and is above the freezing and boiling points of oxygen.
The freezing point oxygen (O2) is 54.36 K (−218.79 °C) and the  boiling point of liquid oxygen is 90.19 K (−182.96 °C) at 101.325 kPa (760 mmHg).
The average temperature on the Moon (at the equator and mid latitudes) varies from -183 °C (about 90 K), at night to 106 °C (about 379 K) during the day, which is an average of 235 K, just a bit over our 190 K target. 
The existence of an atmosphere itself would probably buffer these extremes of temperature, preventing oxygen from going to liquid form a night, but the problem would be that the daytime temperature would cause the temperature to exceed escape velocity.
So, the real trick would be to see how to control the temperature on the Moon to prevent it from rising above 190 K or below 95 K or so. Thus the real issue is how to prevent about 50% of the solar energy that currently reaches the Moon in the daytime from doing so, ideally in a manner that shifts that solar energy to the night. The most obvious way to do that would be to get high winds going from the light side to the dark side at a sufficient speed. 
On Earth, the distances are too great to accomplish this, but the lunar day is much longer (29 days, 12 hours and 44 minutes) and the Moon's circumference is about a quarter of the Earth's. So, if you could get winds going strong in the atmosphere and reduce the average amount of solar energy penetrating the atmosphere by about 20% plus a little more for a buffer (perhaps by somehow increasing its albedo, e.g. with the right kind of clouds perhaps by inserting water vapor or some other highly reflective colored gas), you could get a stable atmosphere on the Moon. It would have to be very cold, but it could otherwise work.
So, rather than magnetic fields, you might need vaporizers to create clouds and fans to keep the air circulating fast enough, rather than any kind of artificial magnetic field.

A:

As others have pointed out, a magnetic field does you no good with most gasses as they are no electrically charged. 
However, you do not need a magnetic field to hold an atmosphere on the moon. The moon's gravity is sufficient. The proof of this is that Titan, which has a lower surface gravity than the moon, has a denser atmosphere than Earth. In addition, Titan's atmosphere is primarily nitrogen, the same primary component of Earth's atmosphere. Titan is even able to hold onto helium and hydrogen, which despite being the lightest gas there is and the most likely to escape into space, still has a concentration of 1000 ppm on Titan. 
Now there are definately geochemical processes on Titan that we do not understand yet which are contributing to this atmosphere, so I imagine that the moon would not hold an atmosphere indefinitely, but assuming human action is taken to put an atmosphere on the moon, that same atmosphere could plausibly be maintained on the moon. 

