Skip to content

[Feature Request]: "Copy Typst" option for exporting tables. #3299

@ertugruluyar-github

Description

@ertugruluyar-github

Description

There is "copy" and "copy LaTeX" option already but there is no for Typst.

Purpose

Easly export table result to Typst project.

Use-case

In academic works with Typst.

Is your feature request related to a problem?

No.

Is your feature request related to a JASP module?

No response

Describe the solution you would like

No response

Describe alternatives that you have considered

No response

Additional context

Typst table reference
You don't need to specify any style. Styles will be applied from template style.
Just give the data like this:

#{
  table(
    columns: 4,
    [], [Exam 1], [Exam 2], [Exam 3],
    table.hline(),
    [John], [], a, [],
    table.hline(),
    [Mary], [], a, a,
    table.hline(),
    [Robert], b, a, b,
    table.hline(),
  )
}

OR:

#{
    // Sütun sayısını belirle [Determine the number of columns]
    let month-count = month-numbers.len()
  
    // Sayfa başlığı [Page title]
    heading(level: 1, translator(key: language-keys.WORK-SCHEDULE))
  
    // İş paketleri listesi [Work packages list]
    for (index, work-package) in work-packages.enumerate(start: 1) {
      [*#translator(key: language-keys.SHORT-WORK-PACKAGE) #index:* #work-package.description\ ]
    }
  
    // Tablo başlığındaki aylar [Months in the table header]
    let table-header-months = month-numbers.map(index => {
      [*#index*]
    })
  
    // Tablo hücreleri [Table cells]
    let table-cells = for (index, work-package) in work-packages.enumerate(start: 1) {
      (
        [*#translator(key: language-keys.SHORT-WORK-PACKAGE) #index*],
        ..month-numbers.map(month => {
          if work-package.months.contains(month) {
            table.cell(fill: rgb(166, 166, 166))[]
          } else {
            []
          }
        }),
      )
    }
  
    // Çalışma takvimi tablosu [Work schedule table]
    table(
      columns: (auto,) + ((1fr,) * month-count),
      align: center + horizon,
      table.header(
        table.cell(rowspan: 2)[*#translator(key: language-keys.SHORT-WORK-PACKAGE)\**],
        table.cell(colspan: month-count)[*#translator(key: language-keys.MONTHS)*],
        ..table-header-months,
      ), ..table-cells,
      table.footer(
        table.cell(
          colspan: month-count + 1,
          align: left,
          stroke: (
            left: 0pt,
            right: 0pt,
            bottom: 0pt,
          ),
        )[\*#translator(key: language-keys.SHORT-WORK-PACKAGE): #translator(key: language-keys.WORK-PACKAGE)],
      ),
    )
}

OR USE CSV: See Typst CSV Reference
Meaing provide CSV export for tables.

#{
  let results = csv("example.csv")
  
  table(
    columns: 2,
    [*Condition*], [*Result*],
    ..results.flatten(),
  )
  }

OR:

#{
  let tabledata= csv("example.csv")
  let table-headings = tabledata.first()
  let data = tabledata.slice(1).pop().flatten()
  let table-footer = tabledata.last()
  table(
    columns: 4,
    ..table-headings.map(x => [*x*]), // bold
    ..data,
    ..table-footer,
  )
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions