Railway Act Article 57

Passengers riding on the train, shippers transporting freight, and recipients receiving freight shall abide by railway safety-related laws and regulations as well as instructions of personnel at the train station and on the train.Pedestrians and vehicles shall intrude neither into/onto railway routes, nor into places within depots or stations that are not designated for public use. However, for purposes of public access, crowd dispersal, tourism development, or other special purposes, where it is separately announced by railway institutions for non-electrified sections of railway routes, this restriction shall not apply.When pedestrians need to cross railway routes, they shall halt, look, listen, and then proceed with crossing only after ascertaining that no trains are approaching from either direction. However, electrified railway sections shall not be crossed except for at overpasses, underpasses, and railway-crossings.Livestock pasturing is strictly forbidden within the bordering slopes of railway routes and within five meters from the center of railway tracks.For a railway institution to make an announcement in accordance with the proviso in Paragraph 2, it must first report the cause, scope, time periods, and related supporting/management measures to the MOTC and receive approval from the MOTC before doing so. Modifications shall be conducted in the same manner.
中文原文 鐵路法第57條
旅客乘車、託運人託運貨物、受貨人領取貨物,應遵守鐵路有關安全法令及站、車人員之指導。
行人、車輛不得侵入鐵路路線及場、站區內非供公眾通行之處所。
但鐵路非電化區間基於民眾通行、疏散人潮、發展觀光或其他特殊需求,經鐵路機構另行公告之範圍,不在此限。
行人必須跨越鐵路路線時,應暫停、看、聽,注意兩方確無來車,始得通過。
但鐵路電化區間,除天橋、地下道及平交道外,不得跨越。
鐵路路線邊坡內及距軌道中心五公尺以內,嚴禁放牧牲畜。
鐵路機構依第二項但書規定公告前,應檢具原因、範圍、時段及相關配套管理措施,報經交通部同意後,始得為之;變更時,亦同。

English translation for reference only; the Chinese text prevails. Not legal advice.