Something I have found, over many years to be very reliable, (recently successfully used on foam) uses exterior latex house paint with flextrack.
The method holds well but may be pried loose with good results--better than glue.
(ALWAYS WASH RAILS and TURNOUTS WITH 409 or SIMILAR, DRYING THOROUGHLY BEFORE STARTING PAINT.)
Use pencil or similar to outline route and paint between lines.
Ahead of time, I use boxcar red on the rails and when set, dry brush grey over the rails and ties.
Place roadbed over freshly painted surface (I use paint near the color of the earth surroundings) and hold with pushpins until dry --- give it an hour or so.
Paint your roadbed as nearly as possible to the color of the ballast you will use. While paint is wet, lay your pre-painted track, holding temporarily with push pins.
I ballast most of my mainline in the conventional manner (wet water and 50/50 glue after the paint has set) and after rubbing the rail tops clean with a dry cloth.
An exception is made on turnouts for which I use a slightly different method to prevent later problems.