original_string: function construct_latex_document( $formula, $fontsize=12 ) {
              global $CFG;
  
              $formula = filter_tex_sanitize_formula($formula);
  
              // $fontsize don't affects to formula's size. $density can change size
              $doc =  "\\documentclass[{$fontsize}pt]{article}\n";
              $doc .= get_config('filter_tex', 'latexpreamble');
              $doc .= "\\pagestyle{empty}\n";
              $doc .= "\\begin{document}\n";
  //dlnsk            $doc .= "$ {$formula} $\n";
              if (preg_match("/^[[:space:]]*\\\\begin\\{(gather|align|alignat|multline).?\\}/i",$formula)) {
                 $doc .= "$formula\n";
              } else {
                 $doc .= "$ {$formula} $\n";
              }
              $doc .= "\\end{document}\n";
              return $doc;
          }
code: function construct_latex_document( $formula, $fontsize=12 ) {
              global $CFG;
  
              $formula = filter_tex_sanitize_formula($formula);
  
              // $fontsize don't affects to formula's size. $density can change size
              $doc =  "\\documentclass[{$fontsize}pt]{article}\n";
              $doc .= get_config('filter_tex', 'latexpreamble');
              $doc .= "\\pagestyle{empty}\n";
              $doc .= "\\begin{document}\n";
  //dlnsk            $doc .= "$ {$formula} $\n";
              if (preg_match("/^[[:space:]]*\\\\begin\\{(gather|align|alignat|multline).?\\}/i",$formula)) {
                 $doc .= "$formula\n";
              } else {
                 $doc .= "$ {$formula} $\n";
              }
              $doc .= "\\end{document}\n";
              return $doc;
          }
code_tokens: function construct_latex_document ( $ formula , $ fontsize = 12 ) { global $ CFG ; $ formula = filter_tex_sanitize_formula ( $ formula ) ; // $fontsize don't affects to formula's size. $density can change size $ doc = "\\documentclass[{$fontsize}pt]{article}\n" ; $ doc .= get_config ( 'filter_tex' , 'latexpreamble' ) ; $ doc .= "\\pagestyle{empty}\n" ; $ doc .= "\\begin{document}\n" ; //dlnsk            $doc .= "$ {$formula} $\n"; if ( preg_match ( "/^[[:space:]]*\\\\begin\\{(gather|align|alignat|multline).?\\}/i" , $ formula ) ) { $ doc .= "$formula\n" ; } else { $ doc .= "$ {$formula} $\n" ; } $ doc .= "\\end{document}\n" ; return $ doc ; }
docstring: Turn the bit of TeX into a valid latex document
  @param string $forumula the TeX formula
  @param int $fontsize the font size
  @return string the latex document
docstring_tokens: Turn the bit of TeX into a valid latex document