Questions tagged [lstdefinestyle]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
1 answer
31 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, ...
user avatar
0 votes
1 answer
42 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, &...
user avatar
0 votes
0 answers
39 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 ...
user avatar
0 votes
1 answer
48 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....
user avatar
  • 160
1 vote
1 answer
45 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}} \...
user avatar
  • 160
0 votes
0 answers
82 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}, ...
user avatar
0 votes
1 answer
97 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 ...
user avatar
2 votes
1 answer
267 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 ...
user avatar
  • 23
1 vote
1 answer
119 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 ...
user avatar
0 votes
1 answer
43 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 ...
user avatar
  • 166
1 vote
1 answer
77 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 ...
user avatar
  • 8,674
1 vote
1 answer
295 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 ...
user avatar
  • 8,674
0 votes
0 answers
64 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&...
user avatar
0 votes
1 answer
250 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{...
user avatar
0 votes
1 answer
170 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-...
user avatar
  • 63
2 votes
1 answer
112 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 = {...
user avatar
  • 1,020
0 votes
0 answers
112 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 ...
user avatar
  • 101
5 votes
1 answer
10k 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 ...
user avatar
2 votes
1 answer
864 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 ...
user avatar
  • 115
1 vote
1 answer
3k 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 ...
user avatar
  • 595
2 votes
1 answer
738 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 (...
user avatar
  • 23
7 votes
2 answers
2k 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} \...
user avatar
  • 1,036
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....
user avatar
  • 1,021
2 votes
1 answer
569 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 ...
user avatar
  • 145
1 vote
0 answers
630 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 ...
user avatar
  • 111
3 votes
1 answer
600 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 ...
user avatar
  • 8,674
1 vote
1 answer
404 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 ...
user avatar
1 vote
0 answers
436 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 ...
user avatar
  • 11
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 ...
user avatar
  • 8,674
0 votes
1 answer
386 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'...
user avatar
  • 288
2 votes
1 answer
683 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 \...
user avatar
  • 123
10 votes
1 answer
9k 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} \...
user avatar
1 vote
1 answer
1k 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 ...
user avatar
  • 8,674
1 vote
1 answer
507 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.
user avatar
  • 595
3 votes
1 answer
517 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: \...
user avatar
  • 8,674
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 ...
user avatar
  • 8,674
2 votes
1 answer
230 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 ":"...
user avatar
  • 259
2 votes
0 answers
606 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{...
user avatar
  • 711
2 votes
1 answer
427 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{...
user avatar
2 votes
1 answer
260 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 ...
user avatar
1 vote
0 answers
596 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 ...
user avatar
  • 11
6 votes
1 answer
11k 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 ...
user avatar
0 votes
1 answer
987 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(...
user avatar
2 votes
1 answer
1k 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{...
user avatar
  • 67
3 votes
1 answer
508 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 ...
user avatar