Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm having trouble getting the paragraphs in my document to indent. I'm not sure what could be wrong, as I thought this was default behaviour.

Here is a cut down version of my tex file:

\documentclass[12pt]{book}
\usepackage[width=4.375in, height=7.0in, top=1.0in, papersize={5.5in,8.5in}]{geometry}
\usepackage[pdftex]{graphicx}
\parindent 10in
\parskip 0.05in
\title{My Broken Example}
\begin{document}
\frontmatter
\maketitle
\tableofcontents
\mainmatter
\raggedright
\chapter{First chapter}

Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sit amet justo ut odio fringilla varius. Maecenas porttitor convallis suscipit. Aenean dictum faucibus purus nec gravida. Phasellus laoreet dolor sit amet orci ultrices varius. Curabitur tempus feugiat nisl, non pretium lacus tincidunt ut. Suspendisse placerat, sem eu rhoncus auctor, diam nisi pulvinar est, id venenatis urna mauris vel dui. 

In vitae arcu ac tortor vehicula dignissim ac sit amet velit. Aenean sapien velit, vestibulum at facilisis nec, egestas sed quam. Nunc sem lectus, condimentum eget porttitor sit amet, euismod vel lorem. Nullam vulputate pellentesque cursus. 

\indent Vestibulum porta, purus id ultricies facilisis, neque nunc aliquet lectus, sit amet vulputate arcu mauris in diam. Praesent interdum lectus ac ligula cursus sed pretium mi tincidunt. Mauris blandit interdum sem, ac porta metus sagittis et. In at ligula id justo gravida rhoncus at vitae massa. Morbi mi tortor, dignissim et pellentesque quis, placerat ut lorem. 

\par Aliquam ut lorem sed tortor gravida feugiat. Aenean mattis aliquam diam, vitae tempus est lobortis ut. Nam augue urna, iaculis eget varius non, sagittis tempus nibh. Donec vitae laoreet enim. Vivamus vel quam ut nunc ultrices mollis. Cras a magna dolor. Sed et luctus lorem. Vivamus nunc felis, volutpat quis bibendum in, dapibus et justo. Donec eget nulla nunc.

Mauris et magna libero, sed euismod turpis. Morbi accumsan rhoncus tempor. Integer venenatis ipsum sit amet erat porttitor a scelerisque nisl malesuada. Mauris porta ultricies risus, sit amet tincidunt risus fermentum interdum. Nunc massa ipsum, tincidunt nec fermentum eget, euismod sit amet leo. Quisque consequat, erat dictum luctus tristique, justo odio congue velit, ac lacinia dolor erat vel libero. Sed pulvinar metus ut est interdum dignissim. Quisque lacus velit, porttitor nec malesuada sed, placerat et augue.

\end{document}

I've tried several things, such as ending lines with \\ and \\* and as you can see I've tried using \indent and \par. I've set \parindent to something crazy.

Nothing seems to work, how do I get indentation?

share|improve this question
add comment

2 Answers

up vote 7 down vote accepted

You need to redefine \parindent a) after \raggedright (which sets it to zero) b) to somewhat less than 10in.

\documentclass[12pt]{book}
\usepackage[width=4.375in, height=7.0in, top=1.0in, papersize={5.5in,8.5in}]{geometry}
\usepackage[pdftex]{graphicx}
\parskip 0.05in
\title{My Broken Example}
\begin{document}
\frontmatter
\maketitle
\tableofcontents
\mainmatter
\raggedright
\parindent 0.5in
\chapter{First chapter}

Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sit amet justo ut odio fringilla varius. Maecenas porttitor convallis suscipit. Aenean dictum faucibus purus nec gravida. Phasellus laoreet dolor sit amet orci ultrices varius. Curabitur tempus feugiat nisl, non pretium lacus tincidunt ut. Suspendisse placerat, sem eu rhoncus auctor, diam nisi pulvinar est, id venenatis urna mauris vel dui. 

In vitae arcu ac tortor vehicula dignissim ac sit amet velit. Aenean sapien velit, vestibulum at facilisis nec, egestas sed quam. Nunc sem lectus, condimentum eget porttitor sit amet, euismod vel lorem. Nullam vulputate pellentesque cursus. 

\indent Vestibulum porta, purus id ultricies facilisis, neque nunc aliquet lectus, sit amet vulputate arcu mauris in diam. Praesent interdum lectus ac ligula cursus sed pretium mi tincidunt. Mauris blandit interdum sem, ac porta metus sagittis et. In at ligula id justo gravida rhoncus at vitae massa. Morbi mi tortor, dignissim et pellentesque quis, placerat ut lorem. 

\par Aliquam ut lorem sed tortor gravida feugiat. Aenean mattis aliquam diam, vitae tempus est lobortis ut. Nam augue urna, iaculis eget varius non, sagittis tempus nibh. Donec vitae laoreet enim. Vivamus vel quam ut nunc ultrices mollis. Cras a magna dolor. Sed et luctus lorem. Vivamus nunc felis, volutpat quis bibendum in, dapibus et justo. Donec eget nulla nunc.

Mauris et magna libero, sed euismod turpis. Morbi accumsan rhoncus tempor. Integer venenatis ipsum sit amet erat porttitor a scelerisque nisl malesuada. Mauris porta ultricies risus, sit amet tincidunt risus fermentum interdum. Nunc massa ipsum, tincidunt nec fermentum eget, euismod sit amet leo. Quisque consequat, erat dictum luctus tristique, justo odio congue velit, ac lacinia dolor erat vel libero. Sed pulvinar metus ut est interdum dignissim. Quisque lacus velit, porttitor nec malesuada sed, placerat et augue.

\end{document}
share|improve this answer
    
Thanks, I didn't realise that was an issue! –  Pureferret Aug 9 '12 at 19:09
add comment

Hint: Don't use \raggedright, as that will just about disable all hyphenation. Instead, load the ragged2e package: doing so will implicitly execute a \RaggedRight command; unlike \raggedright, though, \RaggedRight doesn't interfere with hyphenation. Second, insert the command \AtBeginDocument{\setlength\parindent{2em}} (or whatever indent amount is desired) in the preamble to restore the sought-after paragraph indentation.

The modified and somewhat simplified MWE would look like this:

\documentclass[12pt]{book}
\usepackage[width=4.375in, height=7.0in, top=1.0in,  
     papersize={5.5in,8.5in}]{geometry}
\usepackage{lipsum} % for filler text
\usepackage[document]{ragged2e}
\AtBeginDocument{\setlength\parindent{2em}} % or whatever indent amount is desired
\begin{document}
\chapter{First chapter}
\lipsum[1-4]
\end{document}
share|improve this answer
    
Kudos for mentioning the new package. I'm working on this on an online implication of latex though and can't get packages –  Pureferret Aug 9 '12 at 19:10
    
@Pureferret -- sounds like a very interesting project you're taking on! If I understand you correctly, you're suggesting that you can't load any additional LaTeX packages at all. That's really quite constraining, to put it mildly. Do look into the possibility of loading some additional LaTeX packages on the fly; you'll be much better off if that possibility is there. –  Mico Aug 9 '12 at 19:23
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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