mgieseki / dvisvgm

A fast DVI, EPS, and PDF to SVG converter
https://dvisvgm.de
GNU General Public License v3.0
295 stars 28 forks source link

Inconsistent width of centered content. #210

Closed tecosaur closed 1 year ago

tecosaur commented 1 year ago

dvisvgm processed centred content is sometimes produced with different widths, more specifically: When running on multiple pages, any centred content after the first page is flushed left.

This is apparent simply by looking at the stdout-reported width information.

MWE

TeX content

% preamble
\begin{preview}
  \[ 1+1 \]
\end{preview}

\begin{preview}
  \[ 1+2 \]
\end{preview}

DVI file

org-tex-HuuGmg.zip

dvisvgm commands

~$ dvisvgm --page=1- --no-fonts --bbox=preview --scale=1.168 -o org-tex-hB7aVi-%3p.svg # all pages
~$ dvisvgm --page=2 --no-fonts --bbox=preview --scale=1.168 -o org-tex-hB7aVi-%3p.svg # page 2 only

stdout

~$ dvisvgm --page=1- --no-fonts --bbox=preview --scale=1.168 -o org-tex-HuuGmg-%9p.svg org-tex-HuuGmg.dvi
pre-processing DVI file (format version 2)
processing page 1
  applying bounding box set by preview package (version 13.1)
  width=618.970493pt, height=15.162827pt, depth=.586192pt
  graphic size: 618.970493pt x 15.749019pt (217.543248mm x 5.535147mm)
  output written to org-tex-HuuGmg-000000001.svg
processing page 2
  graphic size: 29.152766pt x 8.861964pt (10.246025mm x 3.114624mm)
  output written to org-tex-HuuGmg-000000002.svg
2 of 2 pages converted in 0.0773962 seconds

~$ dvisvgm --page=2 --no-fonts --bbox=preview --scale=1.168 -o org-tex-HuuGmg-%9p.svg org-tex-HuuGmg.dvi
pre-processing DVI file (format version 2)
processing page 2
  applying bounding box set by preview package (version 13.1)
  width=618.970493pt, height=15.162827pt, depth=.586192pt
  graphic size: 618.970493pt x 15.749019pt (217.543248mm x 5.535147mm)
  output written to org-tex-HuuGmg-000000002.svg
1 of 2 pages converted in 0.0743592 seconds

Note the difference in the reported size of the second page depending on whether it is the first page converted or not.

System information

mgieseki commented 1 year ago

The fix for #209 should also address this issue.

tecosaur commented 1 year ago

Confirmed :slightly_smiling_face:.