~ubuntu-branches/debian/sid/tex4ht/sid

« back to all changes in this revision

Viewing changes to lit/tex4ht-htcmd.tex

  • Committer: Bazaar Package Importer
  • Author(s): Kapil Hari Paranjape
  • Date: 2008-09-12 10:32:36 UTC
  • mfrom: (1.3.2 upstream) (3.1.9 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080912103236-tgw2q5g6f5hp2pnm
Tags: 20080701-2
* debian/patches/add_manpage.diff: Modified the man page
  to recommend that "mk4ht" be used for conversions other than
  from TeX/LaTeX to HTML. This is in response to #495768.
* debian/control: Replaced "sun-java5-jre" with "openjdk-6-jre-headless"
  in the "Suggests" field for "tex4ht-common". The latter java runtime
  seems to work with "xtpipes.jar" and the former is non-free.
  (Closes: #486482)

Show diffs side-by-side

added added

removed removed

Lines of Context:
850
850
 
851
851
\bye
852
852
 
853
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
854
 
 
855
 
 
856
 
 
857
 
 
858
 
 
859
 
\<header functions\><<<
860
 
static void* r_alloc(ARG_II(void *, size_t));
861
 
>>>
862
 
 
863
 
\<functions\><<<
864
 
`[
865
 
static void* r_alloc( q, n ) 
866
 
      void   *q`;
867
 
      size_t  n
868
 
;{    void*   p;
869
 
   if((p = (void *) realloc( q, (size_t) n)) == NULL) bad_mem;
870
 
   return p;
871
 
}
872
 
>>>
873
 
 
874
 
 
875
 
 
876
 
 
877
 
 
878
 
 
879
 
 
880
 
 
881
 
 
882
 
 
883
 
 
884
 
\<main's body\><<<
885
 
`<load env file`>
886
 
}
887
 
>>>
888
 
 
889
 
 
890
 
 
891
 
 
892
 
 
893
 
 
894
 
 
895
 
 
896
 
\LikeChapter{htcmd: postprocessor for tex4ht}
897
 
 
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.
901
 
 
902
 
\TableOfContents[Section,SubSection] 
903
 
 
904
 
 
905
 
 
906
 
\Section{Outline}
907
 
 
908
 
 
909
 
 
910
 
 
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.
918
 
 
919
 
 
920
 
 
921
 
 
922
 
 
923
 
 
924
 
 
925
 
 
926
 
 
927
 
\<mv html and css to dir and chmod\><<<
928
 
eoln_ch = (int) 'x';
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") ){
933
 
      if( dir ){                          
934
 
         (void) execute_script(copy_script, match[1], 
935
 
                               dir? dir :"",".","");
936
 
      }
937
 
      if( ch_mod ){
938
 
         (void) execute_script(chmod_script, ch_mod,
939
 
                               dir? dir:"",match[1], "");
940
 
      }
941
 
}  }
942
 
>>>
943
 
 
944
 
 
945
 
 
946
 
 
947
 
 
948
 
 
949
 
\SubSection{char, signed char, unsigned char (gcc man)}:
950
 
 
951
 
 
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.
955
 
 
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.
963
 
 
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.
967
 
 
968
 
 
969
 
 
970
 
 
971
 
\<definesNO\><<<
972
 
#define Q_CHAR signed char
973
 
#define U_CHAR unsigned char
974
 
#define C_CHAR char
975
 
#define Q_NULL (Q_CHAR *) 0
976
 
#define U_NULL (U_CHAR *) 0
977
 
#define C_NULL (C_CHAR *) 0
978
 
>>>
979
 
 
980
 
Pointers to strings must use  \`'C_CHAR', since we don't 
981
 
know how string constants are treated there.
982
 
 
983
 
 
984
 
 
985
 
 
986
 
\SubSection{EOF Character}
987
 
 
988
 
 
989
 
\<vars\><<<
990
 
static int eoln_ch;
991
 
>>>
992
 
 
993
 
\Verbatim
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.
997
 
Adding the lines
998
 
   #undef EOF
999
 
   #define EOF 255
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.)
1002
 
\EndVerbatim
1003
 
 
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.
1007
 
 
1008
 
 
1009
 
 
1010
 
\SubSection{Comments}
1011
 
 
1012
 
\Verbatim
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,
1017
 
        infovore@xs4all.nl
1018
 
cc: gurari@cse.ohio-state.edu, michel.GOOSSENS@CERN.ch
1019
 
Subject: change to texmf.cnf for tex4ht
1020
 
 
1021
 
Can you change your default setups to add the following line to
1022
 
texmf.cnf?
1023
 
 
1024
 
HTCMDINPUTS = .;$TEXMF/tex4ht//;$TEXMF/tex/latex/tex4ht
1025
 
 
1026
 
this is because Eitan Gurari has added a new C program, htcmd, to the
1027
 
TeX4ht setup, which does some Kpathsea work.
1028
 
 
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.
1032
 
 
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
1036
 
\EndVerbatim
1037
 
 
1038
 
\Section{Platform-dependent Code}
1039
 
 
1040
 
 
1041
 
 
1042
 
 
1043
 
 
1044
 
 
1045
 
 
1046
 
 
1047
 
 
1048
 
 
1049
 
 
1050
 
 
1051
 
 
1052
 
 
1053
 
 
1054
 
 
1055
 
 
1056
 
 
1057
 
 
1058
 
 
1059
 
 
1060
 
 
1061
 
\SubSection{Compilers}
1062
 
 
1063
 
 
1064
 
\List{}
1065
 
\item {BCC32}  
1066
 
 
1067
 
For Win 95.
1068
 
 
1069
 
Options (\''bcc32' comamnd):
1070
 
 
1071
 
\Verbatim
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
1096
 
\EndVerbatim
1097
 
 
1098
 
 
1099
 
\item {BCC}
1100
 
 
1101
 
For DOS.
1102
 
 
1103
 
\item {MSVC++}
1104
 
 
1105
 
For DOS.
1106
 
 
1107
 
\`'c:\msvc\bin\cl  -Ic:\msvc\include -DDOS  htcmd.c'
1108
 
 
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'
1114
 
 
1115
 
The following are the available flags (\''c:\msvc\bin\cl -help').
1116
 
 
1117
 
\Verbatim
1118
 
                         C COMPILER OPTIONS
1119
 
 
1120
 
                            -MEMORY MODEL-
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)
1125
 
                            -OPTIMIZATION-
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
1138
 
                          -CODE GENERATION-
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)
1153
 
                            -OUTPUT FILES-
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
1160
 
                            -PREPROCESSOR-
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"
1167
 
                              -LANGUAGE-
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
1174
 
                           -FLOATING POINT-
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
1178
 
                          -SOURCE LISTING-
1179
 
/Sl<columns> set line width             /Sp<lines> set page length
1180
 
/St<string> set title string            /Ss<string> set subtitle string
1181
 
                           -MISCELLANEOUS-
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
1196
 
                            -MASM SUPPORT-
1197
 
/MA<MASM switch>                        /Ta<file> assemble file without .asm
1198
 
                              -LINKING-
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
1202
 
\EndVerbatim
1203
 
 
1204
 
 
1205
 
\EndList
1206
 
 
1207
 
\SubSection{DJGPP}
1208
 
 
1209
 
 
1210
 
 
1211
 
 
1212
 
\Verbatim
1213
 
1998-10-22  Eli Zaretskii  <eliz@is.elta.co.il>
1214
 
 
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.
1225
 
\EndVerbatim
1226
 
 
1227
 
 
1228
 
 
1229
 
\SubSection{Slashes n Directory Pathes}
1230
 
 
1231
 
 
1232
 
 
1233
 
 
1234
 
\<defines\><<<
1235
 
#if defined(DOS_WIN32) || defined(__DJGPP__)
1236
 
#define dir_path_slash(str) (is_forward_slash(str)? '/' : '\\')
1237
 
#else
1238
 
#define dir_path_slash(str)  '/' 
1239
 
#endif
1240
 
>>>
1241
 
 
1242
 
 
1243
 
 
1244
 
\<header functions\><<<
1245
 
#if defined(DOS_WIN32) || defined(__DJGPP__)
1246
 
   static BOOL is_forward_slash( ARG_I(Q_CHAR *) );
1247
 
#endif
1248
 
>>>
1249
 
 
1250
 
\<functions\><<<
1251
 
#if defined(DOS_WIN32) || defined(__DJGPP__)
1252
 
`[ 
1253
 
static BOOL is_forward_slash(str)
1254
 
                                    Q_CHAR * str
1255
 
;{   
1256
 
   while( *str ){  if( *(str++) == '/' ) { return TRUE; } }
1257
 
   return FALSE;
1258
 
}
1259
 
#endif
1260
 
>>>
1261
 
 
1262
 
 
1263
 
 
1264
 
 
1265
 
 
1266
 
 
1267
 
 
1268
 
 
1269
 
\Section{Command-Line Options}
1270
 
 
1271
 
 
1272
 
\SubSection{Available Options}
1273
 
 
1274
 
\List{disc}
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
1282
 
\EndList
1283
 
 
1284
 
 
1285
 
\Verbatim
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.*
1291
 
\EndVerbatim
1292
 
 
1293
 
 
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\
1304
 
Example: \n\
1305
 
   htcmd name -d/WWW/temp/ -etex4ht-32.env -m644\n\
1306
 
---------------------------------------------------------------\n"
1307
 
>>>
1308
 
 
1309
 
 
1310
 
If option \`'-e' is present, empty pictures are replaced
1311
 
with the named file (e.g., \`'empty.gif').
1312
 
 
1313
 
 
1314
 
 
1315
 
 
1316
 
 
1317
 
\SubSection{Scanning the Options}
1318
 
 
1319
 
 
1320
 
 
1321
 
 
1322
 
 
1323
 
\Verbatim
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'
1333
 
variable.
1334
 
 
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.
1338
 
 
1339
 
> 94a99,102
1340
 
> > #ifdef KPATHSEA
1341
 
> > #include <kpathsea/progname.h>
1342
 
> > #include <kpathsea/tex-file.h>
1343
 
> > #endif
1344
 
> 943c951
1345
 
> <    kpse_set_program_name (argv[0], NULL);
1346
 
> ---
1347
 
> >    kpse_set_program_name (argv[0], "tex4ht");
1348
 
\EndVerbatim
1349
 
 
1350
 
\<kpathsea arg 0\><<<
1351
 
#ifdef KPATHSEA
1352
 
   kpse_set_program_name (argv[0], NULL);
1353
 
#endif
1354
 
>>>
1355
 
 
1356
 
 
1357
 
 
1358
 
If \`'strlen( argv[i] ) == 2' the switch is followed by a
1359
 
space to be deleted when more input is awaited.
1360
 
 
1361
 
 
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; }
1366
 
   q = argv[i]; 
1367
 
} else q = p+2;
1368
 
switch( *(p+1) ){
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;  }
1377
 
}
1378
 
>>>
1379
 
 
1380
 
 
1381
 
 
1382
 
\Section{Loading Style for htf Fonts}
1383
 
 
1384
 
\SubSection{Loading from a Style File}
1385
 
 
1386
 
 
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`>
1397
 
   }  }
1398
 
}
1399
 
>>>
1400
 
 
1401
 
 
1402
 
\<process htfcss line\><<<
1403
 
while( *body && (*body != ' ') ){ body++; }
1404
 
if( *body == ' ' ){ *(body++) = '\0'; }
1405
 
if( *body ){  
1406
 
  if( *key ){ `<add new htfcss rec`> }
1407
 
  else if( last_rec ){ `<append prev htfcss rec`> }
1408
 
}
1409
 
>>>
1410
 
 
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 );
1418
 
if( last_rec ){
1419
 
   last_rec->next = p;  last_rec = p;
1420
 
} else {
1421
 
   htf_rec = last_rec = p;
1422
 
}
1423
 
if( debug ){
1424
 
   (IGNORED) printf(".......%s...%s\n", key, body);
1425
 
}
1426
 
>>>
1427
 
 
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) 
1432
 
    + 2);
1433
 
(IGNORED) strct(last_rec->body,"\n");
1434
 
(IGNORED) strct(last_rec->body,body);
1435
 
if( debug ){
1436
 
   (IGNORED) printf(".......%s\n", body);
1437
 
}
1438
 
>>>
1439
 
 
1440
 
 
1441
 
 
1442
 
  
1443
 
\<defines\><<<
1444
 
struct htf_struct{
1445
 
  Q_CHAR *key,  *body;
1446
 
  struct htf_struct *next;
1447
 
};
1448
 
>>>
1449
 
 
1450
 
\<vars\><<<
1451
 
static struct htf_struct *htf_rec = (struct htf_struct *) 0;
1452
 
>>>
1453
 
 
1454
 
 
1455
 
 
1456
 
\SubSection{From lg File}
1457
 
 
1458
 
 
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;'.
1462
 
 
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;
1470
 
      key = match[1];  
1471
 
      *(key + (int) strlen(key) - 1) = '\0';
1472
 
      `<store font style of lg`>
1473
 
} } 
1474
 
>>>
1475
 
 
1476
 
 
1477
 
 
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);
1482
 
   p->next =  htf_rec;  
1483
 
   htf_rec = p;
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] );
1488
 
   if( debug ){
1489
 
      (IGNORED) printf(".......%s...%s\n", key, match[2]);
1490
 
} }
1491
 
>>>
1492
 
 
1493
 
 
1494
 
 
1495
 
 
1496
 
 
1497
 
 
1498
 
 
1499
 
\Section{Identify the Empty Pictures}
1500
 
 
1501
 
 
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.
1506
 
 
1507
 
The messages in the ``.lg'' file look like
1508
 
\`'--- empty picture --- aa.idv[1] ---'.
1509
 
 
1510
 
 
1511
 
 
1512
 
\<identify the empty pictures\><<<
1513
 
{                             struct empty_pic_struct *last;    
1514
 
   last = empty_pic = (struct empty_pic_struct *) 0;
1515
 
   while( TRUE ) {              
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; }      
1521
 
   }
1522
 
   `<add empty pic`>
1523
 
   last->next = (struct empty_pic_struct *) 0;
1524
 
   last->n = 100000;    
1525
 
}
1526
 
>>>
1527
 
 
1528
 
 
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);   
1533
 
} else { 
1534
 
   last = last->next = (struct empty_pic_struct *) 
1535
 
                   m_alloc(struct empty_pic_struct, (int) 1);   
1536
 
}
1537
 
last->next = (struct empty_pic_struct *) 0;
1538
 
last->n = get_long_int(match[1]);    
1539
 
>>>
1540
 
 
1541
 
 
1542
 
\<main's vars\><<<
1543
 
struct empty_pic_struct *empty_pic;    
1544
 
>>>
1545
 
  
1546
 
\<defines\><<<
1547
 
struct empty_pic_struct{
1548
 
  long int n;
1549
 
  struct empty_pic_struct *next;
1550
 
};
1551
 
>>>
1552
 
 
1553
 
 
1554
 
 
1555
 
The list of empty pictures is stored in \`'emptypic'.
1556
 
 
1557
 
\Section{Process Gifs}
1558
 
 
1559
 
\Verbatim
1560
 
l. 10 --- needs --- ignore ---
1561
 
l. 11 --- needs --- end ignore ---
1562
 
--- needs --- aa.idv[80] ==> aa79x.gif ---
1563
 
--- characters ---
1564
 
\EndVerbatim
1565
 
 
1566
 
\<process gif's\><<<
1567
 
{                               BOOL characters, skip;
1568
 
   characters = skip = FALSE;
1569
 
   while( TRUE ) {              
1570
 
      status = scan_until_str("--- ", 1, TRUE, lg_file);
1571
 
      status = scan_until_str( " ---" , 2, status, lg_file);
1572
 
      if( status ) {
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 ---...`> }
1580
 
      }
1581
 
      if ( eoln_ch == EOF ){ break; }      
1582
 
   }
1583
 
}
1584
 
>>>
1585
 
 
1586
 
 
1587
 
\<--- ??? ---...\><<<
1588
 
status = scan_until_end_str("", 1, status, lg_file);
1589
 
>>>
1590
 
 
1591
 
\<???--- ??? ---...\><<<
1592
 
status = scan_until_end_str("", 1, status, lg_file);
1593
 
>>>
1594
 
 
1595
 
 
1596
 
\<--- characters ---...\><<<
1597
 
status = scan_until_end_str("", 1, status, lg_file);
1598
 
characters = eq_str(match[1],"");
1599
 
>>>
1600
 
 
1601
 
 
1602
 
\SubSection{Identifying the requests}
1603
 
 
1604
 
 
1605
 
 
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);
1614
 
if( status ) {
1615
 
               long int gif_i;
1616
 
               Q_CHAR *p;
1617
 
   gif_i = get_long_int(match[2]);
1618
 
   p = match[2];  
1619
 
   *(p + (int) strlen(p) - 6) = '\0';
1620
 
   if( characters ){
1621
 
      `<translate symbol gifs`>
1622
 
   } else { `<translate non-symbol gifs`> }
1623
 
}
1624
 
>>>
1625
 
 
1626
 
 
1627
 
\SubSection{General Pictures}
1628
 
 
1629
 
 
1630
 
\`'--- needs --- aa.idv[80] ==> aa79x.gif ---'
1631
 
 
1632
 
\<translate non-symbol gifs\><<<
1633
 
if( gif_i == `<empty picture`> ) {
1634
 
  `<insert empty picture`>
1635
 
} else { `<insert non-empty picture`> }
1636
 
>>>
1637
 
 
1638
 
 
1639
 
\<insert non-empty picture\><<<
1640
 
if( !nopict && !skip ){
1641
 
   `<dvi into gif`>
1642
 
}
1643
 
>>>
1644
 
 
1645
 
 
1646
 
\<insert empty picture\><<<
1647
 
if( !skip ){
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], "");
1653
 
   }
1654
 
}
1655
 
empty_pic = empty_pic->next; 
1656
 
>>>
1657
 
 
1658
 
 
1659
 
 
1660
 
\<empty picture\><<<
1661
 
empty_pic->n
1662
 
>>>
1663
 
 
1664
 
 
1665
 
 
1666
 
\SubSection{Pictorial Symbols}
1667
 
 
1668
 
 
1669
 
\<translate symbol gifs\><<<
1670
 
                  Q_CHAR filename[255];
1671
 
                  FILE* file;
1672
 
(IGNORED) strcpy(filename, "");
1673
 
if( dir ){ (IGNORED) strct(filename, dir); }
1674
 
(IGNORED) strct(filename, match[3]);
1675
 
file  = fopen(filename, READ_TEXT_FLAGS);  
1676
 
if( !file ){
1677
 
   `<dvi symbols into gif`>
1678
 
} else { 
1679
 
   (IGNORED) fclose(file);  
1680
 
   (IGNORED) printf("%s already in %s\n", match[3], 
1681
 
                           dir? dir : "current directory" );
1682
 
}
1683
 
>>>
1684
 
 
1685
 
 
1686
 
 
1687
 
\SubSection{The Conversion Code}
1688
 
 
1689
 
 
1690
 
\<dvi into gif\><<<
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,".","");
1694
 
}
1695
 
if( ch_mod && !system_return ){
1696
 
  (void) execute_script(chmod_script, ch_mod, dir?dir:"",match[3], "");
1697
 
}
1698
 
>>>
1699
 
 
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,".","");
1705
 
}
1706
 
if( ch_mod && !system_return ){
1707
 
  (void) execute_script(chmod_script, ch_mod, dir?dir:"",match[3], "");
1708
 
}
1709
 
>>>
1710
 
 
1711
 
 
1712
 
 
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.
1720
 
 
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.
1723
 
 
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.
1730
 
 
1731
 
 
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
1736
 
 > collapses). 
1737
 
 
1738
 
The understanding is correct.
1739
 
 
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.
1746
 
 
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.
1751
 
 
1752
 
-eitan
1753
 
 
1754
 
 
1755
 
 
1756
 
 
1757
 
Example
1758
 
========
1759
 
 A version of
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
1763
 
creating new ones.
1764
 
 
1765
 
A version with a time stamp of at least 1998-11-23-17-30 allows
1766
 
also the use of
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.)
1771
 
%
1772
 
1773
 
% Scripts within tex4ht.env
1774
 
% -------------------------
1775
 
1776
 
% GDEL tmp.ps
1777
 
% Gdvips -mode ibmvga -D 110 -f %%1 -pp %%2  -o tmp.ps
1778
 
% GDEL %%3
1779
 
% Gconvert -crop 0x0 -density 110x110 -transparent '#FFFFFF' tmp.ps %%3
1780
 
% Fglyphgif %%1 %%2 %%3
1781
 
1782
 
% File glyphgif.bat
1783
 
% -----------------
1784
 
1785
 
% if exist c:/cache/%3
1786
 
% COPY c:/cache/%3 %3 
1787
 
% goto done
1788
 
% DEL tmp.ps
1789
 
% dvips -mode ibmvga -D 110 -f %1 -pp %2  -o tmp.ps
1790
 
% DEL %3
1791
 
% convert -crop 0x0 -density 110x110 -transparent '#FFFFFF' tmp.ps %3
1792
 
% COPY %3 c:/cache/%3
1793
 
% :done
1794
 
%
1795
 
 
1796
 
\EndVerbatim\EndHPage{}]\fi
1797
 
 
1798
 
 
1799
 
 
1800
 
 
1801
 
 
1802
 
 
1803
 
 
1804
 
 
1805
 
 
1806
 
 
1807
 
 
1808
 
 
1809
 
 
1810
 
 
1811
 
 
1812
 
 
1813
 
 
1814
 
 
1815
 
 
1816
 
 
1817
 
 
1818
 
 
1819
 
 
1820
 
 
1821
 
\<header functions\><<<
1822
 
static void execute_script( 
1823
 
  ARG_V(struct script_struct*,Q_CHAR *,char *,Q_CHAR *,Q_CHAR *) );
1824
 
>>>
1825
 
 
1826
 
\<functions\><<<
1827
 
`[
1828
 
static void execute_script(script,match_1,match_2,match_3,match_4)  
1829
 
                    struct script_struct* script`;
1830
 
                    Q_CHAR * match_1`;
1831
 
                    Q_CHAR * match_2`;
1832
 
                    Q_CHAR * match_3`;
1833
 
                    Q_CHAR * match_4
1834
 
 
1835
 
;{                               struct script_struct* temp;
1836
 
                                 Q_CHAR *p, *q, *t;
1837
 
   temp = script;  system_return = 0;
1838
 
   while( temp ){
1839
 
      `<command = temp-command`>
1840
 
      if( (command[0] != '\0') && !system_return ){
1841
 
         `<execute system command`> }
1842
 
      temp = temp->next;
1843
 
}  }
1844
 
>>>
1845
 
 
1846
 
 
1847
 
We went to \`'%%%', \`'%%1', ... instead of  \`'%%', \`'%1', ... 
1848
 
to accomodate some needds of dos.  Example (yet, where exactly the
1849
 
conflict is?):
1850
 
 
1851
 
\Verbatim
1852
 
if exist %1.dvi goto yes_dvi
1853
 
goto end
1854
 
yes_dvi:
1855
 
DEL tmp.ps
1856
 
call dvips32  -f %1 -p %2 -l %2 -o tmp.ps  -mode ibmvga -D 110
1857
 
DEL %3
1858
 
call convert -crop 0x0 -density 110x110 -transparent '#FFFFFF' tmp.ps %3
1859
 
end:
1860
 
\EndVerbatim
1861
 
 
1862
 
 
1863
 
 
1864
 
\<command = temp-command\><<<
1865
 
p = temp->command;
1866
 
q = command;
1867
 
while( *p != '\0' ){
1868
 
  *q = *(p++);
1869
 
  if( (*q == '%') && (*p == '%') 
1870
 
     && ((*(p+1) == '%')  || ( (*(p+1) > '0') && (*(p+1) < '5') ) )
1871
 
  ){  p++;
1872
 
    switch( *(p++) ){
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; }
1882
 
      default: {  }
1883
 
  }} else { q++; }
1884
 
}
1885
 
*q = '\0';
1886
 
>>>
1887
 
 
1888
 
 
1889
 
 
1890
 
 
1891
 
 
1892
 
 
1893
 
 
1894
 
\Verbatim
1895
 
 
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)
1901
 
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 :-}
1904
 
 
1905
 
\EndVerbatim
1906
 
 
1907
 
\Verbatim
1908
 
dvips -mode $mf -D $density -f $_[0] -pp $_[1] > tmp.ps
1909
 
\EndVerbatim
1910
 
 
1911
 
\<defines\><<<      
1912
 
#ifndef HTFDIR
1913
 
#define HTFDIR      ""
1914
 
#endif
1915
 
>>>
1916
 
 
1917
 
 
1918
 
 
1919
 
 
1920
 
 
1921
 
Was \''dvips -f $_[0] $magnification -pp $_[1] > tmp.ps'
1922
 
 
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.
1929
 
 
1930
 
My guess this problem should be trivial to fix, just by changing the
1931
 
values of
1932
 
 
1933
 
    $density = "110";    $mf = "ibmvga";
1934
 
 
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.
1938
 
 
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.
1942
 
 
1943
 
\EndVerbatim\EndHPage{}]\fi
1944
 
 
1945
 
 
1946
 
 
1947
 
 
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''.
1953
 
 
1954
 
 
1955
 
 
1956
 
 
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.
1962
 
 
1963
 
/n/candy/0/tex/teTeX/texmf/metafont/misc/modes.mf
1964
 
 
1965
 
\EndVerbatim\EndHPage{}]\fi
1966
 
 
1967
 
 
1968
 
 
1969
 
 
1970
 
 
1971
 
 
1972
 
 
1973
 
\Verbatim
1974
 
convert -crop 0x0 -density $density"."x"."$density"
1975
 
                 ." -transparent #FFFFFF tmp.ps $_[2]"
1976
 
 
1977
 
convert -crop 0x0 -transparent '#'FFFFFF "."$density  tmp.ps $_[2]
1978
 
\EndVerbatim
1979
 
 
1980
 
 
1981
 
 
1982
 
 
1983
 
 
1984
 
 
1985
 
\List{*}
1986
 
\item
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.
1991
 
 
1992
 
\`@         $command = "giftrans -t '#'ffffff tmp.gif > \n";
1993
 
         if( &system_command($_[2]) ){@
1994
 
 
1995
 
\item Crop removes the edges of the background color, and it should appear 
1996
 
before that color is made transparent.
1997
 
 
1998
 
\item
1999
 
The following error occurs when the picture is outside the boundaries
2000
 
of the page.
2001
 
 
2002
 
\Verbatim
2003
 
convert   -dither -monochrome tmp.ps tmp.gif
2004
 
convert: Unable to crop image (geometry does not contain image).
2005
 
\EndVerbatim
2006
 
\EndList
2007
 
 
2008
 
 
2009
 
 
2010
 
 
2011
 
\ifHtml[\HPage{quality}
2012
 
\Link[ftp://204.183.81.131/pub/ImageMagick/www/Magick.html\#C22]{}{}q+a\EndLink
2013
 
\Verbatim
2014
 
When I convert Postscript to another format, how can I improve the appearance of the text? 
2015
 
 
2016
 
     Simple. Increase the dots-per-inch when converting and sub-sample: 
2017
 
 
2018
 
    convert -density 288 -geometry 25% image.ps image.gif
2019
 
 
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. 
2022
 
 
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
2025
 
will be larger. 
2026
 
 
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. 
2030
 
 
2031
 
\EndVerbatim\EndHPage{}]\fi
2032
 
{} --
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
2038
 
{} --
2039
 
\ifHtml[\HPage{ppmtogif}\Verbatim
2040
 
ppmtogif(1)                                                     ppmtogif(1)
2041
 
                                 30 June 1993
2042
 
 
2043
 
 NAME
2044
 
      ppmtogif - convert a portable pixmap into a GIF file
2045
 
 
2046
 
 SYNOPSIS
2047
 
      ppmtogif [-interlace] [-sort] [-map mapfile] [-transparent color]
2048
 
      [ppmfile]
2049
 
 
2050
 
 DESCRIPTION
2051
 
      Reads a portable pixmap as input.  Produces a GIF file as output.
2052
 
 
2053
 
 OPTIONS
2054
 
      -interlace
2055
 
           Tells the program to produce an interlaced GIF file.
2056
 
 
2057
 
      -sort
2058
 
           Produces a GIF file with a sorted color map.
2059
 
 
2060
 
      -map mapfile
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:
2067
 
 
2068
 
           ppmquant -floyd -map mapfile
2069
 
 
2070
 
      -transparent color
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
2074
 
           software.
2075
 
 
2076
 
      All flags can be abbreviated to their shortest unique prefix.
2077
 
 
2078
 
 SEE ALSO
2079
 
      giftoppm(1), ppmquant(1), ppm(5)
2080
 
 
2081
 
 AUTHOR
2082
 
      Based on GIFENCOD by David Rowley <mgardi@watdcsu.waterloo.edu>.
2083
 
      Lempel-Ziv compression based on "compress".
2084
 
\EndVerbatim\EndHPage{}]\fi
2085
 
{} --
2086
 
\ifHtml[\HPage{Ghostscript}\Verbatim
2087
 
 NAME
2088
 
      gs - Aladdin Ghostscript interpreter/previewer
2089
 
 
2090
 
 SYNOPSIS
2091
 
      gs [ options ] [ files ] ...
2092
 
 
2093
 
 DESCRIPTION
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.
2102
 
 
2103
 
      The interpreter recognizes several switches described below, which may
2104
 
      appear anywhere in the command line and apply to all files thereafter.
2105
 
 
2106
 
      You can get a help message by invoking Ghostscript with the -h or -?
2107
 
      option.  This message also lists the available devices.
2108
 
 
2109
 
 
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
2113
 
           -sDEVICE=xyz
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
2119
 
      instead of just
2120
 
           gs myfile.ps
2121
 
      Alternatively, you can type
2122
 
           (epson) selectdevice
2123
 
           (myfile.ps) run
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.,
2127
 
           (vga) selectdevice
2128
 
      or
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:
2133
 
           selectdevice
2134
 
           (command line)
2135
 
           GS_DEVICE
2136
 
           (first device in build list)
2137
 
 
2138
 
      To select the density on a printer, use
2139
 
 
2140
 
                                    - 1 -       Formatted:  October 11, 1998
2141
 
 
2142
 
 GS(1)                                                                 GS(1)
2143
 
                              23 September 1996
2144
 
 
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.
2151
 
 
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
2162
 
 
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
2166
 
      switch
2167
 
           -sOutputFile=\|lpr
2168
 
      You can also send output to stdout for piping with the switch
2169
 
           -sOutputFile=-
2170
 
      In this case you must also use the -q switch, to prevent Ghostscript
2171
 
      from writing messages to stdout.
2172
 
 
2173
 
      To find out what devices are available, type
2174
 
           devicenames ==
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
2178
 
      available devices.
2179
 
 
2180
 
      To select a different paper size, use the command line switch
2181
 
              -sPAPERSIZE=a_known_paper_size
2182
 
      e.g.,
2183
 
              -sPAPERSIZE=a4
2184
 
      or
2185
 
              -sPAPERSIZE=legal
2186
 
      As of this printing, the known paper sizes, defined in gs_statd.ps,
2187
 
      are:
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
2196
 
 
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
2221
 
 
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:
2230
 
 
2231
 
      1.   The directory/ies specified by the -I switch(es) in the command
2232
 
           line (see below), if any;
2233
 
 
2234
 
      2.   The directory/ies specified by the GS_LIB environment variable,
2235
 
           if any;
2236
 
 
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).
2241
 
 
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 `:'.
2244
 
 
2245
 
 X RESOURCES
2246
 
      Ghostscript looks for the following resources under the program name
2247
 
      `Ghostscript':
2248
 
 
2249
 
      borderWidth
2250
 
           The border width in pixels (default = 1).
2251
 
 
2252
 
      borderColor
2253
 
           The name of the border color (default = black).
2254
 
 
2255
 
      geometry
2256
 
 
2257
 
                                    - 3 -       Formatted:  October 11, 1998
2258
 
 
2259
 
 ()                                                                       ()
2260
 
 
2261
 
           The window size and placement, WxH+X+Y (default is NULL).
2262
 
 
2263
 
      xResolution
2264
 
           The number of x pixels per inch (default is computed from
2265
 
           WidthOfScreen and WidthMMOfScreen).
2266
 
 
2267
 
      yResolution
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).
2271
 
 
2272
 
      useBackingPixmap
2273
 
           Determines whether backing store is to be used for saving display
2274
 
           window (default = true).
2275
 
 
2276
 
      See the file `use.txt' for a more complete list of resources.
2277
 
 
2278
 
      To set these resources, put them in a file (such as ~/.Xresources) in
2279
 
      the following form:
2280
 
 
2281
 
                Ghostscript*geometry: 612x792-0+0
2282
 
                Ghostscript*xResolution: 72
2283
 
                Ghostscript*yResolution: 72
2284
 
 
2285
 
      Then load the defaults into the X server:
2286
 
 
2287
 
                % xrdb -merge ~/.Xresources
2288
 
 
2289
 
 OPTIONS
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
2296
 
           back to the shell.
2297
 
 
2298
 
      -Dname=token
2299
 
      -dname=token
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.
2303
 
 
2304
 
      -Dname
2305
 
      -dname
2306
 
           Define a name in systemdict with value=null.
2307
 
 
2308
 
      -Sname=string
2309
 
      -sname=string
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
2313
 
 
2314
 
                                           /name 35 def
2315
 
           whereas -s name=35 is equivalent to
2316
 
                                           /name (35) def
2317
 
 
2318
 
      -q   Quiet startup - suppress normal startup messages, and also do the
2319
 
           equivalent of -dQUIET.
2320
 
 
2321
 
      -gnumber1xnumber2
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.
2325
 
 
2326
 
      -rnumber
2327
 
      -rnumber1xnumber2
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
2332
 
           resolutions.)
2333
 
 
2334
 
      -Idirectories
2335
 
           Adds the designated list of directories at the head of the search
2336
 
           path for library files.
2337
 
 
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.
2344
 
 
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
2348
 
      dictionaries.)
2349
 
 
2350
 
 SPECIAL NAMES
2351
 
      -dDISKFONTS
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.
2356
 
 
2357
 
      -dNOCACHE
2358
 
 
2359
 
       Disables character caching.  Only useful for debugging.
2360
 
 
2361
 
      -dNOBIND
2362
 
           Disables the `bind' operator.  Only useful for debugging.
2363
 
 
2364
 
      -dNODISPLAY
2365
 
           Suppresses the normal initialization of the output device.  This
2366
 
 
2367
 
                                    - 5 -       Formatted:  October 11, 1998
2368
 
 
2369
 
 ()                                                                       ()
2370
 
 
2371
 
           may be useful when debugging.
2372
 
 
2373
 
      -dNOPAUSE
2374
 
           Disables the prompt and pause at the end of each page.  This may
2375
 
           be desirable for applications where another program is `driving'
2376
 
           Ghostscript.
2377
 
 
2378
 
      -dNOPLATFONTS
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.
2382
 
 
2383
 
      -dSAFER
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.
2387
 
 
2388
 
      -dWRITESYSTEMDICT
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.
2392
 
 
2393
 
      -sDEVICE=device
2394
 
           Selects an alternate initial output device, as described above.
2395
 
 
2396
 
      -sOutputFile=filename
2397
 
           Selects an alternate output file (or pipe) for the initial output
2398
 
           device, as described above.
2399
 
 
2400
 
 FILES
