Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question

migrated from stackoverflow.com Feb 1 '11 at 13:49

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

marked as duplicate by Loop Space Feb 3 '11 at 19:08

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
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
2  
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
add comment

2 Answers

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.

share|improve this answer
add comment
\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

share|improve this answer
    
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
add comment