#!/usr/bin/perl
my
$basename
=
'./character-encodings'
;
my
$header
= [ [
'Code'
,
'Char'
,
'Entity'
,
'Encoding'
,
'Name'
] ];
my
$data
= [];
foreach
my
$char
(
sort
keys
%latex_encoding
) {
my
$charcode
=
ord
$char
;
my
$entity
=
$char2entity
{
$char
};
my
$charname
= charnames::viacode(
$charcode
);
push
(
@$data
, [
sprintf
(
"0x%x"
,
$charcode
),
latex_encode(
$char
),
sprintf
(
"\\texttt{%s}"
, latex_encode(
$entity
)),
sprintf
(
"\\texttt{%s}"
, latex_encode(latex_encode(
$char
))),
"\\small $charname"
]);
}
my
$table
= LaTeX::Table->new( {
caption
=>
'Characters'
,
label
=>
'table:charencodings'
,
type
=>
'xtab'
,
header
=>
$header
,
data
=>
$data
} );
$table
=
$table
->generate_string;
my
$doc
=
join
(
""
, (<DATA>));
$doc
=~ s/\[\* table \*\]/
$table
/;
write_file(
"${basename}.tex"
, \
$doc
);
my
$drv
= LaTeX::Driver->new(
source
=>
$basename
.
".tex"
,
output
=>
$basename
.
".dvi"
,
format
=>
'dvi'
,
tmpdir
=> 1,
DEBUG
=> 1,
DEBUGPREFIX
=>
'#latex: '
,
);
$drv
->run;
exit
(0);