2401
 
      /usr/local/share/ghostscript/M.N/*
2402
 
           Startup-files, utilities, and basic font definitions.
2403
 
 
2404
 
      /usr/local/share/ghostscript/fonts/*
2405
 
 
2406
 
      -sOutputFile=filename
2407
 
           Selects an alternate output file (or pipe) for the initial output
2408
 
           device, as described above.
2409
 
 
2410
 
 FILES
2411
 
      /usr/local/share/ghostscript/M.N/*
2412
 
           Startup-files, utilities, and basic font definitions.
2413
 
 
2414
 
      /usr/local/share/ghostscript/fonts/*
2415
 
           Additional font definitions.
2416
 
 
2417
 
      /usr/local/share/ghostscript/M.N/examples/*
2418
 
           Demo Ghostscript files.
2419
 
 
2420
 
      /usr/local/share/ghostscript/M.N/doc/*
2421
 
           Assorted document files.
2422
 
 
2423
 
 ENVIRONMENT
2424
 
      GS_OPTIONS
2425
 
           String of options to be processed before the command line
2426
 
           options.
2427
 
 
2428
 
      GS_DEVICE
2429
 
           Used to define the device used.
2430
 
 
2431
 
      GS_FONTPATH
2432
 
()                                                                       ()
2433
 
 
2434
 
           Path names used to search for fonts
2435
 
 
2436
 
      GS_LIB
2437
 
           Path names for initialization files and fonts
2438
 
 
2439
 
      TEMP Where temporary files are made
2440
 
 
2441
 
 SEE ALSO
2442
 
      The various Ghostscript document files (above).
2443
 
 
2444
 
 BUGS
2445
 
      See the network news group `comp.lang.postscript'.
2446
 
 
2447
 
\EndVerbatim\EndHPage{}]\fi
2448
 
{} --
2449
 
\Link[http://www.fourmilab.ch/webtools/textogif/textogif.html]{}{}dvi to
2450
 
gif (John Walker)
2451
 
\EndLink{} --
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.  
2457
 
 
2458
 
If the problem is trivial to fix, I'll appreciate your advice.
2459
 
Otherwise, please ignore this email. 
2460
 
 
2461
 
-eitan
2462
 
 
2463
 
 
2464
 
 
2465
 
 
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
2472
 
dir tmp*
2473
 
 
2474
 
\EndVerbatim\EndHPage{}]\fi {} --
2475
 
\ifHtml[\HPage{dvips + gs}\Verbatim
2476
 
#!/bin/sh
2477
 
dvitogif ()
2478
 
{
2479
 
  density=100
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
2486
 
  rm $T
2487
 
}
2488
 
for i in 1 2 3 4 ; do
2489
 
  dvitogif $i resume
2490
 
done
2491
 
 
2492
 
 
2493
 
\EndVerbatim\EndHPage{}]\fi{} --
2494
 
\ifHtml[\HPage{cropping}\Verbatim
2495
 
 
2496
 
> but how
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.
2499
 
 
2500
 
I can't locate any reference, but I believe convert is set to crop white
2501
 
margins.
2502
 
 
2503
 
pnmcrop trims white margins in the default setting, and has a command
2504
 
line switch to request trimming of black margins (pnmcrop -h).
2505
 
 
2506
 
 
2507
 
\EndVerbatim\EndHPage{}]\fi {} --
2508
 
\ifHtml[\HPage{more}\Verbatim
2509
 
Script for ps2gif:
2510
 
     #!/bin/sh
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
2515
 
     exit 1
2516
 
     else 
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
2520
 
     fi
2521
 
 
2522
 
 
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 
2526
 
 
2527
 
     The basic idea in UNIX is to make gif files via something like
2528
 
     gs -q -dNOPAUSE -dSAFER -sDEVICE=ppmraw -sOutputFile=- - | ppmtogif
2529
 
 
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
2533
 
     for each image. 
2534
 
 
2535
 
pstoepsi: Script that with -bbonly option places a BoundingBox comment in your PostScript file. 
2536
 
 
2537
 
 
2538
 
Image Magick: free C/C++ source code for ps2jpg conversion. Needs and uses ghostscript for the
2539
 
     conversions. 
2540
 
 
2541
 
 
2542
 
 
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)
2546
 
          psutils source code 
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)
2553
 
          psutils source code 
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 
2558
 
 
2559
 
 
2560
 
 
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. 
2564
 
 
2565
 
 
2566
 
Converting PostScript to Pixelmap 
2567
 
onverting PostScript to Pixelmap
2568
 
 
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
2571
 
 
2572
 
 
2573
 
 3.2 How can I convert PostScript to a bitmap or pixmap? 
2574
 
 
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: 
2578
 
 
2579
 
    gs -sDEVICE=ppmraw -sOutputFile=file.ppm file.ps 
2580
 
 
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 
2584
 
    want. 
2585
 
 
2586
 
    You can also use the ImageMagick-tools program ``convert''. Try 
2587
 
    ftp.x.org in contrib/ImageMagick.tar.Z. 
2588
 
 
2589
 
    If you have the new xv installed, it can now read PostScript files, 
2590
 
    and it stores them to any format. 
2591
 
 
2592
 
 
2593
 
 
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.
2598
 
 
2599
 
 
2600
 
 
2601
 
 
2602
 
# External programs needed
2603
 
# ------------------------
2604
 
$gs         = "gs";
2605
 
$tmpdir     = ".";
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";
2611
 
 
2612
 
 
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.
2616
 
 
2617
 
 
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.
2624
 
 
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
2629
 
little.
2630
 
 
2631
 
 
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. 
2637
 
 
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.
2643
 
 
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 
2647
 
work. Questions:
2648
 
 
2649
 
1. is my understanding correct? -P ibmvga should cause dvips to look for 
2650
 
config.ibmvga?
2651
 
 
2652
 
2. is this file supposed to be anywhere special?  (I've been putting it in the 
2653
 
same directory as config.ps). 
2654
 
 
2655
 
Thanks for any help on this!
2656
 
 
2657
 
Philip A. Viton
2658
 
------------------
2659
 
City Planning, Ohio State University
2660
 
pviton@magnus.acs.ohio-state.edu
2661
 
 
2662
 
 
2663
 
 
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
2672
 
Lines: 40
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
2679
 
 
2680
 
>>>>> pviton@magnus.acs.ohio-state.edu (Philip A. Viton) (PAV) writes:
2681
 
 
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.
2687
 
 
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
2693
 
PAV> config.
2694
 
 
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:
2699
 
 
2700
 
PAV> 1. is my understanding correct? -P ibmvga should cause dvips to look for 
2701
 
PAV> config.ibmvga?
2702
 
 
2703
 
Yes.
2704
 
 
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).
2707
 
 
2708
 
Yes.
2709
 
 
2710
 
BUT: for the mode to be correct you have to insert a line M ibmvga in the
2711
 
file config.ibmvga.
2712
 
 
2713
 
 
2714
 
 
2715
 
From cottrell@ricardo.ecn.wfu.edu Thu Oct 29 00:34:02 EST 1998
2716
 
Organization: Wake Forest University
2717
 
 
2718
 
> 1. is my understanding correct? -P ibmvga should cause dvips to look for
2719
 
> config.ibmvga?
2720
 
 
2721
 
Yes.
2722
 
 
2723
 
> 2. is this file supposed to be anywhere special?  (I've been putting it in the
2724
 
> same directory as config.ps).
2725
 
 
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.
2731
 
 
2732
 
Allin Cottrell
2733
 
Department of Economics
2734
 
Wake Forest University, NC
2735
 
 
2736
 
 
2737
 
-P printername
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
2754
 
> formats
2755
 
 
2756
 
This is trivial with a script (.BAT) file:
2757
 
 
2758
 
   latex $1.tex
2759
 
   dvips -E -o $1.eps %1.dvi
2760
 
   gs -sDEVICE=foo -sOutputFile=%1.foo -q %1.eps
2761
 
 
2762
 
You can add various footoppm and pnmtofoo commands, and things like 
2763
 
giftrans.
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. 
2769
 
 
2770
 
                gs file.ps
2771
 
                gs> (file) ppm24run
2772
 
                gs> quit
2773
 
                ppmtogif file.ppm >file.gif
2774
 
                rm file.ppm
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
2783
 
# background.
2784
 
#
2785
 
# Optionally you can include the image filename, type, width, height, or
2786
 
# other image attributes by embedding special format characters=>
2787
 
2788
 
#   %b   file size
2789
 
#   %d   directory
2790
 
#   %e   filename extention
2791
 
#   %f   filename
2792
 
#   %h   height
2793
 
#   %l   label
2794
 
#   %m   magick
2795
 
#   %p   page number
2796
 
#   %s   scene number
2797
 
#   %t   top of filename
2798
 
#   %u   unique temporary filename
2799
 
#   %w   width
2800
 
#   %x   x resolution
2801
 
#   %y   y resolution
2802
 
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).
2810
 
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.
2817
 
2818
 
# If you use a less-equal-greater sign (<=>) the delegate is bi-directional.
2819
 
# Delegates must be separated with a blank line.
2820
 
#
2821
 
# Lines that begin with a pound sign (#) are comments and are ignored.
2822
 
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.
2826
 
2827
 
# ImageMagick looks for the delegate configurarion file in this order:
2828
 
#
2829
 
#     /usr/local/share/ImageMagick/delegates.mgk
2830
 
#     DELEGATE_PATH/delegates.mgk
2831
 
#     HOME/.magick/delegates.mgk
2832
 
#     ./delegates.mgk
2833
 
#
2834
 
# Where DELEGATE_PATH and HOME are environment variables.
2835
 
#
2836
 
# Like entries in the later two directory overrides the specification
2837
 
# in the system-wide delegates file.
2838
 
2839
 
 
2840
 
<=bzip
2841
 
        |/usr/local/bin/bzip2 -f > %o
2842
 
 
2843
 
<=compress
2844
 
        |/usr/bin/compress -c > %o
2845
 
 
2846
 
<=gs-eps
2847
 
        /usr/local/bin/gs -sDEVICE=epswrite -q -dNOPAUSE -dSAFER \
2848
 
          -sOutputFile="%s" -- "%s" -c quit
2849
 
 
2850
 
<=gs-pdf
2851
 
        /usr/local/bin/gs -sDEVICE=pdfwrite -q -dNOPAUSE -dSAFER \
2852
 
          -sOutputFile="%s" -- "%s" -c quit
2853
 
 
2854
 
<=gs-ps
2855
 
        /usr/local/bin/gs -sDEVICE=pswrite -q -dNOPAUSE -dSAFER \
2856
 
          -sOutputFile="%s" -- "%s" -c quit
2857
 
 
2858
 
<=zip
2859
 
        |/usr/local/bin/gzip -cf > %o
2860
 
 
2861
 
browse=>
2862
 
        /usr/local/bin/netscape http://www.wizards.dupont.com/cristy/ImageMagick.html &
2863
 
 
2864
 
bzip=>
2865
 
        |/usr/local/bin/bzip2 -cd %i
2866
 
 
2867
 
cgm=>
2868
 
        /usr/local/bin/ralcgm -d ps %i %o %u
2869
 
        /usr/bin/mv %o.ps %o
2870
 
        /usr/bin/rm -f %u
2871
 
 
2872
 
compress=>
2873
 
        |/usr/bin/uncompress -c %i
2874
 
 
2875
 
dvi=>
2876
 
        /usr/local/bin/dvips -q -o %o %i
2877
 
 
2878
 
edit=>
2879
 
        /usr/X11R6.4/bin/xterm -title "Edit Image Comment" -e vi %i
2880
 
 
2881
 
file=>
2882
 
        /usr/local/bin/GET %m:%i > %o 2>&1
2883
 
 
2884
 
fig=>
2885
 
        /usr/local/bin/fig2dev -L ps %i %o
2886
 
 
2887
 
ftp=>
2888
 
        /usr/local/bin/GET %m:%i > %o 2>&1
2889
 
 
2890
 
gs-color=>
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
2894
 
 
2895
 
gs-mono=>
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
2899
 
 
2900
 
hpgl=>
2901
 
        /usr/local/bin/hp2xx -q -m eps -f %i %o
2902
 
 
2903
 
htm=>
2904
 
        /usr/local/bin/html2ps -o %o %i
2905
 
 
2906
 
html=>
2907
 
        /usr/local/bin/html2ps -o %o %i
2908
 
 
2909
 
http=>
2910
 
        /usr/local/bin/GET %m:%i > %o 2>&1
2911
 
 
2912
 
launch=>pnm
2913
 
        /usr/local/bin/gimp %i
2914
 
 
2915
 
mpg=>
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
2919
 
 
2920
 
m2v=>
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
2924
 
 
2925
 
pgp=>
2926
 
        /usr/local/bin/pgpv -fq %i
2927
 
 
2928
 
pnm<=win
2929
 
        /usr/local/bin/display -immutable %i
2930
 
 
2931
 
print=>ps
2932
 
        /usr/bin/lp -c -s %i
2933
 
 
2934
 
rad=>
2935
 
        /usr/local/bin/ra_ppm -g 1.0 %i %o
2936
 
 
2937
 
rgba<=rle
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
2940
 
 
2941
 
scan=>
2942
 
        scanimage  -d %i > %o
2943
 
 
2944
 
show=>%m
2945
 
        /usr/local/bin/display -immutable -window_group %g -title "%l of %f" tmp:%i &
2946
 
 
2947
 
shtml=>
2948
 
        /usr/local/bin/html2ps -o %o %i
2949
 
 
2950
 
yuv<=m2v
2951
 
        /usr/local/bin/mpeg2encode %u %o
2952
 
        /usr/bin/rm -f %i*.yuv %u*
2953
 
 
2954
 
yuv<=mpg
2955
 
        /usr/local/bin/mpeg2encode %u %o
2956
 
        /usr/bin/rm -f %i*.yuv %u*
2957
 
 
2958
 
zip=>
2959
 
        |/usr/local/bin/gzip -cdfq %i
2960
 
 
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.
2965
 
 
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.
2968
 
 
2969
 
I have X Free86 operating, and a few other things, but was trying to
2970
 
aviod loading in too many more packages.
2971
 
 
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.
2977
 
 
2978
 
In any case, here are the steps involved :
2979
 
 
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.
2990
 
 
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.
2994
 
 
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).
2998
 
 
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.
3005
 
 
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
3010
 
system.
3011
 
 
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
3015
 
buzzwords.
3016
 
 
3017
 
Two "automatic" methods mentioned involved were based on latex2html 
3018
 
and hyperlatex.
3019
 
 
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.
3026
 
 
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/
3030
 
 
3031
 
They sound interesting, but necessitate loading in extra packages.
3032
 
 
3033
 
A system using translated .tex is :
3034
 
 
3035
 
    http://www.cse.ohio-state.edu/~gurari/TeX4ht/mn.html
3036
 
 
3037
 
More information is obtainable in :
3038
 
 
3039
 
  ftp://ftp.cse.ohio-state.edu/pub/tex/osu/gurari/TeX4ht/dos/port/readme.html
3040
 
 
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
3045
 
interesting.
3046
 
 
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".
3050
 
 
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.
3053
 
 
3054
 
As for more general issues, it was noted that :
3055
 
 
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. 
3060
 
 
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 
3065
 
        Netscape on Linux.
3066
 
 
3067
 
        The plugin is called "techexplorer." 
3068
 
 
3069
 
        Downloads and information are available at:
3070
 
        http://www.ics.raleigh.ibm.com/ics/techexp.htm
3071
 
 
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.
3075
 
 
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
3079
 
originated by them.
3080
 
 
3081
 
 
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
3092
 
Lines: 55
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
3097
 
Mime-Version: 1.0
3098
 
Content-Type: text/plain; charset=us-ascii
3099
 
Content-Transfer-Encoding: 7bit
3100
 
X-Mailer: Mozilla 3.0 (Win16; U)
3101
 
 
3102
 
Joann Taylor wrote:
3103
 
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?
3117
 
3118
 
> Many thanks,
3119
 
3120
 
> Joann
3121
 
 
3122
 
Hi, Joann!
3123
 
 
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).
3128
 
 
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.
3132
 
 
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.
3136
 
 
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
3141
 
degree or another.
3142
 
 
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.
3147
 
 
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.
3151
 
Ken
3152
 
 
3153
 
Are you interested in   |
3154
 
byte-sized education    |   http://www.play-hookey.com
3155
 
over the Internet?      |
3156
 
\EndVerbatim\EndHPage{}]\fi
3157
 
{} --
3158
 
\ifHtml[\HPage{quick conversion}
3159
 
Provide a fast option
3160
 
 
3161
 
 
3162
 
\Verbatim
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.
3167
 
3168
 
> dvips [arguments] file.idv  -o temp.ps
3169
 
3170
 
> will write a single .ps file with multiple pages, one for
3171
 
> each image.  
3172
 
3173
 
> convert temp.ps [arguments] image%03d.gif
3174
 
3175
 
> will take that file and produce one image gif per page
3176
 
> The names of the files are image000.gif, image001.gif, etc.
3177
 
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.
3182
 
 
3183
 
This will be a superior approach, provided you have access 
3184
 
to sufficient memory.  It is rarely the case for me :-(
3185
 
 
3186
 
\EndVerbatim
3187
 
 
3188
 
 
3189
 
 
3190
 
 
3191
 
 
3192
 
 
3193
 
 
3194
 
 
3195
 
 
3196
 
\Verbatim
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
3205
 
Mime-Version: 1.0
3206
 
Content-Type: text/plain; charset=us-ascii
3207
 
 
3208
 
 
3209
 
The perl script enclosed below seems to be faster than
3210
 
simply running file.lg through the shell.
3211
 
 
3212
 
Doug
3213
 
 
3214
 
 
3215
 
 
3216
 
#!/ms/dist/perl5/bin/perl5 -sw
3217
 
#
3218
 
 
3219
 
if (!@ARGV || !($#ARGV==0)) {
3220
 
    die "readLog takes one argument, the file to be read.\n";
3221
 
}
3222
 
 
3223
 
$file = $ARGV[0];
3224
 
 
3225
 
if (! -e $file || ! -r $file || !open(INPUT,"<$file")) {
3226
 
    die "The specified file does not exist or cannot be opened.\n";
3227
 
}
3228
 
 
3229
 
# 2-state machine passing through the input file looking for
3230
 
# lines with dvips or convert information.
3231
 
$state = undef;
3232
 
@names = ();  
3233
 
for (<INPUT>) {
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
3238
 
        } else {
3239
 
            die "Error:Input file $file, two dvips lines, no convert.\n";
3240
 
        }
3241
 
        next;
3242
 
    }
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";
3247
 
        } else {
3248
 
            $names[$state] = $2;  # store the file name with its number
3249
 
            $state = undef;  # reset the machine
3250
 
        }
3251
 
    }
3252
 
}
3253
 
 
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";
3258
 
}
3259
 
 
3260
 
\EndVerbatim
3261
 
 
3262
 
 
3263
 
 
3264
 
 
3265
 
{Shell Note}
3266
 
 
3267
 
\Verbatim
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
3273
 
> Mime-Version: 1.0
3274
 
> Content-Type: text/plain; charset=us-ascii
3275
 
3276
 
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.
3286
 
3287
 
> You might write  
3288
 
>       #!/bin/sh 
3289
 
> as the first line of the file.lg file.  That would 
3290
 
> avoid such problems for most people.  
3291
 
3292
 
> I'm having little sucess with getting larger images, but
3293
 
> I'll keep trying.  
3294
 
 
3295
 
\EndVerbatim
3296
 
 
3297
 
{MF Mode}
3298
 
 
3299
 
 
3300
 
\Verbatim
3301
 
 
3302
 
 
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.  
3306
 
 
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).  
3314
 
 
3315
 
 
3316
 
\EndVerbatim
3317
 
\EndHPage{}]\fi
3318
 
{} --
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:
3323
 
 
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)
3327
 
 
3328
 
   My personal default setting relies on the following entry.
3329
 
    
3330
 
    
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);
3336
 
      mode_common_setup_;
3337
 
    enddef;
3338
 
 
3339
 
b. Inform  the mode and its density to dvips through the switches
3340
 
   `mode' and `D'.   In my default setting this means 
3341
 
    
3342
 
         dvips -mode ibmvga -D 110 ...
3343
 
 
3344
 
c. Inform convert what density is in use.  In my default setting
3345
 
   this means
3346
 
 
3347
 
       convert -density 110x110 ...
3348
 
 
3349
 
The conversion process is slow also on my site.
3350
 
 
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.
3353
 
 
3354
 
-eitan
3355
 
 
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.
3362
 
 
3363
 
--------------------------------------------------------
3364
 
 
3365
 
 
3366
 
 
3367
 
 
3368
 
 
3369
 
 
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)
3377
 
 
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.)
3386
 
 
3387
 
\EndVerbatim\EndHPage{}]\fi
3388
 
{} --
3389
 
\ifHtml[\HPage{more}\Verbatim
3390
 
 >> 0x12aaa8: 0x02 dict --Lwrx--- 0x0000 0x0012fb10
3391
 
 >> 0x12aab0: 0x02 dict --Gwrx--- 0x0000 0x0012ac00
3392
 
 >>
3393
 
 >> Has anybody else experienced similar difficulties?
3394
 
 
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
3399
 
filenames).
3400
 
 
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 :
3406
 
>
3407
 
> echo Creating .ppm file
3408
 
> pcxtoppm tmp00%2.pcx > ppm00%2.ppm   =20
3409
 
> echo Cropping it
3410
 
> pnmcrop ppm00%2.ppm > ppm10%2.ppm
3411
 
> echo Creating .gif (transparent) file
3412
 
> ppmtogif -transparent 1,1,1 ppm10%2.ppm > %3
3413
 
>
3414
 
> It seems to do a good work...
3415
 
 
3416
 
 
3417
 
\EndVerbatim\EndHPage{}]\fi {} --
3418
 
\ifHtml[\HPage{about convert}\Verbatim
3419
 
 
3420
 
     Postscript 
3421
 
 
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 {} --
3433
 
%
3434
 
[\HPage{reuseable}\Verbatim
3435
 
#/bin/sh
3436
 
#
3437
 
#  Usage
3438
 
#    tex4ht.makegif basename pagenumber destination
3439
 
#
3440
 
####################################################
3441
 
#
3442
 
# Produce the image in postscript form, as $3.new.ps
3443
 
#
3444
 
dvips -mode ibmvga -D 110 -f $1.idv -pp $2 > $3.new.ps
3445
 
#
3446
 
#
3447
 
# Check to see if a previous use of this script has left behind a $3.ps file
3448
 
#
3449
 
if test -r $3.ps
3450
 
then
3451
 
#
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.
3455
 
#
3456
 
  if cmp -s $3.ps $3.new.ps
3457
 
  then
3458
 
    echo $3 is unchanged.
3459
 
    rm $3.new.ps
3460
 
  fi
3461
 
fi
3462
 
#
3463
 
#
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.
3467
 
#
3468
 
if test -r $3.new.ps
3469
 
then
3470
 
  mv $3.new.ps $3.ps
3471
 
  convert -crop 0x0 -density 110x110  -transparent '#FFFFFF' $3.ps $3
3472
 
fi
3473
 
 
3474
 
\EndVerbatim\EndHPage{}]
3475
 
%
3476
 
[\HPage{redundancy}\Verbatim
3477
 
#!/bin/sh
3478
 
 
3479
 
  reduceGifs base
3480
 
 
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
3485
 
    same file.
3486
 
 
3487
 
    This can speed up the loading of some html files by a significant
3488
 
    amount.
3489
 
 
3490
 
echo > reduceGifs.sed
3491
 
uplicatesFound=0
3492
 
for fileA in $1*.gif
3493
 
do
3494
 
 Adone=0
3495
 
 for fileB in $1*.gif
3496
 
%  do
3497
 
    if test $fileA = $fileB
3498
 
    then
3499
 
      Adone=1
3500
 
    fi
3501
 
    if test $Adone = 0
3502
 
    then
3503
 
       if cmp -s $fileA $fileB
3504
 
       then
3505
 
          echo s/$fileA/$fileB/g >> reduceGifs.sed
3506
 
          duplicatesFound=1
3507
 
          Adone=1
3508
 
          echo $fileA and $fileB are duplicates.
3509
 
          rm $fileA
3510
 
       fi
3511
 
    fi
3512
 
  done
3513
 
done
3514
 
#
3515
 
if test $duplicatesFound = 1
3516
 
then
3517
 
  for fileA in $1*.htm*
3518
 
  do
3519
 
    mv $fileA $fileA.bak
3520
 
    echo >> $fileA.bak
3521
 
    sed -f reduceGifs.sed < $fileA.bak > $fileA
3522
 
  done
3523
 
fi
3524
 
\EndVerbatim\EndHPage{}]
3525
 
%
3526
 
\ifHtml[\HPage{more}\Verbatim
3527
 
 
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.
3553
 
 
3554
 
 
3555
 
 
3556
 
 
3557
 
 
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?
3561
 
% >
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
3566
 
% > here, though.
3567
 
% >
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.
3574
 
% >
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.
3580
 
% >
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.
3585
 
% >
3586
 
 
3587
 
 
3588
 
%----------------------------------------------- features ------------
3589
 
 
3590
 
 
3591
 
% %---------------------------------------------------------
3592
 
3593
 
%      *
3594
 
% Some links to `convert'  are dead. Use instead the following address
3595
 
3596
 
%    ftp://ftp.wizards.dupont.com/pub/ImageMagick/
3597
 
3598
 
% Also, you'll probably need
3599
 
3600
 
%    -transparent #FFFFFF
3601
 
3602
 
% instead of the following
3603
 
3604
 
%    -transparent #FFFFFF
3605
 
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
3612
 
%        manual
3613
 
%        files (a small back-end utility is still missing for the html4.0
3614
 
%        mode of output in DOS).
3615
 
3616
 
3617
 
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.
3624
 
3625
 
3626
 
3627
 
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
3631
 
3632
 
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?
3637
 
3638
 
3639
 
3640
 
3641
 
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
3645
 
3646
 
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?
3651
 
3652
 
3653
 
3654
 
\EndVerbatim\EndHPage{}]\fi
3655
 
{} --
3656
 
\ifHtml[\HPage{more}\HCode{
3657
 
<H2>Tools That Tgif Uses:</H2>
3658
 
<DL COMPACT>
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.
3663
 
    <P>
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>.
3670
 
    <P>
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>.
3682
 
<P>
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.
3688
 
    <P>
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.
3692
 
    <P>
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
3697
 
    topic</A>.
3698
 
    <P>
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
3709
 
    modifications</A>.
3710
 
    <P>
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">
3714
 
    netpbm</A>.
3715
 
<P>
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.
3720
 
<P>
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).
3726
 
    <P>
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>.
3734
 
</DL>
3735
 
}\EndHPage{}]\fi
3736
 
{} --
3737
 
[\HPage{translation of 
3738
 
dvi} \ExitHPage{}
3739
 
 
3740
 
 
3741
 
Kaz Kylheku \''<kaz@helios.crest.nt.com>', August 7, 1997:
3742
 
 
3743
 
\Verbatim
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
3751
 
have to check.
3752
 
\EndVerbatim
3753
 
 
3754
 
\HCode{<HR>}
3755
 
 
3756
 
July, 1997 (author?):
3757
 
 
3758
 
\Verbatim
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.
3761
 
 
3762
 
I have X Free86 operating, and a few other things, but was trying to
3763
 
aviod loading in too many more packages.
3764
 
 
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.
3770
 
 
3771
 
In any case, here are the steps involved :
3772
 
 
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.
3783
 
 
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.
3787
 
 
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).
3791
 
 
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.
3798
 
 
3799
 
Two "automatic" methods...
3800
 
 
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.
3807
 
 
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/
3811
 
 
3812
 
They sound interesting, but necessitate loading in extra packages.
3813
 
 
3814
 
A system using translated .tex is :
3815
 
 
3816
 
    http://www.cse.ohio-state.edu/~gurari/TeX4ht/mn.html
3817
 
 
3818
 
More information is obtainable in :
3819
 
 
3820
 
  ftp://ftp.cse.ohio-state.edu/pub/tex/osu/gurari/TeX4ht/dos/port/readme.html
3821
 
 
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
3826
 
interesting.
3827
 
\EndVerbatim
3828
 
   
3829
 
\EndHPage{}] -- 
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
3841
 
\EndVerbatim
3842
 
 
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
3845
 
just before it.
3846
 
 
3847
 
\EndHPage{}]\fi
3848
 
 
3849
 
 
3850
 
 
3851
 
 
3852
 
 
3853
 
\SubSection{Ignore/Noignore Commands}
3854
 
 
3855
 
 
3856
 
\<???--- ??? ---...\><<<
3857
 
status = scan_until_end_str("", 1, status, lg_file);
3858
 
>>>
3859
 
 
3860
 
 
3861
 
\Verbatim
3862
 
l. 10 --- needs --- ignore ---
3863
 
l. 11 --- needs --- end ignore ---
3864
 
\EndVerbatim
3865
 
 
3866
 
 
3867
 
We didn't check below the \`'l. dddd ' part.
3868
 
 
3869
 
\<???--- needs ---...\><<<
3870
 
status = scan_until_end_str(" ignore ---", 2, status, lg_file);
3871
 
if( status ){
3872
 
  skip =  eq_str(match[2]," ignore ---") ? TRUE :
3873
 
            ( eq_str(match[2]," end ignore ---") ? FALSE : skip );
3874
 
}
3875
 
>>>
3876
 
 
3877
 
\Section{post-process files}
3878
 
 
3879
 
 
3880
 
\<post-process files\><<<
3881
 
if( file_script ){
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;
3888
 
         p = match[1];
3889
 
         *(p + (int) strlen(p) - 1) = '\0';
3890
 
         (void) execute_script(file_script, match[1], 
3891
 
                             match[2], Xrecord? Xrecord : "", "");
3892
 
}  }  }
3893
 
>>>
3894
 
 
3895
 
 
3896
 
\Section{User Commands}
3897
 
 
3898
 
\`'l. 10 --- needs --- "ls *" ---'
3899
 
 
3900
 
\<process user commands\><<<
3901
 
eoln_ch = (int) 'x';
3902
 
while( eoln_ch != EOF ) {              Q_CHAR *command, ch;
3903
 
                                       int n;
3904
 
                                       struct sys_call_rec *p;
3905
 
                                       BOOL flag;
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);
3909
 
   if( status ){
3910
 
      command = match[2];
3911
 
      *(command + (int) strlen(command) - 5) = '\0'; 
3912
 
      `<flag = permission for system calls`>
3913
 
      if( flag ){
3914
 
        `<execute system command`>
3915
 
      } else { (IGNORED) printf(
3916
 
          "No permission for system call: %s\n", command); }
3917
 
}  }
3918
 
>>>
3919
 
 
3920
 
 
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;
3927
 
  system_calls = q;
3928
 
if( debug ){  
3929
 
   (IGNORED) printf(".......'S' script: '%s'\n", 
3930
 
                                q->filter); }
3931
 
}
3932
 
>>>
3933
 
 
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;
3938
 
  q->filter = p + 2;
3939
 
  system_calls = q;
3940
 
}
3941
 
>>>
3942
 
 
3943
 
 
3944
 
\<flag = permission for system calls\><<<
3945
 
flag = FALSE;
3946
 
p = system_calls;
3947
 
while( p ){                    
3948
 
  if( (n = (int) strlen(p->filter)) == 1 ) {
3949
 
     if( *(p->filter) == '*' ){
3950
 
         flag = TRUE; break;
3951
 
     }
3952
 
  } 
3953
 
  if( strlen(command) >= (unsigned int) n ) {
3954
 
      ch = command[n]; command[n] = '\0';
3955
 
      flag = flag || eq_str(p->filter,command);
3956
 
      command[n] = ch;
3957
 
  }
3958
 
  p = p->next;
3959
 
}
3960
 
>>>
3961
 
 
3962
 
 
3963
 
 
3964
 
 
3965
 
 
3966
 
 
3967
 
From log files \`'l. # --- needs --- "command" ---'
3968
 
 
3969
 
 
3970
 
 
3971
 
 
3972
 
 
3973
 
 
3974
 
 
3975
 
 
3976
 
 
3977
 
 
3978
 
 
3979
 
 
3980
 
 
3981
 
\Section{The Css (Cascade Style Sheets) File}
3982
 
 
3983
 
 
3984
 
 
3985
 
 
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; }
4003
 
 
4004
 
 
4005
 
 
4006
 
 
4007
 
\<process css\><<<
4008
 
{
4009
 
                               Q_CHAR   css_name[255], *p;
4010
 
                               FILE   *css_file, *tmp_file;
4011
 
                               BOOL   css_sty;
4012
 
   `<css-file = open file ...`>
4013
 
   if( css_file ){
4014
 
      (IGNORED) printf ("Entering %s\n", css_name);
4015
 
      tmp_file = fopen("tex4ht.tmp", WRITE_TEXT_FLAGS);
4016
 
      if( !tmp_file ) {
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);
4021
 
      if( !tmp_file ) {
4022
 
         (IGNORED) warn_i_str(5,"tex4ht.tmp");
4023
 
      } else if( !css_file ) {
4024
 
         (IGNORED) warn_i_str(5,css_name);
4025
 
      } else { 
4026
 
        `<c: css file = header of tex4ht.tmp`>
4027
 
        if( css_sty ){
4028
 
           `<css file = css.sty`>
4029
 
           `<c: css file = tail of tex4ht.tmp`>
4030
 
        }
4031
 
      }
4032
 
      (IGNORED) fclose(tmp_file);
4033
 
      (IGNORED) fclose(css_file);
4034
 
}  }
4035
 
>>>
4036
 
 
4037
 
 
4038
 
\SubSection{Preliminary Processing}
4039
 
 
4040
 
\<c: tex4ht.tmp := css file\><<<
4041
 
                   int ch;
4042
 
while( (ch = getc(css_file)) != EOF ) {
4043
 
  (IGNORED) putc( ch, tmp_file );        
4044
 
}
4045
 
(IGNORED) fclose(tmp_file);
4046
 
(IGNORED) fclose(css_file);
4047
 
>>>
4048
 
 
4049
 
 
4050
 
\<css-file = open file ...\><<<
4051
 
(IGNORED) strcpy( css_name, lg_name);
4052
 
p = css_name;
4053
 
while( *p  ){
4054
 
   if( *p == '.' ){ *p = '\0';  break; }
4055
 
   p++;
4056
 
}
4057
 
(IGNORED) strct(css_name, ".css");
4058
 
css_file = fopen(css_name, READ_TEXT_FLAGS);  
4059
 
>>>
4060
 
 
4061
 
\SubSection{Cotributors to the Css File}
4062
 
 
4063
 
Copy until insertion point:
4064
 
 
4065
 
\`'/* css.sty */'
4066
 
 
4067
 
