Skip to content

Manually adding an entry to the outline #2991

Closed

Description

@MrMugame

Description

I'm specifically talking about the outline for headings (table of contents). I want to be able to manually add an entry to it, which will only appear in the outline not in the document itself. In LaTeX one would use \addcontentsline{toc}..., but I couldn't find a similar feature in typst.

Use Case

My usecase would be inserting external PDF pages later into the document (using some PDF manipulation software), which should then have their heading inside of the table of contents

Activity

  1. added
    feature request
    on Dec 18, 2023
  2. Dherse commented on Dec 18, 2023

    @Dherse
    Contributor

    With the current way outlines are constructed I don't think this would be easy, you can imagine outlines as just running a query:

    #locate(loc => {
      let titles = query(heading, loc)
      format-headings(titles)
    })

    Meaning that it would be quite hard to perform this, I would recommend (at least in the meantime) that you add blank pages at the end of your document with the titles you need when remove them when splicing your documents.

  3. laurmaedje commented on Dec 18, 2023

    @laurmaedje
    Member

    You can also add a heading and use show heading: none on that one:

    #outline()
    
    = Introduction
    
    #{
      show heading: none
      heading[Secret heading]
    }
    
    = Background

    Depending on what you need, you might want to en- or disable numbering of that heading.

  4. added
    model
    on Dec 18, 2023
  5. laurmaedje commented on Jan 10, 2025

    @laurmaedje
    Member

    I'll close this as the solution above got a bunch of upvotes and there were no further comments. Let me know if there is a problem with it.

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

    feature requestmodel

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions