summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/generic/FAQ-en/html/FAQ-codelist.html
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/doc/generic/FAQ-en/html/FAQ-codelist.html')
-rw-r--r--Master/texmf-dist/doc/generic/FAQ-en/html/FAQ-codelist.html84
1 files changed, 84 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/generic/FAQ-en/html/FAQ-codelist.html b/Master/texmf-dist/doc/generic/FAQ-en/html/FAQ-codelist.html
new file mode 100644
index 00000000000..4ec9f46961d
--- /dev/null
+++ b/Master/texmf-dist/doc/generic/FAQ-en/html/FAQ-codelist.html
@@ -0,0 +1,84 @@
+<head>
+<title>UK TeX FAQ -- question label codelist</title>
+</head><body>
+<h3>Code listings in LaTeX</h3>
+<p/>&lsquo;Pretty&rsquo; code listings are sometimes considered worthwhile by the
+&ldquo;ordinary&rdquo; programmer, but they have a serious place in
+the typesetting of dissertations by computer science and other
+students who are expected to write programs. Simple verbatim listings
+of programs are commonly useful, as well.
+<p/> <a href="FAQ-verbfile.html">Verbatim listings</a> are dealt with elsewhere,
+
+as is the problem of
+<a href="FAQ-algorithms.html">typesetting algorithm specifications</a>.
+<p/>The <i>listings</i> package is widely regarded as the best bet for
+formatted output (it is capable of parsing program source, within the
+package itself), but there are several well-established packages that
+rely on a pre-compiler of some sort. You may use <i>listings</i>
+to typeset snippets that you include within your source:
+<blockquote>
+<pre>
+\usepackage{listings}
+\lstset{language=C}
+...
+\begin{document}
+\begin{lstlisting}
+#include &lt;stdio.h&gt;
+
+int main(int argc, char ** argv)
+{
+ printf("Hello world!\n");
+ return 0;
+}
+\end{lstlisting}
+\end{document}
+</pre>
+</blockquote><p>
+or you can have it typeset whole files:
+<blockquote>
+<pre>
+\usepackage{listings}
+\lstset{language=C}
+...
+\begin{document}
+\lstinputlisting{main.c}
+\end{document}
+</pre>
+</blockquote><p>
+These very simple examples may be decorated in a huge variety of ways,
+and of course there are other languages in the package&rsquo;s vocabulary
+than just <i>C</i>...
+<p/>Most people, advising others on (La)TeX lists, seem to regard
+<i>listings</i> as the be-all and end-all on this topic. But there
+<em>are</em> alternatives, which may be worth considering, in some
+situations.
+<p/><i>Highlight</i> is attractive if you need more than one output
+format for your program: as well as (La)TeX output,
+<i>highlight</i> will produce (X)HTML, RTF
+and XSL-FO representations of your program listing.
+Documentation is available on the
+<a href="http://www.andre-simon.de/"><i>highlight</a> project site</i>.
+<p/>The <i>lgrind</i> system is another well-established pre-compiler,
+with all the facilities one might need and a wide repertoire of
+languages; it is derived from the very long-established
+<i>tgrind</i>, whose output is based on Plain TeX
+<p/>The <i>tiny_c2l</i> system is more recent: users are encouraged to
+generate their own driver files for languages it doesn&rsquo;t already deal
+with.
+<p/>The <i>C++2LaTeX</i> system comes with strong recommendations for
+use with C and C++.
+<p/>An extremely simple system is <i>c2latex</i>, for which you write
+LaTeX source in your C program comments. The program then
+converts your program into a LaTeX document for processing. The
+program (implicitly) claims to be &ldquo;self-documenting&rdquo;.
+<dl>
+<dt><tt><i>c2latex</i></tt><dd><a href="ftp://cam.ctan.org/tex-archive/support/c2latex.zip">support/c2latex</a> (<a href="ftp://cam.ctan.org/tex-archive/support/c2latex.tar.gz">gzipped tar</a>, <a href="http://www.tex.ac.uk/tex-archive/support/c2latex/">browse</a>)
+<dt><tt><i>C++2LaTeX</i></tt><dd><a href="ftp://cam.ctan.org/tex-archive/support/C++2LaTeX-1_1pl1.zip">support/C++2LaTeX-1_1pl1</a> (<a href="ftp://cam.ctan.org/tex-archive/support/C++2LaTeX-1_1pl1.tar.gz">gzipped tar</a>, <a href="http://www.tex.ac.uk/tex-archive/support/C++2LaTeX-1_1pl1/">browse</a>)
+<dt><tt><i>highlight</i></tt><dd><a href="ftp://cam.ctan.org/tex-archive/support/highlight.zip">support/highlight</a> (<a href="ftp://cam.ctan.org/tex-archive/support/highlight.tar.gz">gzipped tar</a>, <a href="http://www.tex.ac.uk/tex-archive/support/highlight/">browse</a>)
+<dt><tt><i>lgrind</i></tt><dd><a href="ftp://cam.ctan.org/tex-archive/support/lgrind.zip">support/lgrind</a> (<a href="ftp://cam.ctan.org/tex-archive/support/lgrind.tar.gz">gzipped tar</a>, <a href="http://www.tex.ac.uk/tex-archive/support/lgrind/">browse</a>)
+<dt><tt><i>listings.sty</i></tt><dd><a href="ftp://cam.ctan.org/tex-archive/macros/latex/contrib/listings.zip">macros/latex/contrib/listings</a> (<a href="ftp://cam.ctan.org/tex-archive/macros/latex/contrib/listings.tar.gz">gzipped tar</a>, <a href="http://www.tex.ac.uk/tex-archive/macros/latex/contrib/listings/">browse</a>)
+<dt><tt><i>tgrind</i></tt><dd><a href="ftp://cam.ctan.org/tex-archive/support/tgrind.zip">support/tgrind</a> (<a href="ftp://cam.ctan.org/tex-archive/support/tgrind.tar.gz">gzipped tar</a>, <a href="http://www.tex.ac.uk/tex-archive/support/tgrind/">browse</a>)
+<dt><tt><i>tiny_c2l</i></tt><dd><a href="ftp://cam.ctan.org/tex-archive/support/tiny_c2l.zip">support/tiny_c2l</a> (<a href="ftp://cam.ctan.org/tex-archive/support/tiny_c2l.tar.gz">gzipped tar</a>, <a href="http://www.tex.ac.uk/tex-archive/support/tiny_c2l/">browse</a>)
+</dl>
+<p/><p>This question on the Web: <a href="http://www.tex.ac.uk/cgi-bin/texfaq2html?label=codelist">http://www.tex.ac.uk/cgi-bin/texfaq2html?label=codelist</a>
+</body>