Created
February 27, 2015 21:16
-
-
Save rmcelreath/1e3fb52480ae7c79931d to your computer and use it in GitHub Desktop.
TeX code for dumping code boxes to a common plain text file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\newwrite\tempfile | |
\usepackage{verbatim} | |
\makeatletter | |
\newwrite\Code@out % temp file for writing out and reading back in for display | |
\newcommand\VerbSaver{\obeylines\expandafter\VerbSaverArg\noexpand} | |
\newcommand\VerbSaverArg[1][code.txt]{% | |
\gdef\FName{xcodetempx.txt}% | |
\begingroup | |
\@bsphack% | |
\immediate\openout\Code@out\FName% | |
\let\do\@makeother\dospecials% | |
\catcode`\^^M\active% | |
\def\verbatim@processline{% | |
\immediate\write\tempfile{\the\verbatim@line} | |
\immediate\write\Code@out{\the\verbatim@line}}% | |
\verbatim@start} | |
\def\endVerbSaver{% | |
\immediate\write\tempfile{} | |
\immediate\closeout\Code@out\@esphack | |
\endgroup | |
\verbatiminput{\FName}} | |
\makeatother |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment