#Am i missing something while reading the docs?

13 messages · Page 1 of 1 (latest)

modest parrot
#

hey guys, am I missing something here?

The documentation at https://typst.app/docs/guides/table-guide/ under the How to import data into a table? section says that

This example renders the same as the previous one

It says this after showing a map implementation of creating a table after showing the for implementation.

However, it's clearly rendering a different result, is there something I am missing, or is there a typo in the docs?

I have provided a screenshot to show you.

Typst

Not sure how to change table strokes? Need to rotate a table? This guide
explains all you need to know about tables in Typst.

crimson locust
#

oh right yeah must be a bug in the docs. They are using too many columns but otherwise the logic was good

#

nicely found

#

?r

#let moore = csv(bytes(`Entity,Code,Year,Transistors per microprocessor
World,OWID_WRL,1971,2308.2417
World,OWID_WRL,1972,3554.5222
World,OWID_WRL,1974,6097.5625`.text))
#table(
   columns: moore.first().len(),
   ..moore.map(m => m.slice(2)).flatten(),
)

-- corrected
#table(
   columns: moore.first().len() - 2,
   ..moore.map(m => m.slice(2)).flatten(),
)
eternal falcon
#

though for consistency with the for-loop example it should probably just say columns: 2 as well (or maybe that one should be updated to use ...len())

crimson locust
#

yeah I agree. Subtracting 2 was somehow more locally consistent but simpler is better

modest parrot
spark wren
#

I agree with everything that's been said here; or maybe something like this, which makes most sense to me if we want to showcase it being dynamic:

#let offset = 2;
#table(
   columns: moore.first().len() - offset,
   ..moore.map(m => m.slice(offset)).flatten(),
)
spark wren
#

I've added a comment to the issue summarizing this thread and giving my opinions.

crimson locust
#

I've promoted the opposite opinion now because I think it would help non-programmers. But maybe that battle is lost on this particular example, it's already too difficult in that sense

#

not really opposite, but just voting in favour of simplicity.