0

Possible Duplicate:
How can I highlight some lines from source code?

How to hide LaTeX command (keywords) in a listing? When I use for example \textbf{} in the listing it appears as \textbf{}. How can I hide this?

2 Answers2

3

I'm not sure that you can. The listings package provides its own macros for emphasising words in source code listings. For example, by default it emphasises language keywords. You can alter or add to the words that the pakcage emphasises. The following snippet, from the listings documentation,

\lstset{emph={square,root},emphstyle=\underbar}

will cause listings to set the words square and root with an underline.

0
\documentclass[12pt]{article}
\usepackage{alltt}

\begin{document}

\begin{alltt}
How to hide Latex Command (keywords) in a Listing. 
When i user for example \textbf{} the in the listing 
wil be appereard \textbf{}. How can hide this?
\end{alltt}

\end{document}

enter image description here

  • While hard to discern from the way the question was phrased, I believe the OP wanted to format text inside a TeX code listing made with the listings package. And of course, when he/she tried to do that, the commands appeared as they are, and no formatting took place. – Martin Tapankov Feb 01 '11 at 14:45