latexr-markdown

How to properly format an abstract in Rmarkdown - LaTeX to PDF


I have never been able to get the first section of an abstract to be flush with the left side of the page in Rmarkdown. When I render the following MRE 'Premise' will be inserted about 2 tabs closer to the center than it should be. 'Methods and Results' and 'Conclusions' will both be correct.

I have played extensively with adding tabs and trying to drop the vertical bars, and quoting the abstract contents but just cannot figure out the magic combination to stop this behaviour.

--- 
title: 'A few people may read this thing'
author:  | 
    |  $^1$Research Institute    
    |  $^2$University  
    | Person$^1$^[Author for Correspondence: human@place.org], Other Person$^1$$^,$$^2$
abstract: | 
  **Premise:** We did stuff.     
  **Methods and Results:** We used and developed stuff to accomplish stuff.       
  **Conclusions:** You too can do stuff.     
keywords: |
  rmarkdown, latex, weird indent in abstract   
output:
  pdf_document: default
--- 

# Introduction


Solution

  • You can use the LaTeX macro \noindent to suppress the indent at the start of a paragraph. In your Rmd document that could look like this:

    --- 
    title: 'A few people may read this thing'
    author:  | 
        |  $^1$Research Institute    
        |  $^2$University  
        | Person$^1$^[Author for Correspondence: human@place.org], Other Person$^1$$^,$$^2$
    abstract: |
      \noindent 
      **Premise:** We did stuff.     
      **Methods and Results:** We used and developed stuff to accomplish stuff.       
      **Conclusions:** You too can do stuff.     
    keywords: |
      rmarkdown, latex, weird indent in abstract   
    output:
      pdf_document: default
    --- 
    
    # Introduction