0

I am trying to highlight code using minted inside of a newtcbinputlisting and it is working beautifully. Thanks to TeXExchange and many previous answers! However, I am unable to shift the code inside the tcolorbox environment. I'm so close! I'm not sure what I am missing.

\newtcbinputlisting[use counter=filePrg, number format=\arabic]{\codeFromFile}[4]{%
    listing engine=minted,
    minted language=#1,
    listing file={#2},
    minted options={
        fontsize=\footnotesize,
        linenos,
        numbersep=1mm,
        breaklines=true,
        },% <-- put other minted options inside the brackets
    overlay={%
        \begin{tcbclipinterior}
            \fill[gray!25] (frame.south west) rectangle ([xshift=5mm]frame.north west);
        \end{tcbclipinterior}
    },
    colback=pythoncodebg, 
    colframe=black!70, 
    coltitle=White, 
    coltext=Black, 
    before skip= \UofUDoubleSpace, 
    after skip= \UofUDoubleSpace, 
    code={\singlespacing}, 
    breakable, % Allows for code to continue on multiple pages
    listing only, 
    arc=1.5mm, % Curvature of line corner
    enhanced, % jigsaw,
    boxrule=0.5mm, % Border width
    size=title,
    title=\TwoSymbolsAndText{\faCode}{%
    \textbf{File program \thetcbcounter}\ifthenelse{\equal{#3}{}}{}{\textbf{:} \textit{#3}}%
    }{\faCode},
    label=filePrg:#4
}

enter image description here

2
  • 1
    you are missing a small but complete example that can be used for a test. Apr 30 '21 at 19:26
  • I believe I answered my question below. I'm unclear as to why framesep wasn't being recognized. Apr 30 '21 at 20:09
0

After reading more into this, I was trying to use framesep and that was the incorrect approach. Instead, I needed to insert the xleftmargin to specify the offset.

\newtcbinputlisting[use counter=filePrg, number format=\arabic]{\codeFromFileFNS}[4]{%
    listing engine=minted, 
    minted language=#1, 
    listing file={#2}, 
    %left=5mm, 
    minted options={
        fontsize=\footnotesize, 
        linenos, 
        xleftmargin=3.25mm, 
        numbersep=2mm, 
        breaklines=true, 
        },% <-- put other minted options inside the brackets
    overlay={%
        \begin{tcbclipinterior}
            \fill[gray!25] (frame.south west) rectangle ([xshift=5mm]frame.north west);
        \end{tcbclipinterior}
        },
    colback=pythoncodebg, 
    colframe=black!70, 
    coltitle=White, 
    coltext=Black, 
    before skip= \UofUDoubleSpace, 
    after skip= \UofUDoubleSpace, 
    code={\singlespacing}, 
    breakable, % Allows for code to continue on multiple pages
    listing only, 
    arc=1.5mm, % Curvature of line corner
    enhanced jigsaw, % ,
    boxrule=0.5mm, % Border width
    size=title,
    title=\TwoSymbolsAndText{\faCode}{%
    \textbf{File program \thetcbcounter}\ifthenelse{\equal{#3}{}}{}{\textbf{:} \textit{#3}}%
    }{\faCode},
    label=filePrg:#4
}

I apologize I don't have a mwe as this is a massive subfiles project.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.