2

I am using \lstset in order to create boxes with writing in in my document. In these boxes I am using a lot of double dash (--) and a lot of at symbol (@). I am trying to change basicstyle to ensure that both symbols (--, @) come out nicely. I could not find a list of basicstyles and for everything I tried either the @ looks weird and is hard to read or the space between each dash in -- is so small that it looks like a single long dash.

\documentclass[a4paper,11pt,oneside]{book}
\usepackage[DIV=14,BCOR=2mm,headinclude=true,footinclude=false]{typearea}
\usepackage{listings}
\usepackage[T1]{fontenc}
\usepackage{xcolor}
\definecolor{backcolour}{rgb}{0.95,0.95,0.92}
\lstset{backgroundcolor = \color{backcolour}, breaklines=true, language=bash,basicstyle=\rmfamily}


\begin{document}
\chapter*{Test}


% Okay-ish at symbol but the double dash is ugly
\begin{lstlisting}[language=bash]
--PN 4 @ 
\end{lstlisting}

\lstset{backgroundcolor = \color{backcolour}, breaklines=true, language=bash,basicstyle=\sffamily}

% Both the double dash and the at symbol look ugly
\begin{lstlisting}[language=bash]
--PN 4 @ 
\end{lstlisting}


\lstset{backgroundcolor = \color{backcolour}, breaklines=true, language=bash,basicstyle=\ttfamily}

% Good looking double dash but the at symbol is ugly
\begin{lstlisting}[language=bash]
--PN 4 @ 
\end{lstlisting}

\end{document}

enter image description here

Can you help me with that?

1
1

Your question is very opinion based, since there is now way of telling, what you consider good looking.

Instead of answering the unanswerable question, I will rather show you where to find fonts, and how to use them.

You should use monospaced fonts for code. You can find some in the LaTeX Font Catalogue. Usually you can just copy the code from the example page and you are good to go:

enter image description here

\documentclass[a4paper,11pt,oneside]{book}
\usepackage{listings}
\usepackage{DejaVuSansMono}
%% Another possibility is
%% \usepackage{dejavu}
%% which loads the DejaVu Serif and DejaVu Sans fonts as well
\renewcommand*\familydefault{\ttdefault} %% Only if the base font of the document is to be typewriter style
\usepackage[T1]{fontenc}
\usepackage{xcolor}
\definecolor{backcolour}{rgb}{0.95,0.95,0.92}
\lstset{backgroundcolor = \color{backcolour}, breaklines=true, language=bash,}

\begin{document}

\begin{lstlisting}[language=bash]
--PN 4 @ 
\end{lstlisting}

\end{document}

How does it look?

enter image description here

You are using DejaVuSansMono for your listings now:

name                                 type              encoding         emb sub uni object ID
------------------------------------ ----------------- ---------------- --- --- --- ---------
UFFTXN+DejaVuSansMono                Type 1            Custom           yes yes no       4  0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.