class_docstr: Convert strings to dvi files using TeX, caching the results to a directory.
  
  The cache directory is called ``tex.cache`` and is located in the directory
  returned by `.get_cachedir`.
  
  Repeated calls to this constructor always return the same instance.
class_docstr_tok: ["Convert","strings","to","dvi","files","using","TeX",",","caching","the","results","to","a","directory",".","The","cache","directory","is","called","``","tex.cache","``","and","is","located","in","the","directory","returned","by","`",".get_cachedir","`",".","Repeated","calls","to","this","constructor","always","return","the","same","instance","."]
docstr: Generate a dvi file containing latex's layout of tex string.
  
  Return the file name.
docstr_tok: ["Generate","a","dvi","file","containing","latex","'s","layout","of","tex","string",".","Return","the","file","name","."]
code: def make_dvi(cls, tex, fontsize):
      """
      Generate a dvi file containing latex's layout of tex string.
  
      Return the file name.
      """
      basefile = cls.get_basefile(tex, fontsize)
      dvifile = "%s.dvi" % basefile
      if not os.path.exists(dvifile):
          texfile = Path(cls.make_tex(tex, fontsize))
          # Generate the dvi in a temporary directory to avoid race
          # conditions e.g. if multiple processes try to process the same tex
          # string at the same time.  Having tmpdir be a subdirectory of the
          # final output dir ensures that they are on the same filesystem,
          # and thus replace() works atomically.  It also allows referring to
          # the texfile with a relative path (for pathological MPLCONFIGDIRs,
          # the absolute path may contain characters (e.g. ~) that TeX does
          # not support; n.b. relative paths cannot traverse parents, or it
          # will be blocked when `openin_any = p` in texmf.cnf).
          cwd = Path(dvifile).parent
          with TemporaryDirectory(dir=cwd) as tmpdir:
              tmppath = Path(tmpdir)
              cls._run_checked_subprocess(
                  [
                      "latex",
                      "-interaction=nonstopmode",
                      "--halt-on-error",
                      f"--output-directory={tmppath.name}",
                      f"{texfile.name}",
                  ],
                  tex,
                  cwd=cwd,
              )
              (tmppath / Path(dvifile).name).replace(dvifile)
      return dvifile
  
imports: import functools
  import hashlib
  import logging
  import os
  from pathlib import Path
  import subprocess
  from tempfile import TemporaryDirectory
  import numpy
  import matplotlib
  from matplotlib import _api, cbook, dviread
label_desc: Use image node_id 10 for calling the TexManager obj's underlying member method code with example usage: obj.make_dvi(cls, tex, fontsize) and returns: dvifile