the listings package we use to display code doesn't play well with colored text. We need to use this hackish kind of syntax to do it:
In the preamble:
\lstdefinestyle{BashInputStyle}{
language=bash,
linewidth=0.95\linewidth,
xleftmargin=0.05\linewidth,
moredelim=**[is][\color{red}]{§}{§},
moredelim=**[is][\color{OliveGreen}]{`}{`}
}
Then in the code, here I use § delimiters to get red text:
\begin{lstlisting}[style=BashInputStyle]
$ echo hello > newfile.txt
$ git status
# On branch master
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
§newfile.txt§
nothing added to commit but untracked files present (use "git add" to track)
\end{lstlisting}
For now we use:
- Backticks for green
- § for red
backticks need to be replaced by something else because they are sometimes present in the code, such as when displaying tree output in the ASCII charset.
To make things even easier: the delimiters must be in the extended-ascii charset because listings doesn't understand UTF-8.
🆒
I think ° is a good candidate
the listings package we use to display code doesn't play well with colored text. We need to use this hackish kind of syntax to do it:
In the preamble:
Then in the code, here I use § delimiters to get red text:
For now we use:
backticks need to be replaced by something else because they are sometimes present in the code, such as when displaying tree output in the ASCII charset.
To make things even easier: the delimiters must be in the extended-ascii charset because listings doesn't understand UTF-8.
🆒
I think ° is a good candidate