Highly Customizable Scientific Markdown Template: Introduction and Usage for R and RMarkdown

Obinna N. Obianom

2024-05-08

Welcome to the scientific R package

Install

From CRAN or github.com/oobianom/scientific

Usage

Very simply in Rmarkdown with various features, an example of text below

  
  ---
  title: "The New Scientific Report Rmarkdown Theme Example"
  highlighter: "godzilla"
  summaryslide: TRUE
  lightsummaryslide: FALSE
  themecolor: brown
  codelang: "r" #default is R, you may add js php python and so on
  runningheader: "Scientific Report Example" # only for pdf output
  subtitle: "An implementation in R Markdown" # only for html output
  author: "Obinna Obianom (https://github.com/oobianom/scientific)"
  date: "2024-05-08"
  output:
    scientific::html: 
      toc: TRUE
      self_contained: TRUE
  bibliography: skeleton.bib
  link-citations: yes
  summarypoints:
      - Fusce id velit ut tortor pretium viverra. Lectus urna duis convallis convallis tellus id interdum. 
      - Erat imperdiet sed euismod nisi porta lorem. Sed viverra tellus in hac habitasse platea dictumst. 
      - Turpis egestas integer eget aliquet nibh praesent tristique. Ultricies integer quis auctor elit. 
      - Dictum varius duis at consectetur lorem donec massa. Convallis aenean et tortor at risus viverra. 
      - Egestas tellus rutrum tellus pellentesque eu tincidunt tortor aliquam nulla. Aliquet bibendum enim facilisis gravida neque. 
      - Porta lorem mollis aliquam ut porttitor leo a diam. Sit amet mattis vulputate enim nulla aliquet porttitor lacus. 
      - Vestibulum rhoncus est pellentesque elit ullamcorper dignissim. Risus feugiat in ante metus dictum. 
  ---
  
  # Sample text and code
  
  Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Pulvinar   pellentesque habitant morbi tristique senectus et. Neque viverra justo nec ultrices. Non enim praesent elementum facilisis leo vel   fringilla. Orci eu lobortis elementum nibh tellus molestie. Blandit turpis cursus in hac. Commodo sed egestas egestas fringilla   phasellus faucibus. 
  
  ``r
  library(scientific)
  plot(1:100,sample(1:100))
  boxplot(mtcars)
  
  ``
  
  Aliquam malesuada bibendum arcu vitae elementum curabitur vitae. Donec enim diam vulputate ut pharetra sit amet aliquam. Semper   viverra nam libero justo laoreet sit. Fermentum dui faucibus in ornare quam. Sed viverra tellus in hac habitasse platea dictumst   vestibulum rhoncus. Ultricies mi eget mauris pharetra et. Ultrices mi tempus imperdiet nulla malesuada pellentesque elit eget.   Imperdiet nulla malesuada pellentesque elit eget.
  
  # Tables
  
  You can use the `kable()` function from the **knitr** package to format tables that integrate well with the rest of the scientific   handout style. The table captions are placed in the margin like figures in the HTML output.
  
  ``r
  knitr::kable(
    mtcars[1:6, 1:6], caption = 'A subset of mtcars.'
  )
  ``
  
  # Block Quotes
  
  We know from the Markdown syntax that paragraphs that start with `>` are converted to block quotes. If you want to add a   right-aligned footer for the quote, you may use the function `quote_footer()` from **scientific** in an inline R expression. Here is   an example:
  
  > "If it weren't for my lawyer, I'd still be in prison. It went a lot faster with two people digging."
  >
  > <footer>--- Joe Martin</footer>
  
  Without using `quote_footer()`, it looks like this (the second line is just a normal paragraph):
  
  > "Great people talk about ideas, average people talk about things, and small people talk about wine."
  >
  > --- Fran Lebowitz
  
  ## Mathematical equations
  
  In fact, you can include anything in the margin using the **knitr** engine named `marginfigure`. Unlike R code chunks ```` ```{r}   ````, you write a chunk starting with ```` ```{marginfigure} ```` instead, then put the content in the chunk. See an example on the   right about the first fundamental theorem of calculus.
  
  ``{marginfigure}
  We know from _the first fundamental theorem of calculus_ that for $x$ in $[a, b]$:
  $$\frac{d}{dx}\left( \int_{a}^{x} f(u)\,du\right)=f(x).$$
  ``
  
  $$\frac{d}{dx}\left( \int_{a}^{x} f(vc)\,du\right)=f(x).$$