sysreptor icon indicating copy to clipboard operation
sysreptor copied to clipboard

Shifted Figure Reference Numbers

Open vysecurity opened this issue 1 year ago • 7 comments

Since I updated from the traditional sysreptor version to the latest version, I found that the figCounter is now off.

I do:


![Caption here](){#superman}

And it says See Fig 1

Fig 2: Caption here.

It's off compared to the previous versions.

Example:

Thorium-2024-05-03 at 13 32 31@2x

Example CSS:

/* Figure */
figcaption::before {
  content: var(--prefix-figure) counter(figCounter) " - ";
}
.ref-figure::before {
  content: var(--prefix-figure) target-counter(attr(href), figCounter);
  font-weight: normal !important;
  font-family: "Source Code Pro", sans-serif !important;
  font-size: 9pt !important;
  font-color: #296a70 !important;
  color: #296a70 !important;
}

vysecurity avatar May 03 '24 05:05 vysecurity

I fixed it by just referencing the master CSS and deleting all my stuff.

vysecurity avatar May 03 '24 05:05 vysecurity

Another bug here though:

Thorium-2024-05-03 at 14 26 51@2x

See how the text is squished when you try to reference the figure. The space disappears.

vysecurity avatar May 03 '24 06:05 vysecurity

We are aware of the missing space after figure reference bug. The root cause is in weasyprint (HTML+CSS to PDF rendering library). Until the bug is fixed we recommend to use one of the following workarounds:

  • Add a non-breakable space after the reference in markdown code [](#figure-id) shows ...
  • Place the image before the reference in markdown code. The missing space bug only occurs when referencing figures that are rendered below the reference.
  • Change the sentence structure such that no space is after the reference e.g. by putting the reference in parenthesis ... text (see figure 5)

MWedl avatar May 06 '24 04:05 MWedl

Any luck on fixing this?

vysecurity avatar Jul 21 '24 00:07 vysecurity

Not yet. The weasyprint issue is still open.

MWedl avatar Jul 29 '24 13:07 MWedl

Sad times. Any way I can just contribute and fix it? Probably a 30 minute AI generation fix.

vysecurity avatar Dec 10 '24 14:12 vysecurity

As it's a Weasyprint bug, you would have to contribute it there.

AFAIK Weasyprint will soon release v63.1, so if you can and are willing to fix it, now would be a good point in time probably.

aronmolnar avatar Dec 10 '24 14:12 aronmolnar

Tracked in https://github.com/Kozea/WeasyPrint/issues/1875

aronmolnar avatar Jul 22 '25 06:07 aronmolnar