Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve references when exporting to PDFs #1127

Open
QuantumVictor opened this issue Apr 17, 2024 · 3 comments
Open

Improve references when exporting to PDFs #1127

QuantumVictor opened this issue Apr 17, 2024 · 3 comments
Labels
enhancement New feature or request LaTeX typst

Comments

@QuantumVictor
Copy link

QuantumVictor commented Apr 17, 2024

Proposal

MyST Website ouptut

Currently, it is possible to link sections and chapters in MyST websites. In the example I provided, we have a simple book structure where we defined a chapter in a folder and sections in dedicated pages. With MyST Website, we are able to link any word to

  • an other section : the Asia section refers to the Asia page in the example below,
  • to a numbered subsection : we linked the Jaguar displaying the section number (1 here)
  • to a non-numbered subsection : for example, I linked to the Lions section using [](#lion-section) and to the pandas one using [pandas](#panda-section).
    image

We then generate the book using the plain_book template.

Default Latex output

The default output has several issues:

  • the link between sections (different myst webpage) results in a hyperref non existing page,
  • the non-numbered section have no links anymore,
I will first discuss animal coming from \href{/ch1-asia}{Asia} (go there 
to have information about pandas !). We will also detail animals 
from \href{/ch1-africa}{Africa}, especially Lions. We will then describe 
the  \href{/ch1-southamerica}{the South America region} with Jaguars 
in Section~\ref{jaguar-section}.

Proposed output latex

  • MyST pages could be labeled either with a default label (page name) or by a frontmatter keyword label for example.
  • we could take benefit of the hyperref package to link section in the pdf,
I will first discuss animal coming from \href{/ch1-asia}{Asia} (go there
to have information about \hyperref[panda-section]{pandas} !). We will
also detail animals from \href{/ch1-africa}{Africa}, especially 
\hyperref[lion-section]{Lions}. We will then describe the  
\href{/ch1-southamerica}{the South America region} with Jaguars 
in Section~\ref{jaguar-section}.

Files to repeat the example

index.md
ch1_southamerica.md
ch1_asia.md
ch1_africa.md
ch1_0intro.md

Table of content _toc.yml

format: jb-book
root: index
chapters:
  - file: ch1_0intro
    sections:
      - file: ch1_asia
      - file: ch1_africa
      - file: ch1_southamerica

Note : on the ch1_africa, I did not defined the title in the front matter but in the main document in order to add a cross-reference label but the \label{label-africa} in the tex document.

---
short_title: Africa
---
(label-africa)=
# Africa
@QuantumVictor QuantumVictor added the enhancement New feature or request label Apr 17, 2024
Copy link

welcome bot commented Apr 17, 2024

Thanks for opening your first issue here! Engagement like this is essential for open source projects! 🤗

If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.

If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).

Welcome to the EBP community! 🎉

@rowanc1
Copy link
Member

rowanc1 commented Apr 17, 2024

Thanks @QuantumVictor, this is also an issue for our typst export when there is a cross-reference outside of the current article (or articles) -- are you exporting a single page here, or a multi-article document?

@QuantumVictor
Copy link
Author

Hi @rowanc1 ,
I just provided my MyST files of the example by re-editing the comment (sorry, I posted too early my issue...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request LaTeX typst
Projects
None yet
Development

No branches or pull requests

2 participants