On 29/08/2025, Ikumi Keita wrote:
> Thank you. It now works for the beginning portion of circ.tex as
> expected. However, it still fails for the rest after this part:

That part is fixed now.

However, there are some lingering issues that I haven't been able to resolve.

* dvisvgm failures are catastrophic

When there's a failure (such as the intentional ones in circ.tex) dvisvgm fails 
to produce all previews after that failure, unlike dvipng. The dvipng code in 
preview.el uses dvips as a fallback which then also fails and an error symbol 
is added. This is now the behaviour of point-preview (and dvisvgm therein), but 
it does mean that for these previews after the failure the output images are 
not SVGs but lower quality PNG files.

I have posted an issue about it here:
https://github.com/mgieseki/dvisvgm/issues/293

I can either wait for the fix upstream, or modify the code to restart the 
dvisvgm process manually after every failure.

* dvipng output has extra space around tables and equations (unlike dvisvgm). 
Paul D. Nelson suggested using nccmath and \fleqn but these do not reduce the 
space, only move the equation to the left. In general, I am not sure if there's 
a better solution than using a cropping mechanism using ImageMagik or similar 
-- which has its own problems as the user might want to see intentional spaces.
Otherwise, perhaps a modification to the preview tex package is required, but I 
am not familiar enough with tex to resolve it. In the meantime dvisvgm is good 
enough (when there are no failures).

* Files being orphaned in dvips on failure:

In my effort to handle failure cases in preview-point, I found several issues 
with preview.el orphaning files on such failures. I have been able to resolve 
most of them, but one that seems much more difficult to resolve is when 
`preview-fast-conversion` is nil and `preview-image-type` is `'dvipng`. In this 
case, there's an orphan file that never gets deleted for every successful 
preview. Here's a small example 

\documentclass{article}
\usepackage[showlabels,sections,floats,textmath,displaymath]{preview}
\begin{document}
$A
$\ifPreview\special{ps: junk}\fi F$
$B$
\end{document}

Set `preview-fast-conversion` to nil and `preview-image-type` to `dvipng` and 
preview the buffer, then close it. Note the temporary files generate inside 
`_region_.prv`

-- Al

Reply via email to