There are several subroutines for reading other files:
Be careful when specifying the filename with the first two, as LaTeX2HTML may not be in the directory you started in, so it is best to give the full pathname using $texfilepathname=$texfilepath,sort=texfilepath,description=The directory containing the LaTeX file to be translated.$texfilepath and $ddname=$dd,sort=dd,description=The directory divider. This is platform specific, and is determined at the start of the LaTeX2HTML run. Use this variable to ensure that your code is platform independent.$dd.
Suppose you have a LaTeX command called, say,
\inputcsv{
filename}
, which reads
in comma-separated data from the file given by filename,
and sets it in a table. For example, if the contents
of the file sample.csv looked like:
1,5,10,12,3 4,7,9,5,2 7,3,2,1,0then
\inputcsv{sample.csv}
will produce the
following table:
1 | 5 | 10 | 12 | 3 |
4 | 7 | 9 | 5 | 2 |
7 | 3 | 2 | 1 | 0 |
sub do_cmd_inputcsv{ local($after) = @_; local($file,$table); $file = &missing_braces unless ($after=~s/$next_pair_pr_rx/$file=$2;''/eo); $file = "$texfilepath$dd$file"; &slurp_input($file); s/,/<\/TD><TD ALIGN=RIGHT>/sg; s/\n/<\/TD><\/TR>\n<TR><TD ALIGN=RIGHT>/sg; s/^/<TR><TD ALIGN=RIGHT>/g; $table = "</TD></TR><TABLE ALIGN=CENTER>"; $table .= $_; $table .= "</TABLE>"; $table . $after; }Since sample.csv does not contain any LaTeX code--and so no translation is required--&slurp_inputname=&slurp_input,sort=slurpinput,description=This takes one argument, the name of the file to be input. The contents of the file are placed in $_ without any conversion applied.&slurp_input is used. Note that the full pathname is given by prepending $texfilepathname=$texfilepath,sort=texfilepath,description=The directory containing the LaTeX file to be translated.$texfilepath$ddname=$dd,sort=dd,description=The directory divider. This is platform specific, and is determined at the start of the LaTeX2HTML run. Use this variable to ensure that your code is platform independent.$dd to the given file name. Note also the use of $after instead of $_. This was done because &slurp_inputname=&slurp_input,sort=slurpinput,description=This takes one argument, the name of the file to be input. The contents of the file are placed in $_ without any conversion applied.&slurp_input modifies $_. If the file is likely to contain LaTeX commands, e.g.:
A,B,C,D,E\&F 1,5,10,12,3 4,7,9,5,2 7,3,2,1,0then you should use &slurp_input_and_partition_and_pre_processname=&slurp_input_and_partition_and_pre_process,sort=slurpinputand,description=This takes one argument, the name of the file to be read. The contents of the file are translated and placed in $_.&slurp_input_and_partition_and_pre_process instead.