\<c: css file = header of tex4ht.tmp\><<<
4068
 
css_sty = FALSE;
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]);
4075
 
}
4076
 
>>>
4077
 
 
4078
 
\<vars\><<<
4079
 
static BOOL status;
4080
 
>>>
4081
 
 
4082
 
 
4083
 
 
4084
 
\<match[2] := compressed match[1]\><<<
4085
 
{                          Q_CHAR *p, *q;
4086
 
                           int  n;
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++; }
4091
 
    p++;
4092
 
  }
4093
 
  *q = '\0';
4094
 
}
4095
 
>>>
4096
 
 
4097
 
Contribution from lg File
4098
 
 
4099
 
 
4100
 
 
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");
4108
 
>>>
4109
 
 
4110
 
 
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.
4114
 
 
4115
 
 
4116
 
 
4117
 
 
4118
 
We want to remove the non-leading \`'/* css.sty */', just
4119
 
in case htcmd.perl is called consequtively more than once.
4120
 
 
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]);
4128
 
  }
4129
 
}
4130
 
>>>
4131
 
 
4132
 
 
4133
 
\SubSection{Contributions from /Css Commands}
4134
 
 
4135
 
\`'Css: P.noindent { text-indent: 0em }'
4136
 
 
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);
4142
 
   if( status ){
4143
 
      (IGNORED) fprintf(css_file, "%s\n", match[1]);
4144
 
} } 
4145
 
>>>
4146
 
 
4147
 
\SubSection{Contributions From Font-Size}
4148
 
 
4149
 
 
4150
 
\`'\Needs{"Font_Size: 12"}'
4151
 
 
4152
 
 
4153
 
 
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);
4159
 
   if( status ){
4160
 
      base_font_size = (int) get_long_int(match[1]);
4161
 
} } 
4162
 
>>>
4163
 
 
4164
 
 
4165
 
\<vars\><<<
4166
 
static int base_font_size = 10;
4167
 
>>>
4168
 
 
4169
 
 
4170
 
 
4171
 
 
4172
 
\SubSection{Contributions to Fonts}
4173
 
 
4174
 
\`'Font("cmr","10","100")'
4175
 
\`'Font("aptmri","8t","100")'
4176
 
 
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);
4185
 
   if( status ){
4186
 
                      Q_CHAR *p;
4187
 
                      struct htf_struct *font_sty;
4188
 
                      int second;
4189
 
      p = match[1]; 
4190
 
      *(p + (int) strlen(p) - 3) = '\0'; 
4191
 
      p = match[2]; 
4192
 
      *(p + (int) strlen(p) - 3) = '\0'; 
4193
 
      p = match[3]; 
4194
 
      *(p + (int) strlen(p) - 3) = '\0'; 
4195
 
      p = match[4]; 
4196
 
      *(p + (int) strlen(p) - 2) = '\0'; 
4197
 
      `<get font style`>
4198
 
      `<get font size`>
4199
 
      if( font_sty || (second != 100) ){
4200
 
         `<print font style css`> 
4201
 
}  }  } 
4202
 
>>>
4203
 
 
4204
 
 
4205
 
 
4206
 
\<get font size\><<<
4207
 
{                                                  Q_CHAR *p;
4208
 
   second =   (int) 
4209
 
              (  (int) get_long_int(match[3])
4210
 
               * (int) get_long_int(match[4])
4211
 
               / base_font_size
4212
 
              );
4213
 
   while( second > 700 ){  second /= 10; }
4214
 
   p = match[3];
4215
 
   while( *p != '\0' ){
4216
 
     if( (*p < '0') || (*p > '9') ){ second = 100; break; }
4217
 
     p++;
4218
 
   }  
4219
 
}
4220
 
>>>
4221
 
 
4222
 
 
4223
 
 
4224
 
 
4225
 
\<get font style\><<<
4226
 
font_sty = htf_rec;
4227
 
while ( font_sty  ) {
4228
 
  if( eq_str(font_sty->key,match[1]) ){ break; }
4229
 
  font_sty = font_sty->next;
4230
 
}
4231
 
>>>
4232
 
 
4233
 
 
4234
 
 
4235
 
 
4236
 
 
4237
 
 
4238
 
 
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]);
4243
 
}
4244
 
(IGNORED) fprintf(css_file, "{");
4245
 
if( second != 100 ){
4246
 
   (IGNORED) fprintf(css_file, "font-size:%d%c;", second, '%');
4247
 
}
4248
 
if( font_sty  ) {
4249
 
   (IGNORED) fprintf(css_file, font_sty->body);
4250
 
}
4251
 
(IGNORED) fprintf(css_file, "}\n");
4252
 
>>>
4253
 
 
4254
 
 
4255
 
 
4256
 
\SubSection{Font-Css Contributions}
4257
 
 
4258
 
\`'Font_Css("4"): .small-caps{font-variant: small-caps; }'
4259
 
 
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);
4266
 
   if( status ){
4267
 
      (IGNORED) fprintf(css_file, "%s\n", match[1]);
4268
 
}  }
4269
 
>>>
4270
 
 
4271
 
 
4272
 
 
4273
 
 
4274
 
 
4275
 
 
4276
 
 
4277
 
\Section{load env file}
4278
 
 
4279
 
 
4280
 
\SubSection{Retrieve Info}
4281
 
 
4282
 
\<load env file\><<<
4283
 
{                                FILE* file;
4284
 
                                 U_CHAR  env_loc[512];
4285
 
   env_loc[0] = '\0';
4286
 
   `<find tex4ht.env`>
4287
 
   if( file ){  
4288
 
      (IGNORED) printf("Entering %s\n", env_loc[0]? &env_loc[0] 
4289
 
                                                  :"tex4ht.env"); 
4290
 
      `<get info from env file`>
4291
 
      (IGNORED) fclose(file);
4292
 
}  }
4293
 
>>>
4294
 
 
4295
 
 
4296
 
 
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);
4303
 
     if( status ){
4304
 
       switch( ch ){
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;}
4313
 
         default:{ }
4314
 
} }  }  }
4315
 
>>>
4316
 
 
4317
 
 
4318
 
\<script for dvigif\><<<
4319
 
if( debug ){  
4320
 
      (IGNORED) printf(".......'G' script\n"); }
4321
 
dvigif_script = add_script(dvigif_script);
4322
 
>>>
4323
 
 
4324
 
 
4325
 
\<script for dvigif of glyps\><<<
4326
 
if( debug ){  
4327
 
      (IGNORED) printf(".......'F' script\n"); }
4328
 
dvigif_glyp_script = add_script(dvigif_glyp_script);
4329
 
>>>
4330
 
 
4331
 
 
4332
 
\<script for move\><<<
4333
 
if( debug ){  
4334
 
      (IGNORED) printf(".......'M' script\n"); }
4335
 
move_script = add_script(move_script);
4336
 
>>>
4337
 
 
4338
 
 
4339
 
\<script for copy\><<<
4340
 
if( debug ){  
4341
 
      (IGNORED) printf(".......'C' script\n"); }
4342
 
copy_script = add_script(copy_script);
4343
 
>>>
4344
 
 
4345
 
 
4346
 
 
4347
 
 
4348
 
 
4349
 
\<script for file\><<<
4350
 
if( debug ){  
4351
 
      (IGNORED) printf(".......'X' script\n"); }
4352
 
file_script = add_script(file_script);
4353
 
>>>
4354
 
 
4355
 
 
4356
 
 
4357
 
 
4358
 
\<script for chmod\><<<
4359
 
if( debug ){  
4360
 
      (IGNORED) printf(".......'A' script\n"); }
4361
 
chmod_script = add_script(chmod_script);
4362
 
>>>
4363
 
 
4364
 
\<script for empty gifs\><<<
4365
 
if( debug ){  
4366
 
      (IGNORED) printf(".......'E' script\n"); }
4367
 
empty_fig_script = add_script(empty_fig_script);
4368
 
>>>
4369
 
 
4370
 
 
4371
 
 
4372
 
 
4373
 
 
4374
 
\<header functions\><<<
4375
 
static struct script_struct * add_script( ARG_I(struct script_struct *) );
4376
 
>>>
4377
 
 
4378
 
\<functions\><<<
4379
 
`[
4380
 
static struct script_struct * add_script(script) 
4381
 
                           struct script_struct * script
4382
 
 
4383
 
;{ 
4384
 
   struct script_struct* temp, * q;
4385
 
   temp = (struct script_struct *) 
4386
 
                      m_alloc(struct script_struct, (int) 1);   
4387
 
   temp->command = match[1];
4388
 
   if( debug ){  
4389
 
      (IGNORED) printf(".......   %s\n", temp->command); }
4390
 
   temp->next = NULL_SCRIPT;
4391
 
   match[1] = (Q_CHAR *) malloc(70);
4392
 
   max_match[1] = 70;
4393
 
   if( script ){
4394
 
      q = script;
4395
 
      while( q->next ){ q = q->next; }
4396
 
      q->next = temp;
4397
 
   } else {
4398
 
      script = temp;
4399
 
   }
4400
 
   return script;
4401
 
}
4402
 
>>>
4403
 
 
4404
 
 
4405
 
 
4406
 
 
4407
 
 
4408
 
 
4409
 
 
4410
 
 
4411
 
  
4412
 
 
4413
 
 
4414
 
\<vars\><<<
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;
4423
 
>>>
4424
 
 
4425
 
 
4426
 
 
4427
 
 
4428
 
 
4429
 
 
4430
 
 
4431
 
 
4432
 
 
4433
 
 
4434
 
%          case 'H':{ `<env-htf-sty = htfcss.env file`> break;}
4435
 
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;
4440
 
% if( debug ){  
4441
 
%    (IGNORED) printf(".......'H' script: '%s'\n",
4442
 
%                             env_htf_sty); }
4443
 
% >>>
4444
 
4445
 
% \<vars\><<<
4446
 
% static Q_CHAR* env_htf_sty = Q_NULL;
4447
 
% >>>
4448
 
 
4449
 
 
4450
 
 
4451
 
\Verbatim
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
4456
 
% htcmd -d%2 
4457
 
Mmv %1 %2%3
4458
 
Ccp %1 %2%3
4459
 
% htcmd -d%2 -m%1 
4460
 
Achmod %1 %2%3
4461
 
H/n/gold/5/gurari/tex4ht.dir/
4462
 
\EndVerbatim
4463
 
 
4464
 
 
4465
 
 
4466
 
\SubSection{Open Directory}
4467
 
 
4468
 
 
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"); }
4476
 
   }
