0

I search a LaTeX package which show code inside a terminal image, where I could use listings or minted.

If this not possible I have to build it by myself and will it post here.

1
  • 2
    Perhaps tcolorbox package and its libraries listings, listingsutf8 and minted? In the manual there are some examples that look just like a terminal. Jul 30, 2021 at 12:34

1 Answer 1

6

This is my solution:

\usepackage{fancyvrb,minted,tcolorbox}
\tcbuselibrary{skins,breakable,breakable}
\tcbuselibrary{minted}

\definecolor{terminalColor}{RGB}{38,50,56}
\definecolor{Button1}{RGB}{254,94,86}
\definecolor{Button2}{RGB}{254,188,45}
\definecolor{Button3}{RGB}{38,202,59}

\begin{tcblisting}{listing engine=minted,minted style=native,
    minted language=python,enhanced,
    colback=terminalColor,colframe=terminalColor,listing only, title=\tikz {
        \node[circle,fill=Button1,inner sep=3pt] (c) at (0,0){};
        \node[circle,fill=Button2,inner sep=3pt] (c) at (0.5,0){};
        \node[circle,fill=Button3,inner sep=3pt] (c) at (1,0){};
    } ~~~~~~Terminal}
    >>> a = [1, 2, 3]
    >>> b = a
    >>> b.append(4)
    >>> b
    [1, 2, 3, 4]
\end{tcblisting}

Exmaple image

5
  • 1
    Looks a bit Mac-specific :) but nice solution!
    – Marijn
    Jul 31, 2021 at 10:08
  • 1
    Thanks. I have been inspired by carbon.now.sh. It would be nice to have this also for windows linux and macOS terminals.
    – ikreb
    Jul 31, 2021 at 10:45
  • I cannot reproduce this example. Would you please show the preamble you used? Aug 3, 2021 at 17:10
  • 1
    @LaTeXereXeTaL I add the imports. Please don't forget to use -shell-escape and you have to install python and pygments.
    – ikreb
    Aug 3, 2021 at 20:26
  • 1
    Thank you very much! Works perfectly! A beautiful implementation too! Aug 4, 2021 at 0:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .