Document ClassesText format within a listing

Information and discussion about specific document classes and how to create your own document classes.
Post Reply
Kinamand
Posts: 2
Joined: Fri May 16, 2008 4:34 pm

Text format within a listing

Post by Kinamand »

Hi,

I am having a problem formatting the text in a listing. The purpose is to distinguish between parentheses with two different meanings. I have tried to format them in this way:

Code: Select all

\lstset{%
  identifierstyle=\ttfamily,
  basicstyle=\scriptsize,
  aboveskip=\bigskipamount,
  moredelim=**[is][\bfseries]{£}{£}
}
and then using it within the listing like this:

Code: Select all

\begin{lstlisting}
  £(£   ( )     £)£
\end{lstlisting}
The problem is that the result isn't as clear as expected. Isn't there a way to obtain further control of the exact format? e.g. to both make it bold and larger within the £'s.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
Stefan Kottwitz
Site Admin
Posts: 10321
Joined: Mon Mar 10, 2008 9:44 pm

Text format within a listing

Post by Stefan Kottwitz »

Hi Kinamand,

a quick idea is to insert a size command:

Code: Select all

moredelim=**[is][\bfseries\footnotesize]{£}{£}
Now it's bold and bigger than the other \scriptsize parantheses.

Stefan
LaTeX.org admin
Kinamand
Posts: 2
Joined: Fri May 16, 2008 4:34 pm

Re: Text format within a listing

Post by Kinamand »

Hey Stefan,
Thank you very much. That was just what i needed :D
Post Reply