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

fix examples for ref and autoref #1341

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 33 additions & 8 deletions docs/paper.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,24 +113,49 @@ The goal of Open Journals is to provide authors with a seamless and pleasant wri

Tables and figures can be referenced if they are given a *label* in the caption. In pure Markdown, this can be done by adding an empty span `[]{label="floatlabel"}` to the caption. LaTeX syntax is supported as well: `\label{floatlabel}`.

Link to a float element, i.e., a table or figure, with `\ref{identifier}` or `\autoref{identifier}`, where `identifier` must be defined in the float's caption. The former command results in just the float's number, while the latter inserts the type and number of the referenced float. E.g., in this document `\autoref{proglangs}` yields "\autoref{proglangs}", while `\ref{proglangs}` gives "\ref{proglangs}".
For example:


```markdown
: Comparison of programming languages used in the publishing tool. \label{proglangs}

| Language | Typing | Garbage Collected | Evaluation | Created |
|----------|:---------------:|:-----------------:|------------|---------|
| Haskell | static, strong | yes | non-strict | 1990 |
| Lua | dynamic, strong | yes | strict | 1993 |
| C | static, weak | no | strict | 1972 |
```

Makes:

```{table} **Table 1:** Comparison of programming languages used in the publishing tool.
:name: proglangs

| Language | Typing | Garbage Collected | Evaluation | Created |
|----------|:---------------:|:-----------------:|------------|---------|
| Haskell | static, strong | yes | non-strict | 1990 |
| Lua | dynamic, strong | yes | strict | 1993 |
| C | static, weak | no | strict | 1972 |
```

Link to a float element, i.e., a table or figure, with `\ref{identifier}` or `\autoref{identifier}`, where `identifier` must be defined in the float's caption. The former command results in just the float's number, while the latter inserts the type and number of the referenced float. E.g., for this example:



* `\autoref{proglangs}` yields [Table 1](#proglangs)
* `\ref{proglangs}` yields [1](#proglangs)

: Comparison of programming languages used in the publishing tool. []{label="proglangs"}

| Language | Typing | Garbage Collected | Evaluation | Created |
|----------|:---------------:|:-----------------:|------------|---------|
| Haskell | static, strong | yes | non-strict | 1990 |
| Lua | dynamic, strong | yes | strict | 1993 |
| C | static, weak | no | strict | 1972 |

### Equations

Cross-references to equations work similarly to those for floating elements. The difference is that, since captions are not supported for equations, the label must be included in the equation:

$$a^n + b^n = c^n \label{fermat}$$

Referencing, however, is identical, with `\autoref{eq:fermat}` resulting in "\autoref{eq:fermat}".
Referencing, however, is identical, with `\autoref{eq:fermat}` resulting in [Equation 1](#eq:fermat).

(eq:fermat)=
$$a^n + b^n = c^n \label{eq:fermat}$$

Authors who do not wish to include the label directly in the formula can use a Markdown span to add the label:
Expand Down