GeneralRagged Right Justification cancels Indentation

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
SaneAssasin
Posts: 14
Joined: Thu Feb 07, 2013 1:02 am

Ragged Right Justification cancels Indentation

Post by SaneAssasin »

Hello everyone,

I am writing a document using the "mla13" package and when I compile, it is all justified and not ragged right, as the style demands. I entered \raggedrightin the preamble, which solved the problem, but now the first line of the paragraph is not indented and entering \indent does not change it.

A minimal working example:

Code: Select all

\documentclass{article}
\usepackage{mla13}

\title{Title}
\firstname{First name}
\lastname{Last Name}
\professor{Professor}
\class{Class}
\raggedright

\begin{document}
\makeheader
This minimal working example will hopefully show the issue I am having where I seem to be unable to have both ragged right and first paragraph indentation.
\end{document}
Any suggestions? Thank you!

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Ragged Right Justification cancels Indentation

Post by localghost »

The problem is not related to the package at all. Let's take a look at the definition of \raggedright in the LaTeX kernel (file »latex.ltx«).

Code: Select all

\def\raggedright{%
  \let\\\@centercr\@rightskip\@flushglue \rightskip\@rightskip
  \leftskip\z@skip
  \parindent\z@}
Note the last line where \parindent is set to 0pt. You can preserve its value by saving it into another length register before using \raggedright.

Code: Select all

\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage{lipsum}

\newlength{\saveparindent}
\setlength{\saveparindent}{\parindent}
\raggedright
\setlength{\parindent}{\saveparindent}

\begin{document}
  \lipsum[1]
\end{document}
You could also set \parindent by hand. But since it varies with the chosen font size, this is the most convenient way.


Remarks:

Thorsten
DarrenG
Posts: 1
Joined: Wed Apr 15, 2015 1:57 pm

Re: Ragged Right Justification cancels Indentation

Post by DarrenG »

Just wanted to say I found this very useful and used it verbatim. Many thanks.
Post Reply