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.

How do I shrink the text inside the following frame?

\lstset{framexleftmargin=0mm, frame=shadowbox, rulesepcolor=\color{black}}

\begin{ttfamily}
\begin{lstlisting} 
root@bt:~# nmap -O we****t***.com

Starting Nmap 6.01 ( http://nmap.org ) at 2012-12-21 15:38 CET
Nmap scan report for we****t***.com (217.6*.***.**)
Host is up (0.0087s latency).
Not shown: 990 filtered ports
PORT     STATE  SERVICE
21/tcp   open   ftp
22/tcp   open   ssh
53/tcp   open   domain
80/tcp   open   http
110/tcp  open   pop3
143/tcp  open   imap
443/tcp  open   https
587/tcp  closed submission
3306/tcp open   mysql
3389/tcp closed ms-wbt-server
Device type: general purpose
Running (JUST GUESSING): Microsoft Windows 7|2008 (90%)
OS CPE: cpe:/o:microsoft:windows_7:::enterprise cpe:/o:microsoft:windows_server_2008::sp1
Aggressive OS guesses: Microsoft Windows 7 Enterprise (90%), Microsoft Windows Server 2008 SP1 (89%)
No exact OS matches for host (test conditions non-ideal).

OS detection performed. Please report any incorrect results at http://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 79.16 seconds
\end{lstlisting}
\end{ttfamily}

Unfortunately what I get exceeds the page's margins.

share|improve this question
3  
Please consider going through your other questions and marking one of the answers to them as ‘Accepted’ by clicking on the tickmark below their vote count (see How do you accept an answer?). This shows which answer helped you most, and it assigns reputation points to the author of the answer (and to you!). It's part of this site's idea to identify good questions and answers through upvotes and acceptance of answers. –  cgnieder Dec 30 '12 at 16:23
    
I've just accepted the answer you gave me. I do hope I did what I'm supposed to do –  g9999 Dec 30 '12 at 16:35
1  
Please note that you don't have to accept any answers. But if an answer actually helped you then it is also helpful to others browsing this site to be able to see which answers helped most. That is what accepting answers is meant for... So only accept my answer if it actually helped :) –  cgnieder Dec 30 '12 at 16:38
add comment

1 Answer 1

up vote 6 down vote accepted

You'll probably want the basicstyle and the breaklines options. I recommend reading listings very comprehensive documentation. All of these options and many more are explained there.

\documentclass{article}
\usepackage{listings,xcolor}

\lstset{
  framexleftmargin=0mm,
  frame=shadowbox,
  rulesepcolor=\color{black},
  basicstyle=\ttfamily\small,
  breaklines,
  % recommendable when using a monospaced font (see the documentation
  % for details, thanks @egreg for the reminder):
  columns=fullflexible
}

\begin{document}

\begin{lstlisting} 
root@bt:~# nmap -O we****t***.com

Starting Nmap 6.01 ( http://nmap.org ) at 2012-12-21 15:38 CET
Nmap scan report for we****t***.com (217.6*.***.**)
Host is up (0.0087s latency).
Not shown: 990 filtered ports
PORT     STATE  SERVICE
21/tcp   open   ftp
22/tcp   open   ssh
53/tcp   open   domain
80/tcp   open   http
110/tcp  open   pop3
143/tcp  open   imap
443/tcp  open   https
587/tcp  closed submission
3306/tcp open   mysql
3389/tcp closed ms-wbt-server
Device type: general purpose
Running (JUST GUESSING): Microsoft Windows 7|2008 (90%)
OS CPE: cpe:/o:microsoft:windows_7:::enterprise cpe:/o:microsoft:windows_server_2008::sp1
Aggressive OS guesses: Microsoft Windows 7 Enterprise (90%), Microsoft Windows Server 2008 SP1 (89%)
No exact OS matches for host (test conditions non-ideal).

OS detection performed. Please report any incorrect results at http://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 79.16 seconds
\end{lstlisting}

\end{document}

enter image description here

share|improve this answer
    
And, possibly, columns=fullflexible, as using a fixed width font will guarantee aligment without adding space between characters, which I find terrible. –  egreg Dec 30 '12 at 16:37
    
@egreg good point! –  cgnieder Dec 30 '12 at 16:39
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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