Troubleshooting with htmltotex
htmltotex: Command not found
There are two possible sources of this error.
- The path of htmltotex is not in the execution search path. This can be fixed by changing the execution search path to include the directory of htmltotex.
- You do not have Perl compiler of the desired name in the
desired directory as specified in the first line of htmltotex
and imgtops. Check where you have Perl5 and in what name.
If you have Perl5 in the directory
/opt/local/bin, say, with the name, say,
perl5.003, change the first line of htmltotex and imgtops as
#!/opt/local/bin/perl5.003If you do not have a Perl5 compiler at all, get it from http://www.perl.com/perl/CPAN/src/5.0/.
Error: <some command line error> Usage: htmltotex [-a] [-b base_url] [-c] [-d|-g] [-f] [-F] [-h] [-i|-I] [-ip macro_file] [-L lib_dir] [-lf left_footer] [-lh left_header] [-m image_dir] [-o output_file] [-p num] [-P] [-pt num] [-r num] [-rf right_footer] [-rh right_header] [-t temp_dir] [-u] [-v] [-V] [-w num] input_file For detailed help run "htmltotex -h"
This means that you have made a mistake in stating the command line arguments. See the help message or a more detailed listing of the options and their meanings in the tutorial htmltotex.html. You may run
htmltotex -hto display a more detailed help message.
Error: Unable to load library
WARNING: Unable to read resource file ... using defaults
But you may have problems later ...
WARNING: Unable to read special character maps ... ignoring
But you may have problems later ...
These errors are caused by the fact that
htmltotexcannot find the library files, namely,
fonts.mac, misc.mac, spl-charsand
htmltotex.rcin any of the following directories:
htmltotexto add this directory to its default search path. Use the command line option -L for this purpose.
If you continue to get the same error or warning messages, even when you are sure that the library files can be found in the default or extended search path, it is most likely caused by some problem with the unix command
dirname. In that case, please contact me and tell me what platform you are using.
- Your program hangs on some inputs
A reasonable estimate of the running time of
htmltotexfor a 100 kilobyte input is about 20 seconds on a 100 MHz machine. If
htmltotextakes sufficiently longer than this, you may assume that there is something fishy with the execution of
htmltotexfor this file. This may be caused by a bug in the code of
htmltotex. If you face such a situation, contact me and, if possible, tell me the URL of the page where
- The output TeX file refuses to compile gracefully
The most probable reason for this is that there is an error in the html file that you have converted. TeX tells you the paragraph location and the line (or a segment of it) where the error occurred. This gives you the suspected error location in the html file. Try to correct the error, if any, and repeat the process. Some errors in the html files are overlooked and/or corrected by
htmltotex, some others give rise to mild warning messages by the TeX compiler, whereas some others are really fatal. These fatal errors are often caused by
- Unbalanced <'s which might terribly slow the execution
htmltotexand/or result in portions of text vanishing from the output. You may look at a note on <. Here's a tip how you may detect the presence of unbalanced <'s.
htmltotexis designed so that there are NO blank lines anywhere in the output. It's only the presence of unbalanced <'s that might introduce blank lines to the output. Try to find out where it occurred the first time. It's highly probable that there is something wrong only a few lines before that.
- Absence of some tags, which is somehow managed by a reasonable
default action by browsers.
htmltotex, on the other hand, simply susbstitutes the tags it finds in the input file, and hence is completely ignorant about what you have possibly missed to write. For example, absence of the tag <TR> to mark the first row of a table creates severe trouble to
The assumption is that you are converting a file that is error-free with respect to html2 specifications. If the situation is otherwise, nothing is guaranteed by
htmltotexdoes not try to parse your input. It, on the other hand, does a blind pattern substitution.
Let us be optimistic: serious errors do not occur quite often in reality. And, in addition, it is assuring to you that
htmltotexdoes have a limited error-correcting capability !!
If you do not want to bother about TeX errors and their possible solutions, call
htmltotexwith the option
-rand supply a value of 1,2, or 3 to it.
-r 1causes your output TeX file to be compiled silently even in the presence of errors, whereas with
-r 3, TeX will show error messages but won't stop for you to take a corrective measure when an error is found. Note, however, that TeX aborts the compilation if the number of errors exceeds 99, and a single html error might cause 100 TeX errors !!!
- Unbalanced <'s which might terribly slow the execution of
- Missing fonts
This is another source of error when you try to compile a converted TeX file. This is treated separately, because this is not caused by html errors. Let's take an instance of such an error
! Font \@sls=cmsl7 not loadable: Metric (TFM) file not found.This error occurs when TeX can locate neither the METAFONT files like \font l.17 \font \@tts=cmtt7 ?
cmtt7.mfnor the corresponding TeX Font Metric (TFM) files.
If the size of normal text is n points (The default value is 10 and can be changed by the
htmltotextells TeX to load computer modern fonts of sizes n, n-3 and n-5 points. All TeX distributions do not provide fonts at all these sizes. This gives rise to errors of the above kind. In our example, n = 10, and the TeX distribution does not provide the slanted and typewriter fonts at size n-3.
When such a situation occurs, first try other reasonable values of n, say 11 and 12. Use the option
-ptto change the default point size. If you continue to get similar errors for all these values of n, call
htmltotexwith the option
-F. With this option,
htmltotextells TeX to load fonts only at size 10 points. All other fonts are made available through suitable scalings of the 10 point fonts. Since almost all distributions of TeX provide all the required fonts at 10pt, this strategy should work in most of the cases. If you are deprived of some 10pt fonts too, you are in trouble. If you are a good TeXnician, try hacking the font macro files
fonts12.mac. Otherwise leave the burden on me. Don't forget to tell me which fonts your system has and which not. Or try to get a better version of TeX.
Even when you have fonts of smaller sizes, you may choose to work with the
-Foption. This practice is, however, not recommended, since it is always advisable to use, for example, a font designed at 7pt rather than a font designed at 10pt and scaled at 7pt. The resolution is usually poorer in the second case. On the other hand, it is not harmful to use a font at a size larger than its design size. That's why,
htmltotexalways scales up the default fonts to generate larger text.
Before we conclude, let us see what are the admissible values of n as mentioned above. If you convert with
-F, the only admissible values are 10, 11 and 12. Any other value sets n to the default value of 10 (after warning you that
htmltotexis not happy with the value you supplied). Without this option, all values are admissible. That is,
htmltotexnever complains that you have supplied a bad value. TeX, however, complains seriously if it fails to load font metric files at point sizes n, n-3 and n-5. Supply a value of n that makes TeX happy.
WARNING: Image ... cannot be loaded
This is, in almost all cases, caused by a malformed HREF argument to the SRC parameter in the IMG tag. Check the reference.
htmltotexis designed to handle both absolute and relative references to image files that reside only in the local machine. No attempt is made to fetch an image living in a remote machine. URLs in the local machine, on the other hand, can be specified either by an HTTP reference or by a FILE reference. Also check if the
BASEtag inside the header of the html file is creating problem in case of relative references. If so, you can always let
htmltotexignore this URL by specifying a suitable base URL as an argument to the
- You can not put (local and properly referenced) images in your TeX documents.
Two possibilities might cause this problem. You do not have
epsf.styfrom ftp://ftp.dante.de/tex-archive/macros/latex209/contrib/revtex/epsf.sty or ftp://ftp.tex.ac.uk/tex-archive/macros/latex209/contrib/revtex/epsf.sty.
You may completely avoid using the above programs at the cost of not having any image in the output -- just call
- Also look at the known bugs
This page hosted by Get your own Free Home Page