I'm trying to create a code listing and set custom options using pgfkeys. The below provided code works fine. The style handler for title option (currently commented out) is breaking TeX compilation by throwing the capacity exceeded error. What is wrong with the title style handler ?
\documentclass[12pt]{book}
\usepackage{tcolorbox}
\usepackage{hyperref}
\tcbuselibrary{breakable}
\tcbuselibrary{skins}
\tcbuselibrary{listings}
\pgfkeys{%
/code listing/.cd,%
title/.initial = {},%
label/.initial = {},%
%% title/.style = \pgfkeys{%
%% /tcb/.cd,%
%% title=#1,%
%% }%
}
\newtcbinputlisting{\CodeListing}[2][]{%
beamer, breakable, listing only,%
colback=red!5!white, fonttitle=\ttfamily,%
listing file=#2%
}
\newcommand{\IncludeCodeFromFile}[2][]{%
\pgfqkeys{/code listing}{#1}%
\CodeListing{#2}%
}
\begin{document}
\IncludeCodeFromFile[title=Some Code]{somefile.cxx}
\end{document}
.stylekey collects other styles, a.codekey would be the right choice for a key with\pgfkeys. What are you trying to do, though? You first define a value keytitleand then overwrite it withtitle/.style. — Anyway, it would be better to dotitle/.style={/tcb/title={#1}}, see Key that takes a list of other keys as argument and sets them – Qrrbrbirlbel Aug 23 '13 at 04:54