星期一, 十一月 02, 2009

[Tools]Latex Tips -- Include URL and Source Code

Include a URI
To include a URI, it is recommended to use the misc type with the \url command (requires \usepackage{url} in the tex file).

@misc{Riv92b:sig,
key = {Riv92b},
author = {Ron Rivest},
title = {The MD5 Message-Digest Algorithm},
howpublished = {\url{ftp://ftp.isi.edu/in-notes/rfc1321.txt}},
year = {1992}
}

Include Source Code
\usepackage{listings}
\lstset{
        language=C++,
        %%keywordstyle=\bfseries\ttfamily\color[rgb]{0,0,1},
        identifierstyle=\ttfamily,
        %%commentstyle=\color[rgb]{0.133,0.545,0.133},
        %%stringstyle=\ttfamily\color[rgb]{0.627,0.126,0.941},
        showstringspaces=false,
        basicstyle=\small,
        numberstyle=\footnotesize,
        %numbers=left,
        stepnumber=1,
        numbersep=10pt,
        tabsize=2,
        breaklines=true,
        %%prebreak = \raisebox{0ex}[0ex][0ex]{\ensuremath{\hookleftarrow}},
        breakatwhitespace=false,
        aboveskip={1.5\baselineskip},
        columns=fixed,
        %%upquote=true,
        extendedchars=true,
        frame=single,
        %%backgroundcolor=\color{lbcolor},
}
\begin{figure}[h]
  \lstinputlisting{code/foo.cc}
  \caption{\emph{foo.cc} explained}
  \label{fig:foo.cc}
\end{figure}

References:
http://franz.kollmann.in/latex/latex.html
http://www.tjansson.dk/?p=419

1 条评论:

匿名 说...

http://lumerkoz.edu I bookmarked this site., [url="http://www.sqlprof.com/members/Buy-Lamictal.aspx"]lamictal side effects[/url] datasource privatized [url="http://epsaservicecenter.com/members/Buy-Cipro.aspx"]cipro side effects[/url] exacerbates narrowness [url="http://www.comicspace.com/codeine/"]codeine side effects[/url] apples crosswalks [url="http://soundcloud.com/zolpidem"]zolpidem side effects[/url] biosciences [url="http://www.ecometro.com/Community/members/Buy-Zoloft.aspx"]zoloft[/url] imdb modular