R Markdown align text right

Hello Smart People,

I am writing my dissertation using R Markdown and things are going swimmingly except that I cannot get the text to align left. It is justified and my thesis director won't let me produce the manuscript that way.

I've been reading how to make the text to be left justified. The solution that seems to be working for everyone is to include the package ragged2e and that should take care of the problem, except that for me it is creating a error when I knit my document.

This is my YAML header that knits just fine and gives me the pdf I want sans the left justified text.

title: "Chapter_03"
author: "Erwin Lares"
date: "12/23/2020"
geometry: margin=1in
  bookdown::pdf_document2: default
fontsize: 12pt 
- \usepackage{graphicx}
- \usepackage{float}
- \usepackage{longtable}
- \setlength\parindent{24pt} 
- \usepackage{gb4e} \noautomath 

When I include the additional line - \usepackage[document]{ragged2e} in the YAML head it breaks and gives me this error:

! LaTeX Error: There's no line here to end.

Error: LaTeX failed to compile chapter_03.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See chapter_03.log for more info.
Execution halted

I went inside the .log file. It just repeated the error in it.

I can add just - \usepackage{ragged2e} and it compiles fine, but the text is fully justified. If I add the command - \usepackage{ragged2e} \RaggedRight, it also breaks and gives me the same error.

If I attempt to create an environment in the R Markdown document like so:


It breaks again and gives me the same error. I'm at wits' end. Any suggestions would be most welcome.


This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.