handle objects which respond to to_html and to_latex