Linked Questions
14 questions linked to/from How to highlight Python syntax in LaTeX Listings \lstinputlistings command
10
votes
1answer
13k views
Listings: syntax for literate
In the documentation for the listings package it says:
literate = [*]<replacement item>. . .<replacement item>
First note that there are no commas between the items. Each item
...
4
votes
2answers
5k views
Beautifully format text of an external document
I have some formatted long text files looking like this:
f=50 k_max=420
Iteration Func-count min f(x) Procedure
0 1 7.07212e-09
1 2 ...
3
votes
1answer
7k views
Problem with listings package for Python syntax coloring
I am implementing the method I learned here for putting Python code in Latex. Everything works great except that I have problems with comments. Here's the code from the link I mentioned:
\usepackage[...
9
votes
3answers
1k views
How to keep indentations in Python code copied from LaTeX PDF?
I tried to include Python 3.6 code in a LaTeX PDF document which should be easily be copied to save to a file or to try the Python code.
Although,
\begin{verbatim}
for row in range(1,9):
for col ...
3
votes
1answer
2k views
Listings: recognize numbers and `1e-3`
This is a follow up question. Have a look at this one:
Listings: syntax for literate
with the solution by karlkoeller
%Minimal
\documentclass[]{report}
\usepackage[utf8]{inputenc}
\usepackage[...
1
vote
1answer
1k views
get spyder-like color highlighting in pythontex
In my work with Python 3.4, I use spyder (anaconda3 2.0.1) and I like the highlighting of the Spyder editor (version 2.3).
Is it possible to have the same highlighting scheme in latex documents ...
0
votes
1answer
2k views
Python code block outside of margin
I want to include some Python code to my Latex document. I have read this Tex Stackexchange question and added the following code to get syntax highlights:
\usepackage{color}
\DeclareFixedFont{\ttb}{...
0
votes
2answers
1k views
How to put a list of code in appendix?
I want to put a code in my thesis appendix.
print('This sentence is output to the screen')
# Output: This sentence is output to the screen
a = 5
print('The value of a is', a)
# Output: The value of ...
0
votes
1answer
289 views
Using listings to add colorful code
By default listings adds black and white code. How can I make them colorful. Language I work on are -> Python, Mathematica, IDL.
2
votes
1answer
187 views
How to number the listings within sections?
I use this excellent approach for inserting external Python code in my document.
How to highlight Python syntax in LaTeX Listings \lstinputlistings command
\section{TEST}
\pythonexternal[caption=test,...
0
votes
1answer
84 views
How to include minus and hyphen sign in colored python code lisiting?
The post:
How to highlight Python syntax in LaTeX Listings \lstinputlistings command
produced answer from redmode, that gives a colored python code listing. Although the text produces minus/hyphens in ...
0
votes
0answers
60 views
How to include a caption to a Python code snippet
I am using a self-defined command to create an environment for my Python code that I want to show in my document. This command has been taken from redmode's answer to the following question: here.
So, ...
0
votes
0answers
29 views
Using the minted package with Temaker produces 'pygmentize' error
Using Texmaker 5.04 on Windows 10 (with Python installed and up-to-date via Anaconda), I'm trying to compile the minimal example provided in the minted documentation. I expanded the command string ...
0
votes
0answers
8 views
Using a customized python environment within a caption environment
I am using the python-code definition that has been introduced in this answer.
Now, I wonder: Is there a way to use \pythoninline{myFunction()} in a \caption environment? Because, when I just try this,...