Skip to content

Text references don't work with multiline lines #1430

@eliocamp

Description

@eliocamp

Text references don't seem to work if the text is split in multiple lines.

Example: Create a new bookdown project and go to 02-cross-refs.Rmd in the sample book and change the first figure to this:

(ref:caption) Here is a nice figure!

```{r nice-fig, fig.cap='(ref:caption)', out.width='80%', fig.asp=.75, fig.align='center', fig.alt='Plot with connected points showing that vapor pressure of mercury increases exponentially as temperature increases.'}
par(mar = c(4, 4, .1, .1))
plot(pressure, type = 'b', pch = 19)
```

As expected, text reference works and the caption is rendered where it should be:

image

Now add a new line:


(ref:caption) Here is a nice figure!
And this is a second sentence. 

```{r nice-fig, fig.cap='(ref:caption)', out.width='80%', fig.asp=.75, fig.align='center', fig.alt='Plot with connected points showing that vapor pressure of mercury increases exponentially as temperature increases.'}
par(mar = c(4, 4, .1, .1))
plot(pressure, type = 'b', pch = 19)
```

The text reference is still a single paragraph so, according to the documentation, it should still work. However, the ouput doesn't show the correct caption:

image

This seems to be an issue for HTML (gitbook and epub) and word formats. PDF renders correctly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy