TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 ?



  /code listing/.cd,%
  title/.initial = {},%
  label/.initial = {},%
  %% title/.style = \pgfkeys{%
  %%   /tcb/.cd,%
  %%   title=#1,%
  %% }%

  beamer, breakable, listing only,%
  colback=red!5!white, fonttitle=\ttfamily,%
  listing file=#2%

  \pgfqkeys{/code listing}{#1}%

\IncludeCodeFromFile[title=Some Code]{somefile.cxx}
share|improve this question
Looks like \pgfkeys inside \pgfkeys is giving problem. I've removed the \pgfkeys inside style handler and it is working now. – Surya Aug 23 '13 at 4:45
Yes, a .style key collects other styles, a .code key would be the right choice for a key with \pgfkeys. What are you trying to do, though? You first define a value key title and then overwrite it with title/.style. — Anyway, it would be better to do title/.style={/tcb/title={#1}}, see Key that takes a list of other keys as argument and sets them – Qrrbrbirlbel Aug 23 '13 at 4:54
up vote 4 down vote accepted

You should just cut out the \pgfkeys call within the .style and leave only the list of keys that was in its argument. Note that the .style handler is a kind of .code, one that implicitly passes its argument to \pgfkeysalso. Basically, it's a \pgfkeys macro that "expands" to the keys you give it.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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