\documentclass{article} \input Tcode_C.tex %The core \input pdfcolor-rg.tex \input Chighlighting_2.tex \input Tcode_py.tex \TcodeMarker{`} \begin{document} \TcodeSelectLanguage{C} Code formatted as C. \ncode{unsigned _BitInt(24) a; \hfill\break const wchar_t *s=L"long string"} \Code int b= a/2; /* Comment */ #define macro(x) (2*(x)) a=macro(c) //Another comment \endCode \TcodeSelectLanguage{py} From here onwarsds, python is the default. \begin{Code} pairs = [(1, 'one'), (2, 'two'), (3, 'three'), (4, 'four')] pairs.sort(key=lambda pair: pair[1]) pairs \end{Code} C code, but the default language remains python. \begin{CCode} int main(int argc, int **argv){ printf(argc,__func__); return 0 } \end{CCode} % (python code continues) \begin{Code} pairs = [(1, 'one'), (2, 'two'), (3, 'three'), (4, 'four')] pairs.sort(key=lambda pair: pair[1]) pairs \end{Code} \count20=0 \loop \TcodeSelectLanguage{C} \TcodeSelectLanguage{py} \advance\count20 1 \ifnum\count20<100 \repeat \end{document} .