I'm issuing rstudio and bookdown to cross-compile rmarkdown to TeX and make a PDF for my dissertation. I've got everything formatted how I need it, but I'd like an indent to start each of my paragraphs. I've tried the indent: true setting in rmarkdown yaml, and I've tried including a few different variations on this latex command in my preamble: setlength\parindent{24pt}\setlength{\parskip}{0.0pt}. I've also tried moving that command to the last in_header item in the rmarkdown yaml, so I don't think it's an issue with a later pkg overriding it (but maybe I'm wrong).

The resulting pdf: https://github.com/moui72/disStat/blob/master/docs/_main.pdf

Does anyone see what I am doing wrong?

Here is everything before begin{document} in the resulting TeX file.

Links to the full tex file, _site.yml, preamble.tex, and index.Rmd follow the code block. I'll provide a MWE tonight.

\usepackage{fixltx2e} % provides \textsubscript
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
\else % if luatex or xelatex
% use upquote if available, for straight quotes in verbatim environments
% use microtype if available
\UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
            pdfborder={0 0 0},
\urlstyle{same}  % don't use monospace font for urls
% Scale images if necessary, so that they will not overflow the page
% margins by default, and it is still possible to overwrite the defaults
% using explicit options in \includegraphics[width, height, ...]{}
}{% else
\setlength{\parskip}{6pt plus 2pt minus 1pt}
\setlength{\emergencystretch}{3em}  % prevent overfull lines
% Redefines (sub)paragraphs to behave more like sections

%%% Use protect on footnotes to avoid problems with footnotes in titles

%%% Change title format to be more compact

% Create subtitle command for use in maketitle



\newcommand{\myframebox}[2][Dia]{\setlength{\fboxsep}{2.5ex}\raisebox{\dimexpr-\height + 1.0ex}{\fcolorbox{black}{white}{\eqmakebox[#1]{\enspace #2\enspace}}}}

\setlength\parindent{24pt}\setlength{\parskip}{0.0pt plus 1.0pt}


Full tex file https://github.com/moui72/disStat/blob/master/docs/_main.tex

_site.yml (used by bookdown for rstudio) https://github.com/moui72/disStat/blob/master/drafts/_site.yml

Preamble.tex https://github.com/moui72/disStat/blob/master/drafts/preamble.tex

Index.Rmd https://github.com/moui72/disStat/blob/master/drafts/index.Rmd

  • 5
    I didn't read all of your code, but the parskip package generally removes paragraph indents. You should create a MWE demonstrating you're problem. That will involve you removing code from your file bit by bit until you have the minimum file that still demonstrates your problem. You will likely find the problem on your own while creating the MWE. – James Sep 11 at 15:37
  • Thank you, @James! As I noted in my Q, I will work on getting a MWE up tonight, but I was hoping that I might get some insight in the mean time, and I have! thanks again – Tyler Peckenpaugh Sep 11 at 16:05
  • 2
    Although it's already been pointed out that the parskip package omits indents, it seems worth mentioning that packages of this sort often delay settings until \AtBeginDocument, so an attempt to override their settings has to be inserted after \begin{document}, otherwise the reversal won't take effect. – barbara beeton Sep 11 at 18:51
  • aha, thank you @barbarabeeton! moving \setlength\parindent{24pt}\setlength{\parskip}{0.0pt plus 1.0pt} so it is just before my first run of prose did the trick =] – Tyler Peckenpaugh Sep 11 at 20:33

James and Barbara solved my issue in the comments, with the following points:

  1. The parskip package omits indents

  2. This setting is delayed until \AtBeginDocument, so an attempt to override its settings has to be inserted after \begin{document}, otherwise the reversal won't take effect

The solution was simply to put \setlength\parindent{24pt}\setlength{\parskip}{0.0pt plus 1.0pt} after \begin{document}.

The origin of the issue seems to be that bookdown makes use of the parskip package by default. As noted by Ralf Stuber in the comments of this answer, indent: true should disable parskip. When/if I determine why that didn't work for me, I'll update this answer.

I am posting this answer just in case someone else has the same issue.

  • 1
    Using parskip is indeed the default. However, it is not used with indent: true in the YAML header od index.Rmd. I don't understand why that did not work for you. – Ralf Stubner Sep 12 at 5:58
  • Should it be a top-level setting, or does it belong as a child of e.g., output? I would bet on it being my error. Would it be interesting to you if I were to take the time to figure out what was happening? – Tyler Peckenpaugh Sep 12 at 15:15
  • It should be a top-level setting. It would be interesting to see why that did not work for you. – Ralf Stubner Sep 12 at 16:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.