%%% $Id: minted-code.sty 1155 2025-10-08 08:55:59Z herbert $
%
%% This is file `minted-code.sty': listings with minted for unicode
%%
%%   Copyright (C) 2025  Herbert Voss
%% 
%% This file is distributed under the terms of the LaTeX Project Public
%% License from CTAN archives in directory  macros/latex/base/lppl.txt.
%% Either version 1.3 or, at your option, any later version.
%% 
%%
\ProvidesPackage{minted-code}[2025/10/08 v0.01 predefined environments for code sources]

\PassOptionsToPackage{skins,most}{tcolorbox}
\RequirePackage{minted}
\RequirePackage{tcolorbox}
\tcbuselibrary{hooks,minted}
\tcbset{
  Minted@Code/.style={
		boxsep=0.2em,
		boxrule=1pt,
		arc=0.5em, 
		colframe=green!40!black,
		colback=green!5,
		listing only,
		left=0.5em,              
		right=0.5em,             
		top=0em,              
		bottom=0em,            
		fonttitle=\centering,
	},
	minted language = latex,
%    engine=minted,
}

\setminted{breaklines}

\newtcblisting{codeblockA}[1][]{
	minted options app={breaklines, mathescape, linenos, 
	   fontsize=\footnotesize, numbersep=5pt},  
	minted language=latex,
	#1,
	listing only,
	listing engine=minted,
}

\newtcblisting{codeblock}[1][]{%
	minted options app={breaklines, mathescape, %linenos, numbersep=5pt,
	  fontsize=\footnotesize },  
	minted language=latex,
	listing engine=minted,
	Minted@Code,
	#1
}

\newtcblisting{exampleA}[2][]{%  inside/outside, code left
    colframe=red!50!yellow!50!black,
    colback=red!50!yellow!15!white,
    coltitle=red!50!yellow!3!white,
    bicolor,colbacklower=white,
    fonttitle=\sffamily\bfseries,
	listing engine=minted,
	minted language=latex,
    sidebyside,
    title=#2,#1}

\newtcblisting{exampleB}[2][]{%  inside/outside, code right
    colframe=red!50!yellow!50!black,
    colback=white,
    coltitle=red!50!yellow!13!white,
    bicolor,colbacklower=red!50!yellow!5!white,
    fonttitle=\sffamily\bfseries,
    sidebyside,text and listing,
	listing engine=minted,
	minted language=latex,
    title=#2,#1}

\newtcblisting{exampleC}[2][]{%  inside/outside, code left
    colframe=red!50!yellow!50!black,
    colback=red!50!yellow!15!white,
    coltitle=red!50!yellow!13!white,
    bicolor,colbacklower=white,
    fonttitle=\sffamily\bfseries,
%    sidebyside,
	listing engine=minted,
	minted language=latex,
    title=#2,#1}

\newtcblisting{exampleM}[2][]{%
  minted options app={breaklines, mathescape, fontsize=\footnotesize, %numbersep=5pt, linenos
  },  
  listing engine=minted,
  minted language=latex,
  colframe=red!50!yellow!50!black,
  colback=red!50!yellow!15!white,
  coltitle=red!50!yellow!13!white,
  bicolor,colbacklower=white,
  fonttitle=\sffamily\bfseries,
%    sidebyside,
  title=#2,
  #1
%  listing only
}

\endinput

\setminted[latex]{%
breaklines=true,
rulecolor=green,
frame=leftline,
framerule=1pt,
framesep=6pt,
baselinestretch=1.1,
xleftmargin=6pt,
breakanywhere,
escapeinside=||,
}%

