Questions tagged [lstdefinestyle]
The lstdefinestyle tag has no usage guidance.
49
questions
2
votes
1
answer
33
views
How can I extend properties of \lstdefinestyle?
I am importing multiple python scripts into my tex file. I previously had one huge \lstdefinestyle definition which included options for all the specific functions, variables, etc across all my ...
0
votes
1
answer
60
views
Substitute text between delimiters (listings) [closed]
I want to format code within the lstlistings package via \lstdefinestyle. The goal is to substitute the text after the regex 'C:\ up to the regex .eps' with PATH.
How can I realize this?
The solution ...
1
vote
1
answer
61
views
How to put an input listing to fill both columns in a two column format without the end of it getting cut off from the page?
I need to add a bunch of code to show the entire CPP file for the problem that I gave participants to solve but the code keeps cutting off the page no matter what style I define it as. I am using ...
2
votes
1
answer
207
views
Classifying Matlab Code and Pseudocodes Under List of Codes and Matlab and R Output under List of Output
I am kindly requesting for assistance on how to put the headings Matlab Code and Pseudocodes under List of Codes and headings Matlab Output and R Output under List of Output using the below MWE. In ...
1
vote
1
answer
44
views
Only highlight keyword if surrounded by whitespace
I defined a language as follows:
\lstdefinelanguage{Z80}{
sensitive = true,
keywords={a, hl, h, l, b, c, e, ix, sp, bc, af, d},
keywords = [2]{push, ld, and, pop, ret, sra, call, sla,
cp, jp, ...
0
votes
1
answer
133
views
Disable LaTeX interpreting my Source File
In my Latex file:
\lstinputlisting[caption={Pascal Quellcode HashFunctionsTest.pas}]{../source/HashFunctions.pas}
Error:
[{
"owner": "LaTeX",
"severity": 8,
&...
0
votes
0
answers
114
views
Coloring numbers outside string and variables using lstlisting and parsing don't work as expected. Need Help to fix with PDFLaTeX
I am writing my thesis and i need to put extract of code into it. Having developed all my C# code in Visual Studio, I would like to have more or less the same colors, so I have taken different ...
0
votes
1
answer
251
views
How can I use \lstdefinestyle in a subfile?
Assume that main.tex is my main compiled latex file. The rest of them (as sub.tex) includes the list of def ones in order to arrange each chapter, subchapter etc. How can I use defined style in main....
1
vote
1
answer
57
views
How do I replace the R in the words "R output:" with the picture I defined by \Rlogo?
Below is the my code:
\documentclass{article}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\newcommand{\Rlogo}{\protect\includegraphics[height=1.8ex,keepaspectratio]{Rlogo.png}}
\...
0
votes
0
answers
268
views
Reset \lstset Style
I define a \lstdefinestyle in my document that looks something like this:
\lstdefinestyle{examplestyle}{
backgroundcolor=\color{green},
commentstyle=\color{blue},
keywordstyle=\color{magenta},
...
0
votes
1
answer
209
views
Using lstlisting with tcolorbox give me a huge box
I'm using lstlisting with tcolorbox to show some code, but I have a problem with the width of the box. If one of the lines is longer than the document width, then because I have breaklines and ...
3
votes
1
answer
488
views
Changing lstdefinestyle Doesn't Seem to Work
I'm pretty new to using LaTeX, and I'm trying to revise a pre-existing .latex file so that code blocks looks something like below:
I'm a code block and I'm pretty!
Important info goes here.
One ...
1
vote
1
answer
194
views
How to write SPL in LaTex?
I have searched everywhere for SPl(Search Processing Language) that is used in splunk and I wanted to format my piece of code just like that:
I have tried to play with the lstdefinelanguage and ...
0
votes
1
answer
59
views
\lstdefinestyle lists, not arabic numbers but rather roman?
I'm sorry to bother.
I have a \lstdefinestyle define in which I define the colours and size of the fonts, etc, to be shown in a code that I'm placing in a tex document. However, all my document is ...
1
vote
1
answer
350
views
Change color of numbers in listing environment
How to change the color of the numbers in the python code block to blue, but at the same time leave the numbers in the comment block green?
Also, for the keyword network3. How to just change that ...
1
vote
1
answer
440
views
Different programming language environment using \newtcblisting
In the code given below, I am attempting to generate different programming languages syntax environments. With the current code, I am not able to get output to show up with color highlighted syntax ...
0
votes
0
answers
88
views
How to list Apache Webserver configuration snippets?
Is there a way to list with lstlistings apache configuration files?
An example snippet is:
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory&...
0
votes
1
answer
401
views
How to create an lstdefinestyle similar to this?
I am trying to create an lstdefinestyle similar to the one in the image below, but for no reason the settings are not working.
Result of my lstdefinestyle:
\documentclass{article}
\usepackage{...
0
votes
1
answer
217
views
lstlistings with with different languages and diffrent keywords
\lstdefinelanguage{RIPE}
{%
sensitive=t,%
morekeywords={inetnum, netname,descr, country, admin-c, tech-c, status, mnt-by, notify, created, %
last-modified, source, person, address, phone, e-...
2
votes
1
answer
184
views
How do I keep morekeywords from being highlighted in a comment?
Say I have the following listing style:
\lstdefinestyle{custCpp}{
language=c++,
keywordstyle={\bfseries}, % keyword color
keywordstyle = [2]{\color{blue}\bfseries},
otherkeywords = {...
0
votes
0
answers
155
views
Get .prf file from Jetbrains Webstorm and apply it to listings configuration
From the listings doc it is mentioned that I basically can retrieve a Configuration file for the styling of a language from the IDE and apply it as lstset setting:
...settings in an IDE and can be ...
6
votes
1
answer
14k
views
Formatting SQL code
I try to format SQL code to achieve at least similar result to this picture :
My result:
But I can not do that. I struggle with margins, paddings, and numbering for a long time and I already feel ...
2
votes
1
answer
2k
views
Listings all in the same style although different languages are defined and used
So I want to show some python, bash and terminal output using the listing package.
I searched for some language definitions for bash and python for the listing package and in the beginning it worked ...
1
vote
1
answer
4k
views
Code style using package listings not working
In this document I want to use two code styles, DOS and R. I have defined each using the package listings. The DOS style works great but the R style does not color the lines appropriately.
Code (have ...
2
votes
1
answer
945
views
Prevent LaTeX listings from highlighting part of word
I'm defining my own listings and have run into an issue whereby LaTeX highlights words within words - e.g. if OR is a keyword, it highlights the OR in ANIMATOR - even if ANIMATOR itself is a keyword (...
8
votes
2
answers
3k
views
Can one customize lstlisting environment?
I want to add some Python source code to my LaTeX document, but I want to apply some customization. Currently, I have something like this:
\documentclass{article}
\usepackage[utf8]{inputenc}
\...
0
votes
0
answers
49
views
lstlisting numbers ignores sideline [duplicate]
I am writing a paper with ieeeconf style. Now I added an lstlisting but the numbering is slighty off the normal text-region. You can see it here:
Can someone help me to fix this?
Code: https://www....
3
votes
1
answer
760
views
Reduce the height of empty lines in \lstinputlisting
I am using \lstinputlisting to present some of my code in a paper. As shown in this image:
I intend to add empty lines between different parts of codes. However, I somehow want to reduce the height ...
1
vote
0
answers
632
views
Problem with lstlisting in beamer [duplicate]
\documentclass[10pt]{beamer}
\usepackage[utf8]{inputenc}
\usepackage{multicol}
\usepackage{lipsum}% Just for this example
\usepackage{graphicx}
\raggedcolumns % for NOT stretching the columns with ...
3
votes
1
answer
789
views
linebackgroundcolor overwriting backgroundcolor in \lstinputlisting
I am trying to highlight a specific line in a \lstinputlisting environment that already has a background color. The approach that I tried removes my original background color and just highlights the ...
1
vote
1
answer
481
views
Italicize and Underline Keywords in lstdefinestyle
The documentation shows the following:
keywordstyle=\color{black}\bfseries\underbar
For my 3rd set of keywords I have tried:
keywordstyle = [3]\textit\underbar
However, this doesn't work and ...
1
vote
0
answers
567
views
lstlisting - bold numbers, remove gaps between lines [closed]
I am trying to make a coloured source code box with lstlisting. Nearly everything works fine except two things:
I gave up after 2 hours of searching the web on how to make the little numbers in front ...
4
votes
1
answer
1k
views
Change size of listing box locally
In the code given below, I get the output:
How to go about changing the size of the box locally, so that the heading " "cubemaster" Usage" appears on one line instead of two lines?
Thanks.
Here is ...
0
votes
1
answer
537
views
LstListing keeps adding whitespaces when a - is used
So I want to have some nice listings for a manual I'm writing.
The instructions should be copied to the ubuntu terminal in which a bunch of them can be ran after each other.
I fixed that, but now I'...
2
votes
1
answer
769
views
Circled references within code lstlisting
So I just want to create some circled numbers within my code lstlisting, which I could easily reference within a nearby description text.
This is my description text and I want to refer to [1] in \...
12
votes
1
answer
10k
views
advanced string highlighting in listings
I'm using listings to display ruby code with highlighting. I have the following test document:
\documentclass{article}
\usepackage{xcolor}
\usepackage{listings}
\definecolor{dkgreen}{rgb}{0,0.6,0}
\...
2
votes
1
answer
2k
views
Change caption name of multiple listings
Can you please help me modify the listing names as shown in the image attached. I currently have 4 different \lstdefinestyle and would like to then have 4 different listing names. I was trying to ...
1
vote
1
answer
634
views
How to write definition in box and remark in sidebar
I've to write definition, lemma in box and remark in sidebar like this photo.
3
votes
1
answer
608
views
Input file path in modified listing environment
I have a modified environment for a listing called mylisting. I wanted to know how to include the path to the file to be used in the mylisting environment?
Here is the code that I have so far:
\...
2
votes
1
answer
1k
views
Different Matlab code listings environment in same document with Matlab-prettifier
I wanted to be able to have different Matlab code listings in the same document. The first three listings are from the solution found here.
How do I get rid of the thin lined boxes in the first 3 ...
2
votes
1
answer
263
views
Unexpected behavior when using words as delimiters in listings
I am trying to customize a listings style to automatically highlight my code exactly (or sufficiently close to) how my installation of Eclipse/PyDev does. I would like to be able to use "class" and ":"...
2
votes
0
answers
607
views
Lstlisting line color between code lines [duplicate]
I have the following Latex code for VHDL code listing:
\documentclass[english]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{graphicx}
\usepackage{...
2
votes
1
answer
599
views
Define a command based on lstlisting usable in the normal line of the text.
Is there a way in order to define a command of 1 argument (that we can call '\likelisting') that allow us to inherits some defined things with lstlisting. For istance with the code
\begin{...
2
votes
1
answer
334
views
Set format of the document as the format for the listing
I would like to set the text format of the document as the format for the listing. The words in the listing accross my tex document have a bigger space between the characters. I want them to the have ...
1
vote
0
answers
645
views
Adjusting the text width of R listings in LaTex [closed]
Hi I have R codes that I am listing in my LaTex file with
\begin{lstlisting}[language=R]
R code
\end{lstlisting}
I have no specific listing setting in my preamble.
My R code is very wide and ...
6
votes
1
answer
13k
views
Colorize symbols with lstdefinelanguage in latex
I want to put some symbols in green color with lstdefinelanguage in latex, but it seems that symbols are not recognized.
The symbols I need to be colored are =, > and <. Is it possible? How can I ...
0
votes
1
answer
1k
views
How to format an algorithm using lstlisting
I'm writing an algorithm using lstlisting :
\lstset{language=C++}
\begin{lstlisting}[frame=single,caption=Algorithme de la méthode "HOG+SVM"]
HOGDescriptor hog;\\
hog.setSVMDetector(...
2
votes
1
answer
2k
views
How to insert code from a Router or a Switch
At the current time I have inserted the configuration of a couple of routers and switches using the following method:
\lstset{breaklines=true}
\begin{lstlisting}[frame=single]
[Config here]
\end{...
3
votes
1
answer
558
views
listings package: last whitespace removed before the newline character. How to keep it?
I've some sort of template/examples of bash scripts on my computer (.sh files on my hd) in which I put commands and commented outputs. This is my example.sh file:
echo this is wide ...