5

I am trying to get TeX to indent every new paragraph, but have not been successful after trying many different preambles.

Currently, this is my preamble:

\documentclass[12pt]{article}
\usepackage[left=1.5in, right=1in, top=1in, bottom=1.0in]{geometry}
%\usepackage[indentafter]{titlesec}
\usepackage{sectsty}
\usepackage{indentfirst}
%\title{Sections and Chapters}
   %\date{ }
%\setlength{\parident}{10ex}
\linespread{1.7}
\allsectionsfont{\sffamily}
\sectionfont{\fontsize{12}{12}\sffamily}
\subsectionfont{\fontsize{12}{12}\sffamily}
\raggedright

\makeatletter
\renewcommand\section{ 
  \@startsection {section}{1}{\z@}% 
                 {23pt}% 
                 {23pt}% 
                 {\normalsize\sffamily}} 
\renewcommand\subsection{ 
  \@startsection {subsection}{1}{\z@}% 
                 {23pt}% 
                 {23pt}% 
                 {\normalsize\sffamily}} 
\renewcommand\subsubsection{ 
  \@startsection {subsubsection}{1}{\z@}% 
                 {23pt}% 
                 {23pt}% 
                 {\normalfont\normalsize\sffamily}} 
\makeatother
\makeatletter
    \renewcommand\thesection   {\@Roman\c@section .}
    \renewcommand\thesubsection   {{\hspace{2em}}\@Alph\c@subsection .}
    \renewcommand\thesubsubsection   {{\hspace{2em}}\@arabic\c@subsubsection .}
\makeatother

\begin{document}

Does any one have any suggestions?

  • 2
    Apparently, the \raggedright invocation gets rid of the default indentation. As unxnut says in the answer, you can explicitly add in \parindent. Otherwise, you can ditch the \raggedright. – Steven B. Segletes Feb 25 '15 at 2:03
  • 2
    apart from dropping \raggedright note that the % in your section definitions have no effect on the output, but you are missing a % in each case after the { which could affect the output. – David Carlisle Feb 25 '15 at 2:16
5

You issue \raggedright, which is defined as (in latex.ltx):

\def\raggedright{%
  \let\\\@centercr\@rightskip\@flushglue \rightskip\@rightskip
  \leftskip\z@skip
  \parindent\z@}

The last line of \raggedright sets \parindent to 0pt. As such, you need to set to to suit your needs. For example, you could use

enter image description here

\documentclass{article}
\usepackage{lipsum}
\makeatletter
\setlength{\@tempdima}{\parindent}% Save \parindent
\raggedright
\setlength{\parindent}{\@tempdima}% Restore \parindent
\makeatother
\begin{document}

\lipsum[1]

\end{document}
5

You could use ragged2e which enhances ragged-right typesetting by allowing hyphenation and improving line-breaking, and which also makes the paragraph indentation easily configurable.

\documentclass{article}
\usepackage[document]{ragged2e}
\usepackage{kantlipsum}
\setlength{\RaggedRightParindent}{\parindent}
\begin{document}
  \kant[1-10]
\end{document}

ragged right

2

The directive \raggedright, if inserted in the preamble, applies only to material in the main "body" of the document -- but not to footnotes, minipage environments, and p-type columns in tabular and array environments. I suppose you could remedy this by inserting the instruction \raggedright at the start of every footnote and minipage as well. However, that's tedious and error-prone, isn't it? Moreover, hyphenation is disabled by \raggedright, which can cause extremely ragged-looking output.

Instead of using \raggedright, then, I suggest you load the ragged2e package with the option document. Doing so will apply ragged-right typesetting to all parts of the documents, and it will also (re)enable hyphenation.

To set the indentation of the first lines to a nonzero value, use \setlength\RaggedRightParindent{<some length value>}.

A full MWE:

enter image description here

\documentclass{article}
\usepackage[document]{ragged2e}
\setlength\RaggedRightParindent{0.75cm} % indentation of first line of a paragraph
\usepackage{lipsum} % for filler text
\setlength\textheight{11.5cm} % just for this example
\begin{document}
\lipsum*[1]\footnote{\lipsum*[2]}

\bigskip\noindent
\begin{minipage}{0.75\textwidth}
\lipsum*[4]
\end{minipage}
\end{document}

If you comment out (or delete) the instructions \usepackage[document]{ragged2e} and \setlength\RaggedRightParindent{0.75cm} and insert \raggedright instead, you'll notice that the minipage and footnote materials are both typeset fully-justified -- probably not what you want.

1

Have you tried \parindent directive? You could add

\setlength\parindent{0.2in}

to indent by .2 inches. You could use the units of your choice (cm, pt).

  • The standard indentation of LaTeX is \parindent=20.0pt. – Henri Menke Nov 1 '15 at 22:15

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.