Tagged Questions
2
votes
1answer
60 views
Lstinputlisting and listings styles
To further extend my recent question about new listings environments, found here: Multiple listings styles.
How do I define a new lstlistings environment, via the command \lstnewenvironment, and, be ...
5
votes
1answer
73 views
Listings line numbers that match the linerange specification
This is a follow-up question to First line number in lstinputlisting environment. Consider the MWE:
\documentclass{article}
%\usepackage{etoolbox}% http://ctan.org/pkg/etoolbox
...
4
votes
1answer
82 views
Command to insert filename in caption of a listing
I would like to have a command to insert listings that contain the filename in the caption. This works well as long as there is no "_" etc. in the filename.
I also tried the suggestion from a ...
4
votes
1answer
370 views
Including XML file into LaTeX
I am using LaTeX for very first time and have very basic knowledge about it. I am using the template from here to write my thesis. I am using Ubuntu 12.04.
When I try to include a small XML file in ...
3
votes
1answer
106 views
Auto include specific part of source files
I'm creating a lot of code to our small projects (in computer science), and finding myself copy/pasting my comments into the document.
Would it be possible to make a reference point in the code file ...
1
vote
1answer
296 views
\lstinputlisting for a normal text file?
sometimes im using \lstinputlisting to show some code examples in my pdf. Now I just would like to insert a normal textfile. Everything is fine, I like this box around my text and the numbers every ...
4
votes
2answers
300 views
Inserting Code in multiple pages as an appendix
I am trying to insert a script (bash shell code) to the appendix of my document. I am trying to import the script from separate file. The script file name is Event_Db_BckUp_Script.als. The problem is ...
2
votes
1answer
213 views
treating multiple code listings as one figure (listings package)
Please note that I am quite new to tex/latex.
For my paper I need to reference specific parts of my source code as one code listing. This allows me to skip specific lines of the source code that are ...
1
vote
1answer
300 views
Pointing to Java files not in root latex folder using listings
I am trying to use listings to point to a Java source code file. The file path is different from the Latex document. Below is an example of what I am trying to do, though it doesn't compile it says it ...
3
votes
1answer
256 views
Using listings for R code with ## in rangeprefix
In R, comments are preceded by the symbol #. Moreover, to avoid messing with the indentation, it's usually ## instead of #. Therefore, as I want to include some R code in a LaTeX document, I am using ...
3
votes
1answer
703 views
Showing only specific lines using the listings package
I am very new to TeX.
My source code is in an external file, let's call it source.java, and I use \lstinputlisting{source.java}.
How could I use only the lines 3-5 for my code listing? (and not the ...
10
votes
1answer
746 views
How can I pass underscore to \newcommand properly?
I'd like to simplify my code appendix with this command definition:
\usepackage{listings}
% ...
\newcommand{\CodeListing}[1]{%
\lstinputlisting[caption=#1]{#1}%
}
That is, the caption should be ...
8
votes
1answer
2k views
How to make \lstinputlisting applicable to file paths with spaces?
I am using the listings package and the path to the source code contains some spaces.
For example, the path can be /some dir/sub dir/file 1.txt and
\lstinputlisting{/some dir/sub dir/file 1.txt} does ...