What is the minimum distance required between handrail posts and opposite wall?
This answer depends on where you are in the world and if you are in the USA what state you live in.

Section R311.7.1 IRC 2009:

Stairways shall not be less than 36 inches (914 mm) in clear 
width at all points above the permitted handrail height and 
below  the  required  headroom  height.  Handrails  shall  not  project  more  than  4.5  inches  (114  mm)  on  either  side  of  the
stairway  and  the  minimum  clear  width  of  the  stairway  at  and  below  the  handrail  height,  including  treads  and  landings, shall not be less than 31.5 inches (787 mm) where a handrail is installed on one side and 27 (698 mm) where handrails are provided on both sides. 
Exception:
 The width of spiral stairways shall be in accordance with Section R311.5.8. 

Above snippet from:
http://www.co.stevens.wa.us/landservices/documents/STAIRWAYSECTION.pdf