As far as i know, there is no law stating it is illegal, not even civil.
Really, I know of several H&S laws, conduct laws and railway by-laws?
Here is a simplified version of them regarding conduct for railway by-laws.
http://www.dft.gov.uk/pgr/rail/legislation/regs/railwaysbyelaws
6. Unacceptable behaviour
(1) No person shall use any threatening, abusive, obscene or offensive language on the railway.
(2) No person shall behave in a disorderly, indecent or offensive manner on the railway.
Criminal Justice and Public Order Act 1994
Offence of causing intentional harassment, alarm or distress
In Part I of the [1986 c. 64.] Public Order Act 1986 (offences relating to public order), after section 4, there shall be inserted the following section—
“4A Intentional harassment, alarm or distress
(1) A person is guilty of an offence if, with intent to cause a person harassment, alarm or distress, he—
(a) uses threatening, abusive or insulting words or behaviour, or disorderly behaviour, or
(b) displays any writing, sign or other visible representation which is threatening, abusive or insulting,
thereby causing that or another person harassment, alarm or distress.
(2) An offence under this section may be committed in a public or a private place, except that no offence is committed where the words or behaviour are used, or the writing, sign or other visible representation is displayed, by a person inside a dwelling and the person who is harassed, alarmed or distressed is also inside that or another dwelling.
(3) It is a defence for the accused to prove—
(a) that he was inside a dwelling and had no reason to believe that the words or behaviour used, or the writing, sign or other visible representation displayed, would be heard or seen by a person outside that or any other dwelling, or
(b) that his conduct was reasonable.
(4) A constable may arrest without warrant anyone he reasonably suspects is committing an offence under this section.
(5) A person guilty of an offence under this section is liable on summary conviction to imprisonment for a term not exceeding 6 months or a fine not exceeding level 5 on the standard scale or both.”.
http://www.legislation.gov.uk/acts/acts1994/ukpga_19940033_en_17#pt12-pb3-l1g154
and some more laws
ENDANGERING SAFETY
There are two levels of offence within the Offences Against the Person Act of 1861. Both relate to an act or omission which causes the safety of persons using or working on the railway to be endangered.
If committed by neglect it is punishable by a maximum of 2 years imprisonment.
If committed with intent the maximum penalty is life imprisonment.
http://www.trackoff.org/crime.htm