8 Listings
Here are the listings for various files mentioned. They can also be downloaded from
[6].
8.1 cscript.sh
#!/bin/bash
echo 'CSCRIPH.SH -- convert dvi to bitmap.'
#
# verison 1.5
#
# exit statii and their meanings:
# 0 - success
# 1 - bad command line
#proper invocation:
# cscript.sh thedvifile thepage theoutputfile quality
#
# quality is a parameter describing the quality of the converting process
# when using the horribly slow plan-b-method.
# 0-dirty, 1-low, 2-medium, 3-high.
#
# check if command line arguments exists
if [[ ! "$1" || ! "$2" || ! "$3" || ! "$4" ]]
then
echo "CSCRIPT.SH> Error: bad command line"
echo " proper invocation: CSCRIPT.SH thedvifile thepagenumber theoutputfile quality"
exit 1
fi
#check quality settings ...
quality=$4
if [[ "$quality" -lt 0 ]]
then
quality=0
fi
if [[ "$quality" -gt 3 ]]
then
quality=3
fi
echo "CSCRIPT.SH> quality set to $quality"
#try to convert with dvi2bitmap.
rm -f $3
success=0
if ./dvi2bitmap --font-mode=ibmvga --page-range=$2 --magnification=4 -s 4 --output-type=png --resolution=110 --process=transparent=false --output=$3 $1
then success=1
fi
#./dvi2bitmap -fp /var/spool/texmf/pk/ibmvga/public/cm:/var/spool/texmf/pk/ibmvga/public/latex::/var/spool/texmf/pk/ibmvga/ams/cmextra -fm ibmvga -Pt -pp $2 -m 4 -s 4 -t png -r 110 -o $3 $1
#check if the outputfile was generated.
#if not, create image with dvips/gs/convert.
if [[ -e "$3" ]]
#if (( success = 1 ))
then
echo "CSCRIPT.SH> dvi2bitmap made it!"
# enhance the bitmap.
#convert -unsharp 1.0x0.5 $3 fisk_og_slips.gif
#convert fisk_og_slips.gif $3
else
echo "CSCRIPT.SH> dvi2bitmap failed! running the dvips/gs/convert-process..."
dvips -Pcmz -Pamz -mode ibmvga -D 220 -f $1 -pp $2 > TEMPORARY.ps
if [[ "$quality" = 0 ]]
then
res_str='-r25x25'
scale_str='440%'
fi
if [[ "$quality" = 1 ]]
then
res_str='-r110x110'
scale_str='100%'
fi
if [[ "$quality" = 2 ]]
then
res_str='-r160x160'
scale_str='68.75%'
fi
if [[ "$quality" = 3 ]]
then
res_str='-r220x220'
scale_str='50%'
fi
gs -sDEVICE=ppm -sOutputFile=TEMPORARY.ppm $res_str -q -dbatch -dNOPAUSE TEMPORARY.ps -c quit
convert -crop 0x0 -density 110x110 -antialias -scale $scale_str -transparent '#FFFFFF' TEMPORARY.ppm $3
rm TEMPORARY.ps
rm TEMPORARY.ppm
fi
echo "CSCRIPT.SH> finished."
8.2 customlinks.tex
%
% These are commands that configure tex4ht to produce internal
% human readable links into the HTML code.
%
\newcommand{\logcomment}{ --- Customlinks says: }
\newcommand{\chapterlink}{\HCode{<a name='ch\arabic{chapter}'></a>}}
\newcommand{\sectionlink}{\HCode{<a name='sec\arabic{chapter}-\arabic{section}'></a>}}
\newcommand{\subsectionlink}{\HCode{<a name='subsec\arabic{chapter}-\arabic{section}-\arabic{subsection}'></a>}}
\newcommand{\subsubsectionlink}{\HCode{<a name='subsubsec\arabic{chapter}-\arabic{section}-\arabic{subsection}-\arabic{subsubsection}'></a>}}
\newcommand{\reportchapterlink}{\typeout{\logcomment Link to
chapter \thechapter: \FileName\#ch\arabic{chapter}}}
\newcommand{\reportsectionlink}{\typeout{\logcomment Link to
section \thesection:
\FileName\#sec\arabic{chapter}-\arabic{section}}}
\newcommand{\reportsubsectionlink}{\typeout{\logcomment Link to
subsection \thesubsection:
\FileName\#subsec\arabic{chapter}-\arabic{section}-\arabic{subsection}}}
\newcommand{\reportsubsubsectionlink}{\typeout{\logcomment Link to
subsubsection \thesubsubsection:
\FileName\#subsubsec\arabic{chapter}-\arabic{section}-\arabic{subsection}-\arabic{subsubsection}}}
\newcommand{\reportcustomlink}[1]{\typeout{\logcomment Custom link named '#1': \FileName\##1 }}
\newcommand{\customlink}[1]{\HCode{<a name='#1'></a>}\reportcustomlink{#1}}
\newcommand{\thispage}{\arabic{page}}
\newcommand{\reportpagelink}{\typeout{\logcomment Page-link at page
\thispage: \FileName\#p\thispage}}
\newcommand{\pagelink}{\HCode{<a name='p\thispage'></a>}\reportpagelink}
\Configure{chapter}{\chapterlink\reportchapterlink}{}{}{}
\Configure{section}{\sectionlink\reportsectionlink}{}{}{}
\Configure{subsection}{\subsectionlink\reportsubsectionlink}{}{}{}
\Configure{subsubsection}{\subsubsectionlink\reportsubsubsectionlink}{}{}{}
%
% End of internal link code.
%
%
% To generate a report of links generated:
%
% cat bok.log | grep Customlinks > links.txt
%
%
%
% Note that when inserting ``custom links,'' don't insert blank lines
% after the \customlink-command. This will generate an extra (empty
% but visible) paragraph!
%
8.3 tex4ht.env
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% tex4ht.env / .tex4ht %
% %
% Notes: %
% 1. empty lines are harmful %
% 2. place this file in your work %
% directory and/or root directory %
% and/or in directory `xxx' of your %
% choice. In the latest case, compile %
% tex4ht.c with `#define HTFDIR xxx', %
% or provide the address of the file %
% to tex4ht throught the -e switch %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% * Replace `path' and `tfmpath/...' %
% * A ! requests recursive search into %
% subdirectories %
% * Multiple entries of each type are %
% allowed %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%ttfmpath/tex/texmf/fonts/tfm/!
%ipath/tex4ht.dir/ht-fonts/iso8859/!
%ipath/tex4ht.dir/ht-fonts/alias/!
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Replace `path' %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% bookkeeping for searched files
%lpath/tex4ht.dir/tex4ht.fls
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Default scripts
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
s--- needs --- %%1.idv[%%2] ==> %%3 ---
b--- characters ---
g.png
% remove protection
S*
%
% invoke cscript.sh; a script to convert from dvi to bitmap.
%
G./cscript.sh %%1 %%2 %%3 2
%
% t4ht -d%%2
Mmv %%1 %%2
Ccp %%1 %%2
% t4ht -d%%2 -m%%1
Achmod %%1 %%2%%3
% empty gifs
Ecp empty.pic %%1%%2
% validations, XSTL tranformations,...
Xmake -f NSGMLS name=%%1 ext=%%2
% end of file