Tagged Questions
2
votes
1answer
57 views
Environment lstlisting undefined
Hi I have installed the listings package in order to display my code. I am running the following code within my document:
\begin{lstlisting}
public static void main(String[] args) {
...
8
votes
2answers
145 views
Combining `tikzpicture` and `lstlisting`
I'm working on a custom lstlisting environment, in which I use TikZ to add a frame and a title. Because of the widespread curly braces of node I cannot use newenvironment, so I have to resort to ...
4
votes
1answer
139 views
Multiple caption names for listings code (lstinputlisting) based on type of code
In my document I have used:
\renewcommand\lstlistingname{Algorithm}
\renewcommand\lstlistlistingname{Algorithms}
to rename my lstlistings titles.
The problem is that now I want to add a different ...
2
votes
1answer
153 views
lstlisting in a newenvironment
I have a problem with the lstlisting package. I want to define an \newenvironment with one obligatory parameter, which will be the caption name for the lstlisting. I will also have other lstlisting ...
2
votes
1answer
114 views
Creating a custom environment
I'm using the following syntax for my code snippets
\begin{minipage}{\textwidth}
\begin{lstlisting}[caption=<something>, label=<something>]
The REST Endpoint URL
is ...
6
votes
1answer
47 views
`advise` Environment in listings package
I was reading the documentation for the latex listings package and there are advises in it which look like so:
I had a quick look in the source code for the documentation and it turns out that ...
6
votes
2answers
864 views
Create a \lstnewenvironment that creates named listings
I am using the \lstnewenvironment to format a set of code listings in my document.
\lstnewenvironment{code}
{\lstset{language=haskell,
basicstyle=\small\ttfamily,
numbers=left,
...
4
votes
1answer
778 views
lstinputlisting does not include file within lstnewenvironment?
I want to use lstinputlisting to include a file with code within an lstlisting block, which is defined through a new environment. However, the lstinputlisting command itself, not the code, is ...
4
votes
2answers
231 views
Problems When Escaping from Listings
I would like to use LaTeX to document my C++ code, since I am able to typeset mathematics easily, as well as create diagrams using TikZ. I made a minimal LaTeX template for testing, but I have already ...
1
vote
1answer
122 views
Combine listings package with my own enviroment [duplicate]
Possible Duplicate:
How to use different lstset settings for listings?
I have defined my own enviroment as:
\newenvironment{codegui}[3]{%
\def\tmplanguage{#1}\relax
...
4
votes
1answer
231 views
Using LaTeX listings throughout the document
I've got a LaTeX document with a main file and many sub-files. Because we're writing a documentation we use code snippets everywhere. How can I define a listing and use it throughout the documents?
...
7
votes
3answers
246 views
Masking \end{lstlisting}
I am not sure if I am using the right wording in title. Basically what I need is to add the following source using the listing package.
In preamble:
\usepackage{listings}
then and is here when I ...
3
votes
1answer
548 views
\newenvironment fails with special listings environment
I want to use the showexpl, but define a new environment with predefined settings. But all I get is an emergency stop.
\documentclass{scrbook}
\RequirePackage{showexpl}
...
1
vote
1answer
239 views
Why does pdfLaTeX fail when I try to use `begin{lstlisting}` inside a user-defined environment?
I'm having trouble with the listings package. I can't compile the following minimal example through pdfLaTeX:
\documentclass[a4paper, 11pt, twoside, openright, english]{memoir}
\usepackage{listings}
...
4
votes
2answers
882 views
newenvironment/newcommand for existing environment in LaTeX-Beamer
I would like to have the solution of highlighting a line in listings-package as a command or environment. To bad I cannot get it working. I tried:
a simple newenvironment: compile errors
...
4
votes
1answer
474 views
Wrap latex environment
I'm a beginning latex user. I have some programming code in my document which I format using the lstlisting environment from the package listings.
However this still allows the code segments to be ...
6
votes
1answer
2k views
How to define a new environment with a fancy box (tikz) around sample source-code (listings)?
This is what I want to do:
\documentclass{beamer}
\begin{document}
\begin{frame}[fragile]{Frame 1}
Some \structure{Python} code here:
% I want to define a new "pythoncode" environment, so ...
1
vote
1answer
223 views
How to make my unusual environment accept one argument?
I cannot find a good title to express my question. Therefore, please parse the following code first.
Minimal Code
\documentclass[dvips,dvipsnames,cmyk,table]{book}
...
1
vote
1answer
313 views
Listings: new environments with arguments
I have this basic question. How can use arguments with listings? I tried this and it doesn't work:
\lstnewenvironment{cor}[2][]
{\linerange{#1-#2},\lstset{language=[Sharp]C,,basicstyle=\scriptsize,
...
8
votes
2answers
1k views
Listings: different counters for different listing environments
How do I create two lstlisting environments that each have its own counter?
If I use for example
\lstnewenvironment{algorithm}[2]{
\renewcommand\lstlistingname{Algorithm}
\lstset{ ... }
} ...