Would a person gain or lose weight after expelling a flatus? Considering the chemical composition, mass, and pressure range of typical human flatulence, would a person gain or lose weight after passing gas?
 A: I assume you ask this because you want to know if a fart's mass contribution to body weight can be offset by its lighter-than-air property, if any.
According to About.com the typical composition of human flatulence is as follows. I added the molar mass of each component, as the density of a gas determines whether it's heavier or lighter than air:
\begin{array}{l|cr}
\hline
\text{Component} & \text{Fraction (%)} && \text{Molar mass (g/mol)} \\
\hline
\text{Nitrogen}~\mathrm{N_2} & 20-90\% && \approx 28 \\
\text{Hydrogen}~\mathrm{H_2} & 0-50\% & \text{(flammable)} & \approx 2 \\
\text{Carbon dioxide}~\mathrm{CO_2} & 10-30\% && \approx 44 \\
\text{Oxygen}~\mathrm{O_2} & 0-10\% && \approx 32 \\
\text{Methane}~\mathrm{CH_4} & 0-10\% & \text{(flammable)} & \approx 16 \\
\hline
\end{array}
We must make some assumptions within the above guidelines about the exact composition of the fart, and then we can compute the weighted molar mass of a fart and compare it with the molar mass of air.
Assuming a flatus composition of nitrogen $50\%$, hydrogen $20\%$, carbon dioxide $20\%$, oxygen $5\%$, and methane $5\%$, the molar mass of flatus is about $25\,\rm g/mol$, if my math is correct to two significant figures.  As the molar mass of air is about $29\,\rm g/mol$, you would be heavier after you expel flatus, provided that you do not build enough internal pressure to reduce the density of the flatus to any significant extent before it is expelled.
However, as the difference in density between flatus and air is only about $4\,\rm g/mol$, there is probably enough pressure inside you to reduce the added buoyancy of flatus inside you to about nil, so there probably would be no change in your weight before and after farting.
A: The question comes down to buoyancy: is the mass of the flatus inside the body divided by its volume less than or greater than the mass of an equal volume of atmospheric air?
To answer this we need to look at the density of atmospheric air, as well as the density of flatus. Let's start with the atmosphere. We usually see the density of air quoted as 1.2 kg/m3, but of course this varies with temperature and pressure. We can take out the pressure factor as we will assume that variations in atmospheric pressure are reflected in equal variations in pressure inside the body. But the external temperature is a real factor: air at 5°C is quite a bit more dense than air at 35°C - by about 11%.  See this online calculator or just use the ideal gas law for an approximation.
The density of flatus inside the body is a function of the composition and the temperature / pressure. The composition is a function of the processes in your gut - what you eat, and what bacteria you have. There is remarkable variability - see for instance this detailed book chapter. Quoting:

Only one out of three adults consistently possesses the strictly anaerobic bacteria capable of producing significant quantities of methane

Other bacterial processes can produce hydrogen and carbon dioxide. Methane (16) and hydrogen (2) have a much lower atomic mass than atmospheric air (mean ~ 29); carbon dioxide (44) is the only one that is significantly greater.
A diagram of the various processes is found here:

Most of the hydrogen produced is absorbed into the blood stream and exhaled - which is why breath analysis can be used to look at the state of health of the gut. Whether methane is present in significant quantities or not at all depends on your gut flora. 
The pressure inside the colon has been measured. According to the "The Ascrs Textbook of Colon And Rectal Surgery", the maximum squeeze pressure in a man can be as high as 266 mm Hg - almost 1/3 of an atmosphere. That is not enough to offset the lower density of hydrogen or methane.
So, as is often the case, the answer is "it depends". If you have the bacteria to generate methane, you will get heavier after expelling a flatus. If you produce mostly carbon dioxide, you will get lighter.
If you used the composition proposed by @Ernie, and did the math correctly, the molar mass would be 0.5*28+0.2*2+0.2*44+0.05*32+0.05*16 = 26 - just less than the density of air. But even moderate pressure (much less than the 266 mm Hg quoted above) would be sufficient to push the density above that of atmospheric air, even taking account of the difference in temperature. At which point you would be lighter after relieving yourself.
A: It has to be at a higher pressure than atmosphere to escape.  The anus could not hold a large pressure differential so it could only be small pressure difference.  Flatulence is mainly methane that is lighter than the average components of air on earth so I think heavier.
