typst-orange-template icon indicating copy to clipboard operation
typst-orange-template copied to clipboard

Broken list of figures

Open stlankes opened this issue 2 months ago • 12 comments

Hello,

I updated typst to version 0.14. Afterwards the list of figures / tables looks weird.

1.3
Figure 1.3: Lines of code in the Linux kernel. Generated by kernelstats [3]
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

Consequently, the list number is used twice and breaks the layout.

In addition, I had to update the template as followed:

iff --git a/my-outline.typ b/my-outline.typ
index 9b9ab41..8ee9947 100644
--- a/my-outline.typ
+++ b/my-outline.typ
@@ -95,7 +95,7 @@
       #set text(size: textSize)
       #box(width: 100%)[
         #box(width: 0.75cm, align(right, [#it.prefix().at("children").at(2) #h(0.2cm)]))
-        #link(it.element.location(), it.element.at("caption").body)
+        #link(it.element.location(), it.element.at("caption"))
         #box(width: 1fr, repeat(text(weight: "regular")[. #h(4pt)])) 
         #link(it.element.location(),heading_page)
       ]

Otherwise, I get an compiler error.

stlankes avatar Oct 24 '25 21:10 stlankes

Thanks, I will look into it in the next days

flavio20002 avatar Oct 26 '25 17:10 flavio20002

I am not sure if this is a good solution. But following changes work for me:

diff --git a/my-outline.typ b/my-outline.typ
index 8ee9947..a812744 100644
--- a/my-outline.typ
+++ b/my-outline.typ
@@ -94,10 +94,7 @@
     [
       #set text(size: textSize)
       #box(width: 100%)[
-        #box(width: 0.75cm, align(right, [#it.prefix().at("children").at(2) #h(0.2cm)]))
-        #link(it.element.location(), it.element.at("caption"))
-        #box(width: 1fr, repeat(text(weight: "regular")[. #h(4pt)])) 
-        #link(it.element.location(),heading_page)
+        #link(it.element.location(), it.indented(it.prefix(), it.inner()))
       ]
     ]
   }

stlankes avatar Nov 09 '25 08:11 stlankes

Can you please share a Minimal Reproducible Expample on Typst Web App to replicate this bug? I can't reproduce it in the example that is shipped with the package.

Image

Your solution is not optimal, beacuse it writes the word "Figure" while the template should not. Thanks

flavio20002 avatar Nov 25 '25 12:11 flavio20002

Currently, #part doesn't work

https://typst.app/project/rBsPMovehmuncuhBa6ipMT

stlankes avatar Nov 27 '25 20:11 stlankes

I think you have to import it

flavio20002 avatar Nov 27 '25 20:11 flavio20002

I thought that #import "@preview/orange-book:0.6.1": book is the correct way to import it. How should I import the template?

stlankes avatar Nov 28 '25 07:11 stlankes

import "@preview/orange-book:0.6.1": book, part, chapter

or

import "@preview/orange-book:0.6.1": *

flavio20002 avatar Nov 28 '25 07:11 flavio20002

Argh... Too early in the morning. At typst.app is seems to work. On my laptop I got following error message:

watching main.typ
writing to main.pdf

[09:12:54] compiled with errors

error: cannot access fields on type none
   ┌─ @preview/orange-book:0.6.1/my-outline.typ:98:62
   │
98 │         #link(it.element.location(), it.element.at("caption").body)
   │                                                               ^^^^

help: error occurred while applying show rule to this entry
    ┌─ @preview/orange-book:0.6.1/my-outline.typ:104:2
    │  
104 │ ╭   outline(
105 │ │     title: list-of-figure-title,
106 │ │     target: target,
107 │ │   )
    │ ╰───^

I installed typst 0.14.0 on my laptop. I try to find the differences...

stlankes avatar Nov 28 '25 08:11 stlankes

Try to locate the packages file in App data ad delete It, so Typst can download It again. Maybe Is corrupted. You can locale by CTRL+click on the package in visual studio code

flavio20002 avatar Nov 28 '25 08:11 flavio20002

Ah, I know the reason. I have some figures without captions. In the past, it was not an issue. Now I get a compiler error.

Also caption = none doesn't work.

stlankes avatar Nov 29 '25 20:11 stlankes

Hm, I have an appendix. The chapters in the appendix starts with a letter. However, the first figure in the appendix has the number 1.1 and not A.1. Is this behavior intentional?

stlankes avatar Nov 29 '25 20:11 stlankes

I will look at this, thanks for reporting!

flavio20002 avatar Nov 29 '25 20:11 flavio20002

https://github.com/typst/packages/pull/3612

flavio20002 avatar Dec 08 '25 10:12 flavio20002

Fixed in orange-book:0.6.2

flavio20002 avatar Dec 12 '25 14:12 flavio20002

Thank you for your support!

The appendix is now numbered correctly. However, an image must still have a caption. Is this what you want?

stlankes avatar Dec 14 '25 13:12 stlankes

Not really, it's still a bug...

flavio20002 avatar Dec 14 '25 14:12 flavio20002