4477
 
   if( !file ) { `<env file from prog loc`> }
4478
 
#ifndef DOS_WIN32
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"); }
4483
 
   }
4484
 
#endif
4485
 
   `<env file at root dir`>
4486
 
#ifdef ENVFILE
4487
 
   if( !file ) {
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); }
4492
 
   }
4493
 
#endif
4494
 
   `<kpathsea env file`>
4495
 
   if( !file ) warn_i_str( 5, `<warn 1`>);
4496
 
}
4497
 
>>>
4498
 
 
4499
 
 
4500
 
 
4501
 
 
4502
 
 
4503
 
 
4504
 
\<h-defines\><<<
4505
 
#ifndef ENVFILE
4506
 
 
4507
 
#endif
4508
 
>>>
4509
 
 
4510
 
 
4511
 
 
4512
 
\<warn 1\><<<
4513
 
#ifdef  DOS_WIN32
4514
 
   "tex4ht.env"
4515
 
#endif
4516
 
#ifndef  DOS_WIN32
4517
 
   "tex4ht.env | .tex4ht" 
4518
 
#endif
4519
 
>>>
4520
 
 
4521
 
 
4522
 
 
4523
 
 
4524
 
\<kpathsea env file\><<<
4525
 
#ifdef KPATHSEA
4526
 
if( !file )  {
4527
 
   file = kpse_open_file ("tex4ht.env", kpse_program_text_format);
4528
 
   if( debug && file ){  
4529
 
      (IGNORED) printf(".......Open kpathsea tex4ht.env\n"); }
4530
 
}
4531
 
#endif
4532
 
>>>
4533
 
 
4534
 
 
4535
 
 
4536
 
\SubSection{Root Directory}
4537
 
 
4538
 
\<env file at root dir\><<<
4539
 
if( !file ){                
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); }
4546
 
  }
4547
 
}
4548
 
#ifndef DOS_WIN32
4549
 
  if( !file ){        
4550
 
     if( HOME_DIR ){ 
4551
 
          (IGNORED) sprintf(str,"%s/.tex4ht", HOME_DIR);   
4552
 
          file = fopen(str,READ_TEXT_FLAGS);     
4553
 
          (IGNORED) strcpy(&env_loc[0],str);
4554
 
      }
4555
 
  }
4556
 
#endif
4557
 
#if defined(DOS_WIN32) || defined(__MSDOS__)
4558
 
   if( !file ){                
4559
 
      file = fopen("C:/tex4ht.env",READ_TEXT_FLAGS);     
4560
 
       (IGNORED) strcpy(&env_loc[0],"C:/tex4ht.env");
4561
 
   }
4562
 
#endif
4563
 
>>>
4564
 
 
4565
 
\<"s/tex4ht.env"\><<<
4566
 
#if defined(DOS_WIN32) || defined(__DJGPP__)
4567
 
  is_forward_slash(HOME_DIR)?  "%s/tex4ht.env" :  "%s\\tex4ht.env"
4568
 
#else
4569
 
  "%s/tex4ht.env"
4570
 
#endif
4571
 
>>>
4572
 
 
4573
 
 
4574
 
 
4575
 
 
4576
 
 
4577
 
 
4578
 
 
4579
 
 
4580
 
 
4581
 
 
4582
 
 
4583
 
\SubSection{Env File from Command Line}
4584
 
 
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);
4590
 
}
4591
 
if( debug && file ){  
4592
 
      (IGNORED) printf(".......Open: %s\n", tex4ht_env_file); }
4593
 
>>>
4594
 
 
4595
 
\<env file from prog loc\><<<
4596
 
if( dos_env_file ){
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); }
4601
 
}
4602
 
>>>
4603
 
 
4604
 
 
4605
 
 
4606
 
Search along the path: command line file $\rightarrow$ work
4607
 
directory $\rightarrow$ home directory $\rightarrow$ system file.
4608
 
 
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);
4612
 
>>>
4613
 
 
4614
 
 
4615
 
 
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 .
4619
 
 
4620
 
Where access comes from in dos?
4621
 
 
4622
 
 
4623
 
\SubSection{Env File from Location of htcmd.c}
4624
 
 
4625
 
