public function createFile()
    {
        $tmpfile = $this->tmpDir . '/' . $this->hash . '.tex';

        $tex = '\documentclass[12pt]{article}'."\n";
        
        $tex .= '\usepackage[utf8]{inputenc}'."\n";

        // Packages
        foreach ($this->packages as $package) {
            $tex .= '\usepackage{' . $package . "}\n";
        }
        
        $tex .= '\begin{document}'."\n";
        $tex .= '\pagestyle{empty}'."\n";
        $tex .= '\begin{displaymath}'."\n";
        
        $tex .= $this->formula."\n";
        
        $tex .= '\end{displaymath}'."\n";
        $tex .= '\end{document}'."\n";

        if (file_put_contents($tmpfile, $tex) === false) {
            throw new \Exception('Failed to open target file');
        }
    }
public function createFile()
    {
        $tmpfile = $this->tmpDir . '/' . $this->hash . '.tex';

        $tex = '\documentclass[12pt]{article}'."\n";
        
        $tex .= '\usepackage[utf8]{inputenc}'."\n";

        // Packages
        foreach ($this->packages as $package) {
            $tex .= '\usepackage{' . $package . "}\n";
        }
        
        $tex .= '\begin{document}'."\n";
        $tex .= '\pagestyle{empty}'."\n";
        $tex .= '\begin{displaymath}'."\n";
        
        $tex .= $this->formula."\n";
        
        $tex .= '\end{displaymath}'."\n";
        $tex .= '\end{document}'."\n";

        if (file_put_contents($tmpfile, $tex) === false) {
            throw new \Exception('Failed to open target file');
        }
    }
public function createFile ( ) { $ tmpfile = $ this -> tmpDir . '/' . $ this -> hash . '.tex' ; $ tex = '\documentclass[12pt]{article}' . "\n" ; $ tex .= '\usepackage[utf8]{inputenc}' . "\n" ; // Packages foreach ( $ this -> packages as $ package ) { $ tex .= '\usepackage{' . $ package . "}\n" ; } $ tex .= '\begin{document}' . "\n" ; $ tex .= '\pagestyle{empty}' . "\n" ; $ tex .= '\begin{displaymath}' . "\n" ; $ tex .= $ this -> formula . "\n" ; $ tex .= '\end{displaymath}' . "\n" ; $ tex .= '\end{document}' . "\n" ; if ( file_put_contents ( $ tmpfile , $ tex ) === false ) { throw new \ Exception ( 'Failed to open target file' ) ; } }
Create the LaTeX file
Create the LaTeX file