Python is a general-purpose, interpreted high-level programming language.

learn more… | top users | synonyms

3
votes
1answer
118 views

Command line SVG2TikZ

(Apologies if this is too far from topic, but I thought it might be of interest to some here) I am writing a makefile to take a bunch of SVGs that I have drawn and turn them into TikZ pictures via ...
5
votes
1answer
84 views

Latex \newcommand with python code inside

I'm extremely new to Latex. I'm using python package to insert graphics in a loop. What I can not understand is how I can transform this code \documentclass{article} \usepackage{python} ...
1
vote
1answer
46 views

HTML to LaTex: How can I use python and lxml to convert an html document to LaTeX with custom macros

I want to use python to take html5 documents with a known set of tags and convert them to LaTeX for high-quality printing using customized LaTeX macros.
0
votes
1answer
90 views

How to create pdf with latex?

Sorry about asking a stupid question. I'm just trying to use this, but don't know anything. My problem is: I want to plot graph with python code. I run it in terminal (I'm using mac) by calling: ...
17
votes
1answer
445 views

How to typeset programming code syntax with annotations?

If possible I would like to know how to this on latex/tikz to add this like (environment and graph) on my ebook. Thanks a lot!!! Code im trying to implement: \documentclass[11pt,fleqn]{book} ...
6
votes
1answer
672 views

MiKTeX and Perl scripts (and one Python script)

Again and again here on TeX.SX users of MiKTeX ask a question having a problem with a package or included program, where it turns out, that a Perl script is involved, in particular glossaries (because ...
14
votes
2answers
6k views

How to highlight Python syntax in LaTeX Listings \lstinputlistings command

I am using package listings to import my Python source code into my LaTeX document. I use the command \lstinputlistings. I have a Python source like class MyClass(Yourclass): def __init__(self, ...
2
votes
0answers
72 views

I can't get pythonTEX to work, too few arguments

I have tried to get the pythontex package to work in LaTeX but I get the typical(?) output, after I ran LaTeX, the python code and the LaTeX again. Then I found that I get "pythontex.py: error: too ...
4
votes
1answer
61 views

Pass (La)TeX-Length as function argument using pythontex

I'm trying to pass a LaTeX-Length (\textwidth) to a python function specified in an pyblock-environment provided by the pythontex-package. Running pythontex gives me an error message, that does not ...
2
votes
2answers
172 views

Plot theoretical Binomial distribution with pgfplots

I am trying to plot the theoretical binomial distribution with pgfplots but don't get the desired output: \documentclass{article} \usepackage{pgfplots} \usepackage{python} \begin{document} ...
4
votes
1answer
84 views

tcolorbox minted library with python3 non-determinism

Later versions of the package tcolorbox allows formatting source code with its minted library (which uses the minted package). When a document is compiled, a temporary file with extension .pyg is ...
0
votes
1answer
60 views

Python variables not accesible in pyconsole (PythonTeX)

This MWE is self explanatory: % Compile this with pdflatex -> pythontex.py -> pdflatex \documentclass[a6paper]{article} \usepackage{pythontex} \usepackage{geometry} \begin{document} ...
2
votes
2answers
269 views

Installation of pythontex

I am trying to install pythontex on Ubuntu 13.04. but cant find the way how. Downloaded ZIP from http://www.ctan.org/pkg/pythontex. Tried to follow instructions but unfortunately something went ...
1
vote
0answers
132 views

Cannot install pythontex

I have been trying to install pythontex on Windows 8 (64-bit) with MiKTeX installed. I have tried running "latex pythontex.ins" from the directory but it doesn't work. I have tried using the package ...
2
votes
1answer
170 views

Logbook for daily activity with automatic hour count [closed]

I am writing a logbook at work in which I note down when I started, left and how much of a break I took in between. I do this for every day, but I would like to use the result to display it in a table ...
0
votes
0answers
152 views

Installing Pythontex under windows

I have a newbie question. I want to install PythonTex. I am using TeXlive 2011 on windows OS. I do not know how to proceed. I read the PDF file in the directory, and searched the web for a ...
2
votes
1answer
251 views

How to define default 'program listing' title and parameters in Lyx

I'm using LyX software and need to embed python code snippets and the option I found is to put snippet in a file and then use: insert> file> Child Document ----> choose the snippet file ----> set ...
5
votes
1answer
199 views

python.sty on TeX Live 2013 - Forbidden to open for writing error

I have a fresh install of TeX Live 2013 and am attempting to compile a file using the python package. Here is the relevant portion of the file \begin{python} print 'hi' \end{python} I've compiled ...
0
votes
0answers
90 views

How to uncommand a piece of LaTeX document in plasTeX?

I need to get text and math expressions (ignoring tables, pictures and styling) from a set of LaTeX documents and represent them in html. Looks like plasTeX and MathJaX are enough for this task. As I ...
3
votes
1answer
162 views

String Formatting when using PythonTex

First of all, many thanks to Geoffrey Poore, the creator of PythonTex. PythonTeX is awesome. I am trying to use it for the first time and really like what it can do. I am having some trouble with ...
4
votes
1answer
297 views

Python code in LaTeX not running

I managed, thankfully with your help, to run python code in LaTeX. Unfortunately the code below is not running (simple commands like print "hi" are running). Could anybody tell me, what the problem ...
4
votes
1answer
186 views

Latex-Python combination not running on a mac

I am a beginner in Latex/Python and try to run the file below on my Mac (10.8.4 - latest MacTex). This is just a test file and it is not running. Python is running in the console and I have copied ...
3
votes
0answers
2k views

Programmatically generating LaTeX with Python [closed]

I'm fairly new to LaTeX and I want to generate some reports using Python. Here is some code that creates a simple table. After coding this up I began to wonder if there isn't a better way to do ...
4
votes
1answer
144 views

Preventing Ångström symbol being italicised in pythontex

I'm trying to make a plot in a tex document within pythontex and I set the label within pycode tags to be self.label = r'A: {0} B: {1:.0f}$\AA$'.format(self.aaa,self.bbb) I don't want the Ångström ...
1
vote
0answers
133 views

Font size change in svg included in pdflatex beamer document

I include an svg I created with matplotlib (see here how - at the bottom) using pyplot.savefig("test.svg") in my latex document. \documentclass{beamer} \usepackage{graphicx} \usepackage{svg} ...
5
votes
1answer
263 views

How to match cmyk colors between matplotlib and LaTeX

I'm plotting something using matplotlib and I'm using the matplotlib.cm.rainbow colormap. I need to match the same colors in my LaTeX document, but I'm having a difficult time making the colors match ...
3
votes
0answers
37 views

Matching cmyk colors in plot to LaTeX [duplicate]

I'm plotting something using the Python package matplotlib and I'm using the matplotlib.cm.rainbow colormap. I need to match the same colors in my LaTeX document, but I'm having a difficult time ...
12
votes
5answers
2k views

Using Python within LaTeX and accessing its variables

I have used the python package to include Python in my LaTeX document which works fine. I am trying to access the Python variables/calculations outside of \begin{python} ... \end{python}, without ...
5
votes
1answer
163 views

pythontex - reading data from a file

This is about a file location problem while using pythontex (which works great!) I have some python code within \begin{pylabblock} \end{pylabblock} where I am reading in data from a file in the ...
1
vote
1answer
92 views

Turn off syntax highlighting in minted?

How do I turn off syntax highlighting in minted? Defining my DSL with a CFG and then a PEG; and the syntax highlighting is getting in the way.
6
votes
1answer
204 views

Running a simple example with PythonTeX fails

Using the v 0.12 beta of PythonTeX I am trying to compile the following example: \documentclass[12pt]{scrartcl} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage{pythontex} ...
7
votes
1answer
271 views

PythonTeX: importing python files

I'm trying to import a personal python module using python tex, but pythontex doesn't find the module. My attempt: The LaTeX File: % !TEX TS-program = pythontex \documentclass[11pt]{article} ...
4
votes
2answers
1k views

Unable to use python.sty package

When compiling a .tex file that uses python.sty package and contains: \begin{python} ... \end{python} I keep getting an error: ./main.tex:33:I can't find file 'bin/main.py.out' \end{python} ...
2
votes
1answer
150 views

Configure TeXShop to run a script on the document before typesetting

Is it possible to configure TeXshop to automatically run a script on a document at the beginning of the typesetting process? I am interested in having the application run a python script on the ...
2
votes
1answer
144 views

LaTeX suddenly not working

I'm submitting my Ph.D. thesis in 2 days - everything has been working fine for the last 3 years...now I get this: Typesetting “Montgomery_MM_India_v21.tex”… Traceback (most recent call last): File ...
3
votes
0answers
133 views

minted creating garbage output on PDF file [closed]

Good Day, I'm using texlive 2013 which I updated today 20JULY13. When I attempt to compile my LaTeX file using only the most basic minted statements \begin{minted}{c} Test \end{minted} results in ...
6
votes
2answers
187 views

Does anyone know an easy way to produce a table with cells spanning multiple pages using latex? [closed]

I'm looking into the possibility of using latex for programmatically generating PDFs from templates with placeholders and some textual data. The current solution I have is based on reportlab, and it ...
21
votes
3answers
494 views

Best way to illustrate Keplers 2nd law with tikz

I am trying to visualize Keplers second law of planetary motion with tikz. I managed to do the following: \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture} ...
8
votes
3answers
2k views

LaTeX to HTML: PolyTeXnic and PlasTeX

I was stunned by the elegant appearance of the Tau manifesto page, for which the source is in LaTeX. The author used a home-made tool that he calls PolyTeXnic, but which he is not willing to release. ...
2
votes
1answer
123 views

PythonTeX - duplicate entry in .pytxcode file

I have started using pythontex with latex and have run into a situation where it appears that when the code is stripped out of the tex document there is some sort of numbering issue. Here is a ...
3
votes
1answer
222 views

Is there a PythonTex equivalent to \Sexpr{} in R?

I started to use the excellent PythonTex package to write reproducible reports but can't seem to get it to evaluate Python code inside a LaTeX command. R has Sweave & knitr which provide the ...
14
votes
1answer
686 views

Embedding Python in LaTeX - Hello example?

I found example of the using Python in LaTex, but unfortunately I have problem with it. Microsoft Windows [Version 6.2.9200] This is XeTeX, Version 3.1415926-2.5-0.9999.3 (MiKTeX 2.9 32 bit) ...
0
votes
1answer
144 views

pythontex3.py does not compile very simple xelatex file

I have the following environment LinuxMint 15 (which has python2.7 and 3.3 as part of its install. I installed Texlive, Texworks, Pygments for 2.7 and 3. Working with Texworks and creating xelatex ...
7
votes
2answers
188 views

Underscore in filenames in \textit{} imported from a python script

I'm trying to import the name of a result file from a python script and displaying it in the report. In the LaTeX template I have a bunch of variables defined as ${variablename}. The python script ...
11
votes
6answers
3k views

Generate LaTeX Truth Table with Python Cheetah

While looking for code which can automatically generate truth table in LaTeX I stumbled on this Python generator. It appears that the code can be used from Cheetah's framework. Can anybody point me to ...
1
vote
0answers
21 views

How to use \lstinline inside figure environment's caption argument [duplicate]

Here is the code that I have (I have removed parts which I think are not relevant): \documentclass[12pt]{article} \usepackage{listings} % Python style for highlighting ...
23
votes
7answers
2k views

What are the advantages of Lua over other scripting languages for a TeX implementation?

The question is inspired by Martin Schröder's answer to I am new to TeX. Should I use LaTeX, XeLaTeX, …? as well as my two previous questions on this forum: Automatic document update Generate LaTeX ...
16
votes
4answers
576 views

Calculate prices

I want to calculate prices in a LaTex file. This means I want to add two numbers with exactly 2 decimal places and I want to multiply these values by an integer. An other thing is the output format. ...
8
votes
2answers
611 views

Pythontex workflow with LyX

I've recently learned about PythonTeX (Conference presentation). It's a tool that lets you execute python code in your LaTeX documents. This is useful for, e.g., creating matplotlib figures inside ...
1
vote
1answer
244 views

PythonTeX texing problem

I am trying to play with PythonTeX package. Installation went smoothly on this machine running old TeXLive 2011. However when I try to pdflatex or lualatex example provided with installation ...