如何缩小框架内的文字?

如何缩小框架内的文字?

如何缩小以下框架内的文本?

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

不幸的是,我得到的内容超出了页面的边缘。

答案1

您可能需要basicstylebreaklines选项。我建议阅读listings非常全面文档。所有这些选项以及更多选项均已解释。

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

在此处输入图片描述

相关内容