\<main's vars\><<<
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`>;
4630
 
#endif
4631
 
#if !defined(DOS_WIN32) && !defined(__MSDOS__)
4632
 
  (Q_CHAR *) 0;
4633
 
#endif
4634
 
 
4635
 
>>>
4636
 
 
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
4640
 
already as follows:
4641
 
 
4642
 
\<get dos env file\><<<
4643
 
get_env_dir(argv[0])
4644
 
>>>
4645
 
 
4646
 
\<functions\><<<
4647
 
#if defined(DOS_WIN32) || defined(__MSDOS__)
4648
 
`<get tex4ht.env in dos`>
4649
 
#endif
4650
 
>>>
4651
 
 
4652
 
\<get tex4ht.env in dos\><<<
4653
 
`[
4654
 
char *get_env_dir(progname) 
4655
 
      Q_CHAR *progname
4656
 
 
4657
 
;{    int  i;
4658
 
      Q_CHAR *p;
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`%
4668
 
  return p;
4669
 
}
4670
 
>>>
4671
 
 
4672
 
 
4673
 
 
4674
 
 
4675
 
 
4676
 
 
4677
 
The 12 above is for accomodating \''tex4ht.env'.
4678
 
 
4679
 
  Then, in main(), I changed:
4680
 
 
4681
 
\`''char* tex4ht_env_file = (Q_CHAR *) 0;'
4682
 
 
4683
 
  to:
4684
 
 
4685
 
\`'char* tex4ht_env_file = get_env_dir(argv[0]);'
4686
 
 
4687
 
  This works like a charm here, and allows me to use tex4ht from a
4688
 
different directory without typing a single commandline option.
4689
 
 
4690
 
 
4691
 
 
4692
 
 
4693
 
\Section{Open Files}
4694
 
 
4695
 
 
4696
 
 
4697
 
 
4698
 
 
4699
 
\SubSection{General}
4700
 
 
4701
 
\<header functions\><<<
4702
 
static FILE* open_file( ARG_II(C_CHAR *, C_CHAR *) );
4703
 
>>>
4704
 
 
4705
 
\<functions\><<<
4706
 
`[
4707
 
static FILE* open_file(name,ext)     
4708
 
                         Q_CHAR *name`; Q_CHAR *ext
4709
 
;{                       FILE* file;
4710
 
                         C_CHAR filename[255], *p;
4711
 
   (IGNORED) strcpy( filename,name );   
4712
 
   p = filename;
4713
 
   while( TRUE ){
4714
 
     if( *p == '.' ){ 
4715
 
       if( eq_str( ext,LG_EXT ) ) { *p = '\0'; }
4716
 
       else { break; }
4717
 
     }
4718
 
     if( *p == '\0' ){ (IGNORED) strcpy(p, ext); break; }
4719
 
     p++;
4720
 
   }
4721
 
   file  = fopen(filename, READ_TEXT_FLAGS);  
4722
 
   if( !file ) {
4723
 
      (IGNORED) warn_i_str(5,filename);
4724
 
   } else { (IGNORED) printf ("Entering %s\n", filename); }
4725
 
 
4726
 
   return file;
4727
 
}
4728
 
>>>
4729
 
 
4730
 
 
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?
4735
 
 
4736
 
 
4737
 
 
4738
 
 
4739
 
\<defines\><<<
4740
 
#define LG_EXT ".lg"
4741
 
>>>
4742
 
 
4743
 
 
4744
 
 
4745
 
 
4746
 
 
4747
 
4748
 
% \SubSection{htfcss.env}
4749
 
4750
 
4751
 
% \<file = open htfcss.env\><<<
4752
 
% if( htf_cfg ){
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);
4760
 
%    }
4761
 
%    if ( !file ){
4762
 
%       (IGNORED) strcpy(filename, HTFDIR );
4763
 
%       (IGNORED) strct(filename, "htfcss.env");
4764
 
%       file = fopen(filename, READ_TEXT_FLAGS);
4765
 
%    }  
4766
 
%    `<htfcss.env in KPATHSEA`>
4767
 
%    if( !file ) { (IGNORED) warn_i_str(5,"htfcss.env"); }
4768
 
%    else { (IGNORED) printf ("Entering htfcss.env\n"); }
4769
 
% }
4770
 
% >>>
4771
 
4772
 
4773
 
 
4774
 
 
4775
 
 
4776
 
\<mark start lg file\><<<
4777
 
begin_lg_file = ftell(lg_file);
4778
 
>>>
4779
 
 
4780
 
\<rewind lg file\><<<
4781
 
(IGNORED)  fseek(lg_file, begin_lg_file, `<abs file addr`>);
4782
 
>>>
4783
 
 
4784
 
\<abs file addr\><<<
4785
 
0>>>
4786
 
 
4787
 
 
4788
 
 
4789
 
 
4790
 
\<vars\><<<
4791
 
static FILE* lg_file;
4792
 
static long  begin_lg_file;
4793
 
>>>
4794
 
 
4795
 
 
4796
 
 
4797
 
 
4798
 
 
4799
 
\Verbatim
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
4802
 
was corrupt:
4803
 
 
4804
 
*** Fatal error 2106: corrupt DVI file (postamble not found)
4805
 
 
4806
 
  I found the cause, though: you open it with mode "w", which is text
4807
 
mode. Changing this to "wb" solved the problem.
4808
 
\EndVerbatim
4809
 
 
4810
 
 
4811
 
 
4812
 
 
4813
 
 
4814
 
 
4815
 
 
4816
 
 
4817
 
 
4818
 
\Section{Utilities}
4819
 
 
4820
 
 
4821
 
 
4822
 
\SubSection{Error and Warning Messages}
4823
 
 
4824
 
\<signals messages: 2--4\><<<
4825
 
"Illegal storage address\n", `%2 segmentation`%
4826
 
"Floating-point\n",          `%3 `%
4827
 
"Interrupt with Cntr-C\n",   `%4 `% 
4828
 
>>>
4829
 
 
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`%
4836
 
>>>
4837
 
 
4838
 
 
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)"
4846
 
Lines: 43
4847
 
X-Mailer: Quassia Gnus v0.37/Emacs 19.34
4848
 
X-Emacs: 19.34
4849
 
MIME-Version: 1.0 (generated by SEMI MIME-Edit 0.98 - "Sodani")
4850
 
Content-Type: text/plain; charset=US-ASCII
4851
 
 
4852
 
>>>>> "Eitan" == Eitan Gurari <gurari@cse.ohio-state.edu> writes:
4853
 
 
4854
 
    Eitan> I also wonder whether the WIN32 really needs to discard the
4855
 
    Eitan> following code fragment.
4856
 
 
4857
 
signal() is supported through the standard libc, but is mostly
4858
 
ineffective. An example of the kind of code needed is attached.
4859
 
 
4860
 
Thanks for the mods,
4861
 
 
4862
 
Fabrice
4863
 
 
4864
 
/* Interrupt handler. mt_exit() is a cleanup_and_exit function */
4865
 
#ifdef _WIN32
4866
 
BOOL sigint_handler(DWORD dwCtrlType)
4867
 
{
4868
 
  mt_exit(3);
4869
 
  return FALSE;      /* return value obligatory */
4870
 
}
4871
 
#else
4872
 
void sigint_handler (int sig)
4873
 
{
4874
 
  mt_exit(3);
4875
 
}
4876
 
#endif
4877
 
 
4878
 
  /* Catch signals, so we clean up if the child is interrupted.
4879
 
     This emulates "trap 'whatever' 1 2 15".  */
4880
 
#ifdef _WIN32
4881
 
  SetConsoleCtrlHandler((PHANDLER_ROUTINE)sigint_handler, TRUE);
4882
 
#else
4883
 
# ifdef SIGINT
4884
 
  signal (SIGINT, sigint_handler);
4885
 
# endif
4886
 
# ifdef SIGHUP
4887
 
  signal (SIGHUP, sigint_handler);
4888
 
# endif
4889
 
# ifdef SIGTERM
4890
 
  signal (SIGTERM, sigint_handler);
4891
 
# endif
4892
 
#endif
4893
 
\EndVerbatim\EndHPage{}]\fi
4894
 
 
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.
4898
 
 
4899
 
 
4900
 
 
4901
 
 
4902
 
\<header functions\><<<
4903
 
#ifdef KWIN32
4904
 
static BOOL sigint_handler(ARG_I(DWORD));
4905
 
#endif
4906
 
>>>
4907
 
 
4908
 
\<functions\><<<
4909
 
#ifdef KWIN32
4910
 
`[
4911
 
static BOOL sigint_handler(dwCtrlType)     DWORD dwCtrlType
4912
 
;{
4913
 
  err_i(32);
4914
 
  return FALSE;      `% return value obligatory `%
4915
 
}
4916
 
#endif
4917
 
>>>
4918
 
 
4919
 
 
4920
 
\SubSection{System Calls}
4921
 
 
4922
 
 
4923
 
 
4924
 
\<vars\><<<
4925
 
static Q_CHAR command[255];
4926
 
static 
4927
 
>>>
4928
 
 
4929
 
 
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.
4933
 
 
4934
 
 
4935
 
\<vars\><<<
4936
 
static BOOL system_yes;
4937
 
>>>
4938
 
 
4939
 
Solaris-? issues the command \`'-c: bad option(s)' if we check for the
4940
 
presence of the system function.
4941
 
 
4942
 
 
4943
 
 
4944
 
\SubSection{Strings Concat and compare}
4945
 
 
4946
 
 
4947
 
 
4948
 
\<defines\><<<
4949
 
#define eq_str(x,y) (!strcmp(x,y))
4950
 
>>>
4951
 
 
4952
 
 
4953
 
 
4954
 
 
4955
 
 
4956
 
 
4957
 
\SubSection{String into Int}
4958
 
 
4959
 
\<header functions\><<<
4960
 
static long int get_long_int( ARG_I(Q_CHAR *) );
4961
 
>>>
4962
 
 
4963
 
\<functions\><<<
4964
 
`[
4965
 
static long int get_long_int(str)     
4966
 
                         Q_CHAR   *str
4967
 
;{                  long int    i;
4968
 
                         Q_CHAR   *ch;
4969
 
   ch = str;   i = 0;
4970
 
   while( (*ch>= '0') && (*ch <='9') ){
4971
 
     i = 10*i + *(ch++) - '0';
4972
 
   }
4973
 
   return i;
4974
 
}
4975
 
>>>
4976
 
 
4977
 
 
4978
 
 
4979
 
 
4980
 
\SubSection{Pattern Recognition Functions}
4981
 
 
4982
 
 
4983
 
When  failure (false \''status') arises, the input line is consumed to
4984
 
its end. 
4985
 
The \''_until' functions place in ''match[i]' the string found.
4986
 
 
4987
 
\<header functions\><<<
4988
 
static BOOL scan_until_end_str( ARG_IV(C_CHAR *, int, BOOL, FILE *) );
4989
 
>>>
4990
 
 
4991
 
\<functions\><<<
4992
 
`[
4993
 
static BOOL  scan_until_end_str(str,n,flag,file)     
4994
 
                         Q_CHAR   *str`;
4995
 
                         int    n`;
4996
 
                         BOOL   flag`;
4997
 
                         FILE*  file
4998
 
;{                       Q_CHAR   *p; 
4999
 
                         int i;             
5000
 
   if( !flag ) { return flag; }
5001
 
   p = match[n];  i = 0;
5002
 
   while( TRUE ){
5003
 
     if( (i+1) >= max_match[n] ){
5004
 
        max_match[n] += 10;
5005
 
        p = match[n] = (Q_CHAR *)
5006
 
                     r_alloc((void *) match[n], (size_t) max_match[n]);
5007
 
     }
5008
 
     p[i] = (char) (eoln_ch = getc(file));
5009
 
     if( (eoln_ch == (int) '\n') || (eoln_ch == EOF) ){  break; }
5010
 
     i++;
5011
 
   }
5012
 
   p[i] = '\0';
5013
 
   i -= (int) strlen(str);
5014
 
   if( i>= 0 ){  return eq_str(p+i,str);   }
5015
 
   return FALSE;
5016
 
}
5017
 
>>>
5018
 
 
5019
 
 
5020
 
 
5021
 
\<vars\><<<
5022
 
static Q_CHAR* match[10];
5023
 
static int   max_match[10];
5024
 
>>>
5025
 
 
5026
 
 
5027
 
\<main's init\><<<
5028
 
{          int i;
5029
 
  for( i=0;  i<=9; i++){
5030
 
    match[i] = (Q_CHAR *) malloc(70);
5031
 
    max_match[i] = 70;
5032
 
  }
5033
 
}
5034
 
>>>
5035
 
 
5036
 
 
5037
 
\<header functions\><<<
5038
 
static BOOL scan_until_str( ARG_IV(C_CHAR *, int, BOOL, FILE *) );
5039
 
>>>
5040
 
 
5041
 
\<functions\><<<
5042
 
`[
5043
 
static BOOL  scan_until_str(str,n,flag,file)     
5044
 
                         Q_CHAR   *str`;
5045
 
                         int    n`;
5046
 
                         BOOL   flag`;
5047
 
                         FILE*  file
5048
 
;{                       Q_CHAR   *p, ch;              
5049
 
                         int i, j;             
5050
 
   if( !flag ) { return flag; }
5051
 
   p = match[n];  i = 0;
5052
 
   while( TRUE ){
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] ){
5056
 
        max_match[n] += 10;
5057
 
        p = match[n] = (Q_CHAR *)
5058
 
                     r_alloc((void *) match[n], (size_t) max_match[n]);
5059
 
     }
5060
 
     p[i++] = ch;
5061
 
     j =  i - (int) strlen(str);
5062
 
     if( j>= 0 ){
5063
 
       p[i] = '\0';
5064
 
       if( eq_str(p+j,str) ) { return TRUE;  }
5065
 
     }
5066
 
   }
5067
 
}
5068
 
>>>
5069
 
 
5070
 
 
5071
 
 
5072
 
 
5073
 
 
5074
 
 
5075
 
\<header functions\><<<
5076
 
static BOOL scan_str( ARG_III(C_CHAR *, BOOL, FILE *) );
5077
 
>>>
5078
 
 
5079
 
\<functions\><<<
5080
 
`[
5081
 
static BOOL  scan_str(str,flag,file)     
5082
 
                         Q_CHAR   *str`;
5083
 
                         BOOL   flag`;
5084
 
                         FILE*  file
5085
 
;{                       Q_CHAR *p;
5086
 
                         int temp_eoln_ch;              
5087
 
   if( !flag ) { return flag; }
5088
 
   p = str;
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;
5094
 
     }
5095
 
   }
5096
 
   return TRUE;
5097
 
}
5098
 
>>>
5099
 
 
5100
 
 
5101
 
 
5102
 
 
5103
 
 
5104
 
 
5105
 
 
5106
 
 
5107
 
 
5108
 
 
5109
 
 
5110
 
 
5111
 
 
5112
 
 
5113
 
 
5114
 
 
5115
 
 
5116
 
 
5117
 
 
5118
 
 
5119
 
 
5120
 
 
5121
 
 
5122
 
 
5123
 
 
5124
 
 
5125
 
 
5126
 
 
5127
 
 
5128
 
 
5129
 
 
5130
 
 
5131
 
\SubSection{Shorthands and Mnemonics}
5132
 
 
5133
 
 
5134
 
 
5135
 
 
5136
 
\<defines\><<<
5137
 
#define eq_str(x,y) (!strcmp(x,y))
5138
 
>>>
5139
 
 
5140
 
 
5141
 
 
5142
 
\Section{Info}
5143
 
 
5144
 
\SubSection{str inconsistently in lint}
5145
 
 
5146
 
\Link[file://localhost/usr/lib/llib-lc]{}{}llib-lc\EndLink
5147
 
 
5148
 
\SubSection{About DOS}
5149
 
 
5150
 
 
5151
 
\Link[http://www.ku.edu.tr/text/help/dos62\string_adv.html]{}{}%
5152
 
DOS\EndLink,
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>
5155
 
}
5156
 
 
5157
 
 
5158
 
\Verbatim
5159
 
                               DOS 6.2: Advanced
5160
 
                                       
5161
 
What Are Batch Files?
5162
 
 
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:
5168
 
     CLS
5169
 
     C:
5170
 
     CD\WINDOWS
5171
 
     DIR *.DOC
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
5176
 
     is your solution.
5177
 
     
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.
5184
 
     
5185
 
Batch File Names
5186
 
 
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
5199
 
       filename.
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.
5205
 
       
5206
 
The AUTOEXEC.BAT file
5207
 
 
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.
5212
 
     
5213
 
Displaying Batch Files
5214
 
 
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>
5218
 
     
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
5223
 
     "ASCII text."
5224
 
     
5225
 
Storing Batch Files
5226
 
 
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.
5233
 
     
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.
5240
 
     
5241
 
Creating Batch Files
5242
 
 
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.
5255
 
       
5256
 
Common Batch File Commands
5257
 
 
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
5275
 
       file.
5276
 
     PRINT -- prints a specified file.
5277
 
       
5278
 
Batch File Subcommands--ECHO, REM, PAUSE
5279
 
 
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.
5287
 
     
5288
 
    ECHO
5289
 
    
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
5305
 
       off.
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
5318
 
       to the printer.
5319
 
       
5320
 
     Here's an example of how the ECHO command might be used in the
5321
 
     WINLIST.BAT file created above:
5322
 
     CLS
5323
 
     ECHO OFF
5324
 
     ECHO This is a list of files in Windows with .doc extensions.
5325
 
     ECHO.
5326
 
     C:
5327
 
     CD\WINDOWS
5328
 
     DIR *.DOC
5329
 
     
5330
 
    PAUSE
5331
 
    
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
5336
 
     CHECK PRINTER
5337
 
     
5338
 
    REM
5339
 
    
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
5347
 
     Windows directory.
5348
 
     CLS
5349
 
     ECHO OFF
5350
 
     ECHO This is a list of files in Windows with .doc extensions.
5351
 
     ECHO.
5352
 
     C:
5353
 
     CD\WINDOWS
5354
 
     DIR *.DOC
5355
 
     
5356
 
Replaceable Parameters
5357
 
 
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
5361
 
     limited, though.
5362
 
     
5363
 
    What Are Parameters?
5364
 
    
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.
5372
 
     
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.
5380
 
     CLS
5381
 
     ECHO OFF
5382
 
     ECHO This is a list of files in Windows, extensions based on your
5383
 
     parameter.
5384
 
     ECHO.
5385
 
     C:
5386
 
     CD\WINDOWS
5387
 
     DIR *.%1
5388
 
     Now, when you want to use the batch file command, you must
5389
 
     type the following:WINLIST DOC - to show files with .DOC
5390
 
     extensions.
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.
5393
 
     
5394
 
    Multiple Parameters
5395
 
    
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.
5402
 
     CLS
5403
 
     ECHO OFF
5404
 
     ECHO Here are two lists of files in Windows specified by your parameter.
5405
 
     ECHO.
5406
 
     C:
5407
 
     CD\WINDOWS
5408
 
     DIR *.%1
5409
 
     DIR *.%2
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
5414
 
     files.
5415
 
     
5416
 
Invoking Other Batch Files
5417
 
 
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.
5428
 
     
5429
 
CALL
5430
 
 
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
5441
 
     this:
5442
 
     REM This batch file goes into WINDOWS and calls DOCS.BAT
5443
 
     CLS
5444
 
     ECHO OFF
5445
 
     ECHO.
5446
 
     C:
5447
 
     CD\WINDOWS
5448
 
     CALL C:\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.
5454
 
     DIR *.DOC
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."
5461
 
     
5462
 
IF Conditional Statement
5463
 
 
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
5475
 
     CLS
5476
 
     ECHO OFF
5477
 
     ECHO.
5478
 
     C:
5479
 
     CD\WINDOWS
5480
 
     IF %1 = DOC CALL C:\DOCS.BAT
5481
 
     ECHO There are no more documents.
5482
 
     
5483
 
Redirection of Input/Output
5484
 
 
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.
5489
 
     
5490
 
    To the Printer
5491
 
    
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.
5500
 
     
5501
 
    To a File
5502
 
    
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
5509
 
     called FILES.TXT
5510
 
     
5511
 
Writing an AUTOEXEC.BAT
5512
 
 
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.
5518
 
     
5519
 
    What Should I Include In My AUTOEXEC.BAT File?
5520
 
    
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".
5531
 
       
5532
 
    Creating An AUTOEXEC.BAT
5533
 
    
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:
5539
 
     ECHO OFF
5540
 
     CLS
5541
 
     PROMPT $P$G
5542
 
     PATH=C:\;C:\DOS;C:\WINDOWS
5543
 
     MENU
5544
 
     
5545
 
    Creating a Menu
5546
 
    
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
5550
 
     this:
5551
 
     CLS
5552
 
     ECHO OFF
5553
 
     ECHO Main Menu
5554
 
     ECHO.
5555
 
     ECHO 1 - Windows
5556
 
     ECHO.
5557
 
     ECHO 2 - Word for Windows
5558
 
     ECHO.
5559
 
     ECHO 3 - Wordperfect for Windows
5560
 
     
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:
5566
 
   
5567
 
     C:
5568
 
     CD\WINDOWS
5569
 
     WIN
5570
 
     
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.
5576
 
   
5577
 
Hard Disk Considerations
5578
 
 
5579
 
    Size
5580
 
    
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.
5589
 
     
5590
 
    Speed
5591
 
    
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:
5595
 
 
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
5601
 
                          the hard disk.
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.
5605
 
 
5606
 
    Hard Disk Care
5607
 
    
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
5619
 
       20 and 80 percent.
5620
 
    6. Keep food, drinks, cigarette smoke, and cleaning agents with
5621
 
       vapors away from the drive.
5622
 
       
5623
 
Formatting a New Hard Disk
5624
 
 
5625
 
    Plug and Play Disks
5626
 
    
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.
5631
 
     
5632
 
    Unformatted Hard Disks
5633
 
    
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).
5639
 
     
5640
 
    When NOT To Format The Hard Disk
5641
 
    
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.
5645
 
     
5646
 
    When To Format The Hard Disk
5647
 
    
5648
 
     If you just bought the hard disk and it has not been formatted, you
5649
 
     should format it.
5650
 
     
5651
 
    Formatting As A Startup Disk
5652
 
    
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
5655
 
     
5656
 
Partitioning the Hard Disk
5657
 
 
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.
5662
 
     
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.
5675
 
     
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
5687
 
       
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!
5692
 
     
5693
 
Copying DOS Files to the Hard Disk
5694
 
 
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
5704
 
       C:\DOS\COMMAND.COM.
5705
 
       
5706
 
     Include the DOS directory in the path statement of your
5707
 
     AUTOEXEC.BAT batch file.
5708
 
     
5709
 
Paths
5710
 
 
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
5720
 
     AUTOEXEC.BAT
5721
 
     
5722
 
    Displaying The Current Path
5723
 
    
5724
 
     To display the current path, type: PATH
5725
 
     
5726
 
    Setting The Path
5727
 
    
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
5731
 
     
5732
 
    Canceling The Path
5733
 
    
5734
 
     To cancel the current path so that DOS will search only the current
5735
 
     directory, type: PATH;
5736
 
     
5737
 
Configuring the System
5738
 
 
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
5742
 
     this:
5743
 
     buffers=22
5744
 
     files=15
5745
 
     device=mouse.sys
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
5749
 
       time.
5750
 
     device= loads what is called a "device driver" from the hard disk.
5751
 
       
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.
5759
 
     
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.
5765
 
     
5766
 
Backing Up the Hard Disk
5767
 
 
5768
 
    When Should I Back Up?
5769
 
    
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.
5774
 
     
5775
 
    Number The Diskettes
5776
 
    
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.
5780
 
     
5781
 
    Complete Backups
5782
 
    
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:\*.*
5787
 
     a:/s >prn
5788
 
     
5789
 
    Partial Backups
5790
 
    
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
5798
 
       on it.
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
5803
 
       the machine.
5804
 
       Example: C:\>backup c:\*.* a:/s/d 4-16-89
5805
 
     * /m -- backs up all files that have been created or modified since
5806
 
       the last backup.
5807
 
       Example: C:\>backup c:\*.* a:/s/m
5808
 
       
5809
 
    Daily Backups
5810
 
    
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
5818
 
     
5819
 
Restoring Files from Backups
5820
 
 
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
5829
 
     
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
5836
 
   
5837
 
     _________________________________________________________________
5838
 
 
5839
 
 
5840
 
\EndVerbatim
5841
 
 
5842
 
\HCode{<HR>}%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5843
 
 
5844
 
 
5845
 
\Verbatim
5846
 
 
5847
 
alain.chilles@hol.fr  
5848
 
 
5849
 
 Alain Chill\`es
5850
 
 12, rue de l'Ermitage 
5851
 
 78000 Versailles      
5852
 
 
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 :
5856
 
5857
 
> echo Creating .ppm file
5858
 
> pcxtoppm tmp00%2.pcx > ppm00%2.ppm   =20
5859
 
> echo Cropping it
5860
 
> pnmcrop ppm00%2.ppm > ppm10%2.ppm
5861
 
> echo Creating .gif (transparent) file
5862
 
> ppmtogif -transparent 1,1,1 ppm10%2.ppm > %3
5863
 
5864
 
> It seems to do a good work...
5865
 
 
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
5869
 
for such ports.
5870
 
 
5871
 
 
5872
 
\EndVerbatim
5873
 
 
5874
 
\HCode{<HR>}%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5875
 
 
5876
 
\Verbatim
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
5880
 
 
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
5883
 
from text-mode).
5884
 
 
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).
5888
 
 
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.
5894
 
 
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
5904
 
on startup".
5905
 
-----------------------------------------------------------------
5906
 
 
5907
 
> while, but it's unlikely I'll do much work for a while.
5908
 
 
5909
 
As far as I'm concern, we can go public with what we have now.
5910
 
 
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
5914
 
5915
 
>   I don't understand this. Once you come back from what? From text-mode?
5916
 
 
5917
 
Yes. From the text-mode.
5918
 
 
5919
 
> But then the graphical window would re-appear (or you wouldn't be back
5920
 
> from text-mode).
5921
 
 
5922
 
Yes and not.
5923
 
 
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.
5927
 
 
5928
 
If I leave the text-mode with Exit, then the problems I described
5929
 
earlier occur.  
5930
 
 
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.
5934
 
 
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
5939
 
                                                      ^^^^
5940
 
   Exit!).
5941
 
   ^^^^^^
5942
 
 
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.
5948
 
 
5949
 
Well, at least I learned the difference between Exit and Alt-Enter.
5950
 
 
5951
 
 
5952
 
>  > Well, at least I learned the difference between Exit and Alt-Enter.
5953
 
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
5960
 
> you too.
5961
 
 
5962
 
\EndVerbatim
5963
 
 
5964
 
 
5965
 
 
5966
 
\SubSection{scripts from Steven Zeil}
5967
 
\Verbatim
5968
 
 
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
5973
 
MIME-Version: 1.0
5974
 
Content-Type: TEXT/PLAIN; charset=US-ASCII
5975
 
 
5976
 
Dr. Gurari,
5977
 
 
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.
5987
 
 
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.
5994
 
 
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
5999
 
 
6000
 
 
6001
 
Steven Zeil,
6002
 
Old Dominion University
6003
 
[Ph.D. from Ohio State CIS Dept, 1981]
6004
 
 
6005
 
 
6006
 
 
6007
 
 
6008
 
%---------------------------------------------------------------------
6009
 
 
6010
 
                             Some notes on TeX4ht
6011
 
                                       
6012
 
   Some samples of documents I have produced:
6013
 
   
6014
 
     * A Unix tutorial
6015
 
     * Reference sheets for the C++ Standard Template Library (STL)
6016
 
          + Algorithms
6017
 
          + Containers
6018
 
       
6019
 
   Notes:
6020
 
   
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
6027
 
       definitions.
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
6043
 
            from over the net.
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.
6053
 
 
6054
 
%--------------------------------------------------------------
6055
 
(1)
6056
 
 
6057
 
#/bin/sh
6058
 
#
6059
 
#  Usage
6060
 
#    tex4ht.makegif basename pagenumber destination
6061
 
#
6062
 
####################################################
6063
 
#
6064
 
# Produce the image in postscript form, as $3.new.ps
6065
 
#
6066
 
dvips -mode ibmvga -D 110 -f $1.idv -pp $2 > $3.new.ps
6067
 
#
6068
 
#
6069
 
# Check to see if a previous use of this script has left behind a $3.ps file
6070
 
#
6071
 
if test -r $3.ps
6072
 
then
6073
 
#
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.
6077
 
#
6078
 
  if cmp -s $3.ps $3.new.ps
6079
 
  then
6080
 
    echo $3 is unchanged.
6081
 
    rm $3.new.ps
6082
 
  fi
6083
 
fi
6084
 
#
6085
 
#
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.
6089
 
#
6090
 
if test -r $3.new.ps
6091
 
then
6092
 
  mv $3.new.ps $3.ps
6093
 
  convert -crop 0x0 -density 110x110  -transparent '#FFFFFF' $3.ps $3
6094
 
fi
6095
 
 
6096
 
 
6097
 
%-------------------------------------------------------------------
6098
 
 
6099
 
(u3)
6100
 
 
6101
 
 
6102
 
#!/bin/sh
6103
 
#
6104
 
#  reduceGifs base
6105
 
#
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
6110
 
#    same file.
6111
 
#
6112
 
#    This can speed up the loading of some html files by a significant
6113
 
#    amount.
6114
 
#
6115
 
echo > reduceGifs.sed
6116
 
duplicatesFound=0
6117
 
for fileA in $1*.gif
6118
 
do
6119
 
  Adone=0
6120
 
  for fileB in $1*.gif
6121
 
  do
6122
 
    if test $fileA = $fileB
6123
 
    then
6124
 
      Adone=1
6125
 
    fi
6126
 
    if test $Adone = 0
6127
 
    then
6128
 
       if cmp -s $fileA $fileB
6129
 
       then
6130
 
          echo s/$fileA/$fileB/g >> reduceGifs.sed
6131
 
          duplicatesFound=1
6132
 
          Adone=1
6133
 
          echo $fileA and $fileB are duplicates.
6134
 
          rm $fileA
6135
 
       fi
6136
 
    fi
6137
 
  done
6138
 
done
6139
 
#
6140
 
if test $duplicatesFound = 1
6141
 
then
6142
 
  for fileA in $1*.htm*
6143
 
  do
6144
 
    mv $fileA $fileA.bak
6145
 
    echo >> $fileA.bak
6146
 
    sed -f reduceGifs.sed < $fileA.bak > $fileA
6147
 
  done
6148
 
fi
6149
 
 
6150
 
%-----------------------------------------------
6151
 
 
6152
 
(4) 
6153
 
http://www.cygnus.com/misc/gnu-win32/
6154
 
 
6155
 
\EndVerbatim
6156
 
 
6157
 
 
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
6163
 
 
6164
 
 
6165
 
 
6166
 
Eitan:
6167
 
 
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. 
6173
 
 
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
6178
 
easily check).
6179
 
 
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,
6182
 
 
6183
 
\EndVerbatim\EndHPage{}]\fi
6184
 
 
6185
 
 
6186
 
\SubSection{Makefile Tricks}
6187
 
 
6188
 
 
6189
 
\Verbatim
6190
 
 
6191
 
normal:
6192
 
        hugelatex '\def\Status{0}\input live'
6193
 
 
6194
 
pdf:
6195
 
        pdflatex '\def\Status{1}\input live'
6196
 
 
6197
 
html:
6198
 
        latex '\def\Status{2}\input live'
6199
 
        tex4ht live
6200
 
 
6201
 
xxx:
6202
 
        perl htcmd.perl live
6203
 
 
6204
 
clean:
6205
 
        -rm *.dvi *.aux *.log *.blg *.toc *.out
6206
 
        -rm *.xref *.lg *.idv *.out *.otc tmp.* *.css
6207
 
 
6208
 
realclean: clean
6209
 
        -rm live.pdf
6210
 
        -rm live.bbl
6211
 
        -rm *.html *.htm
6212
 
 
6213
 
 
6214
 
bib:
6215
 
        -bibtex live
6216
 
 
6217
 
 
6218
 
\EndVerbatim
6219
 
 
6220
 
 
6221
 
 
6222
 
 
6223
 
\Section{Setting by Viton}
6224
 
 
6225
 
\Verbatim
6226
 
 
6227
 
                            TeX4HT under MiKTeX
6228
 
                                      
6229
 
                              Philip A. Viton
6230
 
                                      
6231
 
1  Introduction
6232
 
 
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
6239
 
   section 7.
6240
 
   
6241
 
2  Get the software
6242
 
 
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
6246
 
       version.
6247
 
     * ImageMagick : for translation of postscript to gif images.
6248
 
     * Ghostscript : used by ImageMagick in the translation.
6249
 
       
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).
6260
 
       
6261
 
   and if you select others, you will need to modify the instructions
6262
 
   accordingly.
6263
 
   
6264
 
3  Set up MiKTeX
6265
 
 
6266
 
   Two of the style files of TeX4ht need to be moved into MiKTeX's LATEX
6267
 
   tree.
6268
 
     * create a directory c:\texmf\tex\latex\tex4ht
6269
 
     * move tex4ht.sty and tex4hta.sty from the TeX4ht directory to this
6270
 
       one.
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.
6274
 
       
6275
 
4  Set up dvips
6276
 
 
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
6284
 
       changes:
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
6287
 
            M ibmvga.
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
6295
 
            postscript fonts.
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.
6300
 
       
6301
 
5  Set up ImageMagick
6302
 
 
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
6318
 
       Ghostscript.
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
6322
 
       it directly:
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
6327
 
            session.
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.
6331
 
       
6332
 
6  Set up TeX4ht
6333
 
 
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.
6364
 
       
6365
 
   Finally, open the file ht.bat. Make sure the last line reads
6366
 
   
6367
 
   htcmd %2 -eC:\tex4ht\tex4ht.env
6368
 
          
6369
 
   and if it doesn't, add the -e switch, whose argument is the drive plus
6370
 
   path to the TeX4ht files.
6371
 
   
6372
 
7  Solving font problems
6373
 
 
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''.
6381
 
   Here's how.
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
6395
 
            document.
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
6400
 
            following:
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
6417
 
       the file:
6418
 
          + Copy it to any directory.
6419
 
          + For safety, do del epfix.bat though there probably won't be
6420
 
            any file to delete.
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
6425
 
            epfont cmr5 72.
6426
 
          + epfont creates a file epfix.bat. This file contains run-able
6427
 
            instructions to have Metafont create your problem fonts. But
6428
 
            before running it:
6429
 
               o Open epfix.bat in a text editor.
6430
 
               o Do a global search-and-replace: replace the string /d by
6431
 
                 a blank.
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.
6443
 
       
6444
 
8  The batch file xht.bat
6445
 
 
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:
6454
 
   
6455
 
   xht tex myfile   for a plain TeX file, or
6456
 
          
6457
 
   xht latex myfile   for a LATEX file.
6458
 
          
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
6472
 
       finishes.
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
6484
 
       may differ.
6485
 
       
6486
 
   You can download the batch file xht.bat here.
6487
 
     _________________________________________________________________
6488
 
   
6489
 
     This document was translated from LATEX by HEVEA
6490
 
     http://para.inria.fr/~maranget/hevea. 
6491
 
 
6492
 
\EndVerbatim
6493
 
 
6494
 
\SubSection{htx.bat}
6495
 
 
6496
 
\Verbatim
6497
 
@echo off
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
6502
 
set opath=%path%
6503
 
set path=%path%;c:\tex4ht
6504
 
set delegate_path=c:\imagemagic
6505
 
call ht %1 %2
6506
 
set path=%opath%
6507
 
set opath=
6508
 
set delegate_path=
6509
 
goto end
6510
 
:syn
6511
 
echo TEX4HT - syntax is tex4ht [tex/latex] file w/o extension
6512
 
goto end
6513
 
:syn1
6514
 
echo TEX4HT - file %2.tex not found
6515
 
:end
6516
 
echo.
6517
 
\EndVerbatim
6518
 
 
6519
 
 
6520
 
 
6521
 
 
6522
 
\ifHtml[\HPage{c:/EMTEX/MFINPUT/ETC/LOCAL.MF}\Verbatim
6523
 
%
6524
 
% local.mf -- Lexmark Optra added
6525
 
%
6526
 
 
6527
 
base_version:=base_version&"/emTeX";
6528
 
 
6529
 
% ------------------------------------------------------------
6530
 
% Define modes
6531
 
% ------------------------------------------------------------
6532
 
 
6533
 
%
6534
 
% HP LaserJet+ (300 DPI)
6535
 
%
6536
 
mode_def laserjet =
6537
 
 proofing:=0; fontmaking:=1; tracingtitles:=0;
6538
 
 pixels_per_inch:=300;
6539
 
 blacker:=0;
6540
 
 fillin:=.2;
6541
 
 o_correction:=.6;
6542
 
 enddef;
6543
 
 
6544
 
%
6545
 
% HP LaserJet 4 (600 DPI)
6546
 
%
6547
 
mode_def laserjetIV =
6548
 
 proofing:=0; fontmaking:=1; tracingtitles:=0;
6549
 
 pixels_per_inch:=600;
6550
 
 blacker:=.25;
6551
 
 fillin:=0;
6552
 
 o_correction:=1;
6553
 
 enddef;
6554
 
 
6555
 
%
6556
 
% HP DeskJet (300 DPI)
6557
 
%
6558
 
mode_def deskjet =
6559
 
 proofing:=0; fontmaking:=1; tracingtitles:=0;
6560
 
 pixels_per_inch:=300;
6561
 
 blacker:=0;
6562
 
 fillin:=0;
6563
 
 o_correction:=.6;
6564
 
 enddef;
6565
 
 
6566
 
% From modes-3.0.mf
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.
6570
 
%
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.
6573
 
%
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$.
6578
 
%
6579
 
mode_def lexmarkr =
6580
 
 proofing:=0; fontmaking:=1; tracingtitles:=0;
6581
 
 pixels_per_inch:=1200;
6582
 
 blacker:=2.0;
6583
 
 fillin:=0;
6584
 
 o_correction:=1;
6585
 
 enddef;
6586
 
 
6587
 
%
6588
 
% Epson FX-80 (240x216 DPI)
6589
 
%
6590
 
mode_def epsonfx =
6591
 
 proofing:=0; fontmaking:=1; tracingtitles:=0;
6592
 
 pixels_per_inch:=240;
6593
 
 aspect_ratio:=216/240;
6594
 
 blacker:=0;
6595
 
 fillin:=0;
6596
 
 o_correction:=.2;
6597
 
 enddef;
6598
 
 
6599
 
%
6600
 
% Epson FX-80 (landscape mode: 216x240 DPI)
6601
 
%
6602
 
mode_def epsonfxl =
6603
 
 proofing:=0; fontmaking:=1; tracingtitles:=0;
6604
 
 pixels_per_inch:=216;
6605
 
 aspect_ratio:=240/216;
6606
 
 blacker:=0;
6607
 
 fillin:=0;
6608
 
 o_correction:=.2;
6609
 
 enddef;
6610
 
 
6611
 
%
6612
 
% Epson MX-80 (120x216 DPI)
6613
 
%
6614
 
mode_def epsonmx =
6615
 
 proofing:=0; fontmaking:=1; tracingtitles:=0;
6616
 
 pixels_per_inch:=120;
6617
 
 aspect_ratio:=216/120;
6618
 
 blacker:=0;
6619
 
 fillin:=0;
6620
 
 o_correction:=.2;
6621
 
 enddef;
6622
 
 
6623
 
%
6624
 
% Epson Stylus (360 DPI)
6625
 
%
6626
 
mode_def epsonsty =
6627
 
 proofing:=0; fontmaking:=1; tracingtitles:=0;
6628
 
 pixels_per_inch:=360;
6629
 
 blacker:=.35;
6630
 
 fillin:=0;
6631
 
 o_correction:=.8;
6632
 
 enddef;
6633
 
 
6634
 
%
6635
 
% NEC-P6 high resolution (360 DPI)
6636
 
%
6637
 
mode_def lqhires =
6638
 
 proofing:=0; fontmaking:=1; tracingtitles:=0;
6639
 
 pixels_per_inch:=360;
6640
 
 blacker:=0;
6641
 
 fillin:=.2;
6642
 
 o_correction:=.6;
6643
 
 enddef;
6644
 
 
6645
 
%
6646
 
% LQ-1500, NEC-P6 medium resolution (360x180 DPI)
6647
 
%
6648
 
mode_def lqmedres =
6649
 
 proofing:=0; fontmaking:=1; tracingtitles:=0;
6650
 
 pixels_per_inch:=360;
6651
 
 aspect_ratio:=180/360;
6652
 
 blacker:=0;
6653
 
 fillin:=0;
6654
 
 o_correction:=.1;
6655
 
 enddef;
6656
 
 
6657
 
%
6658
 
% LQ-1500, NEC-P6 medium resolution (landscape mode: 180x360 DPI)
6659
 
%
6660
 
mode_def lqmedresl =
6661
 
 proofing:=0; fontmaking:=1; tracingtitles:=0;
6662
 
 pixels_per_inch:=180;
6663
 
 aspect_ratio:=360/180;
6664
 
 blacker:=0;
6665
 
 fillin:=0;
6666
 
 o_correction:=.1;
6667
 
 enddef;
6668
 
 
6669
 
%
6670
 
% LQ-1500, NEC-P6 low resolution (180 DPI)
6671
 
%
6672
 
mode_def lqlores =
6673
 
 proofing:=0; fontmaking:=1; tracingtitles:=0;
6674
 
 pixels_per_inch:=180;
6675
 
 blacker:=0;
6676
 
 fillin:=0;
6677
 
 o_correction:=.1;
6678
 
 enddef;
6679
 
 
6680
 
%
6681
 
% C.ITOH 8510A (160x144 DPI)
6682
 
%
6683
 
mode_def itoh =
6684
 
 proofing:=0; fontmaking:=1; tracingtitles:=0;
6685
 
 pixels_per_inch:=160;
6686
 
 aspect_ratio:=144/160;
6687
 
 blacker:=0;
6688
 
 fillin:=0;
6689
 
 o_correction:=.1;
6690
 
 enddef;
6691
 
 
6692
 
%
6693
 
% C.ITOH 8510A (landscape mode: 144x160 DPI)
6694
 
%
6695
 
mode_def itohl =
6696
 
 proofing:=0; fontmaking:=1; tracingtitles:=0;
6697
 
 pixels_per_inch:=144;
6698
 
 aspect_ratio:=160/144;
6699
 
 blacker:=0;
6700
 
 fillin:=0;
6701
 
 o_correction:=.1;
6702
 
 enddef;
6703
 
 
6704
 
%
6705
 
% FAX (204x196 DPI)
6706
 
%
6707
 
mode_def fax =
6708
 
 proofing:=0; fontmaking:=1; tracingtitles:=0;
6709
 
 pixels_per_inch:=204;
6710
 
 aspect_ratio:=196/204;
6711
 
 blacker:=0;
6712
 
 fillin:=.2;
6713
 
 o_correction:=.2;
6714
 
 enddef;
6715
 
 
6716
 
%
6717
 
% FAX (landscape mode: 196x204 DPI)
6718
 
%
6719
 
mode_def faxl =
6720
 
 proofing:=0; fontmaking:=1; tracingtitles:=0;
6721
 
 pixels_per_inch:=196;
6722
 
 aspect_ratio:=204/196;
6723
 
 blacker:=0;
6724
 
 fillin:=.2;
6725
 
 o_correction:=.2;
6726
 
 enddef;
6727
 
 
6728
 
%
6729
 
% HP QuietJet (192 DPI)
6730
 
%
6731
 
mode_def quietjet =
6732
 
 proofing:=0; fontmaking:=1; tracingtitles:=0;
6733
 
 pixels_per_inch:=192;
6734
 
 blacker:=0;
6735
 
 fillin:=0;
6736
 
 o_correction:=.1;
6737
 
 enddef;
6738
 
 
6739
 
%
6740
 
% HP ThinkJet (192x96 DPI)
6741
 
%
6742
 
% Warning: Many fonts break at such low a resolution
6743
 
%
6744
 
mode_def thinkjet =
6745
 
 proofing:=0; fontmaking:=1; tracingtitles:=0;
6746
 
 pixels_per_inch:=192;
6747
 
 aspect_ratio:=96/192;
6748
 
 blacker:=0;
6749
 
 fillin:=0;
6750
 
 o_correction:=.1;
6751
 
 enddef;
6752
 
 
6753
 
%
6754
 
% HP ThinkJet (landscape mode: 96x192 DPI)
6755
 
%
6756
 
% Warning: Many fonts break at such low a resolution
6757
 
%
6758
 
mode_def thinkjetl =
6759
 
 proofing:=0; fontmaking:=1; tracingtitles:=0;
6760
 
 pixels_per_inch:=96;
6761
 
 aspect_ratio:=192/96;
6762
 
 blacker:=0;
6763
 
 fillin:=0;
6764
 
 o_correction:=.1;
6765
 
 enddef;
6766
 
 
6767
 
%
6768
 
% Canon BubbleJet 10ex (360 DPI)
6769
 
%
6770
 
mode_def canonbj =
6771
 
 proofing:=0; fontmaking:=1; tracingtitles:=0;
6772
 
 pixels_per_inch:=360;
6773
 
 blacker:=.6;
6774
 
 fillin:=0;
6775
 
 o_correction:=.6;
6776
 
 enddef;
6777
 
 
6778
 
 
6779
 
%
6780
 
% Select default mode
6781
 
%
6782
 
localfont:=laserjet;
6783
 
 
6784
 
%
6785
 
% Complain about unknown mode
6786
 
%
6787
 
let plain_mode_setup_ = mode_setup;
6788
 
 
6789
 
def mode_setup =
6790
 
 if unknown mode: show mode; errmessage "Unknown mode"; fi
6791
 
 plain_mode_setup_;
6792
 
enddef;
6793
 
 
6794
 
 
6795
 
% ------------------------------------------------------------
6796
 
% Here are macros for Xerox-world font info
6797
 
% ------------------------------------------------------------
6798
 
 
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;
6808
 
 
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;
6813
 
 
6814
 
Xerox_world:=1;    % users can say `if known Xerox_world:...fi'
6815
 
 
6816
 
inner end;
6817
 
let primitive_end_ = end;
6818
 
def end =
6819
 
  if fontmaking > 0:
6820
 
    font_family font_identifier_;
6821
 
    coding_scheme font_coding_scheme_;
6822
 
    font_face_byte max (0, 254 - round 2designsize);
6823
 
  fi;
6824
 
  primitive_end_
6825
 
enddef;
6826
 
 
6827
 
outer end, primitive_end_;
6828
 
let bye = end;
6829
 
% A 96 dpi screen output mode:
6830
 
mode_def htm =
6831
 
 proofing:=0; fontmaking:=1; tracingtitles:=0;
6832
 
 pixels_per_inch:=96;
6833
 
 blacker:=.3;
6834
 
 fillin:=0;
6835
 
 o_correction:=0;
6836
 
 enddef;
6837
 
\EndVerbatim\EndHPage{}]\fi 
6838
 
 
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";
6842
 
 
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
6851
 
 enddef;
