Skip to main content
OverflowAI is here! AI power for your Stack Overflow for Teams knowledge community. Learn more
4 votes
Accepted

Avoid spaces before and after `std::cout` in listings

This is a consequence of the default setting of fixed columns, i.e., every character has the same width. Because the : character is not very wide it looks like a space is introduced. A workaround is ...
Marijn's user avatar
  • 38.1k
3 votes
Accepted

How to change font size **only** for \lstinline{}?

What about creating a new command as \myinline in my MWE: \documentclass{article} \usepackage{listings} \lstset{basicstyle=\ttfamily\small,numbers=left} \newcommand{\myinline}[1]{\lstinline[basicstyle=...
CarLaTeX's user avatar
  • 64.2k
3 votes
Accepted

Changing the name of lstlisting

Instead of changing the name, you could just define a new listings environment and use this instead: \documentclass{article} \usepackage{listings} \lstnewenvironment{newname}[1][]{\lstset{#1}}{} \...
samcarter_is_at_topanswers.xyz's user avatar
2 votes

How to change font size **only** for \lstinline{}?

Save \lstinline with another name and redefine it to pass the original one also the option basicstyle=\ttfamily (without \small). \documentclass{article} \usepackage{listings} \lstset{basicstyle=\...
egreg's user avatar
  • 1.1m
1 vote
Accepted

Incorrect C++ code formatting of pointer near char using listings package and lstlistings

I suggest you to try the package piton (it requires the use of LuaLuaTeX). Here your example formatted by piton with the font JetBrains Mono. \documentclass{article} \usepackage{fontspec} \usepackage{...
F. Pantigny's user avatar
  • 41.6k
1 vote

Highlight numbers using listings package

For information, the package piton directly gives an output respecting the conditions. The package piton does not use any external program and, hence, does not require the use of --shell-escape. ...
F. Pantigny's user avatar
  • 41.6k

Only top scored, non community-wiki answers of a minimum length are eligible