rstudio / rticles

LaTeX Journal Article Templates for R Markdown
https://pkgs.rstudio.com/rticles/
1.47k stars 520 forks source link

how to add caption text in PeerJ template #151

Closed alperyilmaz closed 6 years ago

alperyilmaz commented 6 years ago

The code below is for adding figure and caption: (please ignore backslashes)

\```{r view, out.width = "100%", fig.cap = "An example image.", echo = FALSE}
knitr::include_graphics("view.pdf")
\```

The result (from the sample template)

image

But, I need to have caption text (not bold) in addition to caption title (bold) as shown below:

image

So, how can I add caption text (in addition to caption title) in Rmd file? Does fig.cap have option/ability to add more text?

alperyilmaz commented 6 years ago

To be more specific, here's an example taken from Jatdown publication (please refer to Labeled Sections section):

For example, a can be expressed as:

# [Figure 1] Type II CRISPR-Cas

![](./figures/type-2-crispr.tif)

Genetic organization of the type II-A CRISPR-Cas system...

Which becomes:

<fig id="fig-Figure1">
<label>Figure 1</label>
<graphic xlink:href="figures/type-2-crispr.tif" mimetype="image" mime-subtype="tiff"/>
<caption>
 <title>Type II CRISPR-Cas</title>
 <p>Genetic organization of the type II-A CRISPR-Cas system...</p>
</caption>

What I was referring to in my original question is; <p> element within <caption> element.

yufree commented 6 years ago

Hi, if you want to use markdown in caption, currently such feature is supported by rstudio/bookdown#209 instead of Rmarkdown.

However, you could always use \\textbf{}(not \textbf{}) in fig.cap to bold what you want. For example fig.cap = "\\textbf{an example title.} those are extra words for the title"

yihui commented 6 years ago

That is correct. Thanks @yufree!

github-actions[bot] commented 4 years ago

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary.