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}
  • 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

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.

| improve this answer | |

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.