let mlpost_gen includegraphics ?(mode = mode) ?file f =
let file = match file with
| None -> next_name ()
| Some file -> file
in
let ext = match mode with
| `Pdf -> ".mps"
| `Ps -> ".1"
| `Cairo -> ".pdf"
| `Mps -> ".mps"
in
let full_name = file ^ ext in
Mlpost.Metapost.emit file f;
includegraphics (Latex.text full_name)