Browse Source

added python code include

master
Bit 2 years ago
parent
commit
90ace3c7bb
  1. 31
      base/code_include/python

31
base/code_include/python

@ -0,0 +1,31 @@
\newcommand{\includePythonScript}[2]{
\definecolor{dkgreen}{rgb}{0,0.6,0}
\definecolor{gray}{rgb}{0.5,0.5,0.5}
\definecolor{mauve}{rgb}{0.58,0,0.82}
\lstset{frame=tb,
language=python,
aboveskip=3mm,
belowskip=3mm,
showstringspaces=false,
columns=flexible,
basicstyle={\small\ttfamily},
numbers=none,
numberstyle=\tiny\color{gray},
keywordstyle=\color{blue},
commentstyle=\color{dkgreen},
stringstyle=\color{mauve},
breaklines=true,
breakatwhitespace=true,
tabsize=3}
\ifendswith{#1}{_tex.py}{
\StrLen{#1}[\strlen]
\StrLeft{#1}{\numexpr\strlen-7\relax}[\strleft]
\input{\strleft}\\
}
#2
\\\\
\begin{minipage}{\linewidth}
\lstinputlisting{#1}
\end{minipage}
}
Loading…
Cancel
Save