7

I am writing a Python 2.7 program on Windows that generates LaTeX output.

I would like to make it able to generate PDF output from the LaTeX, but I have only limited leeway to install additional software (I can't install regular TeX distributions, but I can install Python packages with pip).

I would like to know:

  • Is there a LaTeX compiler in the form of a Python package?
  • If there is, where can I find it, and how can I use it to compile a Python string into a PDF file?

The generated LaTeX output is meant to be used with the regular latex or pdflatex.

projetmbc
  • 13,315
  • 7
    No, in reality, only latex can compile latex documents. Note that you generally does not need admin rights to install for example TeXLive. – daleif Jun 21 '17 at 11:15
  • 2
    If I remember, there is a portable version of MikTeX. Maybe could help you. – Sigur Jun 21 '17 at 11:37
  • 2
    If you are connected to the internet and can use a web browser then Cocalc, formerly known as Sagemath Cloud, will give you this ability to combine LaTeX with Python via the cloud--no packages to install. See, for example here. – DJP Jun 21 '17 at 12:50
  • 1
    There is a Python module to programmatically generate LaTeX documents. Of course this uses the regular LaTeX executable as a backend. https://pypi.python.org/pypi/PyLaTeX – Henri Menke Jun 22 '17 at 05:39

1 Answers1

0

Ok, try this:

  1. let Python create a latex document
  2. compile it via the DOS-Cmd shell into a pdf (check Latex doc how to do it)
  3. Python can also call shell commands, so just put the previous command into code
MS-SPO
  • 11,519
  • 4
    This doesn't really help I think, as the main problem here was that the OP couldn't really install a TeX distribution in the first place, and your method assumes that he already has installed one. – Torbjørn T. Jul 06 '21 at 18:45
  • Right, didn't get it. However, if Phyton install works, why shouldn't a distribution like MikTeX? I can run both. // Then there are remote alternatives, like this one http://aslushnikov.github.io/latex-online/ , self-administrated servers (see google with latex remote compile). // So what's the real problem? – MS-SPO Jul 06 '21 at 18:50
  • 2
    I don't know more than what's written in the question, but I would think this is not a personal computer, so the OP doesn't have the rights to install any type of software he wants. (Quite common for company computers and the like, I think.) Hence, an answer describing how to use such a remote alternative might very well be helpful, because that would tell the OP a way to circumvent such a limitation. – Torbjørn T. Jul 06 '21 at 19:04
  • @Nathan.Eilisha Shiraini , as you can see there is some confusion about why you can't install a regular *teX distribution. Is it technically, organizational, other? Please let us know :) – MS-SPO Jul 07 '21 at 14:17