### Question:

Insert Bash code with coloration into my latex report - TeX
• I am writing a long report and I need to include some codes I programed. I would like present my code with coloration, as we can have in some text editor (and not using verbatim).

I need the coloration mode for two kind of languages (coloration given can be totally different, no problem with that):

• Bash language
• (Java language)<= Already have it, thanks!

*concerning the coloration itself, we can consider as simple example linux text editor.

\documentclass{article}
\usepackage{xcolor}
\usepackage{listings}
\lstset{basicstyle=\ttfamily,
showstringspaces=false,
keywordstyle=\color{blue}
}

\begin{document}

\begin{lstlisting}[language=Java,caption={Java version}]
public class HelloWorld {
// Here's the main class
public static void main(String[] args) {
System.out.println("Hello, world!");
}
}
\end{lstlisting}

\begin{lstlisting}[language=bash,caption={bash version}]
#!/bin/bash
echo "Hello, world!"
\end{lstlisting}

\end{document}


• for java i use the listings package with following style:

\definecolor{javakeyword}{rgb}{0,0,0.5}
\definecolor{javastring}{rgb}{0,0.5,0}
\definecolor{javacomment}{rgb}{0.5,0.5,0.5}
\lstdefinestyle{java}{
language=Java,
showspaces=false,
showstringspaces=false,
basicstyle=\ttfamily,
columns=flexible,
stringstyle=\color{javastring},
keywordstyle=\color{javakeyword}\ttfamily\textbf,

\begin{lstlisting}[float,style=Java,caption={Correct Logging example},label=lst:logging]