blob: ccd9dabb570018b9777d4b335f540ccc6332a46d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
<?php
// compileLatex.php
// contenu
$codeLaTeX = '\documentclass{article}
\usepackage[francais]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\begin{document}
Bravo, ça compile !!
\end{document}';
// ficher tex
// regarder la doc, php-cli permettrait de manipuler les fichiers directement comme le bash
$fichier = fopen("latex.tex", "w+");
fputs($fichier, $codeLaTeX);
fclose($fichier);
// compilation
exec('pdflatex latex.tex');
// nettoyage
unlink("latex.aux");
unlink("latex.log");
unlink("latex.tex");
exec('xdg-open latex.pdf');
|