File: test-tcolorbox.tex

package info (click to toggle)
vim-vimtex 2.17-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 8,844 kB
  • sloc: makefile: 360; python: 103
file content (58 lines) | stat: -rw-r--r-- 1,231 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{tcolorbox}

\tcbuselibrary{minted}
\tcbuselibrary{xparse}

\DeclareTCBListing{mintedbox}{ m !O{} }{%
  listing only,
  minted language=#1, #2
}

\newtcblisting{verilog}[2][]{%
    listing engine=minted,
    minted language=verilog,
    listing only,
    breakable,
    enhanced,
    colframe=gray!75,
    title=#2,
    coltitle=black,
    colbacktitle=gray!50,
    fonttitle=\bfseries,
    top=0.5mm,
    bottom=0.5mm,
    % left=0mm,
    right=0mm,
    boxsep=0.5mm,
    minted options = {
        linenos,
        breaklines=true,
        breakbefore=.,
        numbersep=2mm,
    },
    overlay={%
        \begin{tcbclipinterior}
            \fill[gray!25] (frame.south west) rectangle ([xshift=4mm]frame.north west);
        \end{tcbclipinterior}
    },
    #1
}

\begin{document}

This part of the document is in regular syntax highlighting.

\begin{mintedbox}{text}
$ This is a minted box that contains a single dollar sign.
\end{mintedbox}

Now this part of the document has math-mode syntax highlighting.

\begin{verilog}{}
    $strobe("Average period = %g measured from %d periods.", period, total);
\end{verilog}

\end{document}