6852
 
 
6853
 
mode_def escher =           % mode for the 300 imagen printer
6854
 
 proofing:=0;
6855
 
 fontmaking:=1;
6856
 
 tracingtitles:=0;
6857
 
 pixels_per_inch:=300;
6858
 
 blacker:=0;
6859
 
 fillin:=.2;
6860
 
 o_correction:=.6;
6861
 
 enddef;
6862
 
 
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
6871
 
 enddef;
6872
 
 
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
6881
 
 enddef;
6882
 
 
6883
 
% mode for Imagewriter (144 dots per inch) taken from pktor documentation
6884
 
mode_def imagewriter =
6885
 
  proofing := 0;
6886
 
  fontmaking := 1;
6887
 
  tracingtitles := 1; 
6888
 
  pixels_per_inch := 144;
6889
 
  blacker := 0;
6890
 
  fillin := 0;
6891
 
  o_correction := .2;
6892
 
enddef;
6893
 
 
6894
 
 
6895
 
 
6896
 
 
6897
 
localfont:=escher;
6898
 
 
6899
 
\EndVerbatim\EndHPage{}]\fi 
6900
 
 
6901
 
 
6902
 
\HCode{<HR>}
6903
 
 
6904
 
c:/texlive3/tex/texmf/metafont/misc/modes.mf
6905
 
 
6906
 
\Link[file://localhost/usr/local/teTeX/share/texmf/metafont/misc/modes.mf]{}{}modes.mf\EndLink
6907
 
 
6908
 
\HCode{<HR>}
6909
 
 
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.
6917
 
***
6918
 
*** This config.ps file (and dvips's internal defaults!) make use of 
6919
 
*** environment variables EMTEXDIR, DVIDRVGRAPH, GS_LIB and DVIDRVFONTS.
6920
 
***
6921
 
*** EMTEXDIR and DVIDRVFONTS MUST contain only ONE path entry for
6922
 
*** letting maketexp.{bat,cmd} and this config.ps work correctly !!!
6923
 
***
6924
 
*** G. Sawade <sawade@physik.tu-berlin.de>                2-Nov-1995
6925
 
*********************************************************************
6926
 
 
6927
 
 
6928
 
W *** HP LaserJet/300dpi ***
6929
 
 
6930
 
* Claim approx 700 kbytes memory
6931
 
m 700000
6932
 
 
6933
 
* Default resolution.
6934
 
D 300
6935
 
 
6936
 
* Default metafont mode (defined in emTeX's local.mf)
6937
 
M laserjet
6938
 
 
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
6943
 
 
6944
 
T $(EMTEXDIR)\TFM!
6945
 
*T c:\emtex\tfm\dvips;c:\pctex\textfms
6946
 
 
6947
 
 
6948
 
*** ATTENTION ATTENTION: DVIDRVFONTS is allowed only to contain a single path !!!
6949
 
V $(DVIDRVFONTS)\vf!
6950
 
*V c:\texfonts\vf
6951
 
 
6952
 
P $(DVIDRVFONTS)\%d\%f.pk
6953
 
*P c:\pctex\pixel\dpi%d\%f.%p
6954
 
 
6955
 
L $(DVIDRVFONTS)\;lj_base;lj_more
6956
 
 
6957
 
 
6958
 
**** When you want to use the psnfss.map, remove the comment here
6959
 
*p +psnfss.map
6960
 
 
6961
 
 
6962
 
S .;$(EMTEXDIR)\TEXINPUT!!;$(DVIDRVGRAPH)
6963
 
*S .;c:\emtex\texinput\dvips;c:\pctex\texinput;c:\pctex\latex
6964
 
 
6965
 
H .;$(EMTEXDIR)\data\dvips;$(DVIDRVGRAPH);$(DVIDRVFONTS)\ps;$(GS_LIB)
6966
 
*H .;c:\emtex\data\dvips
6967
 
 
6968
 
* Compress fonts
6969
 
Z
6970
 
 
6971
 
*
6972
 
*   Paper size information.  First definition is the default.
6973
 
*
6974
 
*   If your default is a4 uncomment the following definition
6975
 
*   and comment out the letterSize definition.
6976
 
*@ a4size 210mm 297mm
6977
 
*@+ %%PaperSize: a4
6978
 
 
6979
 
@ letterSize 8.5in 11in
6980
 
@+ %%PaperSize: Letter
6981
 
 
6982
 
@ letter 8.5in 11in
6983
 
@+ %%BeginPaperSize: Letter
6984
 
@+ letter
6985
 
@+ %%EndPaperSize
6986
 
 
6987
 
@ legal 8.5in 14in
6988
 
@+ ! %%DocumentPaperSizes: Legal
6989
 
@+ %%BeginPaperSize: Legal
6990
 
@+ legal
6991
 
@+ %%EndPaperSize
6992
 
 
6993
 
@ ledger 17in 11in
6994
 
@+ ! %%DocumentPaperSizes: Ledger
6995
 
@+ %%BeginPaperSize: Ledger
6996
 
@+ ledger
6997
 
@+ %%EndPaperSize
6998
 
 
6999
 
@ tabloid 11in 17in
7000
 
@+ ! %%DocumentPaperSizes: Tabloid
7001
 
@+ %%BeginPaperSize: Tabloid
7002
 
@+ 11x17
7003
 
@+ %%EndPaperSize
7004
 
 
7005
 
@ a4 210mm 297mm
7006
 
@+ ! %%DocumentPaperSizes: a4
7007
 
@+ %%BeginPaperSize: a4
7008
 
@+ a4
7009
 
@+ %%EndPaperSize
7010
 
 
7011
 
@ a3 297mm 420mm
7012
 
@+ ! %%DocumentPaperSizes: a3
7013
 
@+ %%BeginPaperSize: a3
7014
 
@+ a3
7015
 
@+ %%EndPaperSize
7016
 
 
7017
 
@ unknown 0in 0in
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
7022
 
 
7023
 
\ifHtml[\HPage{c:/texlive3/tex/texmf/dvips/config/config.ps}\Verbatim
7024
 
% Memory available.
7025
 
m 1000000
7026
 
 
7027
 
% How to print.
7028
 
o |lpr
7029
 
 
7030
 
% default resolution
7031
 
D 600
7032
 
X 600
7033
 
Y 600
7034
 
M ljfour
7035
 
 
7036
 
% Also look for this list of resolutions.
7037
 
R 300 600
7038
 
Z
7039
 
j0
7040
 
 
7041
 
% The printer offsets the output by this much.
7042
 
O 0pt,0pt
7043
 
 
7044
 
% paper sizes
7045
 
@ A4size 210mm 297mm
7046
 
@+ %%PaperSize: A4
7047
 
 
7048
 
@ letterSize 8.5in 11in
7049
 
 
7050
 
@ letter 8.5in 11in
7051
 
@+ %%BeginPaperSize: Letter
7052
 
@+ letter
7053
 
@+ %%EndPaperSize
7054
 
 
7055
 
@ legal 8.5in 14in
7056
 
@+ ! %%DocumentPaperSizes: Legal
7057
 
@+ %%BeginPaperSize: Legal
7058
 
@+ legal
7059
 
@+ %%EndPaperSize
7060
 
 
7061
 
@ ledger 17in 11in
7062
 
@+ ! %%DocumentPaperSizes: Ledger
7063
 
@+ %%BeginPaperSize: Ledger
7064
 
@+ ledger
7065
 
@+ %%EndPaperSize
7066
 
 
7067
 
@ tabloid 11in 17in
7068
 
@+ ! %%DocumentPaperSizes: Tabloid
7069
 
@+ %%BeginPaperSize: Tabloid
7070
 
@+ 11x17
7071
 
@+ %%EndPaperSize
7072
 
 
7073
 
@ A4 210mm 297mm
7074
 
@+ ! %%DocumentPaperSizes: A4
7075
 
@+ %%BeginPaperSize: A4
7076
 
@+ a4
7077
 
@+ %%EndPaperSize
7078
 
 
7079
 
@ A3 297mm 420mm
7080
 
@+ ! %%DocumentPaperSizes: A3
7081
 
@+ %%BeginPaperSize: A3
7082
 
@+ a3
7083
 
@+ %%EndPaperSize
7084
 
 
7085
 
\EndVerbatim\EndHPage{}]\fi 
7086
 
 
7087
 
 
7088
 
\ifHtml[\HPage{file://localhost/usr/local/teTeX/share/texmf/dvips/config/config.ps}\Verbatim
7089
 
% Thomas Esser, 1998, public domain.
7090
 
%
7091
 
% teTeX's config.ps.
7092
 
%
7093
 
% Memory available.
7094
 
m 1000000
7095
 
 
7096
 
% How to print.
7097
 
o |lp
7098
 
 
7099
 
% default resolution
7100
 
D 600
7101
 
X 600
7102
 
Y 600
7103
 
M ljfive
7104
 
 
7105
 
% Also look for this list of resolutions.
7106
 
R 300 600
7107
 
 
7108
 
% The printer offsets the output by this much.
7109
 
O 0pt,0pt
7110
 
 
7111
 
% Compress fonts. PS files are much more compact, but can sometimes
7112
 
% cause trouble.
7113
 
Z
7114
 
 
7115
 
% An "all-in-one" psfonts.map.
7116
 
p psfonts.map
7117
 
 
7118
 
% Instead of psfonts.map, you can use smaller "modules".
7119
 
% p acrobat.map
7120
 
% p +charter.map
7121
 
% p +lw35extra.map
7122
 
% p +marvosym.map
7123
 
% p +omega.map
7124
 
% p +utopia.map
7125
 
% p +xypic.map
7126
 
% p +mathtime.map
7127
 
% p +lucidabr.map
7128
 
 
7129
 
% Uncomment the following two lines to use Postscript Type1 fonts instead of
7130
 
% bitmap fonts for computer modern & co.
7131
 
% p +bsr.map
7132
 
% p +hoekwater.map
7133
 
 
7134
 
@ letterSize 8.5in 11in
7135
 
 
7136
 
@ A4size 210mm 297mm
7137
 
@+ %%PaperSize: A4
7138
 
 
7139
 
@ letter 8.5in 11in
7140
 
@+ %%BeginPaperSize: Letter
7141
 
@+ letter
7142
 
@+ %%EndPaperSize
7143
 
 
7144
 
@ legal 8.5in 14in
7145
 
@+ ! %%DocumentPaperSizes: Legal
7146
 
@+ %%BeginPaperSize: Legal
7147
 
@+ legal
7148
 
@+ %%EndPaperSize
7149
 
 
7150
 
@ ledger 17in 11in
7151
 
@+ ! %%DocumentPaperSizes: Ledger
7152
 
@+ %%BeginPaperSize: Ledger
7153
 
@+ ledger
7154
 
@+ %%EndPaperSize
7155
 
 
7156
 
@ tabloid 11in 17in
7157
 
@+ ! %%DocumentPaperSizes: Tabloid
7158
 
@+ %%BeginPaperSize: Tabloid
7159
 
@+ 11x17
7160
 
@+ %%EndPaperSize
7161
 
 
7162
 
@ A4 210mm 297mm
7163
 
@+ ! %%DocumentPaperSizes: A4
7164
 
@+ %%BeginPaperSize: A4
7165
 
@+ a4
7166
 
@+ %%EndPaperSize
7167
 
 
7168
 
@ A3 297mm 420mm
7169
 
@+ ! %%DocumentPaperSizes: A3
7170
 
@+ %%BeginPaperSize: A3
7171
 
@+ a3
7172
 
@+ %%EndPaperSize
7173
 
 
7174
 
@ B5 176mm 250mm
7175
 
@+ ! %%DocumentPaperSizes: B5
7176
 
@+ %%PaperSize: B5
7177
 
 
7178
 
\EndVerbatim\EndHPage{}]\fi
7179
 
 
7180
 
\ifHtml[\HPage{newer version}\Verbatim
7181
 
 
7182
 
                            TeX4HT under MiKTeX
7183
 
                                      
7184
 
                              Philip A. Viton
7185
 
                              November 9, 1998
7186
 
                                      
7187
 
   1 Introduction
7188
 
   2 Get the software
7189
 
   3 Set up MiKTeX
7190
 
   4 Set up dvips
7191
 
      4.1 Postscript fonts
7192
 
      4.2 Metafont fonts
7193
 
   5 Set up ImageMagick
7194
 
   6 Set up TeX4ht
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"
7200
 
   
7201
 
1 Introduction
7202
 
 
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.
7210
 
   
7211
 
2 Get the software
7212
 
 
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
7220
 
       translation.
7221
 
       
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).
7232
 
       
7233
 
   and if you select others, you will need to modify the instructions
7234
 
   accordingly.
7235
 
   
7236
 
3 Set up MiKTeX
7237
 
 
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
7242
 
       one.
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.
7246
 
       
7247
 
4 Set up dvips
7248
 
 
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.
7257
 
   
7258
 
  4.1 Postscript fonts
7259
 
  
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.
7264
 
   
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.
7270
 
   
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
7276
 
       ;p +cmfonts.map
7277
 
       If all these lines are uncommented (ie, not preceded by a ;
7278
 
       character) and if you see a reference to
7279
 
       p +amsfonts.map
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.
7291
 
       
7292
 
  4.2 Metafont fonts
7293
 
  
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.
7297
 
   
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).
7305
 
   
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
7312
 
   your call.
7313
 
   
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
7317
 
   be done.
7318
 
   
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
7323
 
   MiKTeX; other TEX
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
7329
 
       changes:
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
7332
 
            M ibmvga.
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
7336
 
            be changed to 110.
7337
 
          + Comment out (by preceding each line with a semi-colon) the
7338
 
            approximately 11 lines of the form
7339
 
            ;p +cmfonts.map
7340
 
            -- we want Metafont to create these fonts if they're
7341
 
            requested.
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.
7346
 
       
7347
 
   A copy of the edited config.ibmvga can be downloaded config.ibmvga .
7348
 
   
7349
 
5 Set up ImageMagick
7350
 
 
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
7354
 
       delegates.mgk.
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
7369
 
       it directly:
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
7374
 
            session.
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.
7378
 
       
7379
 
6 Set up TeX4ht
7380
 
 
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.
7385
 
   
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
7401
 
            in section 4.1.
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.
7423
 
       
7424
 
   Finally, open the file ht.bat. Make sure the last line reads
7425
 
   
7426
 
   htcmd %2 -eC:\ tex4ht\ tex4ht.env
7427
 
          
7428
 
   and if it doesn't, add the -e switch, whose argument is the drive plus
7429
 
   path to the TeX4ht files.
7430
 
   
7431
 
7 The batch file xht.bat
7432
 
 
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.
7439
 
   
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:
7442
 
   
7443
 
   xht tex myfile for a plain TeX file, or
7444
 
          
7445
 
   xht latex myfile for a LaTeX file.
7446
 
          
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
7460
 
       finishes.
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
7472
 
       may differ.
7473
 
       
7474
 
   You can download the batch file xht.bat xht.bat .
7475
 
   
7476
 
A Solving low-resolution font problems
7477
 
 
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
7485
 
   for Metafont.
7486
 
   
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.
7493
 
   
7494
 
  A.1 Identifying the problem fonts
7495
 
  
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
7522
 
            yap.
7523
 
       
7524
 
  A.2 Get the font information
7525
 
  
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
7529
 
       following:
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).
7537
 
       
7538
 
  A.3 Making the problem fonts "by hand"
7539
 
  
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
7548
 
       file to delete.
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
7555
 
       before running it:
7556
 
          + Open epfix.bat in a text editor.
7557
 
          + Do a global search-and-replace: replace the string  /d  by a
7558
 
            blank.
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.
7569
 
 
7570
 
\EndVerbatim\EndHPage{}]\fi
7571
 
 
7572
 
 
7573
 
 
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
7580
 
 
7581
 
 
7582
 
 
7583
 
 
7584
 
 
7585
 
 
7586
 
\Section{Gifs vs JPEG}
7587
 
 
7588
 
 
7589
 
\Verbatim
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
7598
 
Lines: 55
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
7603
 
 
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.
7612
 
 
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.
7616
 
 
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.
7620
 
 
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.
7624
 
 
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.
7627
 
 
7628
 
joannt@teleport.com (Joann Taylor) wrote:
7629
 
 
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?
7643
 
 
7644
 
 
7645
 
>Many thanks,
7646
 
 
7647
 
>Joann
7648
 
>--
7649
 
>* Joann Taylor                                               *
7650
 
>* Principal Consultant - Color Technology Solutions          *
7651
 
>* Specializing in Color Science, Technology and Applications *
7652
 
>* joannt@teleport.com                                        *
7653
 
 
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
7658
 
 
7659
 
 
7660
 
 
7661
 
 
7662
 
\EndVerbatim
7663
 
 
7664
 
 
7665
 
 
7666
 
\bye
7667
 
 
7668
 
 
7669