3

So I've created a .tex document using TeXShop for os X, and I've specified an absolute graphicspath for all the images. Now I'm supposed to render a .html file from the .tex and I've done so using the "htlatex" command in the terminal. But when I open the new html file, all of my pictures are gone and replaced with a tile that wants to fetch an image from the folder that the .html document is in. In the .tex document, I have all the images pathed to another location, just because keeping all the files in one folder would be to much to handle. Can I change the folder from which the .html document fetches images?

This is what I write in the .tex document to path to the images:

\documentclass[11pt]{paper}

\usepackage{hyperref, color, graphicx, textcomp}

\graphicspath{{/Users/Rikardny/Documents/LaTeX-labs/Linux_Introduction/Images/}}

Because I am new to this kind of thing, an easy and newbie-friendly explanation would be nice ;) Thank you in advance!

3
  • 1
    why have you specified absolute paths in the original? (It is probably possible to get tex4ht to fix up the paths (I do not know) but it is not usually a good idea to use absolute paths anyway as it makes your document source tied to one location and by definition not portable. Jun 30, 2014 at 13:25
  • could you please post the mwe? as David said, it is not good idea to use absolute paths with html. it will work as long as you view the document only on your computer, but it will break when you try to publish it on the internet
    – michal.h21
    Jun 30, 2014 at 19:40
  • this works for me with absolute paths
    – michal.h21
    Jul 1, 2014 at 21:49

1 Answer 1

0

Maybe not the TeX answer you were looking for, but with little effort solvable. Others are right imho - relative paths are preferable. Accordingly replace the beginning of the path with void, using your text editor or e.g. Perl:

perl -pi -e 's@/Users/Rikardny/Documents/LaTeX-labs/Linux_Introduction/@@' your_file.txt

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .