Skip to content

Typst: different typst output when writing to .typ file or to pdf with the typst engine #10320

Closed
@ZoomRmc

Description

This one is kind of weird. I'm experiencing different typst output when writing to *.typ file or to pdf with --pdf-engine typst, the latter being broken.

After examining the temporary file produced, it seems like something is happening around the stage when the output is combined with the template file.

Here's steps to reproduce:

  1. RST input converted to a native representation, correctly (not counting the unsupported RST Option List).
    **A**: aaa
    
      - as
    
    **B**: bbb
      - bs
      
    **C**: ccc
      - cs
      
    D D
        ddd
    
    \-E E
      eee
    
    ..
      comment
      
    -F  F
        fff
  2. Native output converter to a typst file (pandoc test.native --from=native -o test.typ), correctly.
     #strong[A];: aaa
     
     #quote(block: true)[
     - as
     ]
     
     / #strong[B];\: bbb: #block[
     - bs
     ]
     
     / #strong[C];\: ccc: #block[
     - cs
     ]
     
     / D D: #block[
     ddd
     ]
     
     / -E E: #block[
     eee
     ]
     
     / -F F: #block[
     fff
     ]
  3. The typst file gets compiled to PDF twice:
    • with typst compile test.typ test-typst.pdf, producing expected results
    • with pandoc test.typ --pdf-engine=typst test-pandoc.pdf, producing broken output
      issue
  4. The main body of the document, as written to the temporary typst file generated (examined with the tool), contains mangled typst output, which explains the incorrect rendering. The main issue is that somehow the term marker becomes text.
    #strong[A];: aaa
    
    #quote(block: true)[
    
    - as
    
    ℄~
    ]
    
    \/ #strong[B];: bbb:
    
    - bs
    
    \/ #strong[C];: ccc:
    
    - cs
    
    \/ D D: ddd
    
    \/ -E E: eee
    
    \/ -F F: fff

It was pretty surprising to see typst code in the document body being different depending on being written directly or composed with the default template and used as a temporary file.

No external templates or filters were used.

Encountered with pandoc 3.2, reproduced with 3.5 & 3.5-nightly-2024-10-21

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions