Code Monkey home page Code Monkey logo

pyptex's Introduction

PypTeX: the Python Preprocessor for TeX

Author: Sébastien Loisel

PypTeX is the Python Preprocessor for LaTeX. It allows one to embed Python code fragments in a LaTeX template file.

An example plot with PypTeX

Installation

pip install pyptex

  1. You will also need a LaTeX installation, and the default LaTeX processor is pdflatex.
  2. You need a Python 3 installation.

Hello, world

Put the following in example.tex:

\documentclass{article}
@{from sympy import *}
\begin{document}
$$\int x^3\,dx = @{S('integrate(x^3,x)')}+C$$
\end{document}

The command pyptex example.tex will generate example.pdf and an intermediary pure-LaTeX file example.pyptex. The resulting PDF can be found here

  • The pyptex executable tries to locate the Python 3 executable using /usr/bin/env python3. If this is causing you problems, try python -u -m pyptex example.tex instead.

Slightly bigger examples

  • 2d and 3d plotting tex | pdf
  • Matrix inverse exercise tex | pdf
  • The F19NB handout for numerical linear algebra at Heriot-Watt university is generated with PypTeX. pdf

TeXShop

If you want to use TeXShop on Mac, put the following into ~/Library/TeXShop/Engines/pyptex.engine and restart TeXShop:

#!/bin/bash
pyptex $1

Documentation

Detailed documentation can be found here

pyptex's People

Contributors

hliam avatar sloisel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pyptex's Issues

Asking questions

Hi! I saw this program on reddit r/math and I tried to use this by the example, this is a great program! However, I want to ask a few quesitons:

  • I am a neovim/vim user, is it possible to integrate pyptex into latexmk or pdflatex so that the users can have a better experience by using pyptex along with the current editor extensions?
  • When I execute pyptex, there would be a folder called {$filename}-generated. If I try to write a lot of documents it would be annoying. Is it possible to add other configurations so that the pictures generated by the program would be put in a certain place (like ~/Pictures)? Thank you!

This is a test feature request

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.