-
Notifications
You must be signed in to change notification settings - Fork 5
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
LaTeX: Document links are not created properly #64
Comments
Labels are not automatically created for headings when the output format is ---
output:
latex:
latex_engine: pdflatex
keep_tex: true
---
## Foo {#sec:foo}
This should create link to Section @sec:foo.
If you don't like the blank lines, you can provide your own template. The blank lines are caused by the empty values of variables in the default template: https://github.com/yihui/litedown/blob/main/inst/resources/litedown.latex On the other hand, you know that these blank lines are harmless.
No, only the first output format is used by default. If you need both |
Yeah, I will try to cook up something. I feel that this is basic feature of markdown that should be supported without any special hoolabaloos. Without looking into code, I am thinking about getting a database of links in document and then creating labels as required. I will refer back in a few days if this idea panned out. |
The relevant code to add automatic IDs to headings in HTML is here: Lines 695 to 708 in 3241888
The complications with LaTeX are at least: 1) we can't reliably detect headings by regular expressions, e.g., One possible way to solve this problem is to add IDs to the Markdown source, e.g., turn Anyway, personally I feel it may not worth the effort but am open to discussion. I tend to manually add IDs to headings (like this) even though I only need HTML output and not LaTeX. Manual IDs have two advantages: 1) They are stable (not subject to changes to heading text); 2) They can be terse (I don't want references like |
Expected behaviour that works in HTML:
[name](#label)
However, both of these don't work in LaTeX:
## heading {#foo}
), they still won't work.After exploring the generated
tex
document withkeep_tex: true
, here is the following issue:label
hyperlink
The problem seems to be that
hyperlink
doesn't work withlabel
and requireshypertarget
(see here). Replacinghyperlink
withhyperref
might work, but still doesn't solve the issue of non-existing named label.MRE:
rmd:
tex:
<-- that's a looot of whitespace
(btw. I thought that adding additional output
html
would create both files as per documentation, but it seems that it doesn't?)The text was updated successfully, but these errors were encountered: