# How to hide LaTeX commands and keywords in a listing? [duplicate]

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?

-

## migrated from stackoverflow.comFeb 1 '11 at 13:49

This question came from our site for professional and enthusiast programmers.

## marked as duplicate by Loop SpaceFeb 3 '11 at 19:08

I think there's a new Tex/Latex StackExchange site these days... may be a better place to ask – DVK Nov 25 '10 at 19:54
See the answer to tex.stackexchange.com/questions/8851/… , it should apply to this question, too. – Jan Hlavacek Feb 1 '11 at 14:04
Given that this is an old question and the context is not overly clear, I'm minded to close this as a duplicate of the question that Jan links to. Any objections? – Loop Space Feb 3 '11 at 11:49
@Andrew: agreed. – Juan A. Navarro Feb 3 '11 at 13:03

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.

-
\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}


-
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 1 '11 at 14:45