[texhax] Colorful LaTeX Terminal Output

Oleg Katsitadze olegkat at gmail.com
Wed Apr 29 06:42:24 CEST 2009


On Mon, Apr 27, 2009 at 07:16:23PM -0400, Christopher Olah wrote:
> Is it possible to do this in a way that is inputenc friendly?

I'm not sure what you mean.  I might be mistaken here, but my
understanding is that -translate-file works on a lower level than
inputenc; inputenc comes into play after input characters have been
mapped according to the -translate-file settings.

> I can find no information on how the output is mapped except a short
> line in the tex manpage about -translate-file...

I surmise that characters are mapped back to whatever they've been
mapped from.  However, in this particular case we are not actually
mapping anything, we are just using a side-effect.  When TeX outputs
"unprintable" characters, it prints them in the ^^xx notation, where
xx is a two-digit hex number.  -translate-file changes TeX's notion of
the set of printable characters.  Also, see below an excerpt from
cp227.tcx.

Oleg

%% cp227.tcx
%% $Id: cp227.tcx 1513 2006-02-13 00:22:35Z karl $
%% Originally written 2004, Thomas Esser.
%% This file is released into the public domain.
%% 
%% This TCX file is the default in TeX Live (as of 2004) for all formats
%% except ConTeXt, which doesn't directly display TeX output, and thus
%% can use -8bit.
%% 
%% This file makes all characters with code >= 128 printable for TeX.
%% TeX itself makes all codes in the range of 32 to 127 printable.  The
%% remaining codes (0-31) are problematic, because printing them
%% "verbatim" might upset your terminal. On the other hand, since HT, VT
%% and FF are quite safe, we make these printable.
%% 
%% Even these can cause confusion.  For example,
%% \showhyphens{$\Psi$}
%% will output "[] $\tenrm  $" to the terminal.  That's a real tab
%% character (because \Psi is \mathchardef to "..09), which is
%% definitely confusing.  But it's all a tradeoff.  If we don't make it
%% printable, then when input text is written to the terminal in error
%% messages, a real tab in the input is written as ^^I.
%% 
%% Our consensus was thus to make HT, VT, and FF printable, but not the
%% others.  In future releases, the situation may be improved.
%% 
%% This tcx does not "translate" anything, it just changes
%% printability.  Characters are mapped 1:1.  The total number of
%% printable characters is 227, which gives this file the name.


More information about the texhax mailing list