[Latex] Put ASCII art into latex
Please copy following article to xxx.tex.
Using xelatex to compile it.
%template for producing IEEE-format articles using LaTex.
%written by Matthew Ward, CS Department, Worcester Polytechnic Institute.
%use at your own risk. Complaints to /dev/null.
%make two column with no page numbering, default is 10-point
% IEEE Conference Style Information
% http://robotics.stanford.edu/~suresh/theory/acmstyle.html
\documentclass[12pt,a4paper]{article}
\usepackage{url,hyperref} %natbib 是一種常用的關於引用文獻的套件
%hyperref是超連結交互參照的套件
%加這個就可以設定字體
\usepackage{fontspec}
%使用xeCJK,其他的還有CJK或是xCJK
\usepackage{xeCJK}
%設定英文字型,不設的話就會使用預設的字型
\setmainfont{Times New Roman}
%設定中英文的字型
%字型的設定可以使用系統內的字型,而不用像以前一樣另外安裝
\setCJKmainfont{標楷體}
%中文自動換行
\XeTeXlinebreaklocale "zh"
%文字的彈性間距
\XeTeXlinebreakskip = 0pt plus 1pt
%設定段落之間的距離
\setlength{\parskip}{0.3cm}
%設定行距
\linespread{1.5}\selectfont
%設定標題為中文
\renewcommand{\refname}{參考資料}
\renewcommand\figurename{圖}
%----要加入這個才有圖型的效果----%
\usepackage{graphicx}
\pagestyle{empty}
%set dimensions of columns, gap between columns, and paragraph indent
\setlength{\textheight}{8.75in}
\setlength{\columnsep}{2.0pc}
\setlength{\textwidth}{6.8in}
\setlength{\topmargin}{0.0in}
\setlength{\headheight}{0.0in}
\setlength{\headsep}{0.0in}
\setlength{\oddsidemargin}{-.19in}
\setlength{\parindent}{1pc}
%I copied stuff out of art10.sty and modified them to conform to IEEE format
\makeatletter
%as Latex considers descenders in its calculation of interline spacing,
%to get 12 point spacing for normalsize text, must set it to 10 points
\def\@normalsize{\@setsize\normalsize{10pt}\xpt\@xpt
\abovedisplayskip 10pt plus2pt minus5pt\belowdisplayskip
\abovedisplayskip \abovedisplayshortskip \z@
plus3pt\belowdisplayshortskip 6pt plus3pt
minus3pt\let\@listi\@listI}
\makeatother
% include the txt file into latex
\usepackage{listings}
\lstset{
keywordstyle=\color{RedViolet},
basicstyle=\tiny\sffamily,
columns=fullflexible,
commentstyle=\color{blue}\textit,
comment=[l]{//},
%morecomment=[s]{/*}{*/},
numberstyle=\tiny,
%extendedchars=true,
breaklines=true,
%linewidth=5cm.
frame=b,
numbers=left,
numberstyle=\tiny,
stepnumber=1,
numbersep=5pt,
%xleftmargin=3pt,
%xrightmargin=3pt,
framextopmargin=10pt,
%framexleftmargin=17pt,
%framexrightmargin=5pt,
%framexbottommargin=4pt,
%morecomment=[l]{//},
stringstyle=\color{red}\textit,
% l command must like
% morecomment=[l][\color{green}]{<green}
% s command must like
morecomment=[s][\color{green}]{<green:-}{:->},
morecomment=[s][\color{orange}]{<orange:-}{:->},
morecomment=[s][\color{pink}]{<pink:-}{:->},
morecomment=[s][\color{brown}]{<brown:-}{:->},
belowskip=10pt,
belowskip=10pt
}
%%%%%%%% For maketitle %%%%%%%%%%
\title{\Huge Intel Chip}
\author{
\Huge FKC \thanks{\LARGE Software Department.}}
\date{\Huge \today}
%%%%%%%% For ASCII art %%%%%%%%%%
\usepackage{verbatim}
%%%%%%%% Start %%%%%%%%%%
\begin{document}
\maketitle
\newpage
\tableofcontents
\newpage
%\listoftables % required if there are tables
%\newpage
\listoffigures % required if there are figures
\newpage
%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{figure}
\begin{verbatim}
+----------+ +----------+ +------------+ +----------+
| | | | | | | |
| CPE | | CM | DSLITE | DSLITE | | CNR7 |
| |<----->| |<------------>| Server |<--->| |
| | | | | | | |
+----------+ +----------+ +-----------+ +----------+
2001:1::2101 2001:1::2009
<---------------------------------------------------------------------+
ping PC(v6's IP) from CNR7
telnet PC(v6's IP) from CNR7
\end{verbatim}
\caption{DSLITE}
\label{fig:ascii-box}
\end{figure}
\end{document}
%%%%%%%% End %%%%%%%%%%
Reference :
0 意見:
張貼留言