@echo off
REM Install latex2html in general. Will require configuration by the user.
REM ========================================================================
REM Uncompress l2hfu3.exe
REM ========================================================================
REM move to the C:\ top directory
c:
cd \
REM skip extraction if the argument is skip
if "%1" == "skip" goto skip
REM must have l2hfu3.exe
if exist C:\l2hfu3.exe goto havzip
echo.
echo *** The l2hfu3.exe file is not in the top C: disk folder. Download this
echo file first, then try again.
goto err
:havzip
REM reset the errorlevel on 98
l2hfu3.exe -z
if errorlevel 1 goto perr
REM Move existing l2h directories out of the way.
if exist C:\l2h\ goto wrnol2h
if exist C:\l2hs\ goto wrnol2h
if exist C:\l2hins\ goto wrnol2h
if exist C:\l2hsup\ goto wrnol2h
goto endol2h
:wrnol2h
cls
echo WARNING: One or more of the folders C:\l2h[s], C:\l2hsup, and C:\l2hins
echo already exist. These directories will be moved to a folder
echo l2hold unless you abort now. To abort, hold down the [Ctrl]
echo key and hit [c]. Then enter [y]. Otherwise just hit [Enter].
pause
cls
if not exist C:\l2holder\ goto noolder
echo *** A folder C:\l2holder exists! Move that folder elsewhere, then try
echo again.
goto err
:noolder
if exist C:\l2hold\ move C:\l2hold C:\l2holder
if errorlevel 1 goto errol2h
mkdir C:\l2hold
if errorlevel 1 goto errol2h
if exist C:\l2holder\ move C:\l2holder C:\l2hold
if errorlevel 1 goto errol2h
if exist C:\l2h\ move C:\l2h C:\l2hold
if errorlevel 1 goto errol2h
if exist C:\l2hs\ move C:\l2hs C:\l2hold
if errorlevel 1 goto errol2h
if exist C:\l2hsup\ move C:\l2hsup C:\l2hold
if errorlevel 1 goto errol2h
if exist C:\l2hins\ move C:\l2hins C:\l2hold
if errorlevel 1 goto errol2h
REM see whether we really got rid of them
if exist C:\l2h\ goto errol2h
if exist C:\l2hs\ goto errol2h
if exist C:\l2hins\ goto errol2h
if exist C:\l2hsup\ goto errol2h
if exist C:\l2holder\ goto errol2h
goto endol2h
:errol2h
echo *** Unable to move your old l2h files out of the way. Installation cannot
echo continue.
goto perr
:endol2h
REM Warn about copyright
cls
echo.
echo WARNING: This install includes a variety of copyrighted programs from
echo many sources and is STRICTLY FOR PERSONAL USE. It should not be
echo redistributed in any form.
echo.
echo WARNING: These programs come with ABSOLUTELY NO WARRANTY OF ANY KIND.
echo.
echo If you need to abort installation for the above reasons, hold down the
echo [Ctrl] key and hit [c]. Then enter [y]. Otherwise just hit [Enter].
pause
cls
REM unzip the latex2html files
echo.
echo I am ready to create the following LaTeX2HTML folders:
echo.
echo C:\l2hsup: Contains essential programs and the docs in l2hdocs
echo C:\l2h: LaTeX2HTML binaries and files
echo C:\l2hins: Installation files for if you want to modify l2h yourself
echo.
echo If you want to abort installation for some reason, hold down the
echo [Ctrl] key and hit [c]. Then enter [y]. Otherwise just hit [Enter].
pause
cls
l2hfu3.exe
if errorlevel 1 goto errnl2h
cls
:skip
REM see whether we really got them (at least some files)
if not exist C:\l2h\bin\latex2html.bat goto errnl2h
if not exist C:\l2hsup\l2hcrop.exe goto errnl2h
if not exist C:\l2hins\texinputs\html.sty goto errnl2h
if not exist C:\l2hsup\var\choose.exe goto errchoos
goto endnl2h
:errnl2h
echo *** Unable to create the LaTeX2HTML files. Installation cannot continue.
goto perr
:errchoos
echo *** Your version of l2hfu3.exe is outdated. This script needs the current
echo version.
goto err
:endnl2h
REM ========================================================================
REM Prepare the further installation
REM ========================================================================
cd \l2hsup
if errorlevel 1 goto err
set stat=y
if not "%stat%" == "y" goto enverr
call var\inini.bat
if "%stat%" == "" goto err
REM ========================================================================
REM Get program ID and top directory
REM ========================================================================
REM notify user of creation
cls
echo.
echo It appears that the LaTeX2HTML folders were successfully created.
echo I will now search for a version of TeX.
echo.
var\choose anykey "Read the message above and hit any key to continue"
cls
REM Search for a TeX top directory
set id=mkt
set top=C:\PROGRA~1\MIKTEX~1.5\
if exist C:\PROGRA~1\MIKTEX~1.6\ set top=C:\PROGRA~1\MIKTEX~1.6\
if exist C:\PROGRA~1\MIKTEX~1.7\ set top=C:\PROGRA~1\MIKTEX~1.7\
if exist C:\PROGRA~1\MIKTEX~1.8\ set top=C:\PROGRA~1\MIKTEX~1.8\
if exist C:\PROGRA~1\MIKTEX~1.9\ set top=C:\PROGRA~1\MIKTEX~1.9\
goto seetop
:endmkt
set id=mko
set top=C:\texmf\
if exist C:\texmf\miktex\ goto seetop
:endmko
set id=fpt
set top=C:\PROGRA~1\TEXLIVE\
goto seetop
:endfpt
set id=xtx
set top=C:\PROGRA~1\XEMTEX\
goto seetop
:endxtx
set id=mtx
set top=C:\EMTEX\
goto seetop
:endmtx
goto asktop
:seetop
if "%top%" == "" goto enverr
if "%id%" == "" goto enverr
if not exist %top% goto end%id%
echo A TeX folder was found, with DOS name:
echo %top%
echo Unless you have more than one version of TeX installed, this should be the
echo one. (Note that MiKTeX 2.5 will show up as MIKTEX~1.5).
var\choose yn "Proceed with this version of TeX:y"
if errorlevel 2 goto end%id%
if errorlevel 1 goto havtop
goto end
:asktop
echo.
echo Unable to find a TeX installation in one of the common locations, such as
echo C:\Program Files\MiKTeX 2.5, C:\texmf, C:\Program files\TeXLive, C:\EMTEX,
echo or C:\Program files\XEmTeX. You will need to manually enter the correct
echo location. (Note that this program must use DOS names. For example,
echo C:\Program Files\MiKTeX 2.5 will be converted to C:\PROGRA~1\MIKTEX~1.5
echo for DOS):
echo.
var\askdir top Please enter the folder of your TeX program:
if errorlevel 1 goto err
call asktmp.bat
if "%top%" == "" goto enverr
if not exist %top% goto perr
cls
echo.
echo In addition I need the type of TeX you have. Select a number from the
echo following menu:
echo.
echo 1) My TeX is none of the ones below
echo 2) My TeX is MiKTeX
echo 3) My TeX is fpTeX
echo 4) My TeX is XEmTeX
echo 5) My TeX is emTeX
echo.
var\choose 12345 "Please press the correct number from the list above"
if errorlevel 5 goto idmtx
if errorlevel 4 goto idxtx
if errorlevel 3 goto idfpt
if errorlevel 2 goto idmkt
if errorlevel 1 goto idgen
goto err
:idmtx
set id=mtx
goto endid
:idxtx
set id=xtx
goto endid
:idfpt
set id=fpt
goto endid
:idmkt
set id=mkt
goto endid
:idgen
set id=gen
goto endid
:endid
if "%id%" == "" goto enverr
cls
:havtop
var\clrerr
if "%id%" == "mko" set id=mkt
REM ========================================================================
REM Move the latex2html files into position
REM ========================================================================
set stat=y
if not "%stat%" == "y" goto enverr
call var\copyfils.bat
if "%stat%" == "" goto err
REM ========================================================================
REM Try to create non-EPS versions of the configuration files
REM ========================================================================
call var\creaneps
REM ========================================================================
REM Move the style files into position
REM ========================================================================
set stys=latex2html\
if not "%stys%" == "latex2html\" goto enverr
set sty=%top%texmf\tex\latex\
if not "%sty%" == "%top%texmf\tex\latex\" goto enverr
if exist %sty% goto calsty
set sty=%top%tex\latex\
if exist %sty% goto calsty
set stys=l2h\
set sty=%top%TEXINPUT\LATEX2E\
if exist %sty% goto calsty
set sty=%top%TEXINPUT\LATEX\
if exist %sty% goto calsty
set sty=
set stys=.\
:calsty
var\clrerr
set stat=y
if not "%stat%" == "y" goto enverr
call var\copysty.bat
if "%stat%" == "" goto err
REM ========================================================================
REM Search for the bin directory
REM ========================================================================
set bin=%top%miktex\bin\
if not "%bin%" == "%top%miktex\bin\" goto enverr
if exist %bin% goto havbin
set bin=%top%bin\win32\
if not "%bin%" == "%top%bin\win32\" goto enverr
if exist %bin% goto havbin
set bin=%top%BIN\
if not "%bin%" == "%top%BIN\" goto enverr
if exist %bin% goto havbin
set bin=%top%
if not "%bin%" == "%top%" goto enverr
:havbin
REM check whether it contains at least some binaries
:chkbin
if exist %bin%latex.exe goto binok
if exist %bin%latex.bat goto binok
if exist %bin%latex2e.exe goto binok
if exist %bin%latex2e.bat goto binok
if exist %bin%tex.exe goto binok
if exist %bin%tex.bat goto binok
if exist %bin%dvips.exe goto binok
if exist %bin%tex386.exe goto binok
if exist %bin%bibtex.exe goto binok
if exist %bin%mktexlsr.exe goto binok
dir /w /o %bin%
echo.
echo Above are the contents of folder %bin%.
echo None of the usual programs like tex.exe or latex.exe are in this folder.
echo Therefor, I must ask you to confirm that I have found the correct programs
echo folder, and if not, to enter the correct one. Searching for a file like
echo latex.exe, latex.bat. latex2e.exe, or similar might give you the correct
echo folder. To abort installation, hit [Esc].
:askbin
echo.
var\askdir bin Programs directory: %bin%
if errorlevel 1 goto err
call asktmp.bat
if "%bin%" == "" goto enverr
if not exist %bin% goto perr
cls
:binok
REM ========================================================================
REM Save the bin directory for adding to the path
REM ========================================================================
REM Save the binary directory
if exist C:\l2hsup\initbin.txt del C:\l2hsup\initbin.txt
if not exist C:\l2hsup\initbin.txt goto dobpt
echo *** Unable to remove the existing initbin.txt??
goto err
:dobpt
echo Ensuring that %bin% will be in the PATH...
echo %bin% > C:\l2hsup\initbin.txt
if exist C:\l2hsup\initbin.txt goto havbpt
echo *** Unable to create initbin.txt?? Installation cannot continue.
goto err
:havbpt
REM ========================================================================
REM Create the latexl2h.bat file
REM ========================================================================
REM Copy it
if exist latexl2h.bat del latexl2h.bat
if not exist latexl2h.bat goto dollh
echo *** Unable to remove the existing latexl2h.bat??
goto err
:dollh
copy /y latexl2h.%id% latexl2h.bat
if exist latexl2h.bat goto havllh
echo *** Unable to create latexl2h.bat?? Installation cannot continue.
goto err
:havllh
REM See whether it will probably work
if not "%id%" == "mtx" goto llhb
REM check the emTeX one
if exist %bin%tex386.exe goto llha
dir /w %bin%*.exe
echo.
echo Nonstandard emTeX installation found. Please go into My Computer and
echo locate file C:\l2hsup\latexl2h.bat (i.e. file latexl2h or latexl2h.bat in
echo the l2hsup folder of the C: drive). Right-click this file and select Edit.
echo Make the window wide enough. Locate the line
echo tex386 "&latex" %1 %2 %3 %4 %5 %6 %7 %8 %9
echo and change "tex386" into the right program name, from the list above.
echo Save and exit.
echo.
var\choose akey "After the above is done, hit [Enter], (or [Esc] to abort)"
if errorlevel 1 goto err
:llha
if exist C:\EMTEX\TEXINPUT\LATEX2E\ goto llhend
echo.
echo Nonstandard TEXINPUT location. Please go into My Computer and locate
echo file C:\l2hsup\latexl2h.bat (i.e. file latexl2h or latexl2h.bat in the
echo l2hsup folder of the C: drive). Right-click this file and select Edit.
echo Make the window wide enough. Locate the line
echo set TEXINPUT=C:\EMTEX\TEXINPUT\LATEX2E!;C:\EMTEX\TEXINPUT!;.;..
if not exist %top%TEXINPUT\LATEX2E\ goto llhaa
echo and change it into
echo set TEXINPUT=%top%TEXINPUT\LATEX2E!;%top%TEXINPUT!;.;..
goto llhaz
:llhaa
if not exist %top%TEXINPUT\LATEX\ goto llhab
echo and change it into
echo set TEXINPUT=%top%TEXINPUT\LATEX!;%top%TEXINPUT!;.;..
goto llhaz
:llhab
echo and change C:\EMTEX\TEXINPUT\LATEX2E to the folder where your article.cls
echo file is located and change C:\EMTEX\TEXINPUT correspondingly
:llhaz
echo Save and exit.
echo.
var\choose akey "After the above is done, hit [Enter], (or [Esc] to abort)"
if errorlevel 1 goto err
goto endllh
REM Check the others
:llhb
if exist %bin%latex.exe goto endllh
dir /w %bin%*.exe
echo.
echo No normal latex.exe file found. Please go into My Computer and locate
echo file C:\l2hsup\latexl2h.bat (i.e. file latexl2h or latexl2h.bat in the
echo l2hsup folder of the C: drive). Right-click this file and select Edit.
echo Make the window wide enough. Locate the line that starts with "latex".
echo Change "latex" into the proper way to run latex, which should be one of
echo the names in the list above.
if not exist %bin%latex2e.bat goto llhba
echo Suggestion: also edit
echo %bin%latex2e.bat
echo the same way. The proper way to run latex is probably inside. You may
echo also want to check TEXINPUT[S], but *leave* the ";.." in the one in
echo latexl2h.bat.
goto llhbz
:llhba
if not exist %bin%latex.bat goto llhbz
echo Suggestion: also edit
echo %bin%latex.bat
echo the same way. The proper way to run latex is probably inside. You may
echo also want to check TEXINPUT[S], but *leave* the ";.." in the one in
echo latexl2h.bat.
:llhbz
echo Save and exit.
echo.
var\choose akey "After the above is done, hit [Enter], (or [Esc] to abort)"
if errorlevel 1 goto err
goto endllh
:endllh
REM ========================================================================
REM Create the secondary init file
REM ========================================================================
if exist init2.bat del init2.bat
if not exist init2.bat goto sic
echo *** Unable to delete init2.bat??
goto err
:sic
copy init%id%.bat init2.bat
if exist init2.bat goto sich
echo *** Unable to create init2.bat?? Installation cannot continue.
goto err
:sich
if not exist l2hmods\%id%\local\init2chk.bat goto noi2b
set stat=y
if not "%stat%" == "y" goto enverr
call l2hmods\%id%\local\init2chk.bat
if "%stat%" == "" goto err
:noi2b
REM ========================================================================
REM Do program fixes
REM ========================================================================
if not exist l2hmods\%id%\local\fixit.bat goto nofix
set stat=y
if not "%stat%" == "y" goto enverr
call l2hmods\%id%\local\fixit.bat
if "%stat%" == "" goto err
:nofix
REM ========================================================================
REM Refresh the file name database
REM ========================================================================
if "%id%" == "mtx" goto piniend
echo.
echo I will now attempt to refresh the TeX data base to be aware of the
echo new style files by trying to run a mktexlsr command.
echo.
var\choose anykey "Press any key"
cls
if not exist %bin%initexmf.exe goto pini2
echo %bin%initexmf.exe -u
%bin%initexmf.exe -u
if errorlevel 1 goto pini2
goto piniend
:pini2
if not exist %bin%mktexlsr.exe goto pini3
echo %bin%mktexlsr.exe
%bin%mktexlsr.exe
if errorlevel 1 goto pini3
goto piniend
:pini3
if not exist %bin%texhash.exe goto pini4
echo %bin%texhash.exe
%bin%texhash.exe
if errorlevel 1 goto pini4
goto piniend
:pini4
if not exist %bin%MakeTeXlsR.exe goto pini5
echo %bin%MakeTeXlsR.exe
%bin%MakeTeXlsR.exe
if errorlevel 1 goto pini5
goto piniend
:pini5
echo mktexlsr.exe
mktexlsr.exe
if errorlevel 1 goto pinierr
goto piniend
:pinierr
echo.
echo *** Unable to refresh the file name data base using mktexlsr.
echo.
echo Users of older TeX systems such as emTeX can probably ignore this.
echo.
echo Users of new MiKTeX versions should be able to go into Start/
echo Programs/MiKTeX.../MiKTeX Options (or Settings)/General and press
echo "Refresh Now" or "Refresh FNDB".
echo.
echo Users of other new TeX systems may have to log in with administrator
echo privileges and run "mktexlsr.exe" from the Start menu.
echo.
var\choose anykey "After reading the above error message, hit any key"
cls
:piniend
REM ========================================================================
REM Finish up
REM ========================================================================
REM Clean up
if exist tmp.bat del tmp.bat
if exist asktmp.bat del asktmp.bat
set top=
set bin=
set stat=
if exist var\uninsta2.txt del var\uninsta2.txt
if exist uninsta2.bat move /y uninsta2.bat var\uninsta2.txt
REM Tell the user to test the installation, exiting at the same time
var\asktest.bat
goto end
:perr
echo An unexpected error occurred. On Windows XP or NT, make sure that you
echo are logged on with administrator privileges. Check disk status and
echo whether some installed files may have read-only attributes.
goto err
:enverr
echo *** Out of environment space! On Windows 98-ME, right click the icon,
echo select Properties / Memory, and increase the initial environment.
echo This should not happen on Windows XP. If it does anyway, do Start /
echo Run / CMD and enter "set", then tell l2h@dommelen.net how much stuff
echo is there.
:err
echo The installation failed!
pause
:end