Warm tip: This article is reproduced from stackoverflow.com, please click
latex isabelle agda

How to include both Agda and Isabelle code in the same latex file?

发布于 2020-03-27 10:30:09

I am creating presentation slides using beamer, and on the slides I want to include pieces of code from Agda and Isabelle standard libraries. All I can find online is generating latex from Agda (lagda) or from Isabelle (document preparation). I want to go the other way, as my slides will have code from different systems. I can still use lstlisting or verbatim, but I would rather not copy-paste and reformat code.

I would prefer to have something like including line numbers from files, or maybe code between tags

Questioner
Yasmine Shaorda
Viewed
54
gallais 2019-07-04 16:56

Your best bet is to use the catchfilebetweentags package: given two files IsabelleCode.tex and AgdaCode.tex generated by the respective LaTeX backends of each language, you can capture the code between an opening tag %<*TAGNAME> and a closing tag %</TAGNAME> in either file by using the appropriate directive e.g.:

\ExecuteMetaData[IsabelleCode.tex]{TAGNAME}
\ExecuteMetaData[AgdaCode.tex]{TAGNAME}