# mdBook - how to use cross-references?

I know this is a Rust language forum but I do not know any other place besides here where mdBook is discussed. I am starting with mdBook with the intention of creating a relatively long report. The user guide is easy to follow, everything worked as expected so far.

However, the user guide does not explain how to use cross references. What is achieved in LaTeX with the commands \label{} and \ref{} or with the annotations {#} and [@] in Pandoc. Would appreciate if someone can point to a simple example, or post one.

Thank you.

Each heading tag will be automatically turned into an anchor you can link to, so ## How to use cross-references? would be accessible as [blah](#how-to-use-cross-references).

You can also use normal HTML elements to tag parts of your document. For example

Here is some text linking to the bottom of [the next paragraph](#next-paragraph).

This is another paragraph.
<div id="next-paragraph" />

1 Like

Thank you Michael for the swift reply. What you refer to are intra-document links, whereas what I am looking for are cross-references.

For instance the following Pandoc code:

# Intro {#intro}

Some text.

# Conclusion {#conc}

As explained in [Section @intro].


Produces something like:

1. Intro

Some text.

2. Conclusion

As explained in Section 1.

Cross-references take care of the numbering, especially useful across the different files that compose the document. LaTeX works in similar way.

Markdown doesn't support automatic numbering and updating of references, just links.

Indeed Michael, Markdown by itself is not enough to write a book. That is why tools like mdBook exist.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.