[texhax] a latex2e difficulty - what else?

Gary Knott knott at civilized.com
Thu Jun 1 01:15:38 CEST 2006

Dear TeXhaxer,

I am having trouble getting an old style file, ctext.sty,
to show braces in \tt text (supposedly).  ctext.sty is
provided here as an attachment.  It is a modified version of
the commonly-used .sty file cprog.sty  used to print
C-programs.  I want \tt text for the C-code, and \it
text or some-such for the comments.

But I am having some-kind of font problem.

My little test file is below.

I would appreciate knowing what to type and where
to type it to get my output to show the braces.

Maybe you know of an up-to-date cprog package?  ctan
doesn't show any, nor does google.

Thanks, Gary Knott, knott at civilized.com


% File: ltest.tex

% 11pt and twoside are ``options'' i.e. switches that are tested in
% the macros in the 'article' style-file.

% I use ctext.sty which is a modified version of cprog.sty to output
% a C-program the way I like it.  The comments are to use \it
% and the C-code is to be \tt.  But, braces do not appear!!!
%  This is a problem in ctext.sty, which is very complex and inscrutable 
to me
% It is a font problem therein I think, since I am outputting
% octal(173) and octal(175) for the braces { and }, and these are
% usual ascii codes that used to be braces in \tt.
% In the new latex, I think I want \tt to be the cmtt11 font,
% But I've tried various things to specify this and none of them
% makes a difference in ctext.sty.  What I get is -
% for lbrace ({) and  a right-doublequote
% for rbrace (}) which is what cmr10 has according to Mittlebach.

% I've also tried using my old latex209 tex files in "compatibility"
% mode, but they don't
% produce any different output! (Actually, I'd be happy just using
% latex209 - but
% I don't know how to get it or install it on my RH8 system.)

% None of this stuff helps.


\usepackage{latexsym} % This package defines \Box (used in ab-algorithm.)


% Override article.sty
\def\l at section#1#2{\addpenalty{\@secpenalty}% good place for page break
     \addvspace{.01em plus\p@}%
     \@tempdima 1.5em
     \parindent \z@ \rightskip \@pnumwidth
     \parfillskip -\@pnumwidth
     \hskip -\leftskip
     #1\nobreak\hfil \nobreak\hbox to\@pnumwidth{\hss #2}\par
     \endgroup} %end of def of l at section

\def\hex#1{\hbox{\tt '#1}}


{\bf Interpreting LISP - test} by Gary D. Knott

This book is intended to be accessible
to a \pix{extra blank} wide range of interested readers from high
school students through professional programmers.

%Let's try \tt in the ordinary way.
  In tt: lbrace is \tt \char'173 \char'175
  In rm: lbrace is \tt \char'173 \char'175

\section{LISP in C}

% The cprog output does not do braces right!  But the \tt font
% does appear otherwise.
% These lets are supposed to effect ctext.sty settings - but even if 
they don't
% they are set in the .sty file.
\let\ctextfont=\tt \let\ccomentfont=\rm \let\cstringfont=\tt

/* Filename:  c:\lisp\lisp.c               Revision Date: Sept. 3, 1999 */

                         LISP  INTERPRETER
and turned off with the directive "!notrace".

/* The atom table - see the braces!! */
struct Atomtable {char name[16]; int32 L; int32 bl; int32 plist;} Atab[n];
struct Atomtable \{char name[16]; int32 L; int32 bl; int32 plist;\} Atab[n];

/* The number table is used for storing floating point numbers.  The field
    nlink is used for linking number table nodes on the number table 
free space
    list. */
union Numbertable {double num; int16 nlink;} Ntab[n];

Here are some braces defining a procedure body.

A block of code:
  setjmp(env); /* calling error() returns to here by longjmp() */

  for (;;) {prompt='*'; swrite(seval(sread())); ourprint("\n");}

/* end of file lisp.c */



| Spoken: Gary D. Knott      Email: knott at civilized.com       |
| Phone: (301) 962-3711      MIME mail welcome                |
|                                                             |
| web: www.civilized.com  (Please look at our HomePage!)      |
| USPS: Civilized Software Inc., 12109 Heritage Park Circle,  |
|       Silver Spring, Maryland 20906, USA                    |
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ctext.sty
Url: http://tug.org/pipermail/texhax/attachments/20060531/ebd6a1a4/attachment.bat 

More information about the texhax mailing list