1

I wanna include a bash script in a black box in a pdf using latex. I achieved everything I want, except bold commands in the script using the following code:

\documentclass[11pt,a4paper,DIV=15]{scrartcl} \usepackage[ngerman]{babel} 
\usepackage[utf8]{inputenc} 
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{float}
\usepackage{xcolor}
\usepackage[colorlinks,linkcolor=blue]{hyperref}
\usepackage{listings}

\lstset{language=bash,backgroundcolor=\color{lightgray},frame=lrbt,basicstyle=\ttfamily}


\begin{document}


\begin{lstlisting}
#!/bin/bash

pdflatex  $1
echo Anstatt  dieses  Skriptes  haettest  Du  pdflatex
echo auch  einfach  direkt  aufrufen  koennen  ...
\end{lstlisting}

\end{document}

I dont get why listing automatically writes my comments italic, but doesnt recognize echo as an command. As commands should be written bold when using language=bash.

1

Simply add \usepackage{lmodern}and get bold "echo". It will be a little bit hard to discover because of the background in lightgray.

| improve this answer | |
1

IF you remove basicstyle=\ttfamily then you should be set, it looks like setting typewriter style for strings is removing the bold formatting for key words.

Removing that gives me this. enter image description here

| improve this answer | |