1

I have this MWE

\documentclass{article}

\usepackage[many]{tcolorbox}
\usepackage{minted}
\usepackage{graphicx}
\usepackage{mwe}

\setminted{linenos}

\tcbset{
    common/.style={
        before=\vskip2\baselineskip\noindent,
        enhanced,
        title empty,
        frame empty,
        segmentation empty,
        middle=0.7cm,
        top=0.5cm,
        left*=1.5mm, right*=1.5mm, bottom=0pt
    }
}

\DeclareTColorBox{coolbox}{O{}mO{}}{
    common,
    interior code={
        \filldraw[ultra thick,fill=white,draw=black,rounded corners=10pt,#1] (frame.north west) -- (frame.north east)[sharp corners] -- (frame.south east);
        \node at  ([xshift=-30pt,yshift=3pt]interior.north east) {\includegraphics[#3]{#2}};
    },
}

\begin{document}

\begin{coolbox}{example-image}[width=1.5cm,angle=-20]
    \begin{minted}{bash}
ENV="() { :; }; echo foo" bash
    \end{minted}
\end{coolbox}

\begin{minted}{bash}
ENV="() { :; }; echo foo" bash
\end{minted}

\end{document}

that produces output using

latexmk -interaction=nonstopmode -shell-escape -synctex=1 -lualatex ./foo.tex

But as you can notice there is a problem with number of lines (I highlighted it with the purple color). In particular the first minted environment is inside coolbox but the second one not. So the first minted is squashed inside coolbox.

The question: Is it possible to avoid the squashing on the left side of coolbox (only on the left because it always opens) to align number of lines outside and inside of it?

2
  • 1
    Does setting left*=0mm in line 19 give what you want? Mar 8 at 10:17
  • 1
    Thank you @Οὖτις! It works. If you want add this comment as answer and I'll accept it.
    – miticollo
    Mar 8 at 10:35

1 Answer 1

1

Your settings for tcolorbox are responsible for that. In your \tcbset command you use left*=1.5mm which causes the identation. The tcolorbox documentation for /tcb/left*=⟨length⟩ reads

Sets /tcb/left such that ⟨length⟩ is the distance between the left bounding box and the text parts.

In your case it should suffice to set left*=0mm.

You must log in to answer this question.

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