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

\ref instruction support #509

Closed
wants to merge 1 commit into from
Closed

\ref instruction support #509

wants to merge 1 commit into from

Conversation

EmielM
Copy link

@EmielM EmielM commented May 12, 2012

Suggestion: instead of generating a \hyperref instruction, internal links without text could generate a \ref instruction, which will render the section number.

Example Markdown input to trigger new behavior:
Take a look at section [](#some-section).

Will render something like 'Take a look at section 2.1'

Instead of generating a \hyperref instruction, internal links
now generate a \ref instruction, which will render the section
number.

Example Markdown input to trigger new behavior:
    [](#introduction)
@jgm
Copy link
Owner

jgm commented May 12, 2012

Interesting suggestion. The problem I see is that it only works with LaTeX. If you convert to HTML, you get an empty link. It would be good to have a convention that works with all writers.

@EmielM
Copy link
Author

EmielM commented May 12, 2012

Right. Thing is that I'd ordinarily happily use the native \ref{..} for such use cases (since it is something that only exists in LaTeX). The problem is that this doesn't work for this use case, since \label instructions are only generated for referenced (by internal link) section headers.

An idea for the HTML writer could be copying the title (although that's not entirely consistent then).

At the same time, I'm also struggling with something similar for images. I'd say that referencing sections and images by number is (at least in research papers and such) rather common.

@EmielM
Copy link
Author

EmielM commented May 12, 2012

Additionally, I've made a tweak that adds the \label tag to images, thus allowing internal references for those - similar to how this works for sections:

The statistics are shown in figure [](fig:stats).

![fig:stats](../figures/stats.png "Statistical overview")

Since this breaks things (the title is now shown as caption), I've not added the patch to this PR. This post is merely for future reference, as I can imagine people needing such functionality. The relevant patch can be found here: https://github.com/EmielM/pandoc/tree/internal-refs

@jgm: I'll close the PR for now :), do as you see fit with any of the patches.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants