Including Raw Text Materials 

I want to include raw text materials as-is into the tex file. The raw text is produced by anther program. I "inlcude" it in so that I don't need to update my latex file everytime I update the program output. what is the best way to do it?

moreverb 

An extension to the verbatim package that can handle TAB expansion, can number lines in an included file, can produce boxed verbatims, etc.

my own hack 

w/ quote 
awk 'BEGIN{ print "\\begin{quote}\\begin{verbatim}\n" } {print} END { print "\\end{verbatim}\\end{quote}\n"} '
w/o quote 
awk 'BEGIN{ print "\\begin{verbatim}\n" } {print} END { print "\\end{verbatim}\n"} '
\begin{verbatim}
\end{verbatim}

T

Including Raw Text Materials 

Use the verbatim package

\verbatiminput{filename}

*References*: [NSS] s4.5, p60.

Including Raw Text Materials 

You can use the alltt package. It works like the verbatim environment except that the backslash and the braces retain their usual meaning:

\usepackage{alltt}
\begin{quote}\begin{alltt}
\input{support/validate.text}
\end{alltt}\end{quote}

David Djajaputra

including java code 

> As a part of my dissertation I need to include java library (it is rather
> large library).  is there an easy way to include Java code in LaTeX?

I use the listings, and fancyvrb packages:

\usepackage{fancyvrb}
\usepackage{listings}
\lstset{language=Java,basicstyle=\footnotesize,fancyvrb=true}
\begin{figure}[htbp]
  \centering
\begin{Verbatim}[frame=single,baselinestretch=1,fontsize=\footnotesize,numbers=left]
public void newImage(Object source , ImageData image)
{
//.. snipped code
}
  \end{Verbatim}
\end{figure}

including java code 

> > I use the listings, and fancyvrb packages:
> > [...]

Thank you, it works.

> - Have you tried to use \verbatiminput to include the file by latex
> instead of include it yourself, with the fancyvrb & listings package?

I am using it like this (note: \verbatiminput doesn't take additional info) :

\lstset{language=Java, basicstyle=\footnotesize, fancyvrb=true,breaklines}
\VerbatimInput[baselinestretch=1,fontsize=\footnotesize,numbers=left]{file.java}
> - Is that the 'program' package will do a better job than listing?

You need to reformat your code first, but after that you may get better result.

Listings Package: set shell scripts as default type 

*Tags*: pkg:listing

> What's the easy way to set shell scripts as default type and use
> mono-space fonts (typewriter font) for it?

You can easily define the shell script highlighting yourself. Set this in your preamble:

%---
\lstdefinelanguage{bash}
  {keywords={for, if, else, then, fi, echo, case, in,
      elif, esac, for, do, done, tar, while, until, shift,
      mv, mkdir, ;;, \$\#, \$1, \$2},
   stringizer=[d]{"},
   commentline={\#},
   sensitive=true,
   basicstyle=\ttfamily
  }
%---
This is a small example, and it is not complete at all, but I think you
get the idea now. At the end there is a "key=value" list, these are
automatically set if you select the language. You can try to add
your default font for shell scripts there. Something like this (did not
test this myself):
%---

I hope this was of any use to you…

Kris Luyten

documented on: 2001.03.08

Questions on Listings Package 

Newsgroups: comp.text.tex
> Second, about the place it put the caption. The "listings" package
> chooses to put the caption on top. But I see many book and articles
> put the caption at the bottom. Besides, my table and figure captains
> are at the bottom. Which place is considered the appropriate place
> nowadays? And most important, how can I make the change accordingly?

(Did not test this) You can use the variable "captionpos" to set the listings top or bottom. ("t" for top, and "b" for bottom). So, \lstsett of \lstsetb.

> Third, about the name it use. The "listings" package chooses
> "Listing ###" as its name. Is it possible to use it back to "Table
> ###" and incorporate with the table numbering that I already have?

This is how you can change "Listing" into "Table":

To incorporate the table numbering, I am not sure: \renewcommand{thelstlisting}{thetable} does not work! It gives the listing the last table number, but does not increment it when the next listing is inserted. You can of course increment \thelstlisting and \thetable but there should be a much better way to do this.

Kris Luyten

Questions on Listings Package 

> > "Listing ###" as its name. Is it possible to use it back to "Table
>
>
>To incorporate the table numbering, I am not sure:
>\renewcommand{\thelstlisting}{\thetable} does not work!

This is not sufficient, because \the… is just the name to *output* the value. Since you want to use internally the same counter, I guess you have to hack either listing or table to use the corresponding counter.

Maybe the following simple hack works for you (I have not tested it; but since nobody else replied…)

\makeatletter
\let\c@lstlisting\c@table
\makeatother

This makes the internal counter for "\thelstlisting" be the same as that of "\thetable". However, even if this works, this hack may give you undesired side effects. For example, if only *one* of the counters is reset with another counter (perhaps in certain classes when the chapter number is increased), then also the `joined' counter is reset.

Martin Vaeth

List file with underlines in their names 

Solution / Conclusion 

 \lstinputlisting[caption=code/jsp/db\_browsetable.jsp]{code/jsp/db_browsetable.jsp}

Analysis / Reason 

Oh, it is the macro error:

\finclude{jsp/db_browsetable.jsp}

is nok, but

\lstinputlisting{code/jsp/db_browsetable.jsp}

is ok!

\lstinputlisting[caption=code/jsp/db_browsetable.jsp]{code/jsp/db_browsetable.jsp}
! Missing $ inserted.
<inserted text>
                $
l.38 ...wsetable.jsp]{code/jsp/db_browsetable.jsp}

Trying History 

Trying History 
\finclude{jsp/db_browsetable.jsp}
?
! Emergency stop.
<inserted text>
                $
l.45 \finclude{jsp/db_browsetable.jsp}
Trying History 
\finclude{jsp/db\_browsetable.jsp}
! Package Listings Error: File `code/jsp/db\unhbox\voidb@x \kern .06em\vbox {\hrule width.3em}browsetable.jsp' not found.
Trying History 
\usepackage[T1]{fontenc}
! Package Listings Error: File `code/jsp/db\T1\textunderscorebrowsetable.jsp' not found.

Use \finclude{jsp/db_browsetable.jsp} produced same above error.

Trying History 
\finclude{jsp/db{_}browsetable.jsp}
! Package Listings Error: File `code/jsp/db{_}browsetable.jsp' not found.

How to format SQL tables? 

Newsgroups: comp.text.tex
| > +-------+------------+--------------+
| > + col 1 | col 2      | col 3        |
| > +-------+------------+--------------+
| > |       |            |              |
| > |       |            |              |
| > |       |            |              |
| > |       |            |              |
| > +-------+------------+--------------+
| > Table 1: Personel table
|
| FWIW: Table captions should be rather located at the top, not at
| the bottom. You might want to try supertabular or longtable, or
| the ccaption package for defining such `non-floating' table captions.

I have located the doc's on supertabular and longtable. And they both appear to keep the tables as running text and not as floats. This may be exactly what I am looking for. Going to check it out! Thanks.

How to format SQL tables? 

They make it possible to have a tabular that spans multiple pages. Each page is its own tabular environment, thus the various parts may have different widths. If that is not what you want you should check out longtable.