1from apify_client import ApifyClient
2
3
4
5client = ApifyClient("<YOUR_API_TOKEN>")
6
7
8run_input = {
9 "latex": """\\documentclass[11pt]{article}
10\\usepackage[margin=2.5cm]{geometry}
11\\usepackage{amsmath,amssymb}
12\\usepackage{booktabs}
13\\usepackage{tikz}
14\\usepackage[colorlinks, allcolors=blue!60!black]{hyperref}
15\\begin{filecontents*}{refs.bib}
16@article{knuth1984,
17 author = {Donald E. Knuth},
18 title = {Literate Programming},
19 journal = {The Computer Journal},
20 year = {1984},
21 volume = {27},
22 pages = {97--111}
23}
24\\end{filecontents*}
25
26\\title{Compiling \\LaTeX{} in the Cloud}
27\\author{An AI Agent}
28\\date{October 2026}
29
30\\begin{document}
31\\maketitle
32
33\\begin{abstract}
34This short paper has equations, a table, a TikZ figure and a citation, all compiled to PDF by one API call.
35\\end{abstract}
36
37\\section{Results}
38The quadratic formula gives the roots of $ax^2 + bx + c = 0$:
39\\begin{equation}
40 x = \\frac{-b \\pm \\sqrt{b^2 - 4ac}}{2a}.
41 \\label{eq:quadratic}
42\\end{equation}
43Equation~\\eqref{eq:quadratic} has two real roots when $b^2 > 4ac$, as Table~\\ref{tab:cases} shows.
44
45\\begin{table}[h]
46 \\centering
47 \\begin{tabular}{lcc}
48 \\toprule
49 Case & Discriminant & Real roots \\\\
50 \\midrule
51 Two roots & $b^2 - 4ac > 0$ & 2 \\\\
52 One root & $b^2 - 4ac = 0$ & 1 \\\\
53 None & $b^2 - 4ac < 0$ & 0 \\\\
54 \\bottomrule
55 \\end{tabular}
56 \\caption{Roots of a quadratic equation.}
57 \\label{tab:cases}
58\\end{table}
59
60\\begin{figure}[h]
61 \\centering
62 \\begin{tikzpicture}[scale=0.8]
63 \\draw[->] (-3,0) -- (3,0) node[right] {$x$};
64 \\draw[->] (0,-1.5) -- (0,4) node[above] {$y$};
65 \\draw[thick, blue, domain=-2.2:2.2, samples=50] plot (\\x, {\\x*\\x - 1});
66 \\fill[red] (-1,0) circle (2pt) (1,0) circle (2pt);
67 \\end{tikzpicture}
68 \\caption{$y = x^2 - 1$ crosses the $x$-axis twice.}
69\\end{figure}
70
71Literate programming~\\cite{knuth1984} inspired documents that mix code and prose.
72
73\\bibliographystyle{plain}
74\\bibliography{refs}
75\\end{document}
76""",
77 "files": [],
78}
79
80
81run = client.actor("jumblemog/latex-to-pdf").call(run_input=run_input)
82
83
84print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
85for item in client.dataset(run.default_dataset_id).iterate_items():
86 print(item)
87
88