'generates a dvi file containing latex\'s layout of tex string
returns the file name'

def make_dvi(self, tex, fontsize):

    if rcParams[u'text.latex.preview']:
        return self.make_dvi_preview(tex, fontsize)
    basefile = self.get_basefile(tex, fontsize)
    dvifile = (u'%s.dvi' % basefile)
    if (DEBUG or (not os.path.exists(dvifile))):
        texfile = self.make_tex(tex, fontsize)
        command = [str(u'latex'), u'-interaction=nonstopmode', os.path.basename(texfile)]
        mpl.verbose.report(command, u'debug')
        with Locked(self.texcache):
            try:
                report = subprocess.check_output(command, cwd=self.texcache, stderr=subprocess.STDOUT)
            except subprocess.CalledProcessError as exc:
                raise RuntimeError((u'LaTeX    was    not    able    to    process    the    following    string:\n%s\n\nHere    is    the    full    report    generated    by    LaTeX:\n%s    \n\n' % (repr(tex.encode(u'unicode_escape')), exc.output.decode(u'utf-8'))))
            mpl.verbose.report(report, u'debug')
        for fname in glob.glob((basefile + u'*')):
            if fname.endswith(u'dvi'):
                pass
            elif fname.endswith(u'tex'):
                pass
            else:
                try:
                    os.remove(fname)
                except OSError:
                    pass
    return dvifile
