LaTeX forum ⇒ GeneralRagged Right Justification cancels Indentation Topic is solved

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

Ragged Right Justification cancels Indentation

Postby SaneAssasin » Wed Feb 13, 2013 8:35 am

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:
  1. \documentclass{article}
  2. \usepackage{mla13}
  4. \title{Title}
  5. \firstname{First name}
  6. \lastname{Last Name}
  7. \professor{Professor}
  8. \class{Class}
  9. \raggedright
  11. \begin{document}
  12. \makeheader
  13. 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.
  14. \end{document}

Any suggestions? Thank you!

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

Postby localghost » Wed Feb 13, 2013 10:45 am

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«).
  1. \def\raggedright{%
  2. \let\\\@centercr\@rightskip\@flushglue \rightskip\@rightskip
  3. \leftskip\z@skip
  4. \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.
  1. \documentclass[11pt]{article}
  2. \usepackage[T1]{fontenc}
  3. \usepackage{lipsum}
  5. \newlength{\saveparindent}
  6. \setlength{\saveparindent}{\parindent}
  7. \raggedright
  8. \setlength{\parindent}{\saveparindent}
  10. \begin{document}
  11. \lipsum[1]
  12. \end{document}

You could also set \parindent by hand. But since it varies with the chosen font size, this is the most convenient way.


LaTeX Community Moderator
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes

¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1

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

Postby DarrenG » Wed Apr 15, 2015 2:03 pm

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

Return to “General”

Who is online

Users browsing this forum: No registered users and 6 guests