Hello, maybe I should also say something here.

Jay is right. The modification does not add any functionality that
hyperlatex did not have before.

Hyperlatex cannot deal with directories in filenames. And my suggested
modifications did not mess with that.

>>> \begin{image}{directory/name} ... \end{image} Hyperlatex couldn't
>>>  deal with that before and it can't deal with it now.

Well, with hyperlatex-relative-prefix it is easy. Only the line
following ;rhx: has been added to the hyperlatex 2.7 code.
(Of course one has to do this also for hyperlatex-format-gif and
hyperlatex-format-img.)

(defun hyperlatex-format-image ()
  (let* ((opt (hyperlatex-parse-optional-argument))
         (tags (if opt opt ""))
         (resolution (hyperlatex-parse-optional-argument))
         (dpi (hyperlatex-parse-optional-argument))
         (url (hyperlatex-parse-required-argument)))
    ;rhx: added the following line
    (setq url (concat (hyperlatex-relative-prefix) url))
    (delete-region hyperlatex-command-start
                   (progn (search-forward "\\end{image}") (point)))
    (hyperlatex-delete-whitespace)
    (hyperlatex-pop-stacks)
    (hyperlatex-gen
     (format (concat "img src=" hyperlatex-meta-dq "%s."
                     hyperlatex-imagetype hyperlatex-meta-dq " %s /")
             url tags))))
}

If I am not wrong then everything works fine if htmldir is ".".

> It would be easy enough to have ps2image create the necessary
> directory, but another problem is that file.ps will be created as
> ./dir/file.ps.

Well, Jay, you are again right. I did not think of this because my
htmldir is ".". But again, hyperlatex is not supposed to handle things
like \begin{image}{directory/name} ... \end{image}. So at least we have not introduced a bug that wasn't there before.


> This would occur (in texfile.makeimage) before ps2image is called,
> and if htmldirectory isn't ".", then the png file will be
> htmldir/dir/file.png.  So both directories ./dir and htmldir/dir
> would have to exist.  It would be nice if file.ps were just
> ./file.ps, but the ps file name is made by TeX based on the image
> name dir/file, and I don't know how to (reasonably) strip off the
> directory name in TeX.

Hmmm, I cannot think of a quick solution to strip off the directory part with latex, but it should work somehow.

But let me ask you about a change. At the moment I have to write some html page that has several places where some math occurs. Having learnt about \begin{image}{file}..\end{image}, I now simply put the math there and let hyperlatex generate a .png for the html document. What bothers me most is that I have to give a file name for every image environment and additionally these filenames have to be unique over the document.

In the \endimage code in hyperlatex.sty appears [EMAIL PROTECTED] So why not replace the line

\jobname.dvi\space>[EMAIL PROTECTED]

by

\jobname.dvi\space>[EMAIL PROTECTED]

and the same with

ps2image\space -res\space [EMAIL PROTECTED] [EMAIL PROTECTED]

replaced by

ps2image\space -res\space [EMAIL PROTECTED]
  [EMAIL PROTECTED]

I would then even add code to ps2image to remove the .ps file.
Who would ever need the .ps file?

Maybe, I do not understand the initial intention, but approximately that would be my suggestion to
1) Overcome the directory problem in the image environment and
2) the tedious work of always having to invent a new filename.




------------------------------------------------------------------
Just some other thoughts about directories in arguments.

Tom maybe you remember that I modified the \xname command in my rhxhlx/rhxxname.hlx package to deal with the issue of having something like

\xname{dir/file}

and correctly creating the following section into

htmldir/dir/file.html

In case the rhxpanel is active, it will also take the panel icons from
htmldir/pics/../dir
if there appears \renewcommand{\HlxIcons}{pics} in the .tex file.

Via rhxxname.hlx I modify certain command of hyperlatex.el in order to
make the directory relative to the target place of the html file.

All arguments to pictures (actually to \htmlicon) should be understood
relative to htmldirectory (even if the current node will be generated in
a subdirectory of htmldir).

The code (from rhxxname.hlx)

(defun hyperlatex-relative-prefix ()
  (setq hyperlatex-rel-prefix "")
  (setq rhx-tmp (hyperlatex-fullname hyperlatex-node-number))
  (while (string-match "/" rhx-tmp)
    (setq rhx-tmp (replace-match "" t t rhx-tmp))
    (setq hyperlatex-rel-prefix (concat hyperlatex-rel-prefix "../" )))
  hyperlatex-rel-prefix)

(defun hyperlatex-relative-fullname (node-number)
  (concat (hyperlatex-relative-prefix)
          (hyperlatex-fullname node-number)))

simply takes the directory part of the current node (which is identical
to the directory part of the corresponding \xname command) and generates
the corresponding directory string that must be prepended to reach
htmldir from the current node.

Example: \xname{dir1/dir2/file}
html-relative-prefix --> ../../
So ../../dir1/dir2 should be equal to htmldirectory.
Note that I do not handle absolute paths, because I think that every
generated stuff should go below htmldirectory.


Best

Ralf



-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
_______________________________________________
Hyperlatex-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hyperlatex-users

Reply via email to