The inventor of TeX, Donald Knuth, also wrote a program called "CWEB". It consists of two main programs, "cweave" and "ctangle". A programmer would write a C program, along with detailed documentation, in the syntax of CWEB (which I think is a bit awkward, but you get used to it if you use it lot). Then you can run cweave on the CWEB file to produce a TeX (not LaTeX) source file, or run ctangle on the CWEB file to produce the C source with all the documentation stripped out. The best way to und
if you already have the C code in a file, you can include verbatim package and simply do: \verbatiminput{yourcode.c}
【在 T*******n 的大作中提到】 : The inventor of TeX, Donald Knuth, also wrote a program called "CWEB". : It consists of two main programs, "cweave" and "ctangle". : A programmer would write a C program, along with detailed documentation, : in the syntax of CWEB (which I think is a bit awkward, but you get used : to it if you use it lot). Then you can run cweave on the CWEB file to : produce a TeX (not LaTeX) source file, or run ctangle on the CWEB file : to produce the C source with all the documentation stripped out. : The best way to und
f*h
5 楼
a follow-up question, is there anyway to specify the maximum number of characters a line can have, say 80, in a source code file. Or, how to do auto-wrapping.
and
【在 T*******e 的大作中提到】 : if you already have the C code in a file, you can include verbatim package and : simply do: : \verbatiminput{yourcode.c}
【在 f********h 的大作中提到】 : a follow-up question, is there anyway to specify the maximum number : of characters a line can have, say 80, in a source code file. Or, : how to do auto-wrapping. : : and
from my experience, the built-in verbatim environment from Latex has all kinds of strange problems. I always include \usepackage{verbatim} before using it.
【在 z*****n 的大作中提到】 : how come? : : 双
T*n
9 楼
That shouldn't happen. What class and packages have you loaded? If you just create a minimal document with " in a verbatim environment, does the problem occur? Also I'm wondering whether this might be a font encoding issue. Are you using a difference font that cmtt (the default in LaTeX), and are you loading the fontenc or t1enc or other similar packages?
I got one problem in verbatim environment: the table indents cannot be d isplayed and all lines starts from the beginning of left inside \verbatim. Another problem is that both verbatim and listings cannot automatically wrap the too-long lines, thus always make the output messy .
【在 T*******e 的大作中提到】 : from my experience, the built-in verbatim environment from Latex has : all kinds of strange problems. I always include \usepackage{verbatim} : before using it.
z*n
11 楼
especially when using \verbatiminput command.
【在 z*****n 的大作中提到】 : I got one problem in verbatim environment: the table indents cannot be d : isplayed and all lines starts from the : beginning of left inside \verbatim. : Another problem is that both verbatim and listings cannot : automatically wrap the too-long lines, thus always make the output messy : .
f*h
12 楼
【在 z*****n 的大作中提到】 : I got one problem in verbatim environment: the table indents cannot be d : isplayed and all lines starts from the : beginning of left inside \verbatim. : Another problem is that both verbatim and listings cannot : automatically wrap the too-long lines, thus always make the output messy : .
T*n
13 楼
Do you mean "tab stops", i.e., what is usually associated with eight spaces? In (La)TeX the ASCII TAB character is treated like a regular space, so it is not expanded. You should take a look at using the fancyvrb package http://www.ctan.org/tex-archive/macros/latex/contrib/fancyvrb/ and also read pages 160-161 in "The LaTeX Companion" 2nd edition. You could put the verbatim environment within a quote environment to have the verbatim text indented. None of the verbatim environments will wrap li
【在 z*****n 的大作中提到】 : I got one problem in verbatim environment: the table indents cannot be d : isplayed and all lines starts from the : beginning of left inside \verbatim. : Another problem is that both verbatim and listings cannot : automatically wrap the too-long lines, thus always make the output messy : .