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:
Manual highlight of TeX code in a verbatim environment

I want to highlight certain parts of a program output listing which represent user input. For example I want to use \textbf in this way:

$ \textbf{dmesg | tail}

...
[ 6854.215650] sd 7:0:0:0: [sdc] Mode Sense: 0b 00 00 08
[ 6854.215653] sd 7:0:0:0: [sdc] Assuming drive cache: write through
[ 6854.215659] sdc: sdc1
[ 6854.218079] sd 7:0:0:0: [sdc] Attached SCSI removable disk
[ 6854.218135] sd 7:0:0:0: Attached scsi generic sg2 type 0
...

I am unable to do it in listings and minted. Moreover I can't find a list of supported languages by minted in order to set it to bash output.

share|improve this question
    
minted uses a Python Pygments library. Look there for a list of supported languages. –  Martin Scharrer May 16 '12 at 11:12
    
Thanks, this is the page.. By the way I cannot make \textbf work inside minted block. –  unsel May 16 '12 at 11:23
    
For a list of supported languages, use pygmentize -L lexers. :) –  Paulo Cereda May 16 '12 at 11:24
    
Since I can't comment yet I'll write this as an answer, I hope this is not too inappropriate: This seems to be a near duplicate of this question: tex.stackexchange.com/a/41724/14576 There the solution was to use a laslisting environment, and do the formatting with the literate option \lstset –  Andreas Wallner May 16 '12 at 11:28
    
Hi Francesco. Please take a look at this question and report if there is anything else you need. The answers partly provide pretty sophisticated ways of highlighting, but this one shows how to use the moredelim option of listings to apply simple font commands, such as \bfseries to highlight certain parts. –  Daniel May 16 '12 at 12:09
show 4 more comments

marked as duplicate by topskip, lockstep, Stefan Kottwitz Jun 16 '12 at 19:27

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.

1 Answer

I found a fast solution in an answer on this question. I had to add

\DeclareFontShape{OT1}{cmtt}{bx}{n}{<5><6><7><8><9><10><10.95><12><14.4><17.28><20.74><24.88>cmttb10}{}

and write my code block in this way (using listings)

\begin{lstlisting}[escapechar=@]
$ @\textbf{dmesg | tail}@ 

...
[ 6854.215650] sd 7:0:0:0: [sdc] Mode Sense: 0b 00 00 08
[ 6854.215653] sd 7:0:0:0: [sdc] Assuming drive cache: write through
[ 6854.215659] sdc: sdc1
[ 6854.218079] sd 7:0:0:0: [sdc] Attached SCSI removable disk
[ 6854.218135] sd 7:0:0:0: Attached scsi generic sg2 type 0
...
\end{lstlisting}
share|improve this answer
add comment

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