Re: Cannot find/open fonts -- executing oolatex

On May 9, 5:07 pm, Ulrike Fischer <ne...@xxxxxxxxxxx> wrote:
Is there a way to check for existing miktex roots and add new ones
from the command line?

I don't know. But there was a discussion in the "feature request" at

(feature request 1782418).

Also you could look at

Thanks for the pointers. I didn't know that miktex has COM interface
now. Unfortunately, there seems to be no officially supported way to
add/remove miktex roots ATM. I could probably poke around in the
registry as in the second link that you gave but I think I will just
leave it up to the user to add tex4ht location to miktex roots after

I already have a working tex4ht installation script. It's a self-
contained batch file that uses only built-in windows commands so it
should be quite portable. It supports installation/uninstallation to a
user specified location (including miktex installation root). I tested
it on my machine and it seems to work fine - Eitan's equation+picture
test file compiles and opens in OO flawlessly. Also much bigger
document compiled without any errors, although, some content got
misrendered, e.g., tables squeezed down to one letter width or
equations like \left( {\frac{a}{b} } \right)^{ \frac{3}{2} } are
interpreted as \frac{(\frac{a}{b})^3}{2} (Eitan, if you are still out
there, do you still have a patiance for more of my questions).

Anyway, those issues are not installation related, so I post this
installation script in it's current form below (perhaps someone could
offer some web space, so people can easily download it).

