Skip to content

math vector function 'vec' not working properly with arguments that are variables #7524

Open

Description

@jevgarrido

Description

The following works:

#let val = 10;

$ mat(val) $
$ mat(#val) $
$ mat(#[#val]) $
$ mat(#{val}) $
$ mat(#{}val) $

However:

#let val = 10;

$ vec(val) $ // <- Not working
$ vec(#val) $ // <- Not working
$ vec(#[#val]) $
$ vec(#{val}) $ // <- Not working
$ vec(#{}val) $

The error is "Expected content, found integer." for the three cases.

This bug is persistent in all versions of the compiler available on the web app at the moment (from 0.10.0 to 0.14.1)

Thank you!

Reproduction URL

No response

Operating system

Web app

Typst version

  • I am using the latest version of Typst

Activity

  1. added
    bug
    on Dec 4, 2025
  2. Enivex commented on Dec 4, 2025

    @Enivex
    Collaborator

    It might be inconvenient, but it's not really a bug. You need to make your variable $10$ instead.

  3. removed
    bug
    on Dec 4, 2025
  4. cAttte commented on Dec 4, 2025

    @cAttte
    Contributor

    isn't it a little weird that mat accepts numbers but vec doesn't 🤔

  5. Enivex commented on Dec 4, 2025

    @Enivex
    Collaborator

    isn't it a little weird that mat accepts numbers but vec doesn't 🤔

    It's too early in the morning, ok 😅

    I must've just skimmed through that part.

    I'm honestly more surprised that it actually works for mat than that it doesn't for vec

  6. reopened this on Dec 4, 2025
  7. added
    math
    needs-investigation
    on Dec 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    mathneeds-investigation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions