853
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
859
\<header functions\><<<
860
static void* r_alloc(ARG_II(void *, size_t));
865
static void* r_alloc( q, n )
869
if((p = (void *) realloc( q, (size_t) n)) == NULL) bad_mem;
896
\LikeChapter{htcmd: postprocessor for tex4ht}
898
The compilation of this file requires the packages
899
\Link[\FTP ProTex.sty]{}{}Pro\TeX\EndLink{}
900
and \Link[\FTP AlProTex.sty]{}{}AlPro\TeX\EndLink.
902
\TableOfContents[Section,SubSection]
911
The post-processor \`'tex4ht.c' prepares a \`'.lg' file in which it
912
lists the pictures that need to be generated, and the entries
913
encountered in \''\Needs{...}'. The \`'.log' file contains the
914
entries encountered in the \''\Needs-{...}'. The htcmd.perl script
915
treats as commands the entries that are enclosed between double-quote
916
(\''"') characters, and the other entries as comments. It first works
917
on the \`'.lg' file and then on the \`'.log' file.
927
\<mv html and css to dir and chmod\><<<
929
while( eoln_ch != EOF ) {
930
status = scan_str("File: ", TRUE, lg_file);
931
status = scan_until_end_str("", 1, status, lg_file);
932
if( status && !eq_str(match[1],"tex4ht.tmp") ){
934
(void) execute_script(copy_script, match[1],
935
dir? dir :"",".","");
938
(void) execute_script(chmod_script, ch_mod,
939
dir? dir:"",match[1], "");
949
\SubSection{char, signed char, unsigned char (gcc man)}:
952
Each kind of machine has a default for what char should
953
be. It is either like unsigned char by default or like
954
signed char by default.
956
Ideally, a portable program should always use signed
957
char or unsigned char when it depends on the signedness
958
of an object. But many programs have been written to
959
use plain char and expect it to be signed, or expect it
960
to be unsigned, depending on the machines they were
961
written for. This option, and its inverse, let you
962
make such a program work with the opposite default.
964
The type char is always a distinct type from each of
965
signed char and unsigned char, even though its behavior
966
is always just like one of those two.
972
#define Q_CHAR signed char
973
#define U_CHAR unsigned char
975
#define Q_NULL (Q_CHAR *) 0
976
#define U_NULL (U_CHAR *) 0
977
#define C_NULL (C_CHAR *) 0
980
Pointers to strings must use \`'C_CHAR', since we don't
981
know how string constants are treated there.
986
\SubSection{EOF Character}
994
OBTW: when compiling htcmd.c, I get messages about the uselessness of comparing
995
chars (which are unsigned, at least on a IRIX 6.5) to EOF which is defined as
996
-1 in stdio.h).... and indeed it program loops endlessly.
1000
after the last #include gets the effect that you probably want (or perhaps
1001
better would be to define a constant EOFCHAR or something.)
1004
The getc returns the next character as an unsigned char converted to int.
1005
This is so to allow all characters to be return as well as end-of-file
1006
indicators (-1 in stdio) and error indicator.
1010
\SubSection{Comments}
1013
Date: Sun, 25 Oct 1998 00:52:22 +0100
1014
X-Mailer: emacs 19.34.6 (via feedmail 9-beta-3 Q)
1015
From: Sebastian Rahtz <s.rahtz@elsevier.co.uk>
1016
To: te@informatik.uni-hannover.de, popineau@esemetz.ese-metz.fr,
1018
cc: gurari@cse.ohio-state.edu, michel.GOOSSENS@CERN.ch
1019
Subject: change to texmf.cnf for tex4ht
1021
Can you change your default setups to add the following line to
1024
HTCMDINPUTS = .;$TEXMF/tex4ht//;$TEXMF/tex/latex/tex4ht
1026
this is because Eitan Gurari has added a new C program, htcmd, to the
1027
TeX4ht setup, which does some Kpathsea work.
1029
I'll be distributing a revised set of files for tex4htk shortly; if
1030
its in your kits, it'll need a complete revision, as the sources and
1031
support files are all changed.
1033
If you picked up TeX4ht already from CTAN (this includes you,
1034
Michel), do not proceed with that. htcmd.c needs some changes for
1035
Kpathsea compilation which I have sent back to Eitan to merge in
1038
\Section{Platform-dependent Code}
1061
\SubSection{Compilers}
1069
Options (\''bcc32' comamnd):
1072
Borland C++ 5.0 for Win32 Copyright (c) 1993, 1996 Borland International
1073
Syntax is: BCC32 [ options ] file[s] * = default; -x- = turn switch x off
1074
-3 * 80386 Instructions -4 80486 Instructions
1075
-Ax Disable extensions -B Compile via assembly
1076
-C Allow nested comments -Dxxx Define macro
1077
-Exxx Alternate Assembler name -Hxxx Use pre-compiled headers
1078
-Ixxx Include files directory -K Default char is unsigned
1079
-Lxxx Libraries directory -M Generate link map
1080
-N Check stack overflow -Ox Optimizations
1081
-P Force C++ compile -R Produce browser info
1082
-RT * Generate RTTI -S Produce assembly output
1083
-Txxx Set assembler option -Uxxx Undefine macro
1084
-Vx Virtual table control -X Suppress autodep. output
1085
-aN Align on N bytes -b * Treat enums as integers
1086
-c Compile only -d Merge duplicate strings
1087
-exxx Executable file name -fxx Floating point options
1088
-gN Stop after N warnings -iN Max. identifier length
1089
-jN Stop after N errors -k * Standard stack frame
1090
-lx Set linker option -nxxx Output file directory
1091
-oxxx Object file name -p Pascal calls
1092
-tWxxx Create Windows app -u * Underscores on externs
1093
-v Source level debugging -wxxx Warning control
1094
-xxxx Exception handling -y Produce line number info
1095
-zxxx Set segment names
1107
\`'c:\msvc\bin\cl -Ic:\msvc\include -DDOS htcmd.c'
1109
In tex-live \`' cl -D_X86_=1 -DWINVER=0x0400 -DWIN32 -D_WIN32
1110
-DWIN32_LEAN_AND_MEAN -D_MT -D_DLL -DKPATHSEA
1111
-D_IMPORT -DANSI -I. -I. -I.. -IG:\fptex\source\web2c-7.2 -c -W3
1112
-DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo -O2x -G5rs -Gy
1113
-c /Fodynamic\htcmd.obj .\htcmd.c'
1115
The following are the available flags (\''c:\msvc\bin\cl -help').
1121
/AS small model (default) /AC compact model
1122
/AM medium model /AL large model
1123
/AH huge model /AT tiny model (.COM files)
1124
/A<string> (custom memory model)
1126
/O enable optimization (same as /Ot) /O1 minimize space
1127
/O2 maximize speed /Oa assume no aliasing
1128
/Ob<n> inline expansion (default n=0) /Oc local common subexpression opt.
1129
/Od disable optimization (default) /Oe enable registers allocation
1130
/Of[-] toggle p-code quoting /Og global common subexpression opt.
1131
/Oi enable intrinsic functions /Ol enable loop optimizations
1132
/On disable ``unsafe'' optimizations /Oo[-] toggle post code-gen. opt.
1133
/Op[-] improve floating-pt consistency /Oq enable maximum p-code optimization
1134
/Or gen. common exit code (CodeView) /Os favor code size
1135
/Ot favor code speed /Ov[-] toggle p-code frame sorting
1136
/OV<n> control inlining by func. size /Ow assume cross-function aliasing
1137
/Ox maximum opts. (/Ob1cegilnot /Gs) /Oz enable ``unsafe'' optimizations
1139
/G0 8086 instructions (default) /G1 186 instructions
1140
/G2 286 instructions /G3 386 instructions
1141
(press <return> to continue)
1142
/GA protected-mode Win entry/exit code /GD protected-mode Win entry/exit code
1143
/GE<x> customize Windows entry/exit /Gq backwards compatibility with v. 6
1144
/Gc Pascal style calling conventions /Gd C style calling conventions
1145
/Ge use stack-check calls /Gf enable string pooling
1146
/Ge use stack-check calls /Gf enable string pooling
1147
/Gs remove stack-check calls /Gn remove p-code native entry points
1148
/Gp<num> specify p-code entry tables /Gr _fastcall style calling convention
1149
/Gt[num] data size threshold /GW real-mode Windows entry/exit code
1150
/Gw real-mode Windows entry/exit code /Gx assume that data is near
1151
/Gx- assume that data is far /Gy separate functions for linker
1152
/Zr check null pointers (/f only)
1154
/Fa[file] name assembly listing file /Fc[file] name source/object listing
1155
/Fd[file] name .PDB filename /Fe<file> name executable filename
1156
/Fl[file] name object listing filename /Fm[file] name map filename
1157
/Fo<file> name object filename /Fr[file] name .SBR filename
1158
/Fp<file> name .PCH filename /FR[file] name extended .SBR filename
1159
/Fs[file] name source listing filename
1161
/C don't strip comments /D<name>[=|#text] define macro
1162
/E preprocess to stdout /EP same as /E but no #line
1163
/I<directory> add #include path /P preprocess to file
1164
/U<name> remove predefined macro /u remove all defined macros
1165
(press <return> to continue)
1166
/X ignore "standard places"
1168
/vd{0|1} disable/enable vtordisp /vm<x> type of pointers to members
1169
/Z7 C 7 style CodeView information /Za disable extensions (implies /Op)
1170
/Zd line number information /Ze enable extensions (default)
1171
/Zg generate function prototypes /Zi prepare for debugging (CodeView)
1172
/Zl omit default library name in .OBJ /Zp[n] pack structs on n-byte boundary
1173
/Zs check syntax only
1175
/FPa calls with altmath /FPc calls with emulator
1176
/FPc87 calls with 8087 library /FPi inline with emulator (default)
1177
/FPi87 inline with 8087
1179
/Sl<columns> set line width /Sp<lines> set page length
1180
/St<string> set title string /Ss<string> set subtitle string
1182
/batch specify batch mode compilation /Bm<num> set compiler's available mem.
1183
/c compile only, no link /H<num> external name length
1184
/J default char type is unsigned /f select fast compiler (default)
1185
/f- select optimizing compiler /Yc create .PCH file
1186
/Yd put debug info in .PCH file /Yu use .PCH file
1187
/YX automatic precompiled header /nologo suppress copyright message
1188
(press <return> to continue)
1189
/Mq compile for QuickWin /ND<name> name data segment
1190
/NM<name> name code segment /NQ<name> combine p-code temp segments
1191
/NT<name> name code segment /NV<name> name far v-table segment
1192
/Tc<file> compile file without .c /Tp<file> compile file without .cpp
1193
/V<string> set version string /W<n> warning level (default n=1)
1194
/w disable all warnings /WX treat all warnings as errors
1195
/Zn turn off SBRPACK for .SBR files
1197
/MA<MASM switch> /Ta<file> assemble file without .asm
1199
/F <hex_num> stack size (hex. bytes) /Lr append 'r' to default lib in .OBJ
1200
/link [lib] give lib name to linker /Ln do not link CRT.LIB
1201
/Ld select dynamically-linked library /Lw select statically-linked library
1213
1998-10-22 Eli Zaretskii <eliz@is.elta.co.il>
1215
* tex4ht.c [__DJGPP__] (ANSI, DOS_GIF_FILE): Define.
1216
(WRITE_BIN_FLAGS, READ_BIN_FLAGS): Use binary mode with DJGPP.
1217
(dos_file_names): New variable.
1218
(sig_err): If got fatal signal other than SIGINT or SIGQUIT, don't
1219
return to caller, since the program will be aborted otherwise.
1220
(main) [KPATHSEA]: If input is from stdin which is not a console
1221
device, switch it to binary mode. Set dos_file_names to TRUE for
1222
all DOS platforms, FALSE on Unix and WIN32, and compute at runtime
1223
for DJGPP. Simplify logic of finding the init file by pushing
1224
HOME=C: into environment if $HOME isn't defined on DOSISH systems.
1229
\SubSection{Slashes n Directory Pathes}
1235
#if defined(DOS_WIN32) || defined(__DJGPP__)
1236
#define dir_path_slash(str) (is_forward_slash(str)? '/' : '\\')
1238
#define dir_path_slash(str) '/'
1244
\<header functions\><<<
1245
#if defined(DOS_WIN32) || defined(__DJGPP__)
1246
static BOOL is_forward_slash( ARG_I(Q_CHAR *) );
1251
#if defined(DOS_WIN32) || defined(__DJGPP__)
1253
static BOOL is_forward_slash(str)
1256
while( *str ){ if( *(str++) == '/' ) { return TRUE; } }
1269
\Section{Command-Line Options}
1272
\SubSection{Available Options}
1275
\item \`'.../'---Directory where files should be sent
1276
\item \`'-mXXX'---\`'chmod XXX' for files
1277
\item \`'-e...'---Name of invisible gif
1278
\item \`'-d'---Directory for config files
1279
\item \`'-p'---Ignore pictures (but not pictorial symbols)
1280
\item \`'-i'---Debugging info
1281
\item Other---Name of dvi file
1286
dvips -mode ibmvga -D 110 -f foo.idv -pp 92 > tmp.ps
1287
convert -crop 0x0 -density 110x110 -transparent '#FFFFFF' tmp.ps foo.gif
1288
mv foo.gif /WWW/temp/.
1289
cp foo.html /WWW/temp/.
1290
chmod 644 /WWW/temp/foo.*
1294
\<command line options\><<<
1295
"\n---------------------------------------------------------------\n\
1296
htcmd filename ...\n\
1297
-d... directory for output files (default: current)\n\
1298
-e... location of tex4ht.env\n\
1299
-i debugging info\n\
1300
-m... chmod ... for output files\n\
1301
-p don't convert pictures (default: convert)\n\
1302
-S... permission for system calls: *-always, filter\n\
1303
-X... script for files\n\n\
1305
htcmd name -d/WWW/temp/ -etex4ht-32.env -m644\n\
1306
---------------------------------------------------------------\n"
1310
If option \`'-e' is present, empty pictures are replaced
1311
with the named file (e.g., \`'empty.gif').
1317
\SubSection{Scanning the Options}
1324
I found that I couldn't compile htcmd.c with KPATHSEA defined, and then noticed
1325
that it doesn't include any of the kpathsea headers. So I have patched htcmd.c
1326
to create two versions: one with the necessary kpathsea headers and one
1327
without. This is the output produced by 'diff'. Let me know if you want to
1328
merge my changes into your htcmd.c, and/or if you notice any errors! I have
1329
changed the second argument of 'kpse_set_program_name' from NULL (which would
1330
effectively mean argv[0]) to 'tex4ht', as that saves having to add a
1331
'HTCMDINPUTS' (or 'HTCMDKINPUTS') variable into the kpathsea configuration file
1332
'texmf.cnf' pointing to the same place for 'tex4ht.env' as the 'TEX4HTINPUTS'
1335
For htcmd.c, the kpathsea library is only useful for locating the tex4ht.env
1336
configuration file. But as it can be used for this purpose for tex4ht.c, it
1337
seems a pity not to enable it for its companion program too.
1341
> > #include <kpathsea/progname.h>
1342
> > #include <kpathsea/tex-file.h>
1345
> < kpse_set_program_name (argv[0], NULL);
1347
> > kpse_set_program_name (argv[0], "tex4ht");
1350
\<kpathsea arg 0\><<<
1352
kpse_set_program_name (argv[0], NULL);
1358
If \`'strlen( argv[i] ) == 2' the switch is followed by a
1359
space to be deleted when more input is awaited.
1362
\<scan flaged args\><<<
1363
if( (int) strlen( argv[i] ) == 2 ){
1364
if( (*(p+1)!='i') && (*(p+1) != 'p') )
1365
{ if( ++i == argc ) bad_arg; }
1369
case 'd':{ dir = q; break; }
1370
case 'e':{ `<get .env directory from com ln`> break; }
1371
case 'i':{ debug = q-1; break;}
1372
case 'm':{ ch_mod = q; break; }
1373
case 'p':{ nopict = q-1; break;}
1374
case 'S':{ `<permission for system calls`> break; }
1375
case 'X':{ Xrecord = q; break;}
1376
default:{ bad_arg; }
1382
\Section{Loading Style for htf Fonts}
1384
\SubSection{Loading from a Style File}
1387
\<htfcss from lg\><<<
1388
{ struct htf_struct *last_rec, *p;
1389
last_rec = (struct htf_struct *) 0;
1390
eoln_ch = (int) 'x';
1391
while( eoln_ch != EOF ) {
1392
status = scan_str("htfcss: ", TRUE, lg_file);
1393
status = scan_until_end_str("", 1, status, lg_file);
1394
if( status ){ Q_CHAR *key, *body;
1395
body = key = match[1];
1396
`<process htfcss line`>
1402
\<process htfcss line\><<<
1403
while( *body && (*body != ' ') ){ body++; }
1404
if( *body == ' ' ){ *(body++) = '\0'; }
1406
if( *key ){ `<add new htfcss rec`> }
1407
else if( last_rec ){ `<append prev htfcss rec`> }
1411
\<add new htfcss rec\><<<
1412
p = m_alloc(struct htf_struct, 1);
1413
p->next = (struct htf_struct *) 0;
1414
p->key = m_alloc(char, (int) strlen(key) + 1);
1415
(IGNORED) strcpy( p->key, key );
1416
p->body = m_alloc(char, (int) strlen(body) + 1);
1417
(IGNORED) strcpy( p->body, body );
1419
last_rec->next = p; last_rec = p;
1421
htf_rec = last_rec = p;
1424
(IGNORED) printf(".......%s...%s\n", key, body);
1428
\<append prev htfcss rec\><<<
1429
last_rec->body = (Q_CHAR *) r_alloc((void *) last_rec->body,
1430
(size_t) strlen(last_rec->body)
1431
+ (size_t) strlen(body)
1433
(IGNORED) strct(last_rec->body,"\n");
1434
(IGNORED) strct(last_rec->body,body);
1436
(IGNORED) printf(".......%s\n", body);
1446
struct htf_struct *next;
1451
static struct htf_struct *htf_rec = (struct htf_struct *) 0;
1456
\SubSection{From lg File}
1459
The command \`'\Configure{htf-css}{cmmi}{font-style: italic;}'
1460
provides in the lg file an entry of the form
1461
\`'Font_Css_Plus cmmi font-style: italic;'.
1463
\<font=(...) from lg\><<<
1464
eoln_ch = (int) 'x';
1465
while( eoln_ch != EOF ) {
1466
status = scan_str("Font_Css_Plus ", TRUE, lg_file);
1467
status = scan_until_str(" ", 1, status, lg_file);
1468
status = scan_until_end_str("", 2, status, lg_file);
1469
if( status ){ Q_CHAR *key;
1471
*(key + (int) strlen(key) - 1) = '\0';
1472
`<store font style of lg`>
1478
\<store font style of lg\><<<
1479
if( (*key != '\0') && (*key != '\n') ) {
1480
struct htf_struct *p;
1481
p = m_alloc(struct htf_struct, 1);
1484
p->key = m_alloc(char, (int) strlen(key) + 1);
1485
(IGNORED) strcpy( p->key, key );
1486
p->body = m_alloc(char, (int) strlen(match[2]) + 1);
1487
(IGNORED) strcpy( p->body, match[2] );
1489
(IGNORED) printf(".......%s...%s\n", key, match[2]);
1499
\Section{Identify the Empty Pictures}
1502
Messages about figures that don't exist are treated as requests for
1503
empty figures. Typically, they shouldn't be present unless they are
1504
programmed into \''\setbox'-like commands. tex4ht-c identifies in the
1505
\''.lg' file the empty figures it finds.
1507
The messages in the ``.lg'' file look like
1508
\`'--- empty picture --- aa.idv[1] ---'.
1512
\<identify the empty pictures\><<<
1513
{ struct empty_pic_struct *last;
1514
last = empty_pic = (struct empty_pic_struct *) 0;
1516
status = scan_str("--- empty picture --- ", TRUE, lg_file);
1517
status = scan_until_str( ".idv[" , 1, status, lg_file);
1518
status = scan_until_end_str("] ---", 1, status, lg_file);
1519
if( status ){ `<add empty pic`> }
1520
if ( eoln_ch == EOF ){ break; }
1523
last->next = (struct empty_pic_struct *) 0;
1529
\<add empty pic\><<<
1530
if( last == (struct empty_pic_struct *) 0 ){
1531
last = empty_pic = (struct empty_pic_struct *)
1532
m_alloc(struct empty_pic_struct, (int) 1);
1534
last = last->next = (struct empty_pic_struct *)
1535
m_alloc(struct empty_pic_struct, (int) 1);
1537
last->next = (struct empty_pic_struct *) 0;
1538
last->n = get_long_int(match[1]);
1543
struct empty_pic_struct *empty_pic;
1547
struct empty_pic_struct{
1549
struct empty_pic_struct *next;
1555
The list of empty pictures is stored in \`'emptypic'.
1557
\Section{Process Gifs}
1560
l. 10 --- needs --- ignore ---
1561
l. 11 --- needs --- end ignore ---
1562
--- needs --- aa.idv[80] ==> aa79x.gif ---
1566
\<process gif's\><<<
1567
{ BOOL characters, skip;
1568
characters = skip = FALSE;
1570
status = scan_until_str("--- ", 1, TRUE, lg_file);
1571
status = scan_until_str( " ---" , 2, status, lg_file);
1573
if( eq_str(match[1],"--- ") ){
1574
if( eq_str(match[2],"needs ---") ){
1575
`<--- needs ---...`>
1576
} else if( eq_str(match[2],"characters ---") ){
1577
`<--- characters ---...`>
1578
} else { `<--- ??? ---...`> }
1579
} else { `<???--- needs ---...`> }
1581
if ( eoln_ch == EOF ){ break; }
1587
\<--- ??? ---...\><<<
1588
status = scan_until_end_str("", 1, status, lg_file);
1591
\<???--- ??? ---...\><<<
1592
status = scan_until_end_str("", 1, status, lg_file);
1596
\<--- characters ---...\><<<
1597
status = scan_until_end_str("", 1, status, lg_file);
1598
characters = eq_str(match[1],"");
1602
\SubSection{Identifying the requests}
1606
\<--- needs ---...\><<<
1607
status = scan_until_str(" ", 1, status, lg_file);
1608
status = scan_until_str(".idv", 1, status, lg_file);
1609
status = scan_until_str("[", 2, status, lg_file);
1610
status = scan_until_str("] ==> ", 2, status, lg_file);
1611
status = scan_until_str(" ", 3, status, lg_file);
1612
*(match[3] + (int) strlen(match[3]) - 1) = '\0';
1613
status = scan_until_end_str("---", 4, status, lg_file);
1617
gif_i = get_long_int(match[2]);
1619
*(p + (int) strlen(p) - 6) = '\0';
1621
`<translate symbol gifs`>
1622
} else { `<translate non-symbol gifs`> }
1627
\SubSection{General Pictures}
1630
\`'--- needs --- aa.idv[80] ==> aa79x.gif ---'
1632
\<translate non-symbol gifs\><<<
1633
if( gif_i == `<empty picture`> ) {
1634
`<insert empty picture`>
1635
} else { `<insert non-empty picture`> }
1639
\<insert non-empty picture\><<<
1640
if( !nopict && !skip ){
1646
\<insert empty picture\><<<
1648
(void) execute_script(empty_fig_script,
1649
dir? dir :"", match[3],"","");
1650
if( ch_mod && !system_return ){
1651
(void) execute_script(chmod_script, ch_mod,
1652
dir?dir:"",match[3], "");
1655
empty_pic = empty_pic->next;
1660
\<empty picture\><<<
1666
\SubSection{Pictorial Symbols}
1669
\<translate symbol gifs\><<<
1670
Q_CHAR filename[255];
1672
(IGNORED) strcpy(filename, "");
1673
if( dir ){ (IGNORED) strct(filename, dir); }
1674
(IGNORED) strct(filename, match[3]);
1675
file = fopen(filename, READ_TEXT_FLAGS);
1677
`<dvi symbols into gif`>
1679
(IGNORED) fclose(file);
1680
(IGNORED) printf("%s already in %s\n", match[3],
1681
dir? dir : "current directory" );
1687
\SubSection{The Conversion Code}
1691
(void) execute_script(dvigif_script,match[1],match[2],match[3],"");
1692
if( dir && !system_return ){
1693
(void) execute_script(move_script,match[3],dir,".","");
1695
if( ch_mod && !system_return ){
1696
(void) execute_script(chmod_script, ch_mod, dir?dir:"",match[3], "");
1700
\<dvi symbols into gif\><<<
1701
(void) execute_script(dvigif_glyp_script?
1702
dvigif_glyp_script : dvigif_script,match[1],match[2],match[3],"");
1703
if( dir && !system_return ){
1704
(void) execute_script(move_script,match[3],dir,".","");
1706
if( ch_mod && !system_return ){
1707
(void) execute_script(chmod_script, ch_mod, dir?dir:"",match[3], "");
1713
\ifHtml[\HPage{more}\Verbatim
1714
> But isn't there a downside to this? If you work with -d then indeed all
1715
> necessary files are transferred (and this may be a good thing). But on the
1716
> other hand, it looks to me as if you lose ALL efficiency in re-making the
1717
> gifs: that is, if you re-run tex4ht with the -d option in htcmd, then all
1718
> gifs are re-made (even the glyph-gifs) every time, whether they exist in
1719
> the current directory, the directory pointed to, by -d, or both.
1721
I'll have to recheck the behavior of htcmd, because from the above
1722
description it looks like the fixed htcmd doesn't do the right job.
1724
The -d flag should specify a target directory, where the output html
1725
and gif files are to be stored. If not given, the work directory is
1726
taken to be the target directory. htcmd should compile a new glyph-gif
1727
only if the gif does not already exist in the target directory. That
1728
is, the glyph-gifs should be created the first time they are needed in
1729
the target directory, but not in consecutive compilations.
1732
> files; my point is that at least for the glyph-gifs this isn't needed,
1733
> since (if I understand correctly) any time that tex4ht asks for (eg)
1734
> cmex10-21.gif it will always represent the same character, no matter what
1735
> TeX document is being processed. (If this is wrong, then my whole theory
1738
The understanding is correct.
1740
> So it would make sense --- and also be space-efficient, since the glyph-gif
1741
> files tend to be tiny, on the order of 500 bytes, while the .ps files can
1742
> be quite a bit larger especially if a complicated re-encoding vector needs
1743
> to be included --- to check first in some central location to see if this
1744
> glyph-gif has already been make, and if so, to just copy it into the
1745
> current directory. That's the essence of my FLIB suggestion.
1747
I placed a newer version of htcmd on the web. It allows to specify in
1748
tex4ht.env a F-script (similar to the G-script) for translating glyphs
1749
into gifs. If the F-script is not provided, the glyphs are to be
1750
translated to gifs under the G-script.
1760
\Link[\shareHOME htcmd.c]{}{}htcmd.c\EndLink{} with a time stamp of at least
1761
1998-11-20-13-18 is required for resolving a bug in a detection
1762
mechanism that {\bf checks for existing gifs of glyphs} before
1765
A version with a time stamp of at least 1998-11-23-17-30 allows
1767
specialized F-scripts for translating glyphs into gifs, instead
1768
of the general purpose G-scripts found in \''tex4ht.env'. (The
1769
new scripts may maintain global caches of such gifs for
1770
cutting down on recompilation time.)
1773
% Scripts within tex4ht.env
1774
% -------------------------
1777
% Gdvips -mode ibmvga -D 110 -f %%1 -pp %%2 -o tmp.ps
1779
% Gconvert -crop 0x0 -density 110x110 -transparent '#FFFFFF' tmp.ps %%3
1780
% Fglyphgif %%1 %%2 %%3
1785
% if exist c:/cache/%3
1786
% COPY c:/cache/%3 %3
1789
% dvips -mode ibmvga -D 110 -f %1 -pp %2 -o tmp.ps
1791
% convert -crop 0x0 -density 110x110 -transparent '#FFFFFF' tmp.ps %3
1792
% COPY %3 c:/cache/%3
1796
\EndVerbatim\EndHPage{}]\fi
1821
\<header functions\><<<
1822
static void execute_script(
1823
ARG_V(struct script_struct*,Q_CHAR *,char *,Q_CHAR *,Q_CHAR *) );
1828
static void execute_script(script,match_1,match_2,match_3,match_4)
1829
struct script_struct* script`;
1835
;{ struct script_struct* temp;
1837
temp = script; system_return = 0;
1839
`<command = temp-command`>
1840
if( (command[0] != '\0') && !system_return ){
1841
`<execute system command`> }
1847
We went to \`'%%%', \`'%%1', ... instead of \`'%%', \`'%1', ...
1848
to accomodate some needds of dos. Example (yet, where exactly the
1852
if exist %1.dvi goto yes_dvi
1856
call dvips32 -f %1 -p %2 -l %2 -o tmp.ps -mode ibmvga -D 110
1858
call convert -crop 0x0 -density 110x110 -transparent '#FFFFFF' tmp.ps %3
1864
\<command = temp-command\><<<
1867
while( *p != '\0' ){
1869
if( (*q == '%') && (*p == '%')
1870
&& ((*(p+1) == '%') || ( (*(p+1) > '0') && (*(p+1) < '5') ) )
1873
case '%':{ q++; break; }
1874
case '1':{ t = match_1;
1875
while( *t != '\0' ){ *(q++) = *(t++); } break; }
1876
case '2':{ t = match_2;
1877
while( *t != '\0' ){ *(q++) = *(t++); } break; }
1878
case '3':{ t = match_3;
1879
while( *t != '\0' ){ *(q++) = *(t++); } break; }
1880
case '4':{ t = match_4;
1881
while( *t != '\0' ){ *(q++) = *(t++); } break; }
1896
> > help tinkering with the code. If you'll have a chance at some
1897
> > point to pass on the kind of changes you are doing, I'll be interested
1898
> > to hardwire them in the code as compile/run-time options.
1899
> for instance, I add -Pem to the dvips command line to access the EM
1900
> fonts instead of EC (faster)
1902
> i also change the name of "convert.exe" to "iconvert.exe" because it
1903
> conflicts with a native NT utility to convert file systems :-}
1908
dvips -mode $mf -D $density -f $_[0] -pp $_[1] > tmp.ps
1921
Was \''dvips -f $_[0] $magnification -pp $_[1] > tmp.ps'
1923
\ifHtml[\HPage{more}\Verbatim
1924
> Before you investigate too much time let me tell you that this is
1925
> definitely not a problem of tex4ht or the generation process. It's
1926
> just the rare case that someone (me ;-) ) uses too small fonts which
1927
> fail to render at resolution 110 dpi. As I'm an HTML writer it was
1928
> easier to solve the problem in HTML than to change the .tex file.
1930
My guess this problem should be trivial to fix, just by changing the
1933
$density = "110"; $mf = "ibmvga";
1935
in the perl script, to another pair of values in compliance with those
1936
available through the `modes.mf' file. These values are sent
1937
to dvips, which in turn calls Metafont to create the fonts.
1939
I'll be interested to introduce a switch in the command line, for
1940
requesting such a change on a global and/or local basis. My interest
1941
in your file is to get a better understanding of the problem.
1943
\EndVerbatim\EndHPage{}]\fi
1948
A scaling by integer s in dvips, $10 \le s \le 100000$, asks for
1949
magnification of $s/1000$ and it overrides the one specified in the
1950
.dvi file. According to the TeXbook ``you can't use magnification
1951
unless your printing device happens to have the fonts that you need at
1952
magnification you desire''.
1957
\ifHtml[\HPage{more}\Verbatim
1958
> - Find out what Metafont modes you have available. I found that teTeX
1959
> uses `modes.mf'. In this file, search for a mode with a resolution of
1960
> around 100 dpi. In `modes.mf', applicable modes are e.g. atarins (96
1961
> dpi) and ibmvga (110 dpi). For my tests, I chose ibmvga.
1963
/n/candy/0/tex/teTeX/texmf/metafont/misc/modes.mf
1965
\EndVerbatim\EndHPage{}]\fi
1974
convert -crop 0x0 -density $density"."x"."$density"
1975
." -transparent #FFFFFF tmp.ps $_[2]"
1977
convert -crop 0x0 -transparent '#'FFFFFF "."$density tmp.ps $_[2]
1987
NOTE-1: For newer converts. \`'BTW, it looks like the argument is
1988
-transparent according to the docs I have on convert. Seems a silly
1989
change. But, what useful things one can see in the docs. '.
1990
NOTE-2: input-file-name should be the first ac=fter convert.
1992
\`@ $command = "giftrans -t '#'ffffff tmp.gif > \n";
1993
if( &system_command($_[2]) ){@
1995
\item Crop removes the edges of the background color, and it should appear
1996
before that color is made transparent.
1999
The following error occurs when the picture is outside the boundaries
2003
convert -dither -monochrome tmp.ps tmp.gif
2004
convert: Unable to crop image (geometry does not contain image).
2011
\ifHtml[\HPage{quality}
2012
\Link[ftp://204.183.81.131/pub/ImageMagick/www/Magick.html\#C22]{}{}q+a\EndLink
2014
When I convert Postscript to another format, how can I improve the appearance of the text?
2016
Simple. Increase the dots-per-inch when converting and sub-sample:
2018
convert -density 288 -geometry 25% image.ps image.gif
2020
Change the density to 144 and geometry to 50% if the above command fails due to insufficient memory. Alternatively, see the Ghostscript
2021
documentation about using high-quality fonts.
2023
The -density option increases the number of pixels (or dots) generated by Ghostscript when processing the input postscript file.
2024
However as all other images formats are generally displayed on screens which are typically about 72 to 100 dots per inch, the output image
2027
The -geometry option reduces the large image output of ghostscript image back to a normal 72 dpi resolution (25% of 288 dpi gives 72 dpi)
2028
but in the process anti-aliases (or smooths) the fonts and lines of the image so as to remove the jaggies you would otherwise get from a
2029
normal postscript to image conversion.
2031
\EndVerbatim\EndHPage{}]\fi
2033
\ifHtml[\HPage{latex graphics companion 457-459}\Verbatim
2034
gs -dNOPAUSE -q -r100 -s DEVICE=pnm -sOutputFile=-
2035
-dTextAlphaBits=4 -dGraphicsAlphaBits=4 tmp.ps -c quit |
2036
ppmtogif -interlace -transparent \#ffffff > xx.gif
2037
\EndVerbatim\EndHPage{}]\fi
2039
\ifHtml[\HPage{ppmtogif}\Verbatim
2040
ppmtogif(1) ppmtogif(1)
2044
ppmtogif - convert a portable pixmap into a GIF file
2047
ppmtogif [-interlace] [-sort] [-map mapfile] [-transparent color]
2051
Reads a portable pixmap as input. Produces a GIF file as output.
2055
Tells the program to produce an interlaced GIF file.
2058
Produces a GIF file with a sorted color map.
2061
Uses the colors found in the mapfile to create the colormap in
2062
the GIF file, instead of the colors from ppmfile. The mapfile
2063
can be any ppm file; all that matters is the colors in it. If the
2064
colors in ppmfile do not match those in mapfile , they are
2065
matched to a "best match". A (much) better result can be obtained
2066
by using the following filter in advance:
2068
ppmquant -floyd -map mapfile
2071
Mark the given color as transparent in the GIF file. The color
2072
is specified as in ppmmake(1). Note that this option outputs a
2073
GIF89a format file which might not be understood by your
2076
All flags can be abbreviated to their shortest unique prefix.
2079
giftoppm(1), ppmquant(1), ppm(5)
2082
Based on GIFENCOD by David Rowley <mgardi@watdcsu.waterloo.edu>.
2083
Lempel-Ziv compression based on "compress".
2084
\EndVerbatim\EndHPage{}]\fi
2086
\ifHtml[\HPage{Ghostscript}\Verbatim
2088
gs - Aladdin Ghostscript interpreter/previewer
2091
gs [ options ] [ files ] ...
2094
Ghostscript is an implementation of Adobe Systems' PostScript (tm)
2095
language, which is in turn similar to Forth. Gs reads files in
2096
sequence and executes them as Ghostscript programs. After doing this,
2097
it reads further input from the standard input stream (normally the
2098
keyboard). Each line is interpreted separately. To exit from the
2099
interpreter, enter the `quit' command. The interpreter also exits
2100
gracefully if it encounters end-of-file. Typing the interrupt
2101
character (e.g. Control-C) is also safe.
2103
The interpreter recognizes several switches described below, which may
2104
appear anywhere in the command line and apply to all files thereafter.
2106
You can get a help message by invoking Ghostscript with the -h or -?
2107
option. This message also lists the available devices.
2110
Ghostscript may be built with multiple output devices. Ghostscript
2111
normally opens the first one and directs output to it. To use device
2112
xyz as the initial output device, include the switch
2114
in the command line. Note that this switch must precede the first .ps
2115
file, and only its first invocation has any effect. For example, for
2116
printer output in a normal configuration that includes an Epson
2117
printer driver, you might use the shell command
2118
gs -sDEVICE=epson myfile.ps
2121
Alternatively, you can type
2122
(epson) selectdevice
2124
All output then goes to the printer instead of the display until
2125
further notice. You can switch devices at any time by using the
2126
selectdevice procedure, e.g.,
2129
(epson) selectdevice
2130
As yet a third alternative, you can define an environment variable
2131
GS_DEVICE as the desired default device name. The order of precedence
2132
for these alternatives, highest to lowest, is:
2136
(first device in build list)
2138
To select the density on a printer, use
2140
- 1 - Formatted: October 11, 1998
2145
gs -sDEVICE=<device> -r<xres>x<yres>
2146
For example, on a 9-pin Epson-compatible printer, you can get the
2147
lowest-density (fastest) mode with
2148
gs -sDEVICE=epson -r60x72
2149
and the highest-density mode with
2150
gs -sDEVICE=epson -r240x72.
2152
If you select a printer as the output device, Ghostscript also allows
2153
you to control where the device sends its output. Normally, output
2154
goes directly to a scratch file on Unix systems. To send the output
2155
to a series of files foo1.xyz, foo2.xyz, ..., use the switch
2156
-sOutputFile=foo%d.xyz
2157
The %d is a printf format specification; you can use other formats
2158
like %02d. Each file will receive one page of output. Alternatively,
2159
to send the output to a single file foo.xyz, with all the pages
2160
concatenated, use the switch
2161
-sOutputFile=foo.xyz
2163
On Unix systems, you can send the output directly to a pipe. For
2164
example, to pipe the output to the command `lpr' (which, on many Unix
2165
systems, is the command that spools output for a printer), use the
2168
You can also send output to stdout for piping with the switch
2170
In this case you must also use the -q switch, to prevent Ghostscript
2171
from writing messages to stdout.
2173
To find out what devices are available, type
2175
after starting up Ghostscript. Alternatively, you can use the -h or
2176
after starting up Ghostscript. Alternatively, you can use the -h or
2177
-? switch in the command line; the help message also lists the
2180
To select a different paper size, use the command line switch
2181
-sPAPERSIZE=a_known_paper_size
2186
As of this printing, the known paper sizes, defined in gs_statd.ps,
2188
PAPERSIZE X" Y" X cm Y cm
2189
-----------------------------------------------------
2190
11x17 11" 17" 27.94 43.18
2191
a0 33.0556" 46.7778" 83.9611 118.816
2192
a10 1.02778" 1.45833" 2.61056 3.70417
2193
a1 23.3889" 33.0556" 59.4078 83.9611
2194
a2 16.5278" 23.3889" 41.9806 59.4078
2195
a3 11.6944" 16.5278" 29.7039 41.9806
2197
a4 8.26389" 11.6944" 20.9903 29.7039
2198
a5 5.84722" 8.26389" 14.8519 20.9903
2199
a6 4.125" 5.84722" 10.4775 14.8519
2200
a7 2.91667" 4.125" 7.40833 10.4775
2201
a8 2.05556" 2.91667" 5.22111 7.40833
2202
a9 1.45833" 2.05556" 3.70417 5.22111
2203
archA 9" 12" 22.86 30.48
2204
archB 12" 18" 30.48 45.72
2205
archC 18" 24" 45.72 60.96
2206
archD 24" 36" 60.96 91.44
2207
archE 36" 48" 91.44 121.92
2208
b0 39.3889" 55.6667" 100.048 141.393
2209
b1 27.8333" 39.3889" 70.6967 100.048
2210
b2 19.6944" 27.8333" 50.0239 70.6967
2211
b3 13.9167" 19.6944" 35.3483 50.0239
2212
b4 9.84722" 13.9167" 25.0119 35.3483
2213
b5 6.95833" 9.84722" 17.6742 25.0119
2214
flsa 8.5" 13" 21.59 33.02
2215
flse 8.5" 13" 21.59 33.02
2216
halfletter 5.5" 8.5" 13.97 21.59
2217
ledger 17" 11" 43.18 27.94
2218
legal 8.5" 14" 21.59 35.56
2219
letter 8.5" 11" 21.59 27.94
2220
note 7.5" 10" 19.05 25.4
2222
INITIALIZATION FILES
2223
When looking for the initialization files (gs_*.ps), the files related
2224
to fonts, or the file for the `run' operator, Ghostscript first tries
2225
opening the file with the name as given (i.e., using the current
2226
working directory if none is specified). If this fails, and the file
2227
name doesn't specify an explicit directory or drive (i.e., doesn't
2228
begin with `/' on Unix systems), Ghostscript will try directories in
2229
the following order:
2231
1. The directory/ies specified by the -I switch(es) in the command
2232
line (see below), if any;
2234
2. The directory/ies specified by the GS_LIB environment variable,
2237
3. The directory/ies specified by the GS_LIB_DEFAULT macro in the
2238
Ghostscript makefile (which has been set to
2239
"/usr/local/share/ghostscript/M.N:/usr/local/share/ghostscript/fonts"
2240
where M.N is the Ghostscript version number).
2242
Each of these (GS_LIB_DEFAULT, GS_LIB, and -I parameter) may be either
2243
a single directory, or a list of directories separated by a `:'.
2246
Ghostscript looks for the following resources under the program name
2250
The border width in pixels (default = 1).
2253
The name of the border color (default = black).
2257
- 3 - Formatted: October 11, 1998
2261
The window size and placement, WxH+X+Y (default is NULL).
2264
The number of x pixels per inch (default is computed from
2265
WidthOfScreen and WidthMMOfScreen).
2268
The number of y pixels per inch (default is computed from
2269
The number of y pixels per inch (default is computed from
2270
HeightOfScreen and HeightMMOfScreen).
2273
Determines whether backing store is to be used for saving display
2274
window (default = true).
2276
See the file `use.txt' for a more complete list of resources.
2278
To set these resources, put them in a file (such as ~/.Xresources) in
2281
Ghostscript*geometry: 612x792-0+0
2282
Ghostscript*xResolution: 72
2283
Ghostscript*yResolution: 72
2285
Then load the defaults into the X server:
2287
% xrdb -merge ~/.Xresources
2290
-- filename arg1 ...
2291
Takes the next argument as a file name as usual, but takes all
2292
remaining arguments (even if they have the syntactic form of
2293
switches) and defines the name ARGUMENTS in userdict (not
2294
systemdict) as an array of those strings, before running the
2295
file. When Ghostscript finishes executing the file, it exits
2300
Define a name in systemdict with the given definition. The token
2301
must be exactly one token (as defined by the `token' operator)
2302
and must not contain any whitespace.
2306
Define a name in systemdict with value=null.
2310
Define a name in systemdict with a given string as value. This
2311
is different from -d. For example, -dname=35 is equivalent to
2312
the program fragment
2315
whereas -s name=35 is equivalent to
2318
-q Quiet startup - suppress normal startup messages, and also do the
2319
equivalent of -dQUIET.
2322
Equivalent to -dDEVICEWIDTH=number1 and -dDEVICEHEIGHT=number2.
2323
This is for the benefit of devices (such as X11 windows) that
2324
require (or allow) width and height to be specified.
2328
Equivalent to -dDEVICEXRESOLUTION=number1 and
2329
-dDEVICEYRESOLUTION=number2. This is for the benefit of devices
2330
(such as printers) that support multiple X and Y resolutions.
2331
(If only one number is given, it is used for both X and Y
2335
Adds the designated list of directories at the head of the search
2336
path for library files.
2338
- This is not really a switch. It indicates to Ghostscript that
2339
the standard input is coming from a file or a pipe. Ghostscript
2340
reads from stdin until reaching end-of-file, executing it like
2341
any other file, and then continues processing the command line.
2342
At the end of the command line, Ghostscript exits rather than
2343
going into its interactive mode.
2345
Note that gs_init.ps makes systemdict read-only, so the values of
2346
names defined with -D/d/S/s cannot be changed (although, of course,
2347
they can be superseded by definitions in userdict or other
2352
Causes individual character outlines to be loaded from the disk
2353
the first time they are encountered. (Normally Ghostscript loads
2354
all the character outlines when it loads a font.) This may allow
2355
loading more fonts into RAM, at the expense of slower rendering.
2359
Disables character caching. Only useful for debugging.
2362
Disables the `bind' operator. Only useful for debugging.
2365
Suppresses the normal initialization of the output device. This
2367
- 5 - Formatted: October 11, 1998
2371
may be useful when debugging.
2374
Disables the prompt and pause at the end of each page. This may
2375
be desirable for applications where another program is `driving'
2379
Disables the use of fonts supplied by the underlying platform
2380
(e.g. X Windows). This may be needed if the platform fonts look
2381
undesirably different from the scalable fonts.
2384
Disables the deletefile and renamefile operators, and the ability
2385
to open files in any mode other than read-only. This may be
2386
desirable for spoolers or other sensitive environments.
2389
Leaves systemdict writable. This is necessary when running
2390
special utility programs such as font2c and pcharstr, which must
2391
bypass normal PostScript access protection.
2394
Selects an alternate initial output device, as described above.
2396
-sOutputFile=filename
2397
Selects an alternate output file (or pipe) for the initial output
2398
device, as described above.
2401
/usr/local/share/ghostscript/M.N/*
2402
Startup-files, utilities, and basic font definitions.
2404
/usr/local/share/ghostscript/fonts/*
2406
-sOutputFile=filename
2407
Selects an alternate output file (or pipe) for the initial output
2408
device, as described above.
2411
/usr/local/share/ghostscript/M.N/*
2412
Startup-files, utilities, and basic font definitions.
2414
/usr/local/share/ghostscript/fonts/*
2415
Additional font definitions.
2417
/usr/local/share/ghostscript/M.N/examples/*
2418
Demo Ghostscript files.
2420
/usr/local/share/ghostscript/M.N/doc/*
2421
Assorted document files.
2425
String of options to be processed before the command line
2429
Used to define the device used.
2434
Path names used to search for fonts
2437
Path names for initialization files and fonts
2439
TEMP Where temporary files are made
2442
The various Ghostscript document files (above).
2445
See the network news group `comp.lang.postscript'.
2447
\EndVerbatim\EndHPage{}]\fi
2449
\Link[http://www.fourmilab.ch/webtools/textogif/textogif.html]{}{}dvi to
2452
\ifHtml[\HPage{more}\Verbatim
2453
I tried to get a feel of how ppm behaves on pc's, using the attached
2454
script. The script works fine for me, if I hand insert the commands
2455
one by one in a sequence. However, if I put the script in a .bat file
2456
and call it, ppmtogif jumps in before gswin32 ends its job.
2458
If the problem is trivial to fix, I'll appreciate your advice.
2459
Otherwise, please ignore this email.
2466
if exist tmp.ps DEL tmp.ps
2467
if exist tmp.ppm DEL tmp.ppm
2468
if exist tmp.gif DEL tmp.gif
2469
c:\texlive3\tex\bin\win32\dvips.exe -f vii.idv -pp 1 -o tmp.ps
2470
c:\texlive3\gs\gs5.10\gswin32.exe -Ic:\texlive3\gs\gs5.10 -dbatch -dNOPAUSE -sDEVICE=ppm -sOutputFile=tmp.ppm -q -c -dquit tmp.ps
2471
c:\src\netpbm\miktex\bin\ppmtogif tmp.ppm tmp.gif
2474
\EndVerbatim\EndHPage{}]\fi {} --
2475
\ifHtml[\HPage{dvips + gs}\Verbatim
2480
T=/tmp/`basename $2 .dvi`.ps
2481
O=`basename $2 .dvi`_$1.gif
2482
# dvips -h bullet.pro -h name.pro -h border.pro -pp $1 $2 > $T
2483
dvips -h bullet.pro -pp $1 $2 > $T
2484
gs -q -r$density -sDEVICE=ppm -sOutputFile=- $T <&- |
2485
pnmcrop | ppmtogif -transparent rgbi:1.0/1.0/1.0 > $O
2488
for i in 1 2 3 4 ; do
2493
\EndVerbatim\EndHPage{}]\fi{} --
2494
\ifHtml[\HPage{cropping}\Verbatim
2497
> could you crop the image without knowing the size of it ? Do you include such
2498
> informations, at least I don't see you using it in your scripts.
2500
I can't locate any reference, but I believe convert is set to crop white
2503
pnmcrop trims white margins in the default setting, and has a command
2504
line switch to request trimming of black margins (pnmcrop -h).
2507
\EndVerbatim\EndHPage{}]\fi {} --
2508
\ifHtml[\HPage{more}\Verbatim
2511
#ps2gif script by Ian Hutchinson 1997; use at your own risk.
2512
#You need Ghostscript and the pbmplus utilities installed.
2513
if [ $# != 2 ] ; then
2514
echo " Usage: $0 " 1>&2
2517
echo "Calling ghostscript to convert, please wait ..." >&2
2518
gs -sDEVICE=ppm -sOutputFile=- -sNOPAUSE -q $1 -c showpage -c quit |
2519
pnmcrop| pnmmargin 10 | ppmtogif >$2
2523
Script for antialiased gif files:
2524
gs -q -dNOPAUSE -dSAFER -sDEVICE=ppmraw -r360x360 -sOutputFile=- INPUTFILE.ps | \
2525
pnmscale 0.2 | ppmquant 256 | ppmtogif > OUTPUTFILE.gif
2527
The basic idea in UNIX is to make gif files via something like
2528
gs -q -dNOPAUSE -dSAFER -sDEVICE=ppmraw -sOutputFile=- - | ppmtogif
2530
The former code works well for me, with 72dpi screen resolution. For 100dpi screen resolution, try
2531
the setting 500x500. The scale operation does the anti-aliasing. Multiple page postscript is dealt
2532
with via "%" expansions in the outputfilename, followed by a loop to do the rest of the pipeline
2535
pstoepsi: Script that with -bbonly option places a BoundingBox comment in your PostScript file.
2538
Image Magick: free C/C++ source code for ps2jpg conversion. Needs and uses ghostscript for the
2543
psutils: a set of useful utilities for multipage PostScript documents, including psresize (alter page
2544
size), psselect (select pages), pstops (rearrangement), psnup (many pages to one), psbook (pages
2545
into signatures), epsffit (fts to bounding box)
2547
Download psutils source code via ftp
2548
Download psutils source code via ftp
2549
MSDOS executable for psutils
2550
MSDOS executable for psutils from CTAN mirror site psutils: a set of useful utilities for multipage PostScript documents, including psresize (alter page
2551
size), psselect (select pages), pstops (rearrangement), psnup (many pages to one), psbook (pages
2552
into signatures), epsffit (fts to bounding box)
2554
Download psutils source code via ftp
2555
Download psutils source code via ftp
2556
MSDOS executable for psutils
2557
MSDOS executable for psutils from CTAN mirror site
2561
Peter Kleiweg's PostScript utilities: It includes a GNU emacs set-up for editing PostScript files,
2562
ps2ppm, a font2ps C program, psselect and pspages (C programs for separating pages and adding
2563
page info in PostScript files), and other goodies.
2566
Converting PostScript to Pixelmap
2567
onverting PostScript to Pixelmap
2569
ps2ppm (� P. Kleiweg) is a Perl5 script for converting PostScript to color images such as GIF. It works
2570
under Unix, using ghostscripthttp://odur.let.rug.nl/~kleiweg/postscript/utils.html
2573
3.2 How can I convert PostScript to a bitmap or pixmap?
2575
Use Ghostscript, and build the devices under gs pbmraw, pbm.dev,
2576
etc. (See devs.mak under the sources for gs) The following converts
2577
file.ps in file.ppm:
2579
gs -sDEVICE=ppmraw -sOutputFile=file.ppm file.ps
2581
Or try using the Ghostscript tools ps2image.ps or pstoppm.ps. Or
2582
use the NETPBM tool pstopnm. Netpbm (a descendant of the PBMPLUS
2583
utilities) can then convert that image into whatever format you
2586
You can also use the ImageMagick-tools program ``convert''. Try
2587
ftp.x.org in contrib/ImageMagick.tar.Z.
2589
If you have the new xv installed, it can now read PostScript files,
2590
and it stores them to any format.
2594
You can use the ppmtogif program (part of the Unix libgr-progs
2595
package) to create a set of GIF's with identical color tables. Merging them
2596
with GIFMerge creates an animated GIF with identical color maps in one
2597
GIF. In this case, use gifstrip.
2602
# External programs needed
2603
# ------------------------
2606
$tmpppmfile = "$tmpdir/pstoeps$$.ppm";
2607
$tmppsfile = "$tmpdir/pstoeps$$.ps";
2608
$gsargs = "-q -sDEVICE=ppmraw -r72 -dNOPAUSE -dSAFER -sOutputFile=$tmpppmfile --";
2609
$pnmfile = "pnmfile";
2610
$pnmcrop = "pnmcrop";
2613
# Run pnmcrop to get information about empty space.
2614
# We need to capture sdterr for that. It requires a shell, so this may
2615
# fail on systems which don't have one.
2618
Encapsulated PostScript (EPS) files
2619
\EndVerbatim\EndHPage{}]\fi
2620
\ifHtml[\HPage{more}\Verbatim
2621
The \`'-mode ibmvga -D 110' flags of the dvips command, within tex4ht.env,
2622
are provided to control the quality of the bitmaps produced for the
2623
pictures. Users might find other values to fit better their needs.
2625
The \''ibmvga' mode is tailored for resolution of 110 dots per inch;
2626
the characteristics of that mode are shown in the file modes.mf of
2627
Metafont. If the switch \`'-mode ibmvga' is omitted, a mode is
2628
guessed from the resolution, with the outcome likely to be degrades a
2632
I'm trying to get dvips to use a non-standard configuration file (instead of
2633
the default config.pls which is by default set up to use the ljfour
2634
printer) under MiKTeX 1.11 under win nt 4. Specifically, I'd like it to call
2635
metafont to generate some fonts in ibmvga mode (110x110 dpi) for use with
2636
Eitan Gurari's tex4ht.
2638
I can get it to run metfont correectly only if I alter the standard config.ps
2639
and change the printer name from "ljfour" to "ibmvga" and the dpi value from
2640
600 to 110. So dvips and metafont seem to be set up correctly. But I'd
2641
like to be able to do this with a job-specific configuration file,
2642
while retaining the settings in the default config.
2644
My understanding of the dvips documentation says that if I create a file
2645
config.ibmvga and call dvips with the parameter -P ibmvga, it should find that
2646
file and over-ride config.ps. I've tried this, but I can't get this to
2649
1. is my understanding correct? -P ibmvga should cause dvips to look for
2652
2. is this file supposed to be anywhere special? (I've been putting it in the
2653
same directory as config.ps).
2655
Thanks for any help on this!
2659
City Planning, Ohio State University
2660
pviton@magnus.acs.ohio-state.edu
2664
From piet@cs.uu.nl Wed Oct 28 12:36:50 EST 1998
2665
Article: 151256 of comp.text.tex
2666
Path: news.cse.ohio-state.edu!news.maxwell.syr.edu!news-ge.switch.ch!surfnet.nl!ruu.nl!cs.uu.nl!not-for-mail
2667
From: Piet van Oostrum <piet@cs.uu.nl>
2668
Newsgroups: comp.text.tex
2669
Subject: Re: dvips config under miktex/win nt
2670
Date: 28 Oct 1998 16:16:19 +0100
2671
Organization: Dept of Computer Science, Utrecht University, The Netherlands
2673
Sender: piet@kemmel.cs.uu.nl
2674
Message-ID: <wz4ssora2k.fsf@kemmel.cs.uu.nl>
2675
References: <pviton.462.000A039F@magnus.acs.ohio-state.edu>
2676
NNTP-Posting-Host: kemmel.cs.uu.nl
2677
X-Newsreader: Gnus v5.4.62/Emacs 19.34
2678
Xref: news.cse.ohio-state.edu comp.text.tex:151256
2680
>>>>> pviton@magnus.acs.ohio-state.edu (Philip A. Viton) (PAV) writes:
2682
PAV> I'm trying to get dvips to use a non-standard configuration file
2683
PAV> (instead of the default config.pls which is by default set up to use
2684
PAV> the ljfour printer) under MiKTeX 1.11 under win nt 4. Specifically,
2685
PAV> I'd like it to call metafont to generate some fonts in ibmvga mode
2686
PAV> (110x110 dpi) for use with Eitan Gurari's tex4ht.
2688
PAV> I can get it to run metfont correectly only if I alter the standard
2689
PAV> config.ps and change the printer name from "ljfour" to "ibmvga" and
2690
PAV> the dpi value from 600 to 110. So dvips and metafont seem to be set up
2691
PAV> correctly. But I'd like to be able to do this with a job-specific
2692
PAV> configuration file, while retaining the settings in the default
2695
PAV> My understanding of the dvips documentation says that if I create a
2696
PAV> file config.ibmvga and call dvips with the parameter -P ibmvga, it
2697
PAV> should find that file and over-ride config.ps. I've tried this, but I
2698
PAV> can't get this to work. Questions:
2700
PAV> 1. is my understanding correct? -P ibmvga should cause dvips to look for
2705
PAV> 2. is this file supposed to be anywhere special? (I've been putting it
2706
PAV> in the same directory as config.ps).
2710
BUT: for the mode to be correct you have to insert a line M ibmvga in the
2715
From cottrell@ricardo.ecn.wfu.edu Thu Oct 29 00:34:02 EST 1998
2716
Organization: Wake Forest University
2718
> 1. is my understanding correct? -P ibmvga should cause dvips to look for
2723
> 2. is this file supposed to be anywhere special? (I've been putting it in the
2724
> same directory as config.ps).
2726
In the same directory as config.ps ought to work (and it does with
2727
web2c, which is ported to win32). There might be some special
2728
command required to rebuild the database of configuration files,
2729
after you add a new one. I suppose this would be mentioned in the
2730
MikTeX documentation.
2733
Department of Economics
2734
Wake Forest University, NC
2738
Sets up the output for the appropriate printer.
2739
This is implemented by reading in con-
2740
fig.printername , which can then set the output
2741
pipe (as in, !lpr -Pprintername as well as the font
2742
paths and any other config.ps defaults for that
2743
printer only. Note that config.ps is read before
2744
config.printername In addition, another file called
2745
~/.dvipsrc is searched for immediately after con-
2746
fig.ps; this file is intended for user defaults.
2747
If no -P command is given, the environment variable
2748
PRINTER is checked. If that variable exists, and a
2749
corresponding configuration file exists, that con-
2750
figuration file is read in.
2751
\EndVerbatim\EndHPage{}]\fi{} --
2752
\ifHtml[\HPage{more}\Verbatim
2753
> - how to automate conversion from TeX source to EPS and various bitmap
2756
This is trivial with a script (.BAT) file:
2759
dvips -E -o $1.eps %1.dvi
2760
gs -sDEVICE=foo -sOutputFile=%1.foo -q %1.eps
2762
You can add various footoppm and pnmtofoo commands, and things like
2764
\EndVerbatim\EndHPage{}]\fi{} --
2765
\ifHtml[\HPage{in latex2html}\Verbatim
2766
postscript image with ghostview and to grab the
2767
image with xv. The grabbed image can be modified with xv and can be stored in GIF format. Another
2768
method is to use ghostscript. Here is an example for an image conversion with ghostscript.
2773
ppmtogif file.ppm >file.gif
2775
\EndVerbatim\EndHPage{}]\fi{} --
2776
\ifHtml[\HPage{delegate.mgk}\Verbatim
2777
# ImageMagick delegates for Unix. The format is as follows. Each
2778
# delegate begins with a tag and/or format separated by a operation
2779
# tag (see below). This line must be followed by one or more commands
2780
# preceded with a tab (\t) character. If a command exceeds the length
2781
# of a line, use the backslash continuation character. End the
2782
# command with an ampersand (&) to execute the command in the
2785
# Optionally you can include the image filename, type, width, height, or
2786
# other image attributes by embedding special format characters=>
2790
# %e filename extention
2797
# %t top of filename
2798
# %u unique temporary filename
2803
# There are two types of delegates: decode and encode. Decode delegates
2804
# begin with a image format (tag) specified (e.g. mpeg) followed with a
2805
# equal-greater sign (=>). The delegate is invoked whenever ImageMagick
2806
# attempts to read an image whose format specifier or filename extension
2807
# matches the tag (e.g. image.mpg for tag mpg=>). The delegate must write
2808
# an image to the file designated by %o in an image format that ImageMagick
2809
# understands (e.g. pnm).
2811
# An encode delegate begins with an image format, a less-equal sign (<=),
2812
# and a tag. The delegate is invoked whenever ImageMagick attempts to write
2813
# an image whose format specifier or filename extension matches the tag
2814
# (e.g. image.mpg for tag <=mpg). ImageMagick writes to a temporary file
2815
# in the format you specify. The delegate can then read this file and
2816
# convert it to a format it supports and pesumably ImageMagick does not.
2818
# If you use a less-equal-greater sign (<=>) the delegate is bi-directional.
2819
# Delegates must be separated with a blank line.
2821
# Lines that begin with a pound sign (#) are comments and are ignored.
2823
# There are a number of delegates used by ImageMagick for special
2824
# circumstances. For example, the print or Ghostscript delegate. Don't
2825
# remove these or ImageMagick may behave strangely.
2827
# ImageMagick looks for the delegate configurarion file in this order:
2829
# /usr/local/share/ImageMagick/delegates.mgk
2830
# DELEGATE_PATH/delegates.mgk
2831
# HOME/.magick/delegates.mgk
2834
# Where DELEGATE_PATH and HOME are environment variables.
2836
# Like entries in the later two directory overrides the specification
2837
# in the system-wide delegates file.
2841
|/usr/local/bin/bzip2 -f > %o
2844
|/usr/bin/compress -c > %o
2847
/usr/local/bin/gs -sDEVICE=epswrite -q -dNOPAUSE -dSAFER \
2848
-sOutputFile="%s" -- "%s" -c quit
2851
/usr/local/bin/gs -sDEVICE=pdfwrite -q -dNOPAUSE -dSAFER \
2852
-sOutputFile="%s" -- "%s" -c quit
2855
/usr/local/bin/gs -sDEVICE=pswrite -q -dNOPAUSE -dSAFER \
2856
-sOutputFile="%s" -- "%s" -c quit
2859
|/usr/local/bin/gzip -cf > %o
2862
/usr/local/bin/netscape http://www.wizards.dupont.com/cristy/ImageMagick.html &
2865
|/usr/local/bin/bzip2 -cd %i
2868
/usr/local/bin/ralcgm -d ps %i %o %u
2869
/usr/bin/mv %o.ps %o
2873
|/usr/bin/uncompress -c %i
2876
/usr/local/bin/dvips -q -o %o %i
2879
/usr/X11R6.4/bin/xterm -title "Edit Image Comment" -e vi %i
2882
/usr/local/bin/GET %m:%i > %o 2>&1
2885
/usr/local/bin/fig2dev -L ps %i %o
2888
/usr/local/bin/GET %m:%i > %o 2>&1
2891
/usr/local/bin/gs -sDEVICE=pnmraw -q -dNOPAUSE -dSAFER \
2892
-dTextAlphaBits=%u -dGraphicsAlphaBits=%u -g%s -r%s %s \
2893
-sOutputFile="%s" -- "%s" -c quit
2896
/usr/local/bin/gs -sDEVICE=pbmraw -q -dNOPAUSE -dSAFER \
2897
-dTextAlphaBits=%u -dGraphicsAlphaBits=%u -g%s -r%s %s \
2898
-sOutputFile="%s" -- "%s" -c quit
2901
/usr/local/bin/hp2xx -q -m eps -f %i %o
2904
/usr/local/bin/html2ps -o %o %i
2907
/usr/local/bin/html2ps -o %o %i
2910
/usr/local/bin/GET %m:%i > %o 2>&1
2913
/usr/local/bin/gimp %i
2916
/usr/local/bin/mpeg2decode -q -b %i -f -r -o3 %o%%d
2917
/usr/local/bin/convert %o*.ppm %o
2918
/usr/bin/rm -f %o*.ppm
2921
/usr/local/bin/mpeg2decode -q -b %i -f -r -o3 %o%%d
2922
/usr/local/bin/convert %o*.ppm %o
2923
/usr/bin/rm -f %o*.ppm
2926
/usr/local/bin/pgpv -fq %i
2929
/usr/local/bin/display -immutable %i
2932
/usr/bin/lp -c -s %i
2935
/usr/local/bin/ra_ppm -g 1.0 %i %o
2938
/usr/local/bin/mogrify -flip -size %wx%h rgba:%i
2939
/usr/local/bin/rawtorle -w %w -h %h -n 4 -o %o %i
2942
scanimage -d %i > %o
2945
/usr/local/bin/display -immutable -window_group %g -title "%l of %f" tmp:%i &
2948
/usr/local/bin/html2ps -o %o %i
2951
/usr/local/bin/mpeg2encode %u %o
2952
/usr/bin/rm -f %i*.yuv %u*
2955
/usr/local/bin/mpeg2encode %u %o
2956
/usr/bin/rm -f %i*.yuv %u*
2959
|/usr/local/bin/gzip -cdfq %i
2961
\EndVerbatim\EndHPage{}]\fi {} --
2962
\ifHtml[\HPage{dvi->gif}\Verbatim
2963
Previously, I asked about how to convert the images from .dvi
2964
files into gif/jpeg for inclusion in web pages.
2966
My own system is a minimalist one; it is based on linux, which perhaps
2967
should have been made clear in my initial post.
2969
I have X Free86 operating, and a few other things, but was trying to
2970
aviod loading in too many more packages.
2972
The packages I ended up using were : tex, dvips, ghostscript, xpaint and
2973
perhaps cjpeg. dvips and ghostscript were necessary add-ons, requiring
2974
a decent number of files. Dvips does not work on my system, as I'm
2975
trying to figure out the minimum number of font packages needed to get
2976
it going. But its being used on a remote system.
2978
In any case, here are the steps involved :
2980
1. Use tex to convert the tex file into .dvi
2981
2. Use dvips to convert the .dvi file into .ps (postscript)
2982
3. Use the ghoscript command
2983
gs -sDEVICE=ppm -sOutputFile=file%d.ppm file.ps
2984
To convert the ps file to a ppm file which xpaint can read.
2985
4. Run X and startup xpaint. The successive pages of the document
2986
will have been converted to numbered ppm files. Load each in
2987
sucession into xpaint. Use the region command to mark out a
2988
region encompassing each formula, and save as .gif file.
2989
5. Refer to each formula file generated within the HTML document.
2991
This works. I suspect there may be a way of "grabbing" the raw the
2992
X screen output when using xdvi to look at the document, and process
2993
the contents, but I don't know enough to do this.
2995
An alternate approach, using slightly different packages, which I have
2996
not tried, is described in Chapter 11.6 (p.455) of the LaTeX Graphics
2997
Companion (Goossens, Rahts, Mittelbach, 1997, ISBN 0-201-85469-4).
2999
Basically the steps are:
3000
1 put each equation in a separate file/page
3001
2 process with dvips to get a postscript file
3002
3 process with Ghostscript to get a pbm file
3003
4 use the netpbm utility pbmcrop to trim white space (or epsfit)
3004
5 use ppmtogif to get a gif file or cjpeg to get a jpeg file.
3006
Ideally, it would be nice to convert .dvi directly into html files,
3007
automatically generating the graphics files and referencing them. Some
3008
people did suggest there were ways of doing this, but they involved
3009
loading in different extra packages which are not part of my current
3012
In spite of my enthusiasm for such direct conversion, I'll be using the above
3013
method until I can get my brain around all this better, being new to linux,
3014
tex, X and all these different file formats, which are presently just
3017
Two "automatic" methods mentioned involved were based on latex2html
3020
latex2html requires perl and hyperlatex requires emacs. Both will
3021
require the pbmutilities and ghostscript, possibly giftrans.
3022
latex2html will do a full conversion of your document so it will
3023
generate equation in gif format. hyperlatex will require that you
3024
indicate that you want an equation converted to gif, otherwise it will
3025
create a textual approximation.
3027
Web pages containing these are :
3028
Hyperlatex ftp://iphthf.physik.uni-mainz.de/pub/gv/unix
3029
latex2html http://www-dsed.llnl.gov/files/programs/unix/latex2html/
3031
They sound interesting, but necessitate loading in extra packages.
3033
A system using translated .tex is :
3035
http://www.cse.ohio-state.edu/~gurari/TeX4ht/mn.html
3037
More information is obtainable in :
3039
ftp://ftp.cse.ohio-state.edu/pub/tex/osu/gurari/TeX4ht/dos/port/readme.html
3041
This document outlines a dos version of the conversion package. It is quite
3042
enlightening, particularly when you don't know too much of the jargon to do
3043
with tex and variants. It provides some general information about what tools
3044
exist to generate what bitmap files from what other files, and was quite
3047
The particular package outlined apparently uses LaTeX, which I don't have
3048
any familiarity with, and am anxious about needed still more libraries and
3049
"background operation files".
3051
Presumably, the dos version is of a much more stand alone nature, but not
3052
using a dos system its not something I've taken much interest in.
3054
As for more general issues, it was noted that :
3056
There was, in fact, an official version of HTML, namely 3.0, that did
3057
support some math. But although W3 even wrote a browser (Arena) for it,
3058
it didn't catch on. IBM produces a ("free") browser plugin called
3059
Techexplorer which can handle certain TeX and LaTeX documents directly.
3061
.... Latest word is that the plugin will be made to work
3062
in Netscape on operating systems other than just Win-95. I believe
3063
it currently works on just Win-95 with Netscape or Microsoft's
3064
Internet Explorer. I am hoping the next release will work in
3067
The plugin is called "techexplorer."
3069
Downloads and information are available at:
3070
http://www.ics.raleigh.ibm.com/ics/techexp.htm
3072
A suggestion was made to use PDF instead of HTML .... I don't know what
3073
PDF is, and I thought HTML was the standard. Apparently there is a version
3074
of TeX called pdftex which outputs PDF directly.
3076
Thanks to Pierre Girard, Eitan Gurari, Ed Russell, Steve Whitlatch,
3077
James Youngman and hymie! for replying/posting by the time I prepared
3078
this summary. Some text has been lifted directly from documents
3082
\EndVerbatim\EndHPage{}]\fi{} --
3083
\ifHtml[\HPage{images to GIF}\Verbatim
3084
From kbigelow@www.play-hookey.com Sat Oct 12 19:36:41 EDT 1996
3085
Article: 107602 of comp.infosystems.www.authoring.html
3086
Path: news.cse.ohio-state.edu!math.ohio-state.edu!howland.erols.net!feed1.news.erols.com!news
3087
From: Ken Bigelow <kbigelow@www.play-hookey.com>
3088
Newsgroups: comp.infosystems.www.authoring.html
3089
Subject: Re: Converting many graphics/images to GIF format
3090
Date: Sat, 12 Oct 1996 17:25:36 +0000
3091
Organization: Erol's Internet Services
3093
Message-ID: <325FD490.57F6@www.play-hookey.com>
3094
References: <52p0em$4dn@nadine.teleport.com>
3095
Reply-To: kbigelow@www.play-hookey.com
3096
NNTP-Posting-Host: kenjb05.play-hookey.com
3098
Content-Type: text/plain; charset=us-ascii
3099
Content-Transfer-Encoding: 7bit
3100
X-Mailer: Mozilla 3.0 (Win16; U)
3104
> Greetings. I have a quick question re: saving graphics to GIF format.
3105
> I am using a Mac to pull together a large html-based help utility and
3106
> need to integrate graphics. I have LOTS that I have used prior in PICT,
3107
> TIFF, and random application formats (Canvas, Kaleidagraph, Photoshop,
3108
> ...ya dee ya...). When I try to save these as GIF files for my html
3109
> pages - most of the graphics get hosed - resolution is very poor and color
3110
> gets trampled on. I expect some degredation but this seems very
3111
> excessive...I have got to be forgetting something. My Canvas 5
3112
> application gives me the impression it is building the appropriate color
3113
> table during the "save" but the resulting image says differently. I am
3114
> not very familiar with the GIF format, so I am not sure of the source of the
3115
> problem. Can any one suggest how I might address this problem or where
3116
> I might find some pointers to a solution?
3124
The problem you're having here has to do with color resolution in the
3125
various methods used to compress graphic data when saving the image
3126
file. I won't go into technical details here, but the two main formats
3127
used currently in Web pages are JPEG (*.jpg) and GIF (*.gif).
3129
JPEGs are saved in 24-bit or 32-bit format. This means they store images
3130
with up to 16.7 million colors or 4 billion colors. As a result, they
3131
are suitable for imaged photographs and similar applications.
3133
GIFs, however, are saved in 8-bit or 4-bit format. These images contain
3134
either 256 colors or even as few as 16 colors. This is very satisfactory
3135
for drawings and for many "ordinary" computer-generated images.
3137
Unfortunately, when you save a high-resolution image (as in TIFF) in GIF
3138
format, you lose most of your colors. The program should be willing to
3139
either "dither" the image or otherwise find the closest match available,
3140
but there's no hope for it -- the image quality will suffer to one
3143
One possible way to handle the problem is to put the GIFs on your page,
3144
since they will be smaller files and will load fairly quickly, and use
3145
them as links to the "real" JPEGs on your server, so the user still has
3146
access to the larger and slower-loading, but far more accurate JPEGs.
3148
Just remember to save your TIFF images in JPEG format first, and then
3149
convert them to GIFs. Going from GIF to JPEG won't improve the
3150
appearance of the image; it's already been degraded.
3153
Are you interested in |
3154
byte-sized education | http://www.play-hookey.com
3155
over the Internet? |
3156
\EndVerbatim\EndHPage{}]\fi
3158
\ifHtml[\HPage{quick conversion}
3159
Provide a fast option
3163
> I think I'll probably write my own Perl script to hanlde
3164
> image conversion. I think it can be made faster than
3165
> using the *.lg file you provide by doing multiple
3166
> conversions at once.
3168
> dvips [arguments] file.idv -o temp.ps
3170
> will write a single .ps file with multiple pages, one for
3173
> convert temp.ps [arguments] image%03d.gif
3175
> will take that file and produce one image gif per page
3176
> The names of the files are image000.gif, image001.gif, etc.
3178
> Thus it looks like I can invoke dvips and convert just
3179
> once each and then simply pass through at correct filenames.
3180
> I imagine that will be faster than invoking the two
3181
> programs once per image.
3183
This will be a superior approach, provided you have access
3184
to sufficient memory. It is rarely the case for me :-(
3197
From: Douglas Bonar <bonard@ms.com>
3198
Date: Wed, 25 Feb 1998 18:29:12 -0500 (EST)
3199
In-Reply-To: Eitan Gurari <gurari@cse.ohio-state.edu>
3200
"Re: And some more ..." (Feb 25, 1:22pm)
3201
References: <199802251822.NAA03524@sunkist.cse.ohio-state.edu>
3202
X-Mailer: Z-Mail Lite (3.2.0 5jul94)
3203
To: Eitan Gurari <gurari@cse.ohio-state.edu>
3204
Subject: Mass conversion
3206
Content-Type: text/plain; charset=us-ascii
3209
The perl script enclosed below seems to be faster than
3210
simply running file.lg through the shell.
3216
#!/ms/dist/perl5/bin/perl5 -sw
3219
if (!@ARGV || !($#ARGV==0)) {
3220
die "readLog takes one argument, the file to be read.\n";
3225
if (! -e $file || ! -r $file || !open(INPUT,"<$file")) {
3226
die "The specified file does not exist or cannot be opened.\n";
3229
# 2-state machine passing through the input file looking for
3230
# lines with dvips or convert information.
3234
if (/^dvips\s+(.*)\s+-pp\s+(\d+)/) {
3235
$dvipsargs = $1; # should be the same ever pass
3236
if (! defined $state) {
3237
$state = $2; # save the index
3239
die "Error:Input file $file, two dvips lines, no convert.\n";
3243
if (/^convert\s+tmp\.ps\s+(.*)\s+(.*)\.gif/) {
3244
$convertargs = $1; # should be the same every time
3245
if (! defined $state) {
3246
die "Error:Input file $file, convert line with no dvips line.\n";
3248
$names[$state] = $2; # store the file name with its number
3249
$state = undef; # reset the machine
3254
system "dvips $dvipsargs -o temp.ps";
3255
system "convert temp.ps $convertargs temp\%03d.gif";
3256
for $i (1..($#names)) { # page numbers in the ps file start at one.
3257
rename sprintf("temp%03d.gif",$i), "$names[$i].gif";
3268
> From: Douglas Bonar <bonard@ms.com>
3269
> Date: Fri, 27 Feb 1998 09:21:13 -0500 (EST)
3270
> X-Mailer: Z-Mail Lite (3.2.0 5jul94)
3271
> To: gurari@cse.ohio-state.edu
3272
> Subject: the continuing saga
3274
> Content-Type: text/plain; charset=us-ascii
3277
> I finally figured out why I was having problems with
3278
> transparency. You write a script file doc.lg, which
3279
> you then execute. But the
3280
> convert (arguments) tmp.ps out.gif
3281
> acts differently for different shells. In particular,
3282
> I use ksh and the '#' in the transparent number comments
3283
> out the rest of the line. That's why I had to move
3284
> tmp.ps forward in the line and why I never could get
3285
> the -transparent flag to work.
3289
> as the first line of the file.lg file. That would
3290
> avoid such problems for most people.
3292
> I'm having little sucess with getting larger images, but
3303
Well, I back down from thinking that you can mass convert the
3304
images. You do end up with gif files, but the cropping doesn't
3305
work, and scale seems to be lost as well.
3307
BTW, I ended up liking the output I got from
3308
-mode iw -D 144 -x 800
3309
I would have just used one of the 120 pixels_per_inch modes,
3310
but they didn't go through mf very well for me. Note that
3311
the size problems I was having were partly due to trying
3312
to mass convert things. Doing that ends up with output
3313
smaller than doing each file seperately (it seems).
3319
\ifHtml[\HPage{more}\Verbatim
3320
--------------------------------------------------------
3321
The best output for larger fonts/scaling of formulas that I can reach
3322
involves the following steps:
3324
a. Find a metafont mode of higher density within your modes.mf file
3325
(in my unix environment the file has the address
3326
.../tex/teTeX/texmf/metafont/misc/modes.mf)
3328
My personal default setting relies on the following entry.
3331
mode_def ibmvga = %\[ IBM VGA monitor (110 dpi)
3332
mode_param (pixels_per_inch, 110);
3333
mode_param (blacker, .3);
3334
mode_param (fillin, 0);
3335
mode_param (o_correction, 0);
3339
b. Inform the mode and its density to dvips through the switches
3340
`mode' and `D'. In my default setting this means
3342
dvips -mode ibmvga -D 110 ...
3344
c. Inform convert what density is in use. In my default setting
3347
convert -density 110x110 ...
3349
The conversion process is slow also on my site.
3351
Well, the above is all I know about this topic. Hope it helps. In
3352
case you'll end up with better solutions, I'll appreciate your input.
3356
> i have one need, larger gifs. my formulas need to be inline with html
3357
> text and i need to control the size of the resulting image. i ran
3358
> convert with a 200% geometry and it ran forever, and generated larger
3359
> gifs but with fuzzy dithered edges. how can i select larger fonts/scaling
3360
> in your system in a clean way? would selecting a different mode be
3361
> right? i tried that with no improvement.
3363
--------------------------------------------------------
3370
\EndVerbatim\EndHPage{}]\fi {} --
3371
\ifHtml[\HPage{more}\Verbatim
3372
GIF has no resolution info. It is fixed at 75 dot per inch.
3373
> > Good to know. I was not aware of this fact. This, I think, might
3374
> > finally explain me why higher densities end up in larger pictures.
3375
> indeed, true. you need JPEG or PNG to get resolution info (if the
3376
> browser bothers to read it)
3378
\EndVerbatim\EndHPage{}]\fi{} --
3379
\ifHtml[\HPage{more}\Verbatim
3380
and the density of the bitmap
3381
pictures. The bitmaps in Figure~\ref{Fig:EG:exdvi} have a density of
3382
110 dots per inch; Figure~\ref{EGf:exdvi-1} shows the corresponding
3383
display of the last picture with a density of 144 dots per inch.
3384
(The \emph{density} refers to the number of bits sampling each inch
3385
in the source dvi picture.)
3387
\EndVerbatim\EndHPage{}]\fi
3389
\ifHtml[\HPage{more}\Verbatim
3390
>> 0x12aaa8: 0x02 dict --Lwrx--- 0x0000 0x0012fb10
3391
>> 0x12aab0: 0x02 dict --Gwrx--- 0x0000 0x0012ac00
3393
>> Has anybody else experienced similar difficulties?
3395
This is probably a gs problem.
3396
gs only allows 80 character input files, and since latex2html uses the
3397
whole path as file name, it easily gets up to this length.
3398
This should be solved by next version of gs (allows 128 character
3401
\EndVerbatim\EndHPage{}]\fi{} --
3402
\ifHtml[\HPage{more}\Verbatim
3403
> 2) display and giftrans are not very good (many errors, screen's
3404
> gestion...) I tried with netpbm which is given with latex2html, and I
3405
> replace in convert.bat the last commands by :
3407
> echo Creating .ppm file
3408
> pcxtoppm tmp00%2.pcx > ppm00%2.ppm =20
3410
> pnmcrop ppm00%2.ppm > ppm10%2.ppm
3411
> echo Creating .gif (transparent) file
3412
> ppmtogif -transparent 1,1,1 ppm10%2.ppm > %3
3414
> It seems to do a good work...
3417
\EndVerbatim\EndHPage{}]\fi {} --
3418
\ifHtml[\HPage{about convert}\Verbatim
3422
ImageMagick requires Ghostscript software to read the
3423
PostScript or the Portable Document format. It is used to
3424
annotate an image when an X server is not available. See the
3425
FreeType library above for another means to annotate an
3426
image. Note, Ghostscript must support the ppmraw device
3427
(type gs -h to verify). If Ghostscript is unavailable, the
3428
Display Postscript extension is used to rasterize a
3429
Postscript document (assuming you define HasDPS). The DPS
3430
extension is less robust than Ghostscript in that it will
3431
only rasterize one page of a multi-page document.
3432
\EndVerbatim\EndHPage{}]\fi {} --
3434
[\HPage{reuseable}\Verbatim
3438
# tex4ht.makegif basename pagenumber destination
3440
####################################################
3442
# Produce the image in postscript form, as $3.new.ps
3444
dvips -mode ibmvga -D 110 -f $1.idv -pp $2 > $3.new.ps
3447
# Check to see if a previous use of this script has left behind a $3.ps file
3452
# If so, and if the $3.ps and $3.new.ps files are identical, then the
3453
# $3.gif file from that previous execution can be retained, and we can avoid
3454
# the time-consuming ps->gif conversion.
3456
if cmp -s $3.ps $3.new.ps
3458
echo $3 is unchanged.
3464
# But if no old file exists, or the .ps files were different, then
3465
# use the new.ps file to produce the .gif image. Retain the $3.new.ps
3466
# file as $3.ps for possible future reuse.
3468
if test -r $3.new.ps
3471
convert -crop 0x0 -density 110x110 -transparent '#FFFFFF' $3.ps $3
3474
\EndVerbatim\EndHPage{}]
3476
[\HPage{redundancy}\Verbatim
3481
Compares all files of form $base*.gif to one another
3482
For each pair of identical .gif files are found, the files
3483
$base*.htm* are edited so that references to these separate
3484
but equal files are replaced by repeated references to the
3487
This can speed up the loading of some html files by a significant
3490
echo > reduceGifs.sed
3492
for fileA in $1*.gif
3495
for fileB in $1*.gif
3497
if test $fileA = $fileB
3503
if cmp -s $fileA $fileB
3505
echo s/$fileA/$fileB/g >> reduceGifs.sed
3508
echo $fileA and $fileB are duplicates.
3515
if test $duplicatesFound = 1
3517
for fileA in $1*.htm*
3519
mv $fileA $fileA.bak
3521
sed -f reduceGifs.sed < $fileA.bak > $fileA
3524
\EndVerbatim\EndHPage{}]
3526
\ifHtml[\HPage{more}\Verbatim
3528
% * The most time-consuming part of the conversion is generating the
3529
% .gif images. I've tried to speed this up a bit:
3530
% + My script for generating the .gif files (1) saves the old .ps
3531
% file. After the new .ps file for the image has been created,
3532
% it is compared to the old one. If unchanged, then the .gif
3533
% file previously generated for that image is reused, rather
3534
% than take the time to produce a new one.
3535
% + After all the .gifs have been produced, this script (2) compares
3536
% the .gifs. If duplicates are found (For example, my STL
3537
% Containers document produces many, many images for the same
3538
% mathmatical expressions e.g., log N), then the .html files
3539
% are edited to use only one of the duplicate .gifs. This can
3540
% significantly reduce the time required to load a document, as
3541
% the repeated references to the same .gif will be served from
3542
% the browser's cache rather than being repeatedly retrieved
3543
% from over the net.
3544
% * Both of the above scripts could be made more portable by rewriting
3545
% them in Perl. Perl could easily replace the use of the sed tool as
3546
% well. Replacing the use of cmp would be more of a problem.Another
3547
% possibility would be to follow the route taken by latex2html and
3548
% use dbm to maintain a content-based ps->gif map. But the use of
3549
% dbm seems to be one of the sticking points in latex2html's
3550
% portability to Win32 systems. By contrast, one can easily obtain
3551
% bash, sed, and cmp as part of the gnuwin32 (4) release, allowing the
3552
% use of these scripts with little or no change.
3558
% > > OK, start laughing, but I don't understand what you mean. If 2htm.bat
3559
% > > is in directory X, and f is a file in a subdirectory of X, doesn't
3560
% > > this put 2htm.bat in the path of f?
3562
% > I'm most certainly not laughing - I know exactly how it feels to be in
3563
% > the dark about an operating system and it's peculiarities. I'm only
3564
% > slowly beginning to feel a little bit at home on this Linux system. I'm
3565
% > having a little difficulty understanding exactly what you're asking
3568
% > The path I was referring to is the executable search path as specified
3569
% > in the path environment variable. The DOS executable search system is
3570
% > similar to Unix's. First, the current directory is searched (note that
3571
% > this is different under Unix), then all directories mentioned in the
3572
% > path variable. These directories are the only ones searched, and
3573
% > subdirectories thereof are not searched, just like under Unix.
3575
% > The basic problem here is that programs under DOS are not, like under
3576
% > Unix, all dumped in one directory, but generally each are installed in
3577
% > their own directory. If the path environment variable arch path. (On my system, this directory is called
3578
% > d:\tools\batch). These startup batch files can then e.g. change to the
3579
% > appropriate directory before starting up the program.
3581
% > This way, you keep a small path environment variable, and still have
3582
% > easy access to all programs. The port manual tries to suggest to place
3583
% > 2htm.bat in a directory in the executable search path; I will change the
3584
% > wording a little to make this more clear.
3588
%----------------------------------------------- features ------------
3591
% %---------------------------------------------------------
3594
% Some links to `convert' are dead. Use instead the following address
3596
% ftp://ftp.wizards.dupont.com/pub/ImageMagick/
3598
% Also, you'll probably need
3600
% -transparent #FFFFFF
3602
% instead of the following
3604
% -transparent #FFFFFF
3606
% in the call to convert.
3607
% The `convert' utility is part of the distribution of ImageMagick.
3608
% It is recommended for use by TeX4ht, to translate postscript
3609
% pictures to gif (or other formats).
3610
% * Once TeX4ht is installed, you might want to consider making a
3611
% transition to the next (not yet complete) version
3613
% files (a small back-end utility is still missing for the html4.0
3614
% mode of output in DOS).
3618
% The changes should be minor, but I can't introduce them here without
3619
% having the win32 installation. the script is just an interpreter of
3620
% the .lg file, making calls to 'convert' and a few other system
3621
% commands (e.g., move file, change protection mode). If you are
3622
% interested, I be glad to modify the script to work on your system, but
3623
% I'll need your advise along the way.
3628
% Doug, Convert is one of many tools within the distribution. I would
3629
% recommend that you download the zip file, and compile just the source
3630
% of convert. -eitan
3633
% > From that directory, what should i grab? There
3634
% > didn't appear to be anything named 'convert'. Do I need
3635
% > the full ImageMagick distribution? Or is there one part
3636
% > of it that is used?
3642
% Doug, Convert is one of many tools within the distribution. I would
3643
% recommend that you download the zip file, and compile just the source
3644
% of convert. -eitan
3647
% > From that directory, what should i grab? There
3648
% > didn't appear to be anything named 'convert'. Do I need
3649
% > the full ImageMagick distribution? Or is there one part
3650
% > of it that is used?
3654
\EndVerbatim\EndHPage{}]\fi
3656
\ifHtml[\HPage{more}\HCode{
3657
<H2>Tools That Tgif Uses:</H2>
3659
<DT><IMG ALT="o" SRC="whitedot.gif"><DD><A
3660
NAME=netpbm><STRONG>Netpbm</STRONG></A> --
3661
a toolkit for conversion of images between a variety of different
3662
formats, as well as to allow a few basic image operations.
3664
Tgif uses netpbm to import/export GIF files, generate trailing TIFF
3665
image for DOS/Windows EPS files, etc.
3666
Please see the IMPORT RASTER GRAPHICS and
3667
GENERATING MICROSOFT WINDOWS EPSI FILES sections of <A
3668
HREF="http://bourbon.cs.umd.edu:8001/tgif/current.html\#man">
3669
`< tgif's man pages</A>.
3671
The official release of netpbm is <A
3672
HREF="ftp://ftp.x.org/R5contrib/netpbm-1mar1994.tar.gz">
3673
ftp://ftp.x.org/R5contrib/netpbm-1mar1994.tar.gz</A>. Since <A
3674
HREF="ftp://ftp.x.org/">ftp.x.org</A> is very difficult to get on,
3675
a copy it is placed at <A
3676
HREF="ftp://bourbon.cs.umd.edu/pub/tgif/netpbm/netpbm-1mar1994.tar.gz">
3677
ftp://bourbon.cs.umd.edu/pub/tgif/netpbm/netpbm-1mar1994.tar.gz</A>.
3678
A <A HREF="ftp://bourbon.cs.umd.edu/pub/tgif/netpbm/README.15nov1997">
3679
modified version</A> of it is placed at <A
3680
HREF="ftp://bourbon.cs.umd.edu/pub/tgif/netpbm/netpbm-15nov1997.tar.gz">
3681
ftp://bourbon.cs.umd.edu/pub/tgif/netpbm/netpbm-15nov1997.tar.gz</A>.
3683
<DT><IMG ALT="o" SRC="whitedot.gif"><DD><A
3684
NAME=pstoepsi><STRONG>Pstoepsi</STRONG></A> --
3685
Script to convert an arbitrary PostScript image to an encapsulated
3686
PostScript image with a bitmap, suitable for incorporation into
3687
FrameMaker, LaTeX, troff, etc.
3689
Pstoepsi is similar to ps2epsi distributed with <A
3690
HREF="http://www.cs.wisc.edu/\string~ghost/">ghostscript</A>. In some cases,
3691
pstoepsi does a little better than ps2epsi.
3693
Tgif uses pstoepsi in the <A
3694
HREF="ftp://bourbon.cs.umd.edu/pub/tgif/samples_tgif/latex.tar.Z">
3695
LaTeX Equation Package</A>. If you are having problems with installing
3696
this package, please look at the <A HREF="faq/latex.html">FAQ on this
3699
A release can be found in either <A
3700
HREF="ftp://ftp.x.org/R5contrib/pstoepsi.tar.Z">
3701
ftp://ftp.x.org/R5contrib/pstoepsi.tar.Z</A> or <A
3702
HREF="ftp://bourbon.cs.umd.edu/pub/tgif/pstoepsi.tar.gz">
3703
ftp://bourbon.cs.umd.edu/pub/tgif/pstoepsi.tar.gz</A>.
3704
However, if any of the above mentioned netpbm releases is used,
3705
all you need is a <A
3706
HREF="ftp://bourbon.cs.umd.edu/pub/tgif/pstoepsi/pstoepsi">pstoepsi
3707
shell script</A> with <A
3708
HREF="ftp://bourbon.cs.umd.edu/pub/tgif/pstoepsi/README.this-site">some
3711
Pstoepsi requires <A
3712
HREF="http://www.cs.wisc.edu/\string~ghost/">ghostscript</A> and <A
3713
HREF="ftp://bourbon.cs.umd.edu/pub/tgif/netpbm/netpbm-15nov1997.tar.gz">
3716
<DT><IMG ALT="o" SRC="whitedot.gif"><DD><A
3717
NAME=ghostscript><STRONG>Ghostscript</STRONG></A> --
3718
<A HREF="http://www.cs.wisc.edu/\string~ghost/">Aladdin Ghostscript</A>
3719
interpreter/previewer.
3721
<DT><IMG ALT="o" SRC="whitedot.gif"><DD><A
3722
NAME=jpeg><STRONG>Jpeg</STRONG></A> --
3723
<A HREF="ftp://ftp.uu.net/graphics/jpeg/">The
3724
Independent JPEG Group's JPEG software</A> (source distribution
3725
is jpegsrc.*.tar.gz).
3727
Tgif can use djpeg from the JPEG package to convert a JPEG file into
3728
a GIF file then use giftopnm and ppmtoxpm from the <A
3729
HREF="ftp://bourbon.cs.umd.edu/pub/tgif/netpbm/netpbm-15nov1997.tar.gz">
3730
netpbm</A> package to import it into tgif.
3731
Please see the IMPORT RASTER GRAPHICS section of <A
3732
HREF="http://bourbon.cs.umd.edu:8001/tgif/current.html\#man">
3733
tgif's man pages</A>.
3737
[\HPage{translation of
3741
Kaz Kylheku \''<kaz@helios.crest.nt.com>', August 7, 1997:
3744
One possible path for doing this is to render the dvi to PostScript using
3745
dvips. Once you have the PostScript, you can use GhostScript to render a
3746
bitmapped image of each page to whatever resolution you want. Using an image
3747
converting program, you can convert these bitmaps to GIF, or whatever you want.
3748
A good image converting program should let you convert the black and white
3749
bitmapped image to a GIF image _and_ scale it down with grayscale anti-aliasing
3750
in the same step. I think ImageMagick is probably able to do it, though I would
3756
July, 1997 (author?):
3759
My own system is a minimalist one; it is based on linux, which perhaps
3760
should have been made clear in my initial post.
3762
I have X Free86 operating, and a few other things, but was trying to
3763
aviod loading in too many more packages.
3765
The packages I ended up using were : tex, dvips, ghostscript, xpaint and
3766
perhaps cjpeg. dvips and ghostscript were necessary add-ons, requiring
3767
a decent number of files. Dvips does not work on my system, as I'm
3768
trying to figure out the minimum number of font packages needed to get
3769
it going. But its being used on a remote system.
3771
In any case, here are the steps involved :
3773
1. Use tex to convert the tex file into .dvi
3774
2. Use dvips to convert the .dvi file into .ps (postscript)
3775
3. Use the ghoscript command
3776
gs -sDEVICE=ppm -sOutputFile=file%d.ppm file.ps
3777
To convert the ps file to a ppm file which xpaint can read.
3778
4. Run X and startup xpaint. The successive pages of the document
3779
will have been converted to numbered ppm files. Load each in
3780
sucession into xpaint. Use the region command to mark out a
3781
region encompassing each formula, and save as .gif file.
3782
5. Refer to each formula file generated within the HTML document.
3784
This works. I suspect there may be a way of "grabbing" the raw the
3785
X screen output when using xdvi to look at the document, and process
3786
the contents, but I don't know enough to do this.
3788
An alternate approach, using slightly different packages, which I have
3789
not tried, is described in Chapter 11.6 (p.455) of the LaTeX Graphics
3790
Companion (Goossens, Rahts, Mittelbach, 1997, ISBN 0-201-85469-4).
3792
Basically the steps are:
3793
1 put each equation in a separate file/page
3794
2 process with dvips to get a postscript file
3795
3 process with Ghostscript to get a pbm file
3796
4 use the netpbm utility pbmcrop to trim white space (or epsfit)
3797
5 use ppmtogif to get a gif file or cjpeg to get a jpeg file.
3799
Two "automatic" methods...
3801
latex2html requires perl and hyperlatex requires emacs. Both will
3802
require the pbmutilities and ghostscript, possibly giftrans.
3803
latex2html will do a full conversion of your document so it will
3804
generate equation in gif format. hyperlatex will require that you
3805
indicate that you want an equation converted to gif, otherwise it will
3806
create a textual approximation.
3808
Web pages containing these are :
3809
Hyperlatex ftp://iphthf.physik.uni-mainz.de/pub/gv/unix
3810
latex2html http://www-dsed.llnl.gov/files/programs/unix/latex2html/
3812
They sound interesting, but necessitate loading in extra packages.
3814
A system using translated .tex is :
3816
http://www.cse.ohio-state.edu/~gurari/TeX4ht/mn.html
3818
More information is obtainable in :
3820
ftp://ftp.cse.ohio-state.edu/pub/tex/osu/gurari/TeX4ht/dos/port/readme.html
3822
This document outlines a dos version of the conversion package. It is quite
3823
enlightening, particularly when you don't know too much of the jargon to do
3824
with tex and variants. It provides some general information about what tools
3825
exist to generate what bitmap files from what other files, and was quite
3830
\ifHtml[\HPage{more}\Verbatim
3831
Gif exist tmp.ps DEL tmp.ps
3832
Gif exist tmp.ppm DEL tmp.ppm
3833
Gdvips -f %%1 -pp %%2 -o tmp.ps
3834
Ggswin32c -sDEVICE=ppm -sOutputFile=tmp.ppm -q -dbatch -dNOPAUSE tmp.ps -c quit
3835
% Gdvips -mode ibmvga -D 110 -f %%1 -pp %%2 -o tmp.ps
3836
% Ggswin32c -r110 -sDEVICE=ppm -sOutputFile=tmp.ppm -q -dbatch -dNOPAUSE tmp.ps -c quit
3837
GMOVE /y tmp.ppm temp.ppm
3838
Gpnmcrop temp.ppm > tmp.ppm
3839
Gif exist %%3 DEL %%3
3840
Gppmtogif -interlace -transparent 1,1,1 tmp.ppm > %%3
3843
The \`'-c quit' must be at the end of gswin32c--it quits the execution
3844
from the batch mode of execution. The postscript file(s) must come
3853
\SubSection{Ignore/Noignore Commands}
3856
\<???--- ??? ---...\><<<
3857
status = scan_until_end_str("", 1, status, lg_file);
3862
l. 10 --- needs --- ignore ---
3863
l. 11 --- needs --- end ignore ---
3867
We didn't check below the \`'l. dddd ' part.
3869
\<???--- needs ---...\><<<
3870
status = scan_until_end_str(" ignore ---", 2, status, lg_file);
3872
skip = eq_str(match[2]," ignore ---") ? TRUE :
3873
( eq_str(match[2]," end ignore ---") ? FALSE : skip );
3877
\Section{post-process files}
3880
\<post-process files\><<<
3882
eoln_ch = (int) 'x';
3883
while( eoln_ch != EOF ) {
3884
status = scan_str("File: ", TRUE, lg_file);
3885
status = scan_until_str(".", 1, status, lg_file);
3886
status = scan_until_end_str("", 2, status, lg_file);
3887
if( status ){ Q_CHAR *p;
3889
*(p + (int) strlen(p) - 1) = '\0';
3890
(void) execute_script(file_script, match[1],
3891
match[2], Xrecord? Xrecord : "", "");
3896
\Section{User Commands}
3898
\`'l. 10 --- needs --- "ls *" ---'
3900
\<process user commands\><<<
3901
eoln_ch = (int) 'x';
3902
while( eoln_ch != EOF ) { Q_CHAR *command, ch;
3904
struct sys_call_rec *p;
3906
status = scan_str("l. ", TRUE, lg_file);
3907
status = scan_until_str(" --- needs --- \"", 1, status, lg_file);
3908
status = scan_until_str("\" ---", 2, status, lg_file);
3911
*(command + (int) strlen(command) - 5) = '\0';
3912
`<flag = permission for system calls`>
3914
`<execute system command`>
3915
} else { (IGNORED) printf(
3916
"No permission for system call: %s\n", command); }
3921
\<env permissions for system calls\><<<
3922
{ struct sys_call_rec *q;
3923
q = m_alloc(struct sys_call_rec, 1);
3924
q->next = system_calls;
3925
q->filter = match[1];
3926
match[1] = (Q_CHAR *) malloc(70); max_match[1] = 70;
3929
(IGNORED) printf(".......'S' script: '%s'\n",
3934
\<permission for system calls\><<<
3935
{ struct sys_call_rec *q;
3936
q = m_alloc(struct sys_call_rec, 1);
3937
q->next = system_calls;
3944
\<flag = permission for system calls\><<<
3948
if( (n = (int) strlen(p->filter)) == 1 ) {
3949
if( *(p->filter) == '*' ){
3953
if( strlen(command) >= (unsigned int) n ) {
3954
ch = command[n]; command[n] = '\0';
3955
flag = flag || eq_str(p->filter,command);
3967
From log files \`'l. # --- needs --- "command" ---'
3981
\Section{The Css (Cascade Style Sheets) File}
3986
%Css: TD.caption{white-space: nowrap; }
3987
%Font("cmex","10","100")
3988
%Font("cmmi","10","100")
3989
%Font("cmmi","5","100")
3990
%Font("cmmi","7","100")
3991
%Font("cmr","10","100")
3992
%Font("cmr","5","100")
3993
%Font("cmr","7","100")
3994
%Font("cmsy","10","100")
3995
%Font("cmsy","7","100")
3996
%Font("cmti","10","100")
3997
%Font("cmtt","10","100")
3998
%Font_Class(1,""): <IMG SRC=""ALT=""CLASS="%s%s-%d--%x">
3999
%Font_Class(3,"mva"): <IMG SRC=""ALT=""CLASS="%s-%d--%x"ALIGN="MIDDLE">
4000
%Font_Class(6,"ul"): <SPAN CLASS="underline"></SPAN>
4001
%Font_Css("sc"): .small-caps{font-variant: small-caps; }
4002
% Font_Css("ul"): .underline{text-decoration:underline; }
4009
Q_CHAR css_name[255], *p;
4010
FILE *css_file, *tmp_file;
4012
`<css-file = open file ...`>
4014
(IGNORED) printf ("Entering %s\n", css_name);
4015
tmp_file = fopen("tex4ht.tmp", WRITE_TEXT_FLAGS);
4017
(IGNORED) warn_i_str(5,"tex4ht.tmp");
4018
} else { `<c: tex4ht.tmp := css file`> }
4019
tmp_file = open_file("tex4ht.tmp", ".tmp");
4020
css_file = fopen(css_name, WRITE_TEXT_FLAGS);
4022
(IGNORED) warn_i_str(5,"tex4ht.tmp");
4023
} else if( !css_file ) {
4024
(IGNORED) warn_i_str(5,css_name);
4026
`<c: css file = header of tex4ht.tmp`>
4028
`<css file = css.sty`>
4029
`<c: css file = tail of tex4ht.tmp`>
4032
(IGNORED) fclose(tmp_file);
4033
(IGNORED) fclose(css_file);
4038
\SubSection{Preliminary Processing}
4040
\<c: tex4ht.tmp := css file\><<<
4042
while( (ch = getc(css_file)) != EOF ) {
4043
(IGNORED) putc( ch, tmp_file );
4045
(IGNORED) fclose(tmp_file);
4046
(IGNORED) fclose(css_file);
4050
\<css-file = open file ...\><<<
4051
(IGNORED) strcpy( css_name, lg_name);
4054
if( *p == '.' ){ *p = '\0'; break; }
4057
(IGNORED) strct(css_name, ".css");
4058
css_file = fopen(css_name, READ_TEXT_FLAGS);
4061
\SubSection{Cotributors to the Css File}
4063
Copy until insertion point:
4067
\<c: css file = header of tex4ht.tmp\><<<
4069
eoln_ch = (int) 'x';
4070
while( eoln_ch != EOF ) {
4071
status = scan_until_end_str("", 1, TRUE, tmp_file);
4072
`<match[2] := compressed match[1]`>
4073
if( eq_str(match[2], "/*css.sty*/") ){ css_sty = TRUE; break; }
4074
(IGNORED) fprintf(css_file, "%s\n", match[1]);
4084
\<match[2] := compressed match[1]\><<<
4087
n = 0; p = match[1]; q = match[2];
4088
while ( (*p != '\0') ){
4089
if (n == 13) { *(q-10) = '\0'; break;}
4090
if( *p != ' ' ){ *(q++) = *p; n++; }
4097
Contribution from lg File
4101
\<css file = css.sty\><<<
4102
(IGNORED) fprintf(css_file, "/* start css.sty */\n");
4103
`<rewind lg file`> `<process Font_Size: ...`>
4104
`<rewind lg file`> `<process Font(...)`>
4105
`<rewind lg file`> `<process Font_Css(...):...`>
4106
`<rewind lg file`> `<process Css:...`>
4107
(IGNORED) fprintf(css_file, "/* end css.sty */\n");
4111
The \`'<process Css:...>' should be after the other two's to allow
4112
the user to overide with \''\Css' commands the the
4113
other contributions.
4118
We want to remove the non-leading \`'/* css.sty */', just
4119
in case htcmd.perl is called consequtively more than once.
4121
\<css file = tail of tex4ht.tmp\><<<
4122
eoln_ch = (int) 'x';
4123
while( eoln_ch != EOF ) {
4124
status = scan_until_end_str("", 1, TRUE, tmp_file);
4125
`<match[2] := compressed match[1]`>
4126
if( !eq_str(match[2], "/*css.sty*/") ){
4127
(IGNORED) fprintf(css_file, "%s\n", match[1]);
4133
\SubSection{Contributions from /Css Commands}
4135
\`'Css: P.noindent { text-indent: 0em }'
4137
\<process Css:...\><<<
4138
eoln_ch = (int) 'x';
4139
while( eoln_ch != EOF ) {
4140
status = scan_str("Css: ", TRUE, lg_file);
4141
status = scan_until_end_str("", 1, status, lg_file);
4143
(IGNORED) fprintf(css_file, "%s\n", match[1]);
4147
\SubSection{Contributions From Font-Size}
4150
\`'\Needs{"Font_Size: 12"}'
4154
\<process Font_Size: ...\><<<
4155
eoln_ch = (int) 'x';
4156
while( eoln_ch != EOF ) {
4157
status = scan_str("Font_Size: ", TRUE, lg_file);
4158
status = scan_until_end_str("", 1, status, lg_file);
4160
base_font_size = (int) get_long_int(match[1]);
4166
static int base_font_size = 10;
4172
\SubSection{Contributions to Fonts}
4174
\`'Font("cmr","10","100")'
4175
\`'Font("aptmri","8t","100")'
4177
\<process Font(...)\><<<
4178
eoln_ch = (int) 'x';
4179
while( eoln_ch != EOF ) {
4180
status = scan_str("Font(\"", TRUE, lg_file);
4181
status = scan_until_str("\",\"", 1, status, lg_file);
4182
status = scan_until_str("\",\"", 2, status, lg_file);
4183
status = scan_until_str("\",\"", 3, status, lg_file);
4184
status = scan_until_end_str("\")", 4, status, lg_file);
4187
struct htf_struct *font_sty;
4190
*(p + (int) strlen(p) - 3) = '\0';
4192
*(p + (int) strlen(p) - 3) = '\0';
4194
*(p + (int) strlen(p) - 3) = '\0';
4196
*(p + (int) strlen(p) - 2) = '\0';
4199
if( font_sty || (second != 100) ){
4200
`<print font style css`>
4206
\<get font size\><<<
4209
( (int) get_long_int(match[3])
4210
* (int) get_long_int(match[4])
4213
while( second > 700 ){ second /= 10; }
4215
while( *p != '\0' ){
4216
if( (*p < '0') || (*p > '9') ){ second = 100; break; }
4225
\<get font style\><<<
4227
while ( font_sty ) {
4228
if( eq_str(font_sty->key,match[1]) ){ break; }
4229
font_sty = font_sty->next;
4239
\<print font style css\><<<
4240
(IGNORED) fprintf(css_file, ".%s-%s", match[1], match[2]);
4241
if( !eq_str(match[4],"100") ){
4242
(IGNORED) fprintf(css_file, "--%s", match[4]);
4244
(IGNORED) fprintf(css_file, "{");
4245
if( second != 100 ){
4246
(IGNORED) fprintf(css_file, "font-size:%d%c;", second, '%');
4249
(IGNORED) fprintf(css_file, font_sty->body);
4251
(IGNORED) fprintf(css_file, "}\n");
4256
\SubSection{Font-Css Contributions}
4258
\`'Font_Css("4"): .small-caps{font-variant: small-caps; }'
4260
\<process Font_Css(...):...\><<<
4261
eoln_ch = (int) 'x';
4262
while( eoln_ch != EOF ) {
4263
status = scan_str("Font_Css(\"", TRUE, lg_file);
4264
status = scan_until_str("\"): ", 1, status, lg_file);
4265
status = scan_until_end_str("", 1, status, lg_file);
4267
(IGNORED) fprintf(css_file, "%s\n", match[1]);
4277
\Section{load env file}
4280
\SubSection{Retrieve Info}
4282
\<load env file\><<<
4284
U_CHAR env_loc[512];
4288
(IGNORED) printf("Entering %s\n", env_loc[0]? &env_loc[0]
4290
`<get info from env file`>
4291
(IGNORED) fclose(file);
4297
\<get info from env file\><<<
4298
eoln_ch = (int) 'x';
4299
while( eoln_ch != EOF ) { Q_CHAR ch;
4300
ch = (char) (eoln_ch = getc(file));
4301
if( eoln_ch != (int) '\n' ){
4302
status = scan_until_end_str("", 1, TRUE, file);
4305
case 'A':{ `<script for chmod`> break;}
4306
case 'C':{ `<script for copy`> break;}
4307
case 'E':{ `<script for empty gifs`> break;}
4308
case 'F':{ `<script for dvigif of glyps`> break;}
4309
case 'G':{ `<script for dvigif`> break;}
4310
case 'M':{ `<script for move`> break;}
4311
case 'S':{ `<env permissions for system calls`> break;}
4312
case 'X':{ `<script for file`> break;}
4318
\<script for dvigif\><<<
4320
(IGNORED) printf(".......'G' script\n"); }
4321
dvigif_script = add_script(dvigif_script);
4325
\<script for dvigif of glyps\><<<
4327
(IGNORED) printf(".......'F' script\n"); }
4328
dvigif_glyp_script = add_script(dvigif_glyp_script);
4332
\<script for move\><<<
4334
(IGNORED) printf(".......'M' script\n"); }
4335
move_script = add_script(move_script);
4339
\<script for copy\><<<
4341
(IGNORED) printf(".......'C' script\n"); }
4342
copy_script = add_script(copy_script);
4349
\<script for file\><<<
4351
(IGNORED) printf(".......'X' script\n"); }
4352
file_script = add_script(file_script);
4358
\<script for chmod\><<<
4360
(IGNORED) printf(".......'A' script\n"); }
4361
chmod_script = add_script(chmod_script);
4364
\<script for empty gifs\><<<
4366
(IGNORED) printf(".......'E' script\n"); }
4367
empty_fig_script = add_script(empty_fig_script);
4374
\<header functions\><<<
4375
static struct script_struct * add_script( ARG_I(struct script_struct *) );
4380
static struct script_struct * add_script(script)
4381
struct script_struct * script
4384
struct script_struct* temp, * q;
4385
temp = (struct script_struct *)
4386
m_alloc(struct script_struct, (int) 1);
4387
temp->command = match[1];
4389
(IGNORED) printf("....... %s\n", temp->command); }
4390
temp->next = NULL_SCRIPT;
4391
match[1] = (Q_CHAR *) malloc(70);
4395
while( q->next ){ q = q->next; }
4415
static struct script_struct
4416
* dvigif_script = NULL_SCRIPT,
4417
* dvigif_glyp_script = NULL_SCRIPT,
4418
* move_script = NULL_SCRIPT,
4419
* empty_fig_script = NULL_SCRIPT,
4420
* copy_script = NULL_SCRIPT,
4421
* file_script = NULL_SCRIPT,
4422
* chmod_script = NULL_SCRIPT;
4434
% case 'H':{ `<env-htf-sty = htfcss.env file`> break;}
4436
% \<env-htf-sty = htfcss.env file\><<<
4437
% env_htf_sty = match[1];
4438
% match[1] = (Q_CHAR *) malloc(70);
4439
% max_match[1] = 70;
4441
% (IGNORED) printf(".......'H' script: '%s'\n",
4446
% static Q_CHAR* env_htf_sty = Q_NULL;
4452
% dvips -mode ibmvga -D 110 -f foo.idv -pp 92 > tmp.ps
4453
% convert -crop 0x0 -density 110x110 -transparent '#FFFFFF' tmp.ps foo.gif
4454
Gdvips -mode ibmvga -D 110 -f %1 -pp %2 > tmp.ps
4455
Gconvert -crop 0x0 -density 110x110 -transparent '#FFFFFF' tmp.ps %3
4461
H/n/gold/5/gurari/tex4ht.dir/
4466
\SubSection{Open Directory}
4469
\<find tex4ht.env\><<<
4470
{ Q_CHAR str[512], *HOME_DIR;
4471
`<env file from command switch`>
4472
if( !file ) { file = fopen("tex4ht.env", READ_TEXT_FLAGS);
4473
(IGNORED) strcpy(&env_loc[0],"tex4ht.env");
4474
if( debug && file ){
4475
(IGNORED) printf(".......Open: ./tex4ht.env\n"); }
4477
if( !file ) { `<env file from prog loc`> }
4479
if( !file ) { file = fopen(".tex4ht", READ_TEXT_FLAGS);
4480
(IGNORED) strcpy(&env_loc[0],".tex4ht");
4481
if( debug && file ){
4482
(IGNORED) printf(".......Open: ./.tex4ht\n"); }
4485
`<env file at root dir`>
4488
file = fopen( ENVFILE,READ_TEXT_FLAGS);
4489
(IGNORED) strcpy(&env_loc[0],ENVFILE);
4490
if( debug && file ){
4491
(IGNORED) printf(".......Open: %s\n", ENVFILE); }
4494
`<kpathsea env file`>
4495
if( !file ) warn_i_str( 5, `<warn 1`>);
4517
"tex4ht.env | .tex4ht"
4524
\<kpathsea env file\><<<
4527
file = kpse_open_file ("tex4ht.env", kpse_program_text_format);
4528
if( debug && file ){
4529
(IGNORED) printf(".......Open kpathsea tex4ht.env\n"); }
4536
\SubSection{Root Directory}
4538
\<env file at root dir\><<<
4540
HOME_DIR = getenv("HOME");
4541
if( HOME_DIR ){ (IGNORED) sprintf(str,`<"s/tex4ht.env"`>, HOME_DIR);
4542
file = fopen(str,READ_TEXT_FLAGS);
4543
(IGNORED) strcpy(&env_loc[0],str);
4544
if( debug && file ){
4545
(IGNORED) printf(".......Open: %s\n", str); }
4551
(IGNORED) sprintf(str,"%s/.tex4ht", HOME_DIR);
4552
file = fopen(str,READ_TEXT_FLAGS);
4553
(IGNORED) strcpy(&env_loc[0],str);
4557
#if defined(DOS_WIN32) || defined(__MSDOS__)
4559
file = fopen("C:/tex4ht.env",READ_TEXT_FLAGS);
4560
(IGNORED) strcpy(&env_loc[0],"C:/tex4ht.env");
4565
\<"s/tex4ht.env"\><<<
4566
#if defined(DOS_WIN32) || defined(__DJGPP__)
4567
is_forward_slash(HOME_DIR)? "%s/tex4ht.env" : "%s\\tex4ht.env"
4583
\SubSection{Env File from Command Line}
4585
\<env file from command switch\><<<
4586
file = tex4ht_env_file?
4587
fopen( tex4ht_env_file, READ_TEXT_FLAGS ) : NULL;
4588
if( tex4ht_env_file ){
4589
(IGNORED) strcpy(&env_loc[0],tex4ht_env_file);
4591
if( debug && file ){
4592
(IGNORED) printf(".......Open: %s\n", tex4ht_env_file); }
4595
\<env file from prog loc\><<<
4597
file = fopen( dos_env_file, READ_TEXT_FLAGS ) ;
4598
(IGNORED) strcpy(&env_loc[0],dos_env_file);
4599
if( debug && file ){
4600
(IGNORED) printf(".......Open: %s\n", dos_env_file); }
4606
Search along the path: command line file $\rightarrow$ work
4607
directory $\rightarrow$ home directory $\rightarrow$ system file.
4609
\<get .env directory from com ln\><<<
4610
if( !access(p+2,F_OK) ) tex4ht_env_file = q;
4611
else warn_i_str(6,q);
4616
The function \`'int access(const char *pathname, int mode)', and the mode
4617
\`'F_OK' that tests for the existence of file, are defined in the
4618
following directory. The function returns 0 if ok and -1 on error .
4620
Where access comes from in dos?
4623
\SubSection{Env File from Location of htcmd.c}
4626
Q_CHAR * tex4ht_env_file = (Q_CHAR *) 0;
4627
Q_CHAR * dos_env_file =
4628
#if defined(DOS_WIN32) || defined(__MSDOS__)
4629
`<get dos env file`>;
4631
#if !defined(DOS_WIN32) && !defined(__MSDOS__)
4637
Under DOS, argv[0] usually includes the full path to the program -
4638
even if it wasn't typed in. This can be used to find the program's own
4639
directory, and hence the configuration file. I've implemented this
4642
\<get dos env file\><<<
4643
get_env_dir(argv[0])
4647
#if defined(DOS_WIN32) || defined(__MSDOS__)
4648
`<get tex4ht.env in dos`>
4652
\<get tex4ht.env in dos\><<<
4654
char *get_env_dir(progname)
4659
if(! progname || ! *progname) return NULL; `% Safety `%
4660
i = (int) strlen(progname);
4661
while( (progname[--i] != dir_path_slash(progname) )
4662
&& i > 0) ; `%Search for slash`%
4663
if(i == 0) return NULL; `%Not found? Give up`%
4664
p = (Q_CHAR *) malloc(i+12);
4665
if(p == NULL) return NULL; `%Space for new extention after dot`%
4666
strncpy(p, progname, i+1); `%Copy up to slash`%
4667
strcpy(&p[i+1],"tex4ht.env"); `%Append new extention`%
4677
The 12 above is for accomodating \''tex4ht.env'.
4679
Then, in main(), I changed:
4681
\`''char* tex4ht_env_file = (Q_CHAR *) 0;'
4685
\`'char* tex4ht_env_file = get_env_dir(argv[0]);'
4687
This works like a charm here, and allows me to use tex4ht from a
4688
different directory without typing a single commandline option.
4693
\Section{Open Files}
4699
\SubSection{General}
4701
\<header functions\><<<
4702
static FILE* open_file( ARG_II(C_CHAR *, C_CHAR *) );
4707
static FILE* open_file(name,ext)
4708
Q_CHAR *name`; Q_CHAR *ext
4710
C_CHAR filename[255], *p;
4711
(IGNORED) strcpy( filename,name );
4715
if( eq_str( ext,LG_EXT ) ) { *p = '\0'; }
4718
if( *p == '\0' ){ (IGNORED) strcpy(p, ext); break; }
4721
file = fopen(filename, READ_TEXT_FLAGS);
4723
(IGNORED) warn_i_str(5,filename);
4724
} else { (IGNORED) printf ("Entering %s\n", filename); }
4731
We have here a little inconsistency with tex4ht.c. There the input file
4732
name is appended with the extension .dvi, allowing double extensions.
4733
Here, if an extension is present, we remove it before putting .lg on
4734
top of the name. Should we fix that?
4740
#define LG_EXT ".lg"
4748
% \SubSection{htfcss.env}
4751
% \<file = open htfcss.env\><<<
4753
% file = open_file(htf_cfg, ".env");
4754
% } else { C_CHAR filename[255];
4755
% file = fopen("htfcss.env", READ_TEXT_FLAGS);
4756
% if ( !file && env_htf_sty ){
4757
% (IGNORED) strcpy(filename, env_htf_sty);
4758
% (IGNORED) strct(filename, "htfcss.env");
4759
% file = fopen(filename, READ_TEXT_FLAGS);
4762
% (IGNORED) strcpy(filename, HTFDIR );
4763
% (IGNORED) strct(filename, "htfcss.env");
4764
% file = fopen(filename, READ_TEXT_FLAGS);
4766
% `<htfcss.env in KPATHSEA`>
4767
% if( !file ) { (IGNORED) warn_i_str(5,"htfcss.env"); }
4768
% else { (IGNORED) printf ("Entering htfcss.env\n"); }
4776
\<mark start lg file\><<<
4777
begin_lg_file = ftell(lg_file);
4780
\<rewind lg file\><<<
4781
(IGNORED) fseek(lg_file, begin_lg_file, `<abs file addr`>);
4784
\<abs file addr\><<<
4791
static FILE* lg_file;
4792
static long begin_lg_file;
4800
I've been held up a bit by a
4801
bug in tex4ht.c that caused emTeX to complain that the created .idv file
4804
*** Fatal error 2106: corrupt DVI file (postamble not found)
4806
I found the cause, though: you open it with mode "w", which is text
4807
mode. Changing this to "wb" solved the problem.
4822
\SubSection{Error and Warning Messages}
4824
\<signals messages: 2--4\><<<
4825
"Illegal storage address\n", `%2 segmentation`%
4826
"Floating-point\n", `%3 `%
4827
"Interrupt with Cntr-C\n", `%4 `%
4830
\<warn and err messages\><<<
4831
`<command line options`>, `%0`%
4832
"Insufficient memory\n", `%1`%
4833
`<signals messages: 2--4`>
4834
"Can't find/open file ``%s'\n", `%5`%
4835
"Can't access directory ``%s\n'", `%6`%
4839
\ifHtml[\HPage{more}\Verbatim
4840
To: Eitan Gurari <gurari@cse.ohio-state.edu>
4841
Subject: Re: texk4ht.c, small patch for win32
4842
References: <199803130718.CAA17393@sunkist.cse.ohio-state.edu>
4843
From: Fabrice POPINEAU <popineau@esemetz.ese-metz.fr>
4844
Date: 13 Mar 1998 14:05:50 +0100
4845
In-Reply-To: Eitan Gurari's message of "Fri, 13 Mar 1998 02:18:58 -0500 (EST)"
4847
X-Mailer: Quassia Gnus v0.37/Emacs 19.34
4849
MIME-Version: 1.0 (generated by SEMI MIME-Edit 0.98 - "Sodani")
4850
Content-Type: text/plain; charset=US-ASCII
4852
>>>>> "Eitan" == Eitan Gurari <gurari@cse.ohio-state.edu> writes:
4854
Eitan> I also wonder whether the WIN32 really needs to discard the
4855
Eitan> following code fragment.
4857
signal() is supported through the standard libc, but is mostly
4858
ineffective. An example of the kind of code needed is attached.
4860
Thanks for the mods,
4864
/* Interrupt handler. mt_exit() is a cleanup_and_exit function */
4866
BOOL sigint_handler(DWORD dwCtrlType)
4869
return FALSE; /* return value obligatory */
4872
void sigint_handler (int sig)
4878
/* Catch signals, so we clean up if the child is interrupted.
4879
This emulates "trap 'whatever' 1 2 15". */
4881
SetConsoleCtrlHandler((PHANDLER_ROUTINE)sigint_handler, TRUE);
4884
signal (SIGINT, sigint_handler);
4887
signal (SIGHUP, sigint_handler);
4890
signal (SIGTERM, sigint_handler);
4893
\EndVerbatim\EndHPage{}]\fi
4895
Msvc recommends not using printf, but we ignoring this recommendation
4896
here with the assumption that the recommendation relates to I/O
4897
interrupts that are not considered here.
4902
\<header functions\><<<
4904
static BOOL sigint_handler(ARG_I(DWORD));
4911
static BOOL sigint_handler(dwCtrlType) DWORD dwCtrlType
4914
return FALSE; `% return value obligatory `%
4920
\SubSection{System Calls}
4925
static Q_CHAR command[255];
4930
The library \`'<stdlib.h>' includes a function
4931
\`'int system(const char *cmdstring);'. When cmdstring is NULL,
4932
the return value is 0 iff the platform does not support system calls.
4936
static BOOL system_yes;
4939
Solaris-? issues the command \`'-c: bad option(s)' if we check for the
4940
presence of the system function.
4944
\SubSection{Strings Concat and compare}
4949
#define eq_str(x,y) (!strcmp(x,y))
4957
\SubSection{String into Int}
4959
\<header functions\><<<
4960
static long int get_long_int( ARG_I(Q_CHAR *) );
4965
static long int get_long_int(str)
4970
while( (*ch>= '0') && (*ch <='9') ){
4971
i = 10*i + *(ch++) - '0';
4980
\SubSection{Pattern Recognition Functions}
4983
When failure (false \''status') arises, the input line is consumed to
4985
The \''_until' functions place in ''match[i]' the string found.
4987
\<header functions\><<<
4988
static BOOL scan_until_end_str( ARG_IV(C_CHAR *, int, BOOL, FILE *) );
4993
static BOOL scan_until_end_str(str,n,flag,file)
5000
if( !flag ) { return flag; }
5001
p = match[n]; i = 0;
5003
if( (i+1) >= max_match[n] ){
5005
p = match[n] = (Q_CHAR *)
5006
r_alloc((void *) match[n], (size_t) max_match[n]);
5008
p[i] = (char) (eoln_ch = getc(file));
5009
if( (eoln_ch == (int) '\n') || (eoln_ch == EOF) ){ break; }
5013
i -= (int) strlen(str);
5014
if( i>= 0 ){ return eq_str(p+i,str); }
5022
static Q_CHAR* match[10];
5023
static int max_match[10];
5029
for( i=0; i<=9; i++){
5030
match[i] = (Q_CHAR *) malloc(70);
5037
\<header functions\><<<
5038
static BOOL scan_until_str( ARG_IV(C_CHAR *, int, BOOL, FILE *) );
5043
static BOOL scan_until_str(str,n,flag,file)
5050
if( !flag ) { return flag; }
5051
p = match[n]; i = 0;
5053
ch = (char) (eoln_ch = getc(file));
5054
if( (eoln_ch == (int) '\n') || (eoln_ch == EOF) ){ return FALSE; }
5055
if( (i+1) >= max_match[n] ){
5057
p = match[n] = (Q_CHAR *)
5058
r_alloc((void *) match[n], (size_t) max_match[n]);
5061
j = i - (int) strlen(str);
5064
if( eq_str(p+j,str) ) { return TRUE; }
5075
\<header functions\><<<
5076
static BOOL scan_str( ARG_III(C_CHAR *, BOOL, FILE *) );
5081
static BOOL scan_str(str,flag,file)
5087
if( !flag ) { return flag; }
5089
while( *p != '\0' ){
5090
if( *(p++) != (temp_eoln_ch = getc(file)) ) {
5091
while( (temp_eoln_ch != (int) '\n')
5092
&& (temp_eoln_ch != EOF) ){ temp_eoln_ch = getc(file); }
5093
eoln_ch = temp_eoln_ch; return FALSE;
5131
\SubSection{Shorthands and Mnemonics}
5137
#define eq_str(x,y) (!strcmp(x,y))
5144
\SubSection{str inconsistently in lint}
5146
\Link[file://localhost/usr/lib/llib-lc]{}{}llib-lc\EndLink
5148
\SubSection{About DOS}
5151
\Link[http://www.ku.edu.tr/text/help/dos62\string_adv.html]{}{}%
5153
\HCode{<LI><a href="http://www.csulb.edu/~murdock/easydosinfo.html">DOS the Easy Way</a>,
5154
<LI><a href="http://www.csulb.edu/~murdock/dosindex.html">The Web-Based Guide to DOS</a>
5161
What Are Batch Files?
5163
Batch files are user-written "mini-programs" in which each line is
5164
a DOS command. Such files are processed line-by-line, executing
5165
commands that have been batched together. Most of the time batch
5166
files are created to avoid having to type in a series of
5167
commonly-used commands. A simple example might be the following:
5172
This batch file will clear the screen, go to the c: drive,
5173
change directories to Windows, and list all the files .DOC
5174
extensions. If you carry out these four commands on a regular
5175
basis, and you're tired of typing them in each time, a batch file
5178
Batches, however, can be quite complicated, executing a long chain
5179
of commands. One command in the chain might run a whole new batch
5180
file. It is even possible to create smart "batches" that test for
5181
certain conditions. For example, the above batch file might be
5182
written in such a way that it checks first for the existence of
5183
files with .DOC extensions before listing them.
5187
Batch files are always given a filename with a .BAT extension. From
5188
that point on, the filename is considered a DOS command. When you
5189
type it, the series or batch of commands is immediately executed.
5190
For example, the above file might be given the name WINLIST.BAT.
5191
That way, whenever the user wants to see the .DOC documents in
5192
Windows, he or she just needs to type the command WINLIST and hit
5193
<ENTER>. It's not necessary to type in the .BAT extension. It's a
5194
very good idea to use file names that easily indicate the purpose
5195
of the "batch" and are easy to remember. Also, keep in mind these
5196
DOS conventions when creating batch files:
5197
* The filename must be eight characters or less in length.
5198
* Don't use capitalization, spaces, or punctuation marks in the
5200
* Remember to add a .BAT extension.
5201
* Keep in mind that the full filename, such as WINLIST.BAT, has two
5202
parts, a main name and an extension, separated by a period. This
5203
will be important later when you are using the DIR command to list
5204
the batch files or the TYPE command to view them.
5206
The AUTOEXEC.BAT file
5208
The AUTOEXEC.BAT is a special-purpose batch file that runs each
5209
time you start your computer. It is the most important batch file
5210
on your computer and must be treated with extreme care. If you
5211
accidentally delete you will crash your computer.
5213
Displaying Batch Files
5215
It is possible to display the contents of a batch file without
5216
actually executing it. To display the contents of a batch, use the
5217
TYPE command. Example: TYPE AUTOEXEC.BAT <Enter>
5219
Batch files may also be loaded into a program called the DOS editor
5220
or into your favorite word processor for viewing, editing and
5221
printing. When you save a batch file with a word processor. though,
5222
you must remember to save the file as unformatted "DOS text" or
5227
In order to find your batch files quickly and to access them no
5228
matter what drive or directory you are currently using, group them
5229
together in a directory. Later, we will discuss how to include this
5230
directory in what is called the "command path". The "path" is
5231
simply a single statement in the AUTOEXEC.BAT file which tells your
5232
computer where to look for commands.
5234
When you type in a command your computer starts at the beginning of
5235
the path and works it's way to the end till it comes to the
5236
requested command. By the way, the AUTOEXEC.BAT must be in the root
5237
directory, which is always the beginning of the path, in order to
5238
automatically execute at startup. See "Writing an AUTOEXEC.BAT"
5239
later in this handout.
5241
Creating Batch Files
5243
Batch files may be written a couple of ways:
5244
1. The EDIT command starts up a program called the "DOS editor." You
5245
can think of it as a very simple word processor that allows you to
5246
create files which are stripped of formatting. When you save a
5247
batch file with the DOS editor, it is saved as "DOS text" or
5248
"ASCII text", meaning that there are no word processing formatting
5249
codes attached to it. It's bare bones text.
5250
2. Better yet, use a word processor to create and edit your batch
5251
file. Wordperfect for Windows and Word for Windows are especially
5252
popular ones, because they have easy options to save the file as
5253
"DOS text" or "ASCII text". Wordperfect for DOS (Version 5.2)
5254
allows the same function when you save with CTRL + F5.
5256
Common Batch File Commands
5258
Some typical DOS commands found in batch files are the following:
5259
* CLS -- Clears the screen; resets cursor at upper left of screen.
5260
DATE -- Sets the system date.
5261
TIME -- Sets the system time.
5262
C:-- Goes to the C: drive.
5263
A:-- Goes to the A: drive.
5264
CD-- Changes directories.
5265
DIR -- Lists files in the current directory.
5266
FORMAT A: -- Initializes a blank diskette in the A drive.
5267
PATH -- Lists directories to be searched for command files.
5268
PROMPT $P$G -- Shows the current drive, directory and subdirectory
5269
(which is known as the current "path").
5270
COPY -- copies a file to a specified location.
5271
REN -- renames a file.
5272
DEL -- deletes a file.
5273
TYPE -- prints the contents of a file to the screen.
5274
EDIT -- starts up the DOS editor, allowing you to edit a specified
5276
PRINT -- prints a specified file.
5278
Batch File Subcommands--ECHO, REM, PAUSE
5280
Besides basic DOS commands, batch files can contain various
5281
subcommands typically used only in batch files. These subcommands
5282
provide the ability to print messages on the screen, permitting the
5283
user to type in conditions, allow "command loops" which execute a
5284
series of commands a certain number of times, or even branch off to
5285
execute other subsections of the batch file--all of which make the
5286
batch more efficient.
5290
The ECHO subcommand controls the display of batch file commands as
5291
they are executed. Normally, ECHO is "on". That means that as a
5292
batch file runs, the individual commands are displayed, along with
5293
the computer's response to those commands. For example, if you run
5294
the batch file WINLIST.BAT created earlier, the commands C:,
5295
CD:\WINDOWS, and DIR *.DOC would have appeared on screen at the DOS
5296
prompt, followed by the output of that command. Naturally, C: and
5297
C:\WINDOWS won't provide any output. But, DIR *.DOC will show both
5298
the command and the output. Now, even though the default setting
5299
has ECHO turned on, you can turn it off by entering the command
5300
ECHO OFF. From that point on, the commands will not show up on the
5301
screen. Don't worry, the output will still show. This, of course,
5302
will keep your screen looking neat and uncluttered. The following
5303
are examples of how the ECHO command is used:
5304
* ECHO Shows the current status of ECHO, whether it is turned on or
5306
ECHO OFF Turns off the display of commands. This command is usually
5307
put at the beginning of a batch file to suppress the commands in
5308
order to show output only.
5309
ECHO ON Turns on the display of commands.
5310
@ECHO The @ is used to prevent the words immediately following it
5311
from showing up on screen. So, if you wanted to turn off the ECHO,
5312
but you didn't even want the words ECHO OFF to appear on the
5313
screen, you would create the batch file command @ECHO OFF.
5314
ECHO [text] Displays the text following the ECHO command on the
5315
screen. This is a way to send messages to the user.
5316
ECHO. ECHO followed by a period inserts a blank line.
5317
ECHO >PRN Routes commands that would normally appear on the screen
5320
Here's an example of how the ECHO command might be used in the
5321
WINLIST.BAT file created above:
5324
ECHO This is a list of files in Windows with .doc extensions.
5332
The PAUSE command temporarily halts the batch file and prompts the
5333
user to hit a key to continue. In fact, PAUSE causes the line
5334
"Strike a key when ready..." to be printed on screen. But you can
5335
add another message to tell a user what to do next. Example: PAUSE
5340
A REM subcommand indicates a remark. Remarks are non-executing
5341
lines of the batch file, intended for information only. Type the
5342
command REM, followed by a string of up to 123 characters. If ECHO
5343
is turned off, REM statements will not show up on the screen when
5344
the batch file is executed. Most of the time, users add REM
5345
statements as notes to themselves. For example, we can add a REM to
5346
our earlier batch: REM This batch file shows the documents in the
5350
ECHO This is a list of files in Windows with .doc extensions.
5356
Replaceable Parameters
5358
Up to this point, the batch files you have written have performed
5359
an operation on drives, directories, file names and extensions
5360
specified within the batch commands. The result might be somewhat
5363
What Are Parameters?
5365
Fortunately, DOS allows something known as a replaceable parameter,
5366
a.k.a. a "dummy parameter" or "variable." That is, if you
5367
substitute a % for a drive, directory, file name or extension in
5368
your batch file, DOS will understand the % to be a blank space.
5369
When you execute the batch, you will need to type in the batch file
5370
command immediately followed by the drive, directory, file name or
5371
extension you want to fill in the blank.
5373
This setup allows your batch files much greater flexibility. For
5374
example, the batch called WINLIST.BAT will only show you files
5375
ending with a .DOC extension. To make this batch file more
5376
efficient, you could substitute the .DOC with a % character
5377
followed by a number (1-9). This will allow you to type in a
5378
different extension when you type in the batch file command:REM
5379
This batch file shows specified items in the Windows directory.
5382
ECHO This is a list of files in Windows, extensions based on your
5388
Now, when you want to use the batch file command, you must
5389
type the following:WINLIST DOC - to show files with .DOC
5391
WINLIST XLS - to show files with .XLS extensions.Note: There is a
5392
space between the command and the extension here, not a period.
5396
As you can see, the dummy parameter is a % followed by a number
5397
(1-9). You might want to add more than one parameter to a batch
5398
file, though. If so, start by using %1, and increase by increments
5399
of one. For example, the above batch could be revised to show two
5400
lists of documents based on two separate variables:
5401
REM This batchfile shows two lists of specified items in the Windows directory.
5404
ECHO Here are two lists of files in Windows specified by your parameter.
5410
When you enter the batch file command, you would add the
5411
two extensions to the command line, separated by a space. For
5412
example: WINLIST DOC XLS This would show you two separate lists: A
5413
list of .DOC files immediately followed by an inventory of .XLS
5416
Invoking Other Batch Files
5418
One interesting feature of batch files is that a command embedded
5419
inside one batch can run a whole new batch file with a different
5420
name. This is commonly used in creating "menu" batch files. For
5421
example, you might have one batch file called MENU.BAT used to
5422
print a menu on the screen with options A, B, and C. Each of these
5423
letters might, in turn, be separate batch files with the file names
5424
A.BAT, B.BAT, C.BAT. That way a user can select option A, B, or C,
5425
and by typing in a single letter he or she can start up a different
5426
batch. For example, the A.BAT batch might start up Windows, the
5427
B.BAT might run Lotus, and the C.BAT might start Paintshop Pro.
5431
In a similar way the CALL subcommand can be used to link separate
5432
batch files. To use the command, add the line CALL immediately
5433
followed by the new batch. The current batch file will branch off
5434
to execute the other batch, and return later to finish any
5435
subsequent commands. For example, let's say you wanted to break the
5436
WINLIST.BAT into two separate batch files, a main one and a
5437
secondary one called DOCS.BAT. Let's suppose you wanted to do this
5438
because the DOCS.BAT file is a generic one that lists the documents
5439
with .DOC extensions in whichever is the current directory. In that
5440
case, your primary batch file, WINLIST.BAT, would look like
5442
REM This batch file goes into WINDOWS and calls DOCS.BAT
5449
ECHO There are no more documents.
5450
The CD\WINDOWS command will take
5451
you into the Windows directory, and then the batch file called
5452
DOCS.BAT will start up. It might look like this:
5453
ECHO Here are the .DOC documents in whichever is the current directory.
5455
Note that the syntax for the CALL command is CALL [Drive:]
5456
[Path] [Filename]. It is not necessary to include the extension
5457
.BAT after a filename used with CALL. Here the main batch file will
5458
branch off to execute the batch called DOCS.BAT, but afterward the
5459
last line of WINLIST.BAT will be executed, printing the message on
5460
screen "There are no more documents."
5462
IF Conditional Statement
5464
The IF subcommand allows condition testing within a batch file. In
5465
effect, it allows the batch file to "make decisions" as it runs and
5466
to execute appropriate command accordingly. The syntax is IF
5467
[Condition] [Command]. The condition must be something that can be
5468
evaluated as either true or false. When the condition is true, the
5469
command is executed. When it's false, the command is skipped and
5470
the next line of the batch file is executed. Let's look at a simple
5471
example using WINLIST.BAT. Say you wanted to test this condition:
5472
If the user asks to see documents with a .DOC extension, then list
5473
them. If not, don't bother. Write it this way:
5474
REM This batch file tests to see if the user wants .DOC documents first, BEFORE calling DOCS.BAT
5480
IF %1 = DOC CALL C:\DOCS.BAT
5481
ECHO There are no more documents.
5483
Redirection of Input/Output
5485
Normally, DOS allows your computer prints output to the screen.
5486
However, you can choose to redirect output to a the printer or to a
5487
file. To do so, use the > character. Usually, this character is are
5488
used together with the commands TYPE and DIR.
5492
Directing output to the printer means you are sending it out
5493
through a port such as LPT1 and LPT2 (for parallel printers, like a
5494
dot matrix) or COM1 and or COM2 (for serial printers like a Laser
5495
Jet). As an alternative, send the output to the PRN, which stands
5496
for "printer." For example:TYPE LETTER.DOC > PRN - prints
5497
LETTER.DOC on the printer.
5498
DIR *.DOC > LPT1 - prints a list of .DOC documents on the printer
5499
hooked up to port LPT1.
5503
Directing output to a file is the same as saving it to a file.
5504
Sometimes, for example, you may want to save a list of documents to
5505
review or print later. For example:DIR *.DOC > MYDOCS.LST - saves
5506
the list of .DOC documents to a file called MYDOCS.LST.To append
5507
output to an existing file, add the >> sign.DIR *.DOC >>FILES.TXT -
5508
attaches the list to an existing list of documents in the file
5511
Writing an AUTOEXEC.BAT
5513
An autoexec.bat is a special-purpose batch file that runs each time
5514
you boot your computer. The name stands for "automatically
5515
executing." Every time you start your computer, DOS will search for
5516
an AUTOEXEC.BAT in the root directory. It is important to store
5517
your AUTOEXEC.BAT in this directory.
5519
What Should I Include In My AUTOEXEC.BAT File?
5521
Since it runs each time your boot the computer, an AUTOEXEC.BAT is
5522
useful for setting system parameters and startup tasks. The
5523
following are common commands:
5524
* PATH -- sets a search path for commands or other batch files. In
5525
effect, it tells the computer where to look for commands. It will
5526
start looking in the first directory and work its way to the end
5527
of the path. Each directory in the path is separated by a
5528
semicolon. See the example below.
5529
PROMPT $P$G-- sets the prompt to show you which drive and directory
5530
is currently "active".
5532
Creating An AUTOEXEC.BAT
5534
In order to create a practice AUTOEXEC.BAT, use the A: drive. DON'T
5535
MESS WITH YOUR ORIGINAL. If you put one on the A: drive, you will
5536
be able to turn off your computer and restart it with the disk in
5537
drive A: DOS will look for AUTOEXEC.BAT there first. Use the EDIT
5538
command to run the DOS Editor and type this simple example:
5542
PATH=C:\;C:\DOS;C:\WINDOWS
5547
The last command in this practice AUTOEXEC.BAT automatically
5548
invokes another batch file called MENU.BAT. You would, of course,
5549
create this second batch with the DOS Editor. It might look like
5557
ECHO 2 - Word for Windows
5559
ECHO 3 - Wordperfect for Windows
5561
This batch file doesn't really do anything. It just displays a menu on
5562
the screen and allows the user to select an option: 1, 2, or 3. Now
5563
you need to create separate batch files for each of the menu items.
5564
Each batch file should be named with a number corresponding to one of
5565
the menu choices. For example, 1.BAT is as follows:
5571
That will start up the program Windows when the user enters the number
5572
1. Note: The command WIN, which doesn't require the extension .EXE, is
5573
actually located in the C:\WINDOWS directory. However, if you have
5574
included C:\WINDOWS in the path statement of your AUTOEXEC.BAT file,
5575
you don't need to include it here in the 1.BAT batch file.
5577
Hard Disk Considerations
5581
The size of a hard disk is now measured in megabytes and gigabytes.
5582
One thousand megabytes = 1 gigabyte. Hard disks usually come no
5583
smaller than 20 megabytes and can be as large as a gigabyte or
5584
more. Of course, the most important consideration when purchasing a
5585
hard drive is the size requirement of your software. The
5586
documentation will tell you, for example, "This product needs 33
5587
megabytes of free disk space." If you want to check the capacity of
5588
your hard disk, and the space available, use the CHKDSK command.
5592
Speed is always an important factor to consider when you are
5593
purchasing a hard disk. The faster a hard disk, the more it costs.
5594
Here are some important questions to ask the salesperson:
5596
Speed Factor Explanation
5597
Average Access Time The average amount of time,usually measured in
5598
milliseconds, it takes for the computer to
5599
locate information on the hard disk.
5600
Transfer Rate How fast the computer can read from and write to
5602
Disk Cache Refers to the speed at which the computer can
5603
temporarily use part of your hard disk for
5604
extra processing memory.
5608
1. Whenever you are moving a computer or hard disk, take great care
5609
not to jolt the hardware. Disk heads inside the device may rub
5610
against the actual disk and cause damage to the disk--sometimes
5611
irreparable--if the disk is moved suddenly. Never move a hard disk
5612
while the computer is turned on.
5613
2. Do not turn the hard disk or CPU containing a hard disk on its
5614
side without consulting your User's Manual.
5615
3. Place the drive on a sturdy and level surface.
5616
4. Do not use the hard disk at temperatures below 50 degrees
5617
Fahrenheit and above 104 degrees Fahrenheit.
5618
5. Do not use the hard disk if the relative humidity is not between
5620
6. Keep food, drinks, cigarette smoke, and cleaning agents with
5621
vapors away from the drive.
5623
Formatting a New Hard Disk
5627
Some hard disks come already formatted with DOS installed. All you
5628
need to do is plug them in. If you turn on your computer without a
5629
diskette in drive A: or B: and the computer boots up successfully,
5630
then your disk has already been set up and formatted.
5632
Unformatted Hard Disks
5634
If your disk does not come formatted, you will have to format it
5635
yourself. Usually, the computer will come with the software
5636
necessary to format your disk. Usually the disk is labeled Install
5637
or Setup, and you would need to put that disk in drive A: or B: and
5638
type in the appropriate command (Install or Setup).
5640
When NOT To Format The Hard Disk
5642
Do not format the hard disk if the computer boots successfully and
5643
you see a DOS prompt or some other program come up. Remember,
5644
formatting erases all data from the disk.
5646
When To Format The Hard Disk
5648
If you just bought the hard disk and it has not been formatted, you
5651
Formatting As A Startup Disk
5653
To format the hard disk and transfer the DOS system files so you
5654
can start the computer from your hard disk, type: format c:/s
5656
Partitioning the Hard Disk
5658
Before you can format a hard disk, you must partition it. Partition
5659
means to divide the disk into two or more separate sections. It's
5660
usually done so that the computer can run operating systems other
5661
than DOS. UNIX or XENIX, for example.
5663
However, let's say that you are just running DOS on your computer,
5664
and no other operating system. Then you still might consider
5665
partitioning your hard disk to divide it up into separate sections
5666
for better organization of your files. These sections are called
5667
"logical drives." The first partition is called the "active
5668
partition" is always located on the C: drive and contains three
5669
very important files needed to run DOS. These are IO.SYS, MSDOS.SYS
5670
and COMMAND.COM. The second partition is the one you would divide
5671
up into logical drives, giving each a separate letter designation,
5672
D - Z. That allows you a total of 23 extra logical drives. Each one
5673
of these is like a separate file cabinet that contains it's own
5674
group of directories. How you organize your hard disk is up to you.
5676
You can set up partitions on your hard disk before or after you
5677
format it--or during the installation of DOS. In any of these three
5678
cases, you use the FDISK command. If you have not formatted the
5679
disk, start the system with your DOS diskette in drive A:. At the
5680
DOS prompt, type FDISK. Obviously, if you have formatted the disk,
5681
you can just type the command at the DOS prompt. A menu comes up
5682
allowing you the following options:
5683
1. Create DOS Partition or Logical DOS Drive
5684
2. Set Active Partition
5685
3. Delete Partition or Logical DOS Drive
5686
4. Display Partition Information
5688
To partition the hard disk during DOS installation run SETUP on you
5689
DOS installation diskette. Partitioning is one of the options
5690
offered there. Warning: Re-partitioning erases existing partitions.
5691
Use extreme caution!
5693
Copying DOS Files to the Hard Disk
5695
When you install DOS, the files are usually copied into the
5696
directory labeled DOS. If not, you can set up this directory and
5697
save your DOS files there by following these steps:
5698
1. Put your DOS diskette in drive A:
5699
2. Create a DOS subdirectory by typing: MD C:\DOS.
5700
3. Copy the DOS program files from A: to your new subdirectory by
5701
typing COPY A:*.* C:\DOS.
5702
4. Delete the file COMMAND.COM from the DOS directory, since a copy
5703
is placed in the root directory during formatting, by typing DEL
5706
Include the DOS directory in the path statement of your
5707
AUTOEXEC.BAT batch file.
5711
As was mentioned earlier in this handout, the path is a list of
5712
drives and directories which tells DOS where to look for commands.
5713
If you are in the root directory C:\ and the command WIN is in the
5714
Windows directory, DOS will not be able to find the command unless
5715
you give it the proper path. Most people put a permanent path in
5716
their AUTOEXEC.BAT batch file, listing all their primary drives and
5717
directories so that DOS will never have trouble finding a command.
5718
However, you can always enter a path at the DOS prompt if the drive
5719
or directory you want DOS to search is not specified in the
5722
Displaying The Current Path
5724
To display the current path, type: PATH
5728
To set the path, type in the full path, beginning with the root
5729
directory (C:\) and working your way through each primary
5730
directory, separating each with a semicolon.PATH=C:\;\DOS;\WINDOWS
5734
To cancel the current path so that DOS will search only the current
5735
directory, type: PATH;
5737
Configuring the System
5739
Another file which allows you more efficient use of your hard disk
5740
is the CONFIG.SYS file. It lets you override various system
5741
defaults set by DOS. A sample CONFIG.SYS file might look like
5746
* buffers= sets the amount of Random Access Memory that DOS reserves
5747
for data transferred from the hard disk.
5748
files= sets the number of files that DOS allows to be open at one
5750
device= loads what is called a "device driver" from the hard disk.
5752
Some applications require certain values for buffers or files. This
5753
information is given in the documentation under Setup or Install.
5754
Other applications automatically update your existing CONFIG.SYS
5755
with other values when they are installed. Before installing a new
5756
application, make a copy of your existing CONFIG.SYS with a name
5757
such as CONFIG.BAK. That way, if anything goes wrong, you can
5758
restore the original.
5760
A device driver is a file that is needed to run a device such as a
5761
mouse, joystick or sound card. When you install such a device, the
5762
driver is usually automatically copied to your CONFIG.SYS. If it is
5763
not, you might have to add the appropriate line to the CONFIG.SYS.
5764
Check the documentation for the appropriate driver.
5766
Backing Up the Hard Disk
5768
When Should I Back Up?
5770
Once the hard disk is set up, you should do a complete backup.
5771
After that, the frequency of backups will depend on how much use
5772
your hard disk receives. But at least once a week, you should do a
5773
partial backup as illustrated below.
5775
Number The Diskettes
5777
Since the restore command (see below) will prompt you for disks by
5778
their numbers, be sure to number your floppy disks as you go. Files
5779
must be restored in the order in which they were backed up.
5783
To do a complete backup of the entire hard disk, including the
5784
organization of directories and subdirectories as well as files,
5785
type backup c:\*.* a:/s To do a complete backup which will also
5786
give you a printed list of the backup files, type backup c:\*.*
5791
To do a partial backup after you have done a complete backup, add
5792
to the complete backup command the following parameters (you may
5793
use more than one at a time):
5794
* /a -- adds backup files to the current files on the floppy
5795
diskette rather than writing over the existing files on the disk.
5796
Unless you specify this option, copies of any old files on a
5797
backup floppy diskette are erased before the new files are written
5799
Example: C:\>backup c:\*.* a:/s/a
5800
* /d mm-dd-yy -- backs up all files created or altered on or after
5801
the specified date. To use this parameter, you must have been
5802
consistent about entering the correct date every time you started
5804
Example: C:\>backup c:\*.* a:/s/d 4-16-89
5805
* /m -- backs up all files that have been created or modified since
5807
Example: C:\>backup c:\*.* a:/s/m
5811
You may want to create a batch file to run at the end of each day
5812
to back up any files created or modified. The following is an
5813
example of such a file, which backs up modified files in any
5814
subdirectories, adding them to the existing files on the backup
5815
diskette and giving you a printed list of the backup files. Let's
5816
say you created it using the DOS Editor and called it
5817
BACKUP.BAT.backup c:\*.* a:/s/m/a >prn
5819
Restoring Files from Backups
5821
You must use the DOS restore command to transfer files created with
5822
backups from a floppy to a hard disk. The restore command converts
5823
the backed-up files for normal use. Do not attempt to use the DOS
5824
copy command to transfer files from backup diskettes. Restore will
5825
prompt you to insert backup diskettes in numbered order. Files will
5826
be replaced in subdirectories if you specified /s during the backup
5827
procedure. To restore all files from floppies back onto a newly
5828
formatted hard disk, typerestore a: c:\*.* /s
5830
This document is a publication of The Office of Information Technology
5831
at The University of North Carolina. It may be copied for individual
5832
or non-profit use. Please send comments about this publication to CB#
5833
3450, 402 Hanes Hall, Chapel Hill, NC, 27599-3450. Authors: Doug Ens.
5834
Editor: Kathryn McDonnell. Web Editor: Kathy Edwards. Revision date:
5835
5/21/94. Print date: . OIT Document DDS05
5837
_________________________________________________________________
5842
\HCode{<HR>}%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5847
alain.chilles@hol.fr
5850
12, rue de l'Ermitage
5853
> 2) display and giftrans are not very good (many errors, screen's
5854
> gestion...) I tried with netpbm which is given with latex2html, and I
5855
> replace in convert.bat the last commands by :
5857
> echo Creating .ppm file
5858
> pcxtoppm tmp00%2.pcx > ppm00%2.ppm =20
5860
> pnmcrop ppm00%2.ppm > ppm10%2.ppm
5861
> echo Creating .gif (transparent) file
5862
> ppmtogif -transparent 1,1,1 ppm10%2.ppm > %3
5864
> It seems to do a good work...
5866
If it is fine with you, I'll add the above code to the next
5867
distribution with an acknowledgment to you. I have very little
5868
knowledge of DOS and PC Windows, and I rely on users' contributions
5874
\HCode{<HR>}%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5877
> Unfortunately, this doesn't solve the problem. If I get to text-mode
5878
> by switching from a graphical-window, once I come back, my
5879
> graphical-window is gone
5881
I don't understand this. Once you come back from what? From text-mode?
5882
But then the graphical window would re-appear (or you wouldn't be back
5885
> and the entry in the start menu that got me
5886
> the window in the first place is ruined (i.e., it now connects into
5887
> text-mode instead of bringing up a graphical window).
5889
The default MS-DOS prompt window settings are such that it retains the
5890
setting it last had between sessions. This means that if you close the
5891
DOS window in graphical mode, the next time you start one it will come
5892
up in graphical mode; likewise, if you close it while in text mode, it
5893
will come back in text mode next time.
5895
I have checked the compilation of the test files under W95, and also
5896
noted that Display switches the screen to text-mode (which doesn't make
5897
much sense to me). I've made a note of this in the port manual. What
5898
you should probably do to solve your problem is change the DOS-prompt
5899
window settings to always start up in windowed mode. To do this, either
5900
click on the icon in the top left corner of the window (beside the title
5901
bar) and select Properties, or use the properties button on the button
5902
bar (the third rightmost on my system). You'll get an MS-DOS prompt
5903
properties window; select the screen tab, and uncheck "Restore settings
5905
-----------------------------------------------------------------
5907
> while, but it's unlikely I'll do much work for a while.
5909
As far as I'm concern, we can go public with what we have now.
5911
> > Unfortunately, this doesn't solve the problem. If I get to text-mode
5912
> > by switching from a graphical-window, once I come back, my
5913
> > graphical-window is gone
5915
> I don't understand this. Once you come back from what? From text-mode?
5917
Yes. From the text-mode.
5919
> But then the graphical window would re-appear (or you wouldn't be back
5924
If I leave the text-mode with Alt-Enter, then everything works fine.
5925
Moreover, In future calls to `ht...', all the work is done within the
5926
graphical-window of dos without interrupting to text-mode.
5928
If I leave the text-mode with Exit, then the problems I described
5931
Without automatically returning from the text-mode, appending the
5932
following in the documentation with `(not Exit!)', and giving an early
5933
warning also in `6.1 The test files', should do the job.
5935
Another problem exists when using the port in a DOS box under
5936
Windows '95, and possibly Windows 3.11: the display program
5937
switches a windowed DOS box to full screen. Restoring the
5938
previous setting is a matter of pressing Alt-Enter (not
5943
> The default MS-DOS prompt window settings are such that it retains the
5944
> setting it last had between sessions. This means that if you close the
5945
> DOS window in graphical mode, the next time you start one it will come
5946
> up in graphical mode; likewise, if you close it while in text mode, it
5947
> will come back in text mode next time.
5949
Well, at least I learned the difference between Exit and Alt-Enter.
5952
> > Well, at least I learned the difference between Exit and Alt-Enter.
5954
> Exit closes the DOS box, possibly (depending on how it's configured)
5955
> retaining the screen settings until the next DOS box. Alt-Enter just
5956
> switches it between windowed and full-screen mode; the two are not even
5957
> remotely alike ;-) I've added a comment about exit to the manual, but
5958
> the one you provided suggests that Alt-Enter and Exit have similar
5959
> functionality, which is not the case. I hope my alternative works for
5966
\SubSection{scripts from Steven Zeil}
5969
Date: Tue, 27 May 1997 13:30:48 -0400 (EDT)
5970
From: "Steven J. Zeil" <zeil@cs.odu.edu>
5971
To: gurari@cse.ohio-state.edu
5972
Subject: TeX4ht: thanks & comments
5974
Content-Type: TEXT/PLAIN; charset=US-ASCII
5978
I recently came across your TeX4ht system, and would like to thank you for
5979
making it available. I've been a long-time user of latex2html, but have
5980
been increasingly frustrated at the fragility of that converter. I had
5981
come to the conclusion some time ago that much of the problem with
5982
latex2html lay in the use of Perl scripts to emulate the macro definition
5983
and execution facilities of TeX and LaTeX, and felt sure that a more
5984
stable converter would be possible that allowed TeX to handle its own
5985
macros, but did the conversion from a combination of the .dvi file and
5986
redefining the "standard" LaTeX commands.
5988
I had actually gone so far as to prototype such a converter, using dvi2tty
5989
to extract plain-text from the .dvi file, and redefining LaTeX commands to
5990
either insert html tags into the output text or else to use \specials to
5991
mark the beginnings and ends of images, when I saw a reference to your
5992
system. It looks very much like what I had been hoping for, and my initial
5993
experience with using it has been very pleasant.
5995
I hope you will continue to develop and support it (though I
5996
fully understand how hard it can be for a faculty member to find time to
5997
do so). I've prepared a few comments in
5998
http://www.cs.odu.edu/~zeil/tex4ht/tex4ht_discussion.html
6002
Old Dominion University
6003
[Ph.D. from Ohio State CIS Dept, 1981]
6008
%---------------------------------------------------------------------
6010
Some notes on TeX4ht
6012
Some samples of documents I have produced:
6015
* Reference sheets for the C++ Standard Template Library (STL)
6021
* Waiting until the \begin{document} to declare for the first time
6022
whether to do normal LaTeX processing or html generation is a bit
6023
too late. I would like to be able to provide html-aware
6024
equivalents of standard LaTeX packages (e.g., graphics). But if I
6025
provide these in package form, they must be \use'd before the
6026
\Preamble. Thus they cannot use \ifHtml to choose among alternate
6028
* The most time-consuming part of the conversion is generating the
6029
.gif images. I've tried to speed this up a bit:
6030
+ My script for generating the .gif files (1) saves the old .ps
6031
file. After the new .ps file for the image has been created,
6032
it is compared to the old one. If unchanged, then the .gif
6033
file previously generated for that image is reused, rather
6034
than take the time to produce a new one.
6035
+ After all the .gifs have been produced, this script (2) compares
6036
the .gifs. If duplicates are found (For example, my STL
6037
Containers document produces many, many images for the same
6038
mathmatical expressions e.g., log N), then the .html files
6039
are edited to use only one of the duplicate .gifs. This can
6040
significantly reduce the time required to load a document, as
6041
the repeated references to the same .gif will be served from
6042
the browser's cache rather than being repeatedly retrieved
6044
* Both of the above scripts could be made more portable by rewriting
6045
them in Perl. Perl could easily replace the use of the sed tool as
6046
well. Replacing the use of cmp would be more of a problem.Another
6047
possibility would be to follow the route taken by latex2html and
6048
use dbm to maintain a content-based ps->gif map. But the use of
6049
dbm seems to be one of the sticking points in latex2html's
6050
portability to Win32 systems. By contrast, one can easily obtain
6051
bash, sed, and cmp as part of the gnuwin32 (4) release, allowing the
6052
use of these scripts with little or no change.
6054
%--------------------------------------------------------------
6060
# tex4ht.makegif basename pagenumber destination
6062
####################################################
6064
# Produce the image in postscript form, as $3.new.ps
6066
dvips -mode ibmvga -D 110 -f $1.idv -pp $2 > $3.new.ps
6069
# Check to see if a previous use of this script has left behind a $3.ps file
6074
# If so, and if the $3.ps and $3.new.ps files are identical, then the
6075
# $3.gif file from that previous execution can be retained, and we can avoid
6076
# the time-consuming ps->gif conversion.
6078
if cmp -s $3.ps $3.new.ps
6080
echo $3 is unchanged.
6086
# But if no old file exists, or the .ps files were different, then
6087
# use the new.ps file to produce the .gif image. Retain the $3.new.ps
6088
# file as $3.ps for possible future reuse.
6090
if test -r $3.new.ps
6093
convert -crop 0x0 -density 110x110 -transparent '#FFFFFF' $3.ps $3
6097
%-------------------------------------------------------------------
6106
# Compares all files of form $base*.gif to one another
6107
# For each pair of identical .gif files are found, the files
6108
# $base*.htm* are edited so that references to these separate
6109
# but equal files are replaced by repeated references to the
6112
# This can speed up the loading of some html files by a significant
6115
echo > reduceGifs.sed
6117
for fileA in $1*.gif
6120
for fileB in $1*.gif
6122
if test $fileA = $fileB
6128
if cmp -s $fileA $fileB
6130
echo s/$fileA/$fileB/g >> reduceGifs.sed
6133
echo $fileA and $fileB are duplicates.
6140
if test $duplicatesFound = 1
6142
for fileA in $1*.htm*
6144
mv $fileA $fileA.bak
6146
sed -f reduceGifs.sed < $fileA.bak > $fileA
6150
%-----------------------------------------------
6153
http://www.cygnus.com/misc/gnu-win32/
6158
\ifHtml[\HPage{more}\Verbatim
6159
From: "Philip A. Viton" <pviton@magnus.acs.ohio-state.edu>
6160
To: gurari@cse.ohio-state.edu
6161
Subject: saving time
6162
Date: Sun, 22 Nov 1998 15:11:12 -0400
6168
I took a look at Steven Zeil's suggestion on generating gifs, and I agree
6169
that it has possibilities; but as he points out, the cmp utility isn't
6170
available for nt: the two file comparison utilities which are available
6171
aren't meant to report a silent yes-or-no answer: they both display lots of
6172
data, and I don't know if they return with some checkable return-code or not.
6174
Presumably one can get a cmp.exe using the cygnus port of the gcc compiler,
6175
but this requires a 500K dll to copy with the unix overhead. It may be
6176
possible to make cmp with the non-unix/non-cygnus version of gcc for win32,
6177
but I don't know. (I have this compiler, so if you have cmp's source I can
6180
On the other hand, in some respects this is over-kill. SZ saves all the .ps
6181
files; my point is that at least for the glyph-gifs this isn't needed,
6183
\EndVerbatim\EndHPage{}]\fi
6186
\SubSection{Makefile Tricks}
6192
hugelatex '\def\Status{0}\input live'
6195
pdflatex '\def\Status{1}\input live'
6198
latex '\def\Status{2}\input live'
6202
perl htcmd.perl live
6205
-rm *.dvi *.aux *.log *.blg *.toc *.out
6206
-rm *.xref *.lg *.idv *.out *.otc tmp.* *.css
6223
\Section{Setting by Viton}
6233
This note explains how to set up a working version of TeX4ht, Eitan
6234
Gurari's TeX/LATEX-to-HTML translation system, when the underlying TeX
6235
engine is Christian Schenk's MiKTeX for Win32 platforms. Thanks to
6236
Eitan for answering lots of TeX4ht questions, to Piet van Oostrum for
6237
helping with an important MiKTeX-related problem, and most of all to
6238
Gaunce Lewis for helping me solve the font-making problem described in
6243
Besides a standard MiKTeX setup, you will need the following freely
6244
available software packages:
6245
* TeX4ht : the translation system itself. Be sure to get the Win95
6247
* ImageMagick : for translation of postscript to gif images.
6248
* Ghostscript : used by ImageMagick in the translation.
6250
Choose directories for each of these packages, and unzip the
6251
distributions, being sure to preserve directory (folder) names. Note
6252
that you will need an unzipper which understands long file names. In
6253
what follows, I assume the following directories:
6254
* For TeX4ht: c:\tex4ht
6255
* For ImageMagic: c:\ImageMagic
6256
* For Ghostscript: c:\gs
6257
* For MiKTeX itself: c:\texmf (this is the default root of the
6258
MiKTeX system, but you are offered the opportunity to change it
6259
when you install the system).
6261
and if you select others, you will need to modify the instructions
6266
Two of the style files of TeX4ht need to be moved into MiKTeX's LATEX
6268
* create a directory c:\texmf\tex\latex\tex4ht
6269
* move tex4ht.sty and tex4hta.sty from the TeX4ht directory to this
6271
* update the MiKTeX database: from the MiKTeX program group do
6272
Maintenance then Refresh filename database. This runs a quick DOS
6273
session which updates the database.
6277
TeX4ht uses dvips to create Postscript images of symbols which are
6278
unavailable in standard fonts. It does so in a special Metafont mode
6279
called ibmvga, and you need to tell dvips and Metafont about it.
6280
* Locate the dvips configuration file config.ps, typically in
6281
c:\texmf\dvips\config\local
6282
* Make a copy of this file under the name config.ibmvga
6283
* Use a text editor to edit config.ibmvga, and make the following
6285
+ at the top of the file change the Metafont mode from M ljfour
6286
(or whatever printer you selected when you set up MiKTeX) to
6288
+ below that, change the dpi resolution from D 600 (or whatever
6289
resolution your default printer is set up for) to D 110.
6290
+ Comment out (by preceeding each line with a semi-colon) the
6291
approximately 11 lines following the instruction ;;;Comment
6292
these lines if you don't have PostScript versions of the
6293
fonts: we want Metafont to create these font files if they're
6294
requested, since we can't assume that readers will have
6296
* Save the file config.ibmvga
6297
* From a DOS session, run initexmf -u to update the confguration
6298
files. If you forget this, then dvips will not be able to make
6299
fonts at the required resolution.
6301
5 Set up ImageMagick
6303
* Switch to the ImageMagick directory, and check that there exists a
6304
file delegates.mgk. If not, copy the file
6305
c:\ImageMagic\delegates\delegates.nt to the main ImageMagick
6306
directory as delegates.mgk.
6307
* Use a text editor to open delegates.mgk. In this file there are
6308
about 5 instances of calls to the program gswin. In each of these
6309
replace gswin by the full path and executable name to the
6310
command-line version of Ghostscript, typically c:\gs\gswin32c.
6311
If you omit the ``c'' and refer only to gswin32 you will get the
6312
windowed version of Ghostscript: each time it is called to
6313
translate a file, it will pop up an empty window, do the
6314
translation, and close the window. It seems to make no difference
6315
which version you use, but since the TeX4ht system is a
6316
command-line utility, it is less distracting --- and may save a
6317
bit of time, too --- to run the command-line version of
6319
* In order for ImageMagick to find its delegates file, you need to
6320
set the environment variable delegate_path. You can let the batch
6321
file xht.bat described in section 8 do it for you, or you can do
6323
+ Under Windows NT: open the Control Panel, choose System, then
6324
Enviroment. At the bottom of the dialog under Variable: enter
6325
delegate_path, and under Value: enter c:\ImageMagic. Click
6326
OK. This will take effect the next time you start a DOS
6328
+ Under Windows95: edit autoexec.bat; add the line
6329
set delegate_path=c:\ImageMagic. You may need to re-boot for
6330
the changes to take effect.
6334
First, you will need to add TeX4ht's directory to your path. You can
6335
do this from the Windows NT Control Panel (or by editing autoexec.bat
6336
in Windows95), or you can let the batch file xht.bat described in
6337
section 8 do it for you.
6338
Next, switch to the TeX4ht directory. Use a text editor to open the
6339
file tex4ht.env, and make sure that the following are correct:
6340
* the first uncommented line begins with a t : the remainder of
6341
this should contain a path to the MiKTeX tfm files. For the
6342
standard MiKTeX distribution change the line to read
6343
tc:\texmf\fonts\tfm! --- note the trailing exclamation point,
6344
which is required, and be sure to include the leading t.
6345
* Locate the line beginning Gdvips32 and change it to Gdvips. To
6346
have dvips make the right fonts you need to change -mode to -P so
6347
that that part of the line reads -P ibmvga (note: capital ``P'').
6348
* Locate the line beginning Gconvert ... . On this line:
6349
+ change convert to the full drive/path name to the convert
6350
utility: under the directory assumptions made here the line
6351
would begin Gc:\ImageMagic\convert. Be sure not to delete the
6352
initial ``G'' which is needed by TeX4ht.
6353
+ make sure that the line says -transparent #FFFFFF and not
6354
-transparent '#FFFFFF' (ie, no quotes).
6355
* under this, make sure that you see Gdel %%3, and not Gdel %%%3
6356
(remove the extra % if necessary).
6357
* change Gcopy /y %%1 %%2%%3 to Gcopy %%1 %%2%%3 (remove the /y).
6358
* change Gmove /y %%1 %%2%%3 to Gmove %%1 %%2%%3 (remove the /y). I
6359
don't know whether Windows95 supports the move command: if it
6360
doesn't, you will have to figure out how to simulate it.
6361
* the last line of the file should read H followed by the full drive
6362
plus path to the TeX4ht files. If you chose the default location,
6363
you will not need to change this.
6365
Finally, open the file ht.bat. Make sure the last line reads
6367
htcmd %2 -eC:\tex4ht\tex4ht.env
6369
and if it doesn't, add the -e switch, whose argument is the drive plus
6370
path to the TeX4ht files.
6372
7 Solving font problems
6374
When a font is not found, dvips calls Metafont; but if Metafont has
6375
trouble making the font, then the font will not be placed where dvips
6376
can find it. Unfotunately, Metafont has problems with about 15 fonts
6377
in ibmvga mode, and while they do not apparently lead to any major
6378
ill-effects when viewing the output on the Web, the result isn't quite
6379
perfect enough for Metafont.
6380
To solve the problems, you need to make the problem fonts ``by hand''.
6382
* Run TeX on your document without the TeX4ht extensions (ie,
6383
disable \usepackage{tex4ht}).
6384
* Now check for any font problems. Open the previwer yap. Click on
6385
View then Options then Display. Under Mode choose IBM vga (110
6386
dpi) and click OK. Ignore the warning about it's not being
6387
recommended to have screen and printer at different resolutions.
6388
* Open your document in the previewer and page through it. One of
6389
three things will happen:
6390
+ Metafont never runs. In this case you can immediately use
6391
TeX4ht to process your document.
6392
+ Metafont runs, but the DOS window closes without your
6393
intervention. In this case, Metafont has succeeded in making
6394
a missing font. You can now use TeX4ht to process your
6396
+ Metafont runs, but there is a problem. The DOS window opens,
6397
but waits for you to close it manually. At this point you
6398
need to make a note of the font which caused the problem. At
6399
the bottom of the window, you will see approximately the
6401
Output written on cmr5.72gf
6402
Transcript written on cmr5.log
6403
Metafont failed on cmr5! Return code 1
6404
Press any key to continue ...
6405
+ Look at the first of these lines, and write down (a) the font
6406
name (which is the text before the .72gf, here cmr5), and (b)
6407
the resolution ( the text just before gf, here 72).
6408
+ Do this for each font for which Metafont reports a problem.
6409
* You should now probably set yap's display resolution back to its
6410
original value; exit yap.
6411
* Now you need to make any fonts Metafont choked on, ``by hand''.
6412
I've made a little batch file, epfont.bat, which you can download
6413
here, and which eases the difficulties for you. (This is based on
6414
the work of Gaunce Lewis; I'm grateful to him for sharing it with
6415
me). The batch file is set up to make fonts in ibmvga mode, but it
6416
contains instructions on how to customize it for any mode. To use
6418
+ Copy it to any directory.
6419
+ For safety, do del epfix.bat though there probably won't be
6421
+ Repeatedly run epfont, once for every font you noted in the
6422
previous step, where Metafont fails. The arguments to epfont
6423
are (1) the font name (cmr5 in the example) followed by the
6424
resolution (72 in the example), so in this case you'd say
6426
+ epfont creates a file epfix.bat. This file contains run-able
6427
instructions to have Metafont create your problem fonts. But
6429
o Open epfix.bat in a text editor.
6430
o Do a global search-and-replace: replace the string /d by
6432
o Scan thorough the file and look for any lines which end
6433
...already exists!. This says that you asked Metafont to
6434
make a file which is already made. When you see one of
6435
these, delete the entire ``section'' of the file
6436
associated with that font. Sections begin with a line
6437
that says REM followed by one that says REM fontname
6438
resolution where fontname and resolution are echoes of
6439
information you provided.
6440
o Save epfix.bat and run it from the command line. This
6441
will make all missing fonts connected with your
6442
document. You can now safely run TeX4ht.
6444
8 The batch file xht.bat
6446
I've created a small batch file called xht.bat which takes care of
6447
several of the details associated with running TeX4ht. You can place
6448
the batch file in a directory in your path and then call it from any
6449
place on your hard disk. The batch file is set up with the directory
6450
defaults as described in section 2; if you choose different locations,
6451
you will need to edit the file accordingly.
6452
The syntax, which you will be reminded of if you call xht with no
6453
parameters, is the same as for TeX4ht's starting batch file ht.bat:
6455
xht tex myfile for a plain TeX file, or
6457
xht latex myfile for a LATEX file.
6459
What the batch file does is:
6460
1. It adds the TeX4ht directory to your path before calling the
6461
translator, and then removes it when the job ends.
6462
There is a cost to this: we save a copy of the current path in the
6463
environment variable opath, and then append the TeX4ht directory
6464
to path. At the end of the batch file, path is set equal to opath,
6465
and opath is erased. The cost is the length of opath, which is
6466
temporarily added to your environment. Under Windows NT4 this will
6467
never be a problem, but it is possible that you could run out of
6468
environment space under Windows 95. If that happens you will
6469
probably need to alter autoexec.bat.
6470
2. It sets the environment variable delegate_path required by the
6471
ImageMagick convert utility; and then removes it when the job
6473
3. Since I tend to forget to specify tex or latex, xht.bat does a
6474
quick check to see that you have actually provided two parameters.
6475
(However, note that it doesn't check that the first parameter is
6476
either tex or latex: it would be easy to add this if you need it).
6477
4. It also tries in a simpleminded way to check that you provide the
6478
name of the source (.tex) file without an extension: it adds the
6479
extension .tex to the name of the source file which you provided:
6480
if that file exists, then we assume that you did not provide the
6481
extension. This will fail if you provide, say, myfile.tex and the
6482
file myfile.tex.tex happens also to exist in the same directory.
6483
In my case, I can be sure that this won't happen, but your habits
6486
You can download the batch file xht.bat here.
6487
_________________________________________________________________
6489
This document was translated from LATEX by HEVEA
6490
http://para.inria.fr/~maranget/hevea.
6494
\SubSection{htx.bat}
6498
:: cover funciton for Eitan Gurari's TeX4ht system.
6499
:: Phil Viton, November 1998
6500
if "%2"=="" goto syn
6501
if not exist %2.tex goto syn1
6503
set path=%path%;c:\tex4ht
6504
set delegate_path=c:\imagemagic
6511
echo TEX4HT - syntax is tex4ht [tex/latex] file w/o extension
6514
echo TEX4HT - file %2.tex not found
6522
\ifHtml[\HPage{c:/EMTEX/MFINPUT/ETC/LOCAL.MF}\Verbatim
6524
% local.mf -- Lexmark Optra added
6527
base_version:=base_version&"/emTeX";
6529
% ------------------------------------------------------------
6531
% ------------------------------------------------------------
6534
% HP LaserJet+ (300 DPI)
6537
proofing:=0; fontmaking:=1; tracingtitles:=0;
6538
pixels_per_inch:=300;
6545
% HP LaserJet 4 (600 DPI)
6547
mode_def laserjetIV =
6548
proofing:=0; fontmaking:=1; tracingtitles:=0;
6549
pixels_per_inch:=600;
6556
% HP DeskJet (300 DPI)
6559
proofing:=0; fontmaking:=1; tracingtitles:=0;
6560
pixels_per_inch:=300;
6567
% Michael Covington's (mcovingt@ai.uga.edu) definition for the Lexmark
6568
% Optra R (4049), reflecting a taste for a heavier than normal rendition
6569
% of the Computer Modern fonts.
6571
% You may prefer a lesser value of blacker (down to maybe 1.0).
6572
% Initially tested on 10, 12, 17-point CMR and 10-point math italic.
6574
% While we're talking about the Optra R, here's another useful fact: it
6575
% takes 32-bit-wide 72-pin SIMMs, 70 or 80 ns. Contrary to the
6576
% documentation, you do not have to use IBM's special SIMMs. On the
6577
% whole, it's a superb printer, 1200 dpi PostScript for $<\$1500$.
6580
proofing:=0; fontmaking:=1; tracingtitles:=0;
6581
pixels_per_inch:=1200;
6588
% Epson FX-80 (240x216 DPI)
6591
proofing:=0; fontmaking:=1; tracingtitles:=0;
6592
pixels_per_inch:=240;
6593
aspect_ratio:=216/240;
6600
% Epson FX-80 (landscape mode: 216x240 DPI)
6603
proofing:=0; fontmaking:=1; tracingtitles:=0;
6604
pixels_per_inch:=216;
6605
aspect_ratio:=240/216;
6612
% Epson MX-80 (120x216 DPI)
6615
proofing:=0; fontmaking:=1; tracingtitles:=0;
6616
pixels_per_inch:=120;
6617
aspect_ratio:=216/120;
6624
% Epson Stylus (360 DPI)
6627
proofing:=0; fontmaking:=1; tracingtitles:=0;
6628
pixels_per_inch:=360;
6635
% NEC-P6 high resolution (360 DPI)
6638
proofing:=0; fontmaking:=1; tracingtitles:=0;
6639
pixels_per_inch:=360;
6646
% LQ-1500, NEC-P6 medium resolution (360x180 DPI)
6649
proofing:=0; fontmaking:=1; tracingtitles:=0;
6650
pixels_per_inch:=360;
6651
aspect_ratio:=180/360;
6658
% LQ-1500, NEC-P6 medium resolution (landscape mode: 180x360 DPI)
6660
mode_def lqmedresl =
6661
proofing:=0; fontmaking:=1; tracingtitles:=0;
6662
pixels_per_inch:=180;
6663
aspect_ratio:=360/180;
6670
% LQ-1500, NEC-P6 low resolution (180 DPI)
6673
proofing:=0; fontmaking:=1; tracingtitles:=0;
6674
pixels_per_inch:=180;
6681
% C.ITOH 8510A (160x144 DPI)
6684
proofing:=0; fontmaking:=1; tracingtitles:=0;
6685
pixels_per_inch:=160;
6686
aspect_ratio:=144/160;
6693
% C.ITOH 8510A (landscape mode: 144x160 DPI)
6696
proofing:=0; fontmaking:=1; tracingtitles:=0;
6697
pixels_per_inch:=144;
6698
aspect_ratio:=160/144;
6708
proofing:=0; fontmaking:=1; tracingtitles:=0;
6709
pixels_per_inch:=204;
6710
aspect_ratio:=196/204;
6717
% FAX (landscape mode: 196x204 DPI)
6720
proofing:=0; fontmaking:=1; tracingtitles:=0;
6721
pixels_per_inch:=196;
6722
aspect_ratio:=204/196;
6729
% HP QuietJet (192 DPI)
6732
proofing:=0; fontmaking:=1; tracingtitles:=0;
6733
pixels_per_inch:=192;
6740
% HP ThinkJet (192x96 DPI)
6742
% Warning: Many fonts break at such low a resolution
6745
proofing:=0; fontmaking:=1; tracingtitles:=0;
6746
pixels_per_inch:=192;
6747
aspect_ratio:=96/192;
6754
% HP ThinkJet (landscape mode: 96x192 DPI)
6756
% Warning: Many fonts break at such low a resolution
6758
mode_def thinkjetl =
6759
proofing:=0; fontmaking:=1; tracingtitles:=0;
6760
pixels_per_inch:=96;
6761
aspect_ratio:=192/96;
6768
% Canon BubbleJet 10ex (360 DPI)
6771
proofing:=0; fontmaking:=1; tracingtitles:=0;
6772
pixels_per_inch:=360;
6780
% Select default mode
6782
localfont:=laserjet;
6785
% Complain about unknown mode
6787
let plain_mode_setup_ = mode_setup;
6790
if unknown mode: show mode; errmessage "Unknown mode"; fi
6795
% ------------------------------------------------------------
6796
% Here are macros for Xerox-world font info
6797
% ------------------------------------------------------------
6799
def font_family expr s = % string s names the font family, e.g., "CMR"
6800
headerbyte 49: BCPL_string(s,20);
6801
special "fontid="&s enddef;
6802
def coding_scheme expr s = % string s names the scheme, e.g. "TEX TEXT"
6803
headerbyte 9: BCPL_string(s,40);
6804
special "codingscheme="&s enddef;
6805
def font_face_byte expr x = % integer x gives the family member number,
6806
headerbyte 72: x; % which should be between 0 and 255
6807
special "fontfacebyte"; numspecial x enddef;
6809
def BCPL_string(expr s,n)= % string s becomes an n-byte BCPL string
6810
for l:=if length(s)>=n: n-1 else: length(s) fi: l
6811
for k:=1 upto l: , substring (k-1,k) of s endfor
6812
for k:=l+2 upto n: , 0 endfor endfor enddef;
6814
Xerox_world:=1; % users can say `if known Xerox_world:...fi'
6817
let primitive_end_ = end;
6820
font_family font_identifier_;
6821
coding_scheme font_coding_scheme_;
6822
font_face_byte max (0, 254 - round 2designsize);
6827
outer end, primitive_end_;
6829
% A 96 dpi screen output mode:
6831
proofing:=0; fontmaking:=1; tracingtitles:=0;
6832
pixels_per_inch:=96;
6837
\EndVerbatim\EndHPage{}]\fi
6839
\ifHtml[\HPage{c:/texlive3/tex/texmf/fonts/source/public/phonetic/local.mf}\Verbatim
6840
% A file to be loaded after "plain.mf". Not final by any means.
6841
base_version:=base_version&"/drofnats";
6843
mode_def canon = % canon mode: for the old Imagen (Canon LBP10)
6844
proofing:=0; % no, we're not making proofs
6845
fontmaking:=1; % yes, we are making a font
6846
tracingtitles:=0; % no, don't show titles in the log
6847
pixels_per_inch:=240;
6848
blacker:=.2; % make pens a wee bit blacker
6849
fillin:=.2; % and compensate for fillin
6850
o_correction:=.4; % but don't overshoot as much
6853
mode_def escher = % mode for the 300 imagen printer
6857
pixels_per_inch:=300;
6863
mode_def think = % think mode: for the think jet and screen
6864
proofing:=0; % no, we're not making proofs
6865
fontmaking:=1; % yes, we are making a font
6866
tracingtitles:=0; % no, don't show titles in the log
6867
pixels_per_inch:=96; % really lowres
6868
blacker:=0; % don't make the pens any blacker
6869
fillin:=0; % and don't compensate for fillin
6870
o_correction:=.2; % but suppress most overshoots
6873
mode_def aps = % aps mode: for the Autologic APS-Micro5
6874
proofing:=0; % no, we're not making proofs
6875
fontmaking:=1; % yes, we are making a font
6876
tracingtitles:=1; % yes, show titles online
6877
pixels_per_inch:=722.909; % that's roughly 10 per pt
6878
blacker:=.2; % make pens a teeny bit blacker
6879
fillin:=.2; % but compensate for diagonal fillin
6880
o_correction:=1; % and keep the full overshoot
6883
% mode for Imagewriter (144 dots per inch) taken from pktor documentation
6884
mode_def imagewriter =
6888
pixels_per_inch := 144;
6899
\EndVerbatim\EndHPage{}]\fi
6904
c:/texlive3/tex/texmf/metafont/misc/modes.mf
6906
\Link[file://localhost/usr/local/teTeX/share/texmf/metafont/misc/modes.mf]{}{}modes.mf\EndLink
6910
\ifHtml[\HPage{c:/EMTEX/DATA/DVIPS/CONFIG.PS}\Verbatim
6911
*********************************************************************
6912
*** This default config.ps (originally of Russel Lang, I think)
6913
*** has some changes with respect for PCTeX.
6914
*** If an entry occurs twice, the second is intend for PCTeX.
6915
*** I don't use it, please check about errors in the pathes and so on
6916
*** and tell me corrections by email.
6918
*** This config.ps file (and dvips's internal defaults!) make use of
6919
*** environment variables EMTEXDIR, DVIDRVGRAPH, GS_LIB and DVIDRVFONTS.
6921
*** EMTEXDIR and DVIDRVFONTS MUST contain only ONE path entry for
6922
*** letting maketexp.{bat,cmd} and this config.ps work correctly !!!
6924
*** G. Sawade <sawade@physik.tu-berlin.de> 2-Nov-1995
6925
*********************************************************************
6928
W *** HP LaserJet/300dpi ***
6930
* Claim approx 700 kbytes memory
6933
* Default resolution.
6936
* Default metafont mode (defined in emTeX's local.mf)
6939
* Paths (uncomment and edit if you need these)
6940
* ^^^^^^^^^ means delete the '*' (gs :)
6941
* Due to dvips's new method of expanding $(FOO) into FOO's value
6942
* I changed the pathes with respect for emTeX's environment
6945
*T c:\emtex\tfm\dvips;c:\pctex\textfms
6948
*** ATTENTION ATTENTION: DVIDRVFONTS is allowed only to contain a single path !!!
6949
V $(DVIDRVFONTS)\vf!
6952
P $(DVIDRVFONTS)\%d\%f.pk
6953
*P c:\pctex\pixel\dpi%d\%f.%p
6955
L $(DVIDRVFONTS)\;lj_base;lj_more
6958
**** When you want to use the psnfss.map, remove the comment here
6962
S .;$(EMTEXDIR)\TEXINPUT!!;$(DVIDRVGRAPH)
6963
*S .;c:\emtex\texinput\dvips;c:\pctex\texinput;c:\pctex\latex
6965
H .;$(EMTEXDIR)\data\dvips;$(DVIDRVGRAPH);$(DVIDRVFONTS)\ps;$(GS_LIB)
6966
*H .;c:\emtex\data\dvips
6972
* Paper size information. First definition is the default.
6974
* If your default is a4 uncomment the following definition
6975
* and comment out the letterSize definition.
6976
*@ a4size 210mm 297mm
6979
@ letterSize 8.5in 11in
6980
@+ %%PaperSize: Letter
6983
@+ %%BeginPaperSize: Letter
6988
@+ ! %%DocumentPaperSizes: Legal
6989
@+ %%BeginPaperSize: Legal
6994
@+ ! %%DocumentPaperSizes: Ledger
6995
@+ %%BeginPaperSize: Ledger
7000
@+ ! %%DocumentPaperSizes: Tabloid
7001
@+ %%BeginPaperSize: Tabloid
7006
@+ ! %%DocumentPaperSizes: a4
7007
@+ %%BeginPaperSize: a4
7012
@+ ! %%DocumentPaperSizes: a3
7013
@+ %%BeginPaperSize: a3
7018
@+ statusdict /setpageparams known { hsize vsize 0 1 statusdict begin {
7019
@+ setpageparams } stopped end } { true } ifelse { statusdict /setpage known
7020
@+ { hsize vsize statusdict begin { setpage } stopped pop end } if } if
7021
\EndVerbatim\EndHPage{}]\fi
7023
\ifHtml[\HPage{c:/texlive3/tex/texmf/dvips/config/config.ps}\Verbatim
7030
% default resolution
7036
% Also look for this list of resolutions.
7041
% The printer offsets the output by this much.
7045
@ A4size 210mm 297mm
7048
@ letterSize 8.5in 11in
7051
@+ %%BeginPaperSize: Letter
7056
@+ ! %%DocumentPaperSizes: Legal
7057
@+ %%BeginPaperSize: Legal
7062
@+ ! %%DocumentPaperSizes: Ledger
7063
@+ %%BeginPaperSize: Ledger
7068
@+ ! %%DocumentPaperSizes: Tabloid
7069
@+ %%BeginPaperSize: Tabloid
7074
@+ ! %%DocumentPaperSizes: A4
7075
@+ %%BeginPaperSize: A4
7080
@+ ! %%DocumentPaperSizes: A3
7081
@+ %%BeginPaperSize: A3
7085
\EndVerbatim\EndHPage{}]\fi
7088
\ifHtml[\HPage{file://localhost/usr/local/teTeX/share/texmf/dvips/config/config.ps}\Verbatim
7089
% Thomas Esser, 1998, public domain.
7091
% teTeX's config.ps.
7099
% default resolution
7105
% Also look for this list of resolutions.
7108
% The printer offsets the output by this much.
7111
% Compress fonts. PS files are much more compact, but can sometimes
7115
% An "all-in-one" psfonts.map.
7118
% Instead of psfonts.map, you can use smaller "modules".
7129
% Uncomment the following two lines to use Postscript Type1 fonts instead of
7130
% bitmap fonts for computer modern & co.
7134
@ letterSize 8.5in 11in
7136
@ A4size 210mm 297mm
7140
@+ %%BeginPaperSize: Letter
7145
@+ ! %%DocumentPaperSizes: Legal
7146
@+ %%BeginPaperSize: Legal
7151
@+ ! %%DocumentPaperSizes: Ledger
7152
@+ %%BeginPaperSize: Ledger
7157
@+ ! %%DocumentPaperSizes: Tabloid
7158
@+ %%BeginPaperSize: Tabloid
7163
@+ ! %%DocumentPaperSizes: A4
7164
@+ %%BeginPaperSize: A4
7169
@+ ! %%DocumentPaperSizes: A3
7170
@+ %%BeginPaperSize: A3
7175
@+ ! %%DocumentPaperSizes: B5
7178
\EndVerbatim\EndHPage{}]\fi
7180
\ifHtml[\HPage{newer version}\Verbatim
7191
4.1 Postscript fonts
7193
5 Set up ImageMagick
7195
7 The batch file xht.bat
7196
A Solving low-resolution font problems
7197
A.1 Identifying the problem fonts
7198
A.2 Get the font information
7199
A.3 Making the problem fonts "by hand"
7203
This note explains how to set up a working version of TeX4ht, Eitan
7204
Gurari's TeX/LaTeX-to-HTML translation system, when the underlying TeX
7205
engine is Christian Schenk's MiKTeX for Win32 platforms. Thanks to
7206
Eitan for answering lots of TeX4ht questions and for valuable editing
7207
suggestions, to Piet van Oostrum for helping with an important
7208
MiKTeX-related problem, and most of all to Gaunce Lewis for helping me
7209
solve the font-making problem described in appendix A.
7213
Besides a standard MiKTeX setup, you will need the following freely
7214
available software packages:
7215
* http://www.cse.ohio-state.edu/~gurari/TeX4ht/mn.html#mn27.html :
7216
the translation system itself. Be sure to get the Win95 version.
7217
* http://www.wizards.dupont.com/cristy/www/archives.html : for
7218
translation of postscript to gif images.
7219
* ftp://ftp.cs.wisc.edu/ghost/aladdin/ : used by ImageMagick in the
7222
Choose directories for each of these packages, and unzip the
7223
distributions, being sure to preserve directory (folder) names. Note
7224
that you will need an unzipper which understands long file names. In
7225
what follows, I assume the following directories:
7226
* For TeX4ht: c:\ tex4ht
7227
* For ImageMagic: c:\ ImageMagic
7228
* For Ghostscript: c:\ gs
7229
* For MiKTeX itself: c:\ texmf (this is the default root of the
7230
MiKTeX system, but you are offered the opportunity to change it
7231
when you install the system).
7233
and if you select others, you will need to modify the instructions
7238
Two of the style files of TeX4ht need to be moved into MiKTeX's LaTeX
7239
tree. (Plain TeX will also find them).
7240
* create a directory c:\ texmf\ tex\ latex\ tex4ht
7241
* move tex4ht.sty and tex4hta.sty from the TeX4ht directory to this
7243
* update the MiKTeX database: from the MiKTeX program group do
7244
Maintenance then Refresh filename database. This runs a quick DOS
7245
session which updates the database.
7249
TeX4ht uses dvips to create Postscript images of equations, and of
7250
symbols which are unavailable in standard fonts; these are then
7251
converted to .gif images using the ImageMagick/Ghostscript combination
7252
described in the next section. How you set up dvips depends on whether
7253
and how you are using Postscript fonts. Note that these instructions
7254
are geared to the way MiKTeX is set up: if you're not using MiKTeX you
7255
may have to make adjustments. You can download MiKTeX's dvips
7256
configuration file, config.ps, config.ps for reference.
7258
4.1 Postscript fonts
7260
MiKTeX comes with a complete set of public-domain Type-1 (Postscript)
7261
fonts for the Computer Modern, LaTeX and AMS math fonts. By far the
7262
simplest solution is to use them in conjunction with TeX4ht; note that
7263
you can do so whether or not you have a Postscript printer.
7265
However, if you have removed the Type-1 fonts from your hard disk
7266
(perhaps to save space) the next sub-section describes how to use
7267
Metafont to do the work for you; this is a much more complicated
7268
solution and is not recommended. You can check that the Type-1 fonts
7269
are present by looking in subdirectories of c:\ texmf\ fonts\ type1.
7271
To set up to use Postscript fonts in TeX4ht:
7272
* Use a text editor to open the dvips configuration file config.ps;
7273
this is usually in c:\ texmf\ dvips\ config\ local
7274
* In this file are two sections dealing with Type-1 fonts in a
7275
series of lines like
7277
If all these lines are uncommented (ie, not preceded by a ;
7278
character) and if you see a reference to
7280
then there's nothing more to do -- you are already using
7281
Postscript fonts for all your printing.
7282
* If some of these lines are commented out, or if there's no
7283
reference to amsfonts.map, then
7284
+ uncomment them all
7285
+ add a line p +amsfonts.map
7286
+ save the file under a new name (in the same place as the
7287
original), for example as config.tex4ht. The name you choose
7288
must begin with config, and the extension is your choice.
7289
+ close the editor and run initexmf -u to update the MiKTeX
7290
database, or else dvips will not recognize your definition.
7294
If you do not have the Type-1 fonts, you can instruct dvips to use
7295
Metafont to generate fonts and characters. But this is more
7296
complicated, and, overall, less satisfactory.
7298
First, you need to select the resolution for your fonts: this can have
7299
a substantial impact on the legibility of your HTML and on the size of
7300
the gifs your readers have to download, and as you might expect, these
7301
considerations run in opposite directions. For example, making
7302
Metafont fonts at 600 dpi rather than at 110 dpi makes the HTML pages
7303
more readable, but can increase the total size of the gifs by a factor
7304
of 1.7 (in one experiment).
7306
Second, in low-resolution modes (below about 300 dpi) there may be a
7307
dvips-Metafont interaction problem, resulting in certain fonts not
7308
being made automatically. The solution to this problem is somewhat
7309
cumbersome, and is described in Appendix A below; the upshot is
7310
probably that unless your document generates a really large set of
7311
gifs, the high-resolution solution is probably preferable. But it's
7314
I assume that if you elect a high-resolution solution, you'll use
7315
whatever printer mode you are currently using to print hard-copy
7316
documents from the yap previewer. In this case there's nothing more to
7319
If you prefer to reduce the size of gifs to be transferred, one
7320
suggestion is to use the Metafont mode ibmvga, and you need to tell
7321
dvips and Metafont about it. Here's how: but note that these
7322
instructions are specific to the version of config.ps provided by
7324
distributions appear to provide different versions of this file.
7325
* Locate the dvips configuration file config.ps, typically in
7326
c:\ texmf\ dvips\ config\ local
7327
* Make a copy of this file under the name config.ibmvga
7328
* Use a text editor to edit config.ibmvga, and make the following
7330
+ at the top of the file change the Metafont mode from M ljfour
7331
(or whatever printer you selected when you set up MiKTeX) to
7333
+ below that, change the dpi resolution from D 600 (or whatever
7334
resolution your default printer is set up for) to D 110. If
7335
you also see entries for X 600 and Y 600, these also need to
7337
+ Comment out (by preceding each line with a semi-colon) the
7338
approximately 11 lines of the form
7340
-- we want Metafont to create these fonts if they're
7342
* Save the file config.ibmvga
7343
* From a DOS session, run initexmf -u to update the configuration
7344
files. If you forget this, then dvips will not be able to make
7345
fonts at the required resolution.
7347
A copy of the edited config.ibmvga can be downloaded config.ibmvga .
7349
5 Set up ImageMagick
7351
* Switch to the ImageMagick directory, and check that there exists a
7352
file delegates.mgk. If not, copy the file c:\ ImageMagic\
7353
delegates\ delegates.nt to the main ImageMagick directory as
7355
* Use a text editor to open delegates.mgk. In this file there are
7356
about 5 instances of calls to the program gswin. In each of these
7357
replace gswin by the full path and executable name to the
7358
command-line version of Ghostscript, typically c:\ gs\ gswin32c.
7359
If you omit the "c" and refer only to gswin32 you will get the
7360
windowed version of Ghostscript: each time it is called to
7361
translate a file, it will pop up an empty window, do the
7362
translation, and close the window. It seems to make no difference
7363
which version you use, but since the TeX4ht system is a
7364
command-line utility, it is less distracting -- and may save a bit
7365
of time, too -- to run the command-line version of Ghostscript.
7366
* In order for ImageMagick to find its delegates file, you need to
7367
set the environment variable delegate_ path. You can let the batch
7368
file xht.bat described in section 7 do it for you, or you can do
7370
+ Under Windows NT: open the Control Panel, choose System, then
7371
Environment. At the bottom of the dialog under Variable:
7372
enter delegate_ path, and under Value: enter c:\ ImageMagic.
7373
Click OK. This will take effect the next time you start a DOS
7375
+ Under Windows95: edit autoexec.bat; add the line
7376
set delegate_ path=c:\ ImageMagic. You may need to re-boot
7377
for the changes to take effect.
7381
First, you will need to add TeX4ht's directory to your path. You can
7382
do this from the Windows NT Control Panel (or by editing autoexec.bat
7383
in Windows95), or you can let the batch file xht.bat described in
7384
section 7 do it for you.
7386
Next, switch to the TeX4ht directory. Use a text editor to open the
7387
file tex4ht.env, and make sure that the following are correct:
7388
* the first uncommented line begins with a t : the remainder of this
7389
should contain a path to the MiKTeX tfm files. For the standard
7390
MiKTeX distribution change the line to read tc:\ texmf\ fonts\
7391
tfm! -- note the trailing exclamation point, which is required,
7392
and be sure to include the leading t.
7393
* Locate the line beginning Gdvips32 and change it to Gdvips.
7394
* On the same line, make the following changes:
7395
+ if you are using Postscript fonts and you did not make a new
7396
dvips config file as described in section 4.1, delete the
7397
text -mode ibmvga -D 110.
7398
+ if you are using Postscript fonts and you did make a new
7399
dvips config file, change -mode ibmvga -D 110 to -P tex4ht
7400
where tex4ht is the extension of the config file you created
7402
+ if you are using Metafont in your standard printer mode as
7403
described by config.ps, delete the text -mode ibmvga -D 110.
7404
+ if you are using Metafont in a non-standard dvips
7405
configuration file, here assumed to be config.ibmvga, change
7406
-mode to -P so that that part of the line reads -P ibmvga
7407
(note: capital "P") and set the dpi value following -D
7408
accordingly (for ibmvga it should be -D 110).
7409
* Locate the line beginning Gconvert . . . . On this line:
7410
+ change convert to the full drive/path name to the convert
7411
utility: under the directory assumptions made here the line
7412
would begin Gc:\ ImageMagic\ convert. Be sure not to delete
7413
the initial "G" which is needed by TeX4ht.
7414
+ make sure that the line says -transparent #FFFFFF and not
7415
-transparent '#FFFFFF' (ie, no quotes).
7416
* under this, make sure that you see Gdel %%3, and not Gdel %%%3
7417
(remove the extra % if necessary).
7418
* change Gcopy /y %%1 %%2%%3 to Gcopy %%1 %%2%%3 (remove the /y).
7419
* change Gmove /y %%1 %%2%%3 to Gmove %%1 %%2%%3 (remove the /y).
7420
* the last line of the file should read H followed by the full drive
7421
plus path to the file hft.sty. If you chose the default location,
7422
you will not need to change this.
7424
Finally, open the file ht.bat. Make sure the last line reads
7426
htcmd %2 -eC:\ tex4ht\ tex4ht.env
7428
and if it doesn't, add the -e switch, whose argument is the drive plus
7429
path to the TeX4ht files.
7431
7 The batch file xht.bat
7433
I've created a small batch file called xht.bat which takes care of
7434
several of the details associated with running TeX4ht. You can place
7435
the batch file in a directory in your path and then call it from any
7436
place on your hard disk. The batch file is set up with the directory
7437
defaults as described in section 2; if you choose different locations,
7438
you will need to edit the file accordingly.
7440
The syntax, which you will be reminded of if you call xht with no
7441
parameters, is the same as for TeX4ht's starting batch file ht.bat:
7443
xht tex myfile for a plain TeX file, or
7445
xht latex myfile for a LaTeX file.
7447
What the batch file does is:
7448
1. It adds the TeX4ht directory to your path before calling the
7449
translator, and then removes it when the job ends.
7450
There is a cost to this: we save a copy of the current path in the
7451
environment variable opath, and then append the TeX4ht directory
7452
to path. At the end of the batch file, path is set equal to opath,
7453
and opath is erased. The cost is the length of opath, which is
7454
temporarily added to your environment. Under Windows NT4 this will
7455
never be a problem, but it is possible that you could run out of
7456
environment space under Windows 95. If that happens you will
7457
probably need to alter autoexec.bat.
7458
2. It sets the environment variable delegate_ path required by the
7459
ImageMagick convert utility; and then removes it when the job
7461
3. Since I tend to forget to specify tex or latex, xht.bat does a
7462
quick check to see that you have actually provided two parameters.
7463
(However, note that it doesn't check that the first parameter is
7464
either tex or latex: it would be easy to add this if you need it).
7465
4. It also tries in a simple-minded way to check that you provide the
7466
name of the source (.tex) file without an extension: it adds the
7467
extension .tex to the name of the source file which you provided:
7468
if that file exists, then we assume that you did not provide the
7469
extension. This will fail if you provide, say, myfile.tex and the
7470
file myfile.tex.tex happens also to exist in the same directory.
7471
In my case, I can be sure that this won't happen, but your habits
7474
You can download the batch file xht.bat xht.bat .
7476
A Solving low-resolution font problems
7478
If you elected to use Metafont instead of Type-1 fonts, you may run
7479
into the following problem: when a font is not found, dvips calls
7480
Metafont; but if Metafont has trouble making the font, then the font
7481
will not be placed where dvips can find it. Unfortunately, Metafont
7482
has problems with several fonts in low-resolution modes, and while
7483
those problems do not seem to lead to any major ill-effects when
7484
viewing the output on the Web, the result isn't quite perfect enough
7487
This appendix describes how to solve the problem. Note that you will
7488
never run into this problem if you use Type-1 fonts -- this is the
7489
recommended procedure -- or if you use Metafont in high-resolution
7490
(above 300 dpi) modes. But if you want to save download bandwidth and
7491
use Metafont in low-resolution modes you will need to make the problem
7492
fonts "by hand". Here's how.
7494
A.1 Identifying the problem fonts
7496
You can identify the problem fonts in either of two ways.
7497
* If you're watching TeX4ht run, watch for Metafont errors and, if
7498
you're quick, you may able to stop the screen scrolling at the
7499
right place by hitting Control+S and extracting the information
7500
described in the next sub-section. (Control+Q restarts). But this
7501
is a bit tricky, especially on a fast computer.
7502
* Alternatively, once you have .dvi file (this can be either with or
7503
without the TeX4ht extensions), open the previewer yap. Click on
7504
View then Options then Display. Under Mode choose IBM vga (110
7505
dpi) and click OK. Ignore the warning about it's not being
7506
recommended to have screen and printer at different resolutions.
7507
+ Open your document in the previewer and page through it. One
7508
of three things will happen:
7509
o Metafont never runs. In this case there will be no
7510
problems with TeX4ht.
7511
o Metafont runs, but the DOS window closes without your
7512
intervention. In this case, Metafont has succeeded in
7513
making a missing font. In this case, too, there will be
7514
no problems with TeX4ht.
7515
o Metafont runs, but there is a problem. The indicator of
7516
this is that the DOS window for Metafont waits for you
7517
to close it manually. At this point you need to make a
7518
note of the font which caused the problem, as described
7519
in the next sub-section.
7520
+ When you have paged through the document, you should set
7521
yap's display resolution back to its original value; exit
7524
A.2 Get the font information
7526
At each instance of a Metafont problem, you need to extract
7527
information about the font in question.
7528
* At the bottom of the window, you will see something like the
7530
+ Output written on cmr5.72gf
7531
Transcript written on cmr5.log
7532
Metafont failed on cmr5! Return code 1
7533
Press any key to continue ...
7534
* Look at the first of these lines, and write down (a) the font name
7535
(which is the text before the .72gf, here cmr5), and (b) the
7536
resolution ( the text just before gf, here 72).
7538
A.3 Making the problem fonts "by hand"
7540
You must now make any fonts that Metafont "choked" on. I've set up a
7541
little batch file, epfont.bat, which you can download epfont.bat , and
7542
which tries to ease the difficulties for you. (This is based on the
7543
work of Gaunce Lewis; I'm grateful to him for sharing it with me). The
7544
batch file is set up to make fonts in ibmvga mode, but it contains
7545
instructions on how to customize it for any mode. To use the file:
7546
* Copy it to any directory.
7547
* For safety, do del epfix.bat though there probably won't be any
7549
* Repeatedly run epfont, once for every font you noted in the
7550
previous step, where Metafont fails. The arguments to epfont are
7551
(1) the font name (cmr5 in the example) followed by the resolution
7552
(72 in the example), so in this case you'd say epfont cmr5 72.
7553
* epfont creates a file epfix.bat. This file contains run-able
7554
instructions to have Metafont create your problem fonts. But
7556
+ Open epfix.bat in a text editor.
7557
+ Do a global search-and-replace: replace the string /d by a
7559
+ Scan thorough the file and look for any lines which end
7560
...already exists!. This says that you asked Metafont to make
7561
a file which is already made. When you see one of these,
7562
delete the entire "section" of the file associated with that
7563
font. Sections begin with a line that says REM followed by
7564
one that says REM fontname resolution where fontname and
7565
resolution are echoes of information you provided.
7566
+ Save epfix.bat and run it from the command line. This will
7567
make all missing fonts connected with your document. You can
7568
now safely run TeX4ht.
7570
\EndVerbatim\EndHPage{}]\fi
7574
\ifHtml[\HPage{more}\Verbatim
7575
> 4. I've cleaned up the section on resolution in the metafont case, mostly
7576
> by eliminating it. It's true that by fiddling around with the metafont mode
7577
> you can get substantially smaller gifs, but I don't understand why. So I
7578
> just dumped that stuff altogether.
7579
\EndVerbatim\EndHPage{}]\fi
7586
\Section{Gifs vs JPEG}
7590
From stop@the-light.com Tue Oct 1 18:06:16 EDT 1996
7591
Article: 105020 of comp.infosystems.www.authoring.html
7592
Path: news.cse.ohio-state.edu!nntp.sei.cmu.edu!fs7.ece.cmu.edu!cantaloupe.srv.cs.cmu.edu!rochester!cornellcs!newsstand.cit.cornell.edu!portc01.blue.aol.com!news-peer.gsl.net!news.gsl.net!news.sgi.com!enews.sgi.com!news.mathworks.com!newsfeed.internetmci.com!news.onr.com!usenet
7593
From: stop@the-light.com (Victor Engel)
7594
Newsgroups: comp.infosystems.www.authoring.html
7595
Subject: Re: Converting many graphics/images to GIF format
7596
Date: Tue, 01 Oct 1996 03:12:57 GMT
7597
Organization: Onramp Access, Inc. 512-322-9200
7599
Message-ID: <52q5si$68k@mari.onr.com>
7600
References: <52p0em$4dn@nadine.teleport.com>
7601
NNTP-Posting-Host: onramp6-7.onr.com
7602
X-Newsreader: Forte Free Agent 1.0.82
7604
Before you go to all the work of converting all your graphics to GIF,
7605
bear in mind that for the web, GIF may not be the format you should
7606
use for many of your images. The GIF format is an 8-bit format, so you
7607
will be losing a lot of color information when converting from a 24
7608
bit image. There are many alogrithms the software could use to perform
7609
the color reduction. Which one used depends upon which software you
7610
are using and what settings you are using. Here are my recommendations
7611
for converting your images.
7613
1) For photographs and other images using gradations of color, convert
7614
to JPG. Experiment a little with the compression ratio until you get a
7615
good compromise between quality and file size.
7617
2) For images with large areas of a single color, use the GIF format.
7618
These images will have few colors and will be saved as smaller files
7619
than if they were saved as JPG images.
7621
Use your favorite search engine and review some GIF/JPG FAQs for more
7622
detail on this subject, or review the FAQ in
7623
comp.infosystems.www.authoring.images.
7625
You may also want to take a peek at http://the-light.com/netcol.html,
7626
but this site is targeted at designers of individual images.
7628
joannt@teleport.com (Joann Taylor) wrote:
7630
>Greetings. I have a quick question re: saving graphics to GIF format.
7631
>I am using a Mac to pull together a large html-based help utility and
7632
>need to integrate graphics. I have LOTS that I have used prior in PICT,
7633
>TIFF, and random application formats (Canvas, Kaleidagraph, Photoshop,
7634
>...ya dee ya...). When I try to save these as GIF files for my html
7635
>pages - most of the graphics get hosed - resolution is very poor and color
7636
>gets trampled on. I expect some degredation but this seems very
7637
>excessive...I have got to be forgetting something. My Canvas 5
7638
>application gives me the impression it is building the appropriate color
7639
>table during the "save" but the resulting image says differently. I am
7640
>not very familiar with the GIF format, so I am not sure of the source of the
7641
>problem. Can any one suggest how I might address this problem or where
7642
>I might find some pointers to a solution?
7650
>* Principal Consultant - Color Technology Solutions *
7651
>* Specializing in Color Science, Technology and Applications *
7652
>* joannt@teleport.com *
7654
-----------------------------------------------------------
7655
Victor Engel Vector Angle
7656
Stop@The-Light.com lights@onr.com
7657
http://the-light.com http://www.onr.com/user/lights