[l2h] Fix for relative image paths in includegraphics?

mjreed@essex.ac.uk mjreed@essex.ac.uk
Fri, 13 Sep 2002 14:14:41 +0100


Hi,

I have had problems with relative paths in files like:

\documentclass{article}
\usepackage{graphicx}
\begin{document}
\section{test}
\includegraphics{./test.eps}
\end{document}

(usually its a more complex relative path eg ../figs/test.eps)

I have patched latex2html-2002-1 using:

*** graphics-support.perl	2002/09/13 12:01:14	1.1
--- graphics-support.perl	2002/09/13 13:08:56
***************
*** 297,302 ****
--- 297,305 ----
    my $src;
    if( $punt || ($ext && !$GRAPHICS_RULE{$ext}) ||
       !($src=find_file($file,$GRAPHICS_PATH, $GRAPHICS_EXTENSIONS))){
+       if( $file =~ /^\./ ) {
+ 	  $newfile="$texfilepath/$file";
+ 	  $origcall =~ s|$file|$texfilepath/$file|;}
      &fall_back_to_latex_image($src,$origcall,$save); }
    # --------------------------------------------------
    # We'll work with the web image.

This fixes my problem.

Is this useful to anyone? Not sure if I have made a "safe" change,
advice on consequence or a better place to put it would be appreciated!

Thanks,

Martin
--
Dr. M.J. Reed                               Room:          4SB.6.15
Dept. Electronic Systems Engineering         Tel:+44 (0)1206 872479
University of Essex, Colchester CO4 3SQ, UK  FAX:+44 (0)1206 872900
mailto:mjreed@essex.ac.uk    Web: http://esewww.essex.ac.uk/~mjreed