A few final remarks. It works on NT based systems only, so users of
win98 and below are out of luck. Sorry. Shell scripting on NT is
already traumatic enough for me. All lines are numbered in case they
get wrapped in this post. Copy and paste them into a text editor and
unwrap all lines not starting with a number. Remove the bracketed
numbers and save it as 'install-tex4ht.bat'. If you are too lazy to do
it manually save it as 'install-tex4ht.txt' and from the command line
run (one line):
(for /f "tokens=1* delims=[]" %K in (install-tex4ht.txt) do @echo.

OK, without the further ado, here's the installation script.

[2]::- *** TEX4HT installation script
*** -::
Usage: -::
[5]::- *
Installation: -::
[6]::- install-
tex4ht.bat -::
[7]::- install-tex4ht.bat
install -::
[8]::- *
Uninstallation: -::
[9]::- install-tex4ht.bat
uninstall -::
Remaks: -::
[12]::- * Installation script will prompt you for locations of
unzipped -::
[13]::- and files; you can to avoid that
by -::
[14]::- defining them in the configuration section of the
script -::
[15]::- * After installation created TDS (TeX Directory Structure)
tree -::
[16]::- has to be added to MiKTeX's roots (use MiKTeX's
Settings -::
[17]::- utility mo.exe). Alternatively, you can install to
MiKTeX's -::
[18]::- intallation directory but this is not recommended.
Refresh -::
[19]::- FNDB after
installation. -::
[20]::- * Uninstallation will leave behind created TDS
tree; -::
[21]::- delete it manually if
desired -::
[24]@echo off
[27]:: ******************** Configuration section
*********************** ::
[28]::unzipped tex4ht location
[29]set tex4ht_unzipped_dir=.\tex4ht-20070708
[30]::unzipped newt4ht location
[31]set newt4ht_unzipped_dir=.\newt4ht
[32]::tex4ht installation dir
[33]set tex4ht_install_dir=C:\texmf-local
[34]::change (Y) or not (N) the default <oo> script to <oo-alt>
[35]set use_oo-alt=Y
[36]::rollback if installation failed (Y/N)
[37]::(removes only texh4ht and leaves created TDS tree behind)
[38]set rollback=N
****************************************************************** ::
[41]if not "%OS%"=="Windows_NT" goto requireNT
[42]for %%G in (xcopy.exe) do if "%%~$PATH:G"=="" goto :noxcopy
[44]call :help
[45]for %%G in (tex4ht_unzipped_dir newt4ht_unzipped_dir
tex4ht_install_dir) do (
[46] call :setupdirs %%G
[47] if not defined %%G goto :abort
[49]goto %1 :install
[51]for %%G in (%tex4ht_install_dir%\tex4ht\base\win32\tex4ht.env
%tex4ht_install_dir%\scripts\tex4ht\bat\*.bat) do (
[52] call %% > nul
[53] REM && move /Y %%G.tmp %%G || goto :copyerror
[57]set "copyopt=/I /S /Y /D"
[58]xcopy.exe %newt4ht_unzipped_dir%\texmf\tex4ht %tex4ht_install_dir%
\tex4ht %copyopt% || goto :copyerror
[59]xcopy.exe %newt4ht_unzipped_dir%\texmf\tex\generic\tex4ht
%tex4ht_install_dir%\tex\generic\tex4ht %copyopt% || goto :copyerror
[60]xcopy.exe %tex4ht_unzipped_dir%\texmf\tex4ht\ht-fonts
%tex4ht_install_dir%\tex4ht\ht-fonts %copyopt% || goto :copyerror
[61]xcopy.exe %tex4ht_unzipped_dir%\bin\win32\*.bat %tex4ht_install_dir
%\scripts\tex4ht\bat %copyopt% || goto :copyerror
[62]echo Search and replace "c:\tex4ht\texmf\" with
[63]for %%G in (%tex4ht_install_dir%tex4ht\base\win32\tex4ht.env
%tex4ht_install_dir%scripts\tex4ht\bat\*.bat) do (
[64] call :replstr %%G "c:\tex4ht\texmf\" "%tex4ht_install_dir%"
[66]if /i "%use_oo-alt%"=="Y" (
[67] echo Search and replace "oo>" with "oo-bak>"
[68] call :replstr %tex4ht_install_dir%tex4ht\base\win32\tex4ht.env
"oo>" "oo-bak>"
[69] echo Search and replace "oo-alt>" with "oo>"
[70] call :replstr %tex4ht_install_dir%tex4ht\base\win32\tex4ht.env
"oo-alt>" "oo>"
[72]echo To finish installation add "%tex4ht_install_dir%" to MiKTeX
roots and refresh FNDB
[74]goto :eof
[78]echo Uninstalling TEH4HT...
[79]for %%H in (%tex4ht_install_dir%tex4ht %tex4ht_install_dir%tex
\generic\tex4ht %tex4ht_install_dir%scripts\tex4ht) do (
[80] if exist "%%~H\" (
[81] echo Removing "%%~H\"
[82] rmdir /S /Q "%%~H\"
[83] )
[85]echo Uninstallation complete
[87]goto :eof
[90]findstr "^::-" %~sf0
[91]goto :eof
[94]::let's make sure that dirs are in short format
[95]for /f "tokens=1* delims==" %%H in ('set %1 2^>^&1') do set
[96]if defined $cratchVar set "$cratchVar=%$cratchVar%\"
[97]if not exist "%$cratchVar%" (set /p $cratchVar=%1=)
[98]if not exist "%$cratchVar%" (
[99] set "$cratchVar="
[100] set /p $cratchVar=Specified directory does not exist. Retry? [y/
[101] set $cratchVar | findstr /i "=y\>" >nul && goto :setupdirs ||
set "$cratchVar="
[103]set %1=%$cratchVar%
[104]goto :eof
[106]:replstr <file name> <search string> <replace string>
[109]for /f "tokens=1* delims=[]" %%K in ('find /n /v "" "%~1"') do (
[110] set lineNo=0000%%K
[111] set "txtline==%%L"
[112] REM This may break if txtline contains poison characters
[113] REM together with quotation characters
[114] call set "txtline.%%lineNo:~-4%%=%%txtline:%~2=%~3%%"
[116]::echo from for command so we don't get screwed by poison
[117]>"%~1" (for /f "tokens=1* delims==" %%K in ('set txtline.') do
[118]goto :eof
[121]>&2 echo There were some errors while copying files. Make sure
that correct installation directories are specified.
[122]>&2 echo Aborting installation.
[123]if /i "%rollback%"=="Y" call :uninstall
[125]exit /b 1
[128]>&2 echo Aborting installation.
[130]exit /b 1
[133]>&2 echo This script requires Windows NT based system. Sorry.
[135]exit /b 1
[138]>&2 echo No xcopy command? Aborting installation, please don't
hate me.
[140]exit /b 1