LaTeX reader:  Better handling of figure and table with caption.

We now look for a \caption inside the environment; if one is
found, it is attached to the graphic or tabular found there.

Closes #1204.