[l2h] Custom environments

Prakash Countcham Prakash.Countcham at imag.fr
Mon Jun 7 17:52:13 CEST 2004


   Hello,

   I try to use latex2html to convert a document with custom environments. 
For example, here is a customized \input:

\RequirePackage{stack}
\NewStack{reldir}{.}
\newcommand\relinput[2]{%
   \Push{reldir}{\Stack{reldir}/#1}%
   \input{\Stack{reldir}/#2}%
   \Pop{reldir}}

First, I tried to let tex handle this command with:

&process_commands_in_tex (<<_RAW_ARG_CMDS_);
relinput # {} # {}
_RAW_ARG_CMDS_


But the file in question is said not to be found even if it exists.

Then, I tried to adapt the subroutine do_cmd_input in the following way, 
but I have got the same problem.

$relinput_rep = ".";

sub do_cmd_relinput {
     local($_) = @_;
     local($rep,$file,$output,$oldrep);
     (s/\s*(.*)\s*\n/$rep =$1;''/s) unless (
	(s/$next_pair_pr_rx/$rep=$2;''/eo)
	||(s/$next_pair_rx/$rep=$2;''/eo));
     (s/\s*(.*)\s*\n/$file =$1;''/s) unless (
	(s/$next_pair_pr_rx/$file=$2;''/eo)
	||(s/$next_pair_rx/$file=$2;''/eo));
     local($after) = $_;
     $oldrep = $relinput_rep;
     $relinput_rep = "$relinput_rep$dd$rep";
     $file = &revert_to_raw_tex("\\input{$relinput_rep$dd$file}\n") if $file;
     if ($PREAMBLE) { &add_to_preamble('include',$file)}
     elsif (!($file=~/^\s*$/)) {
	$output = &process_undefined_environment('center'
		, ++$global{'max_id'},"\\vbox{$file}");
     }
     $relinput_rep = $oldrep;
     $output.$after;
}


Any idea ?

I've also got other questions: Can I add a custom directory with my own 
perl subroutines? Where can I find a documentation on how to add 
environments to latex2html (I tried to read the code, but a clear 
documentation would be better)?

TIA,

  Prakash



More information about the latex2html mailing list