Fix bugs in figure tag. Add optional gridsingle attribute, for use of single images in multifigure layouts.