X-Git-Url: https://git.martlubbers.net/?a=blobdiff_plain;f=preamble%2Flistings.tex;h=e975b3de444f2b8be7847d1914a1cd3e48f8c613;hb=b8ed2f5d652345859c8cb9daf48116a2c1a32c48;hp=a6b54c3578f910a132f729c5312f9b91f5c60adc;hpb=5bd4efa4ebb3e70f19c6fa09366a8feb68aa2de7;p=phd-thesis.git diff --git a/preamble/listings.tex b/preamble/listings.tex index a6b54c3..e975b3d 100644 --- a/preamble/listings.tex +++ b/preamble/listings.tex @@ -5,6 +5,7 @@ \def\addToLiterate#1{\edef\lst@literate{\unexpanded\expandafter{\lst@literate}\unexpanded{#1}}} \lst@Key{moreliterate}{}{\addToLiterate{#1}} \makeatother +\definecolor{lstbg}{gray}{.95} % General listings settings \lstset{% basewidth=0.5em, @@ -19,7 +20,6 @@ backgroundcolor=\color{lstbg}, keepspaces=true, keywordstyle=\bf, - postbreak=\mbox{\textcolor{gray}{$\hookrightarrow$}\space}, showspaces=false, showstringspaces=false, showtabs=false, @@ -41,7 +41,7 @@ \newcommand{\cinline}[1]{\lstinline[language=c,postbreak=]|#1|} \newcommand{\arduinoinline}[1]{\lstinline[language={[Arduino]C++},postbreak=]|#1|} \newcommand{\pythoninline}[1]{\lstinline[language=Python,postbreak=]|#1|} -\newcommand{\cleaninline}[1]{\lstinline[language=Clean,postbreak=]|#1|} +\newcommand{\cleaninline}[2][]{\lstinline[language=Clean,postbreak=,#1]|#2|} \newcommand{\cleaninputlisting}[2][]{\renewcommand*{\lstlistingname}{Listing (\gls{CLEAN})}\lstinputlisting[escapeinside={/*}{*/},language=Clean,#1]{\subfix{#2}}} \newcommand{\haskellinline}[1]{\lstinline[language={[Regular]Haskell},postbreak=]|#1|} \newcommand{\haskellinputlisting}[2][]{\renewcommand*{\lstlistingname}{Listing (\gls{HASKELL})}\lstinputlisting[language={[Regular]Haskell},#1]{\subfix{#2}}} @@ -58,6 +58,9 @@ \my@chapter} \makeatother +% Mark source code in the margin par +\newcommand{\srcmark}[1]{\marginpar[\footnotesize\emph{#1}]{\footnotesize\emph{#1}}} + \lstnewenvironment{lstPython}[1][] {% \lstset{language=Python, #1} @@ -94,3 +97,11 @@ % Fix the algorithm font \renewcommand\AlCapFnt{\normalfont} +\makeatletter +\patchcmd{\lsthk@SelectCharTable}{% + \lst@ifbreaklines\lst@Def{`)}{\lst@breakProcessOther)}\fi + }{% + }{ + }{ + } +\makeatother