Skip to content

Commit

Permalink
fix examples for ref and autoref
Browse files Browse the repository at this point in the history
  • Loading branch information
sneakers-the-rat committed May 22, 2024
1 parent 9127304 commit 3da06e6
Showing 1 changed file with 33 additions and 8 deletions.
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

0 comments on commit 3da06e6

Please sign in to comment.