%%
%% This is file `minted-code.sty': listings with minted
%% for unicode
%%
%%   Copyright (C) 2025  Herbert Voss
%% 
%% It may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3c
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%%    http://www.latex-project.org/lppl.txt
%% and version 1.3c or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
%% 
%%
\ProvidesPackage{minted-code}[2025/08/02 v0.04 for LuaLaTeX]

\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=||,
}%

