Questions tagged [tcblisting]
The `tcblisting` environment combines features of `tcolorbox` and `listings` or `minted`.
55
questions
0
votes
0
answers
35
views
How to make an environment created with newtcblisting behave the same as one created by the minted environment?
I have declared a new envrionment in a class file like this (the complete file exists here):
\renewcommand{\theFancyVerbLine}{\parbox{10pt}{\centering\footnotesize\arabic{FancyVerbLine}}}
\...
2
votes
1
answer
35
views
Compile error when using scrartcl with \newtcbinputlisting
I get the error:
\cl@chapter ->\cl@chapter
@elt {pythoncode}
l.239 listing file={#3},#1}
when using the scrartcl documentclass with the \newtcbinputlisting. Can you tell me how I can go ...
2
votes
2
answers
125
views
Side by side minipage and tcblisting environment
I would like to use a configuration similar to the following, so that the width of the minipage automatically adapts to that of the tcblisting, but I don't know how to get the width of varwidth (noted ...
1
vote
1
answer
24
views
Issues with making lstnumber two-digit with hyperref and tcolorbox
I'm trying to use tcolorbox and make all lstnumbers two digit. It seems like there is an error with hyperref. I've attached a working example below.
\documentclass{scrartcl}
\usepackage[utf8]{...
1
vote
1
answer
57
views
How to add a second overlay to a tcolorbox?
I have the following MWE (inspired by inspired by this and this)...
\documentclass{article}
\usepackage[most]{tcolorbox}
\tcbuselibrary{listings, breakable, skins}
\usepackage{lipsum}
\usepackage{...
0
votes
1
answer
58
views
How can I restyle the listings caption to a tcblistings environment?
I am trying to define a tcblistings environment that should work under the following syntax...
\begin{code}{TITLE}{LANG}{CAPTION}{OPTS}
code here
\end{code}
Everything but the language should be ...
0
votes
0
answers
40
views
Why does a `tcolorbox` code listing box using `listing above text` not keep the output with the code?
I'm trying to use a tcolorbox to list code above output in a document with 2 geometries. My attempt is failing utterly and I can't figure out why.
Here's the problem:
The box is being split into two, ...
0
votes
1
answer
47
views
Argument of \verbatim@ has an extra } error while placing a tcolorbox inside a node
Trying to place a macOS style Terminal inside a node:
\documentclass[a4paper,openany,14pt,oneside,]{extbook}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usepackage{tcolorbox}
\tcbuselibrary{skins,...
0
votes
1
answer
17
views
In list of the Listings show without "Listing X:" part
I have my Latex document that uses tcblistings.
I generate a list of the Listings with:
\begingroup
\parskip=0pt
\tcblistof[\chapter]{codes}{Listings}
\endgroup
Which result in the following Listings:...
0
votes
1
answer
42
views
How can I modify my tcblisting to show input code and the expected output side-by-side?
I have a code listing and tcblisting defined as follows.
\lstdefinelanguage{MyScheme}{
basewidth=0.5em,
morekeywords=[1]{define, cond, lambda, else},
alsodigit=!\$\%&*+-./:<=>?@^_~,
...
0
votes
1
answer
78
views
How to quickly change spacing of lstlisting to use two spaces instead of four?
I'm working on some LaTeX code listings and have decided to change my spacing from four to two. The problem is that there are a ton of listings in my document (which is ~500 pages)... is there any way ...
0
votes
0
answers
41
views
Pass a listing as an argument to a command?
I have a custom listing defined as follows:
\newtcblisting[auto counter, number within=chapter]{MyCListing}[2][]{%
enhanced,
frame hidden,
breakable,
borderline north = {0.5pt}{0pt}{...
2
votes
1
answer
64
views
How do I use a section counter inside a tcblisting?
I'd like to add the current figure/section number to the title of a tcblisting. Right now, my hacky solution is to just use the section number and increment it manually every time I want to use my ...
0
votes
0
answers
52
views
finalizecache and cachedir undefined when using minted with tcblisting
I am using minted to display python code and I need to use finalizecache and cachedir to be able to submit my code somewhere else and compile without using --shell-escape, which is disabled for ...
0
votes
1
answer
21
views
Extra text below listing with name "keywordstyle keywordstyle"
I have defined the following listing for Python Code:
\newtcblisting[use counter from=sqlCode, list inside=codes]{pythonCode}[2][]{%
listing only,
breakable,
top=0.25pt,
bottom=0.25pt,
right=...
2
votes
1
answer
61
views
Remove thin black frame around standalone image
My MWE:
\documentclass[12pt]{article}
\usepackage[most]{tcolorbox}
\tcbset{
sidebyside,
listing options={
basicstyle=\small\ttfamily,
breaklines=true,
postbreak=\mbox{\textcolor{red}{$...
2
votes
1
answer
134
views
Break lines in tcblisting
Here is my MWE:
\documentclass[12pt]{article}
\usepackage[most]{tcolorbox}
\tcbset{sidebyside,
breaklines=true,
postbreak=\mbox{\textcolor{red{$\hookrightarrow$}\space}}}
\begin{document}
\...
1
vote
1
answer
61
views
standalone inside
The code
\documentclass[12pt]{article}
\usepackage[most]{tcolorbox}
\usepackage{mathtools}
\usepackage{chemmacros}
\tcbset{sidebyside}
\begin{document}
\begin{tcblisting}{
comment and listing,...
0
votes
1
answer
72
views
tcolorbox dispExample in Beamer
I used the @egreg's answer in beamer, but it doesn't work. How to handle it?
0
votes
0
answers
94
views
tcblisting box w/ minted shows incorrect listings
When using one of the tcblisting boxes for code and comments with minted, I often have problems getting the code snippets to show up. Previously, I used listings and had no problems, but the second I ...
0
votes
1
answer
246
views
Adding colon along with custom title to tcolorbox
Sorry that the question description isn't great, but what I mean is how can you update the settings to support having either a title that's just default from the tcbcounter like Example 1.1 or ...
1
vote
1
answer
398
views
tcolorbox with theorem and lstlisting
In some of my notes, I want to include an example question as well as code listings on how to carry out the function in one tcolorbox, something like the following image all included inside a box ...
2
votes
1
answer
41
views
how to remove this incompatibility between tikz, bodegraph and tcblisting
Hello I want to plot some code examples of using the Bodegraph package with tcblisting.
The code below works fine if I put the semilog {} ... command in a scope environment, on the other hand if I put ...
0
votes
1
answer
71
views
Shadow of a frame remains
The setup below leaves a shadow of a frame around the input. How can I make the box blend totally with the background?
\documentclass{article}
\usepackage{tcolorbox}
\tcbuselibrary{listings, breakable}...
0
votes
1
answer
89
views
How to add a tikzpicture to the tcblisting title?
I want to add this tikzture with the three coloured circles
\definecolor{Button1}{RGB}{254,94,86}
\definecolor{Button2}{RGB}{254,188,45}
\definecolor{Button3}{RGB}{38,202,59}
\begin{tikzpicture}
\...
4
votes
3
answers
129
views
Show math macros and result in a table
I'm writing some documentation about some macros I've made up. (I know there will probably be comments about the macros too, but that's not what I'm asking about.) Ideally, I'd like to make a sort of ...
0
votes
1
answer
261
views
Adding program code to the listing
I want to make a nice headline. So that it does not stick out, but is exactly with the frame. How do I set the width and height of the gray header? Can be this can be done automatically?
And still, ...
1
vote
1
answer
99
views
Using listings linerange in tcolorbox breaks formatting
When using listings's linerange or firstline/lastline, the tcolorbox shows extra top and bottom padding, and the font is different. Is there a way to fix this, or is this a bug with tcolorbox that ...
0
votes
1
answer
291
views
Cannot use unicode box drawing chars inside tcolorbox listing
I am trying to use unicode box drawing characters inside a tcblisting. First I used the pmboxdraw library to define what those characters should be mapped to, so that they could be drawn. I was able ...
2
votes
2
answers
398
views
How can create marking exam with tcolorbox
In order to make an exam, I used the tabular environment, but it still boring, i want to make the something with the nice template tcolorbox, how can use it:
\documentclass[11pt,a4paper]{article}
\...
1
vote
0
answers
384
views
Centering \newtcblisting [closed]
Continuing with my book in xelatex, I could't solve how to center a tcblisting.
Here is my (i hope this time), MWE:
% !TEX encoding = UTF-8
% !TEX program = xelatex
% !TEX spellcheck = es_ES
% !TEX ...
0
votes
0
answers
45
views
Problem with the extension of the file which is used to save listings [duplicate]
I want to display a snippet of Python code as a colored framed box in a beamer presentation. Besides, I'd like to save the snippet in a file. The code below gets the job done:
\documentclass{beamer}
...
1
vote
0
answers
213
views
Change or ignore ponctually the escaping characters of a `tcblisting`
In the MWE below, where $default^{ok}$ is typeset by LaTeX, I define escaping characters. Is it possible to modify this setting every time I would need to use pipelines in my code ? Can I simply turn ...
1
vote
1
answer
117
views
Decorate minted listing inside a tcolorobox [Merly done...]
I would like to decorate some listings just for pedagogical reasons.
Here is a starting code where I can draw a line but I still fail to produce a frame. How can I do that ?
\documentclass[12pt,...
3
votes
1
answer
211
views
tcolorbox adds fragments of listing to list of listings
I'm writing a report due to tomorrow night but I have a problem that I can not resolve.
The code is the following, the problem is that in the list of listing appears also a fragment of the listing ...
5
votes
1
answer
429
views
How to replace the "space symbol" (squat-u) in listings?
Instead of this output with a "squat-u" space symbol
I would like to replace it with e.g. $\cdot$. It is no problem to replace the default symbol for tabs but not for spaces??
\documentclass{article}...
4
votes
0
answers
238
views
How to remove lines and characters from listings / tcolorbox?
Consider this MWE
\documentclass{ltxdoc}
\PassOptionsToPackage{final}{listings}
\usepackage[%
,listings
]{tcolorbox}
\lstdefinestyle{mystyle}{%
style = {mystyledef},
}
\lstdefinestyle{...
5
votes
1
answer
2k
views
How to configure tcblisting with minted to allow copy/paste from listing with whitespace characters?
This answer from a similar question gets very close to a final copy/paste solution, but does not work for me as it does not select whitespace. I am asking a new question as the linked one is several ...
1
vote
1
answer
339
views
tcblisting apparently not a verbatim environment
MWE
% arara: pdflatex
\documentclass{article}
\usepackage{tcolorbox}
\tcbuselibrary{listings}
\begin{document}
\begin{tcblisting}{listing options={language=ruby}}
"hello #{world}"
\end{tcblisting}
\...
6
votes
2
answers
535
views
Using tikzpicture along with tcblisting
I am trying to use tikzpicture along with tcblisting. Basically, I am trying to design a figure to show the use of Java compiler, which converts Java source code into bytecode.
See below the code ...
4
votes
2
answers
856
views
tcolorbox: TikZ picture option of "tikz lower"?
Package tcolorbox has defined a style called "tikz lower". The package manual introduces it as follows:
/tcb/tikz lower=options
This style adds a centered tikzpicture environment to the start ...
0
votes
1
answer
325
views
how break the page between the 2 parts of tcblisting
As soon as the latex code is too long, the second frame is not displayed correctly.
How to cut the box of tcblisting so that the listing on the one hand and its execution is in two separate frames
\...
1
vote
1
answer
237
views
Label inside of \newtcbinputlisting giving incorrect ref number
In the code below, I am trying to reference some matlab code that is written using a \newtcbinputlisting environment. When I attach a label to the code, the reference number come in as "1" or "a)" or ...
2
votes
1
answer
209
views
Have new tcblisting TOC match up current TOCs
In the code below, I am trying to match up the format and font of a new \tcblistof to my other TOCs
My new \tcblistof looks like this where it is missing the figure number 1.1:
and I want this to ...
1
vote
1
answer
795
views
Change font type in \newtcbox to \texttt
I wanted to change the font type to \texttt inside of the LIB box:
This code is found here:
\documentclass{article}
\usepackage[many]{tcolorbox}
\newtcbox{\mylib}{enhanced,nobeforeafter,tcbox raise ...
4
votes
4
answers
645
views
Is it possible to have a tcblisting environment within an \ifthenelse?
I would like to choose which code to print according to a boolean flag.
If I use my \ifthenelse with plain text it works perfectly, but if I put a tcblisting environment instead of the plain text, it ...
3
votes
1
answer
165
views
"Repair" listing environment when used in the enumerate environment
In the code given below, the my listing environment gets skewed while in the enumerate environment:
How to fix the code so that the listing box inside the enumerate environment, looks like that out ...
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 ...
1
vote
1
answer
207
views
Increase parskip in tcblisting output
How to increase the \parskip in the output of a tcblisting, i.e. the vertical space between the black squares in the following example?
Neither the \parskip of the surrounding text nor the spacing ...
1
vote
1
answer
503
views
Change \tcolorbox tcblistof font formatting to match document's other lists
This code is building from the solution posted here by Dr. Hupfer.
I was attempting to get the font and other formatting of the tcblistof to match with the other lists in the document (like the list ...