Document ClassesIndentation of new paragraphs

Information and discussion about specific document classes and how to create your own document classes.
Post Reply
ofers
Posts: 2
Joined: Wed Jul 25, 2007 4:50 pm

Indentation of new paragraphs

Post by ofers »

Does anyone have a solution to the following problem:

Latex by default indents new paragraphs. But it is actually nicer if it only does so after another paragraph, and not after equations, figures and other objects that leave enough space anyway. The manual solution of adding \noindent or \% is not practical in a large document (I'm writing a book), especially since floating objects move and you never know a priory whether the paragraph will be preceded by another paragraph or not.
Is there any package that solves this problem ?

Thank you for your help,
Ofer

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
pumpkinegan
Posts: 91
Joined: Thu May 03, 2007 10:29 pm

Indentation of new paragraphs

Post by pumpkinegan »

What indenting behavior are you referring to? LaTeX does not indent after an equation environment. I presume you have put new lines between your text and equations and figures, for example:

Code: Select all

Default text. Default text. Default text. Default text. Default text. Default text. Default text. Default text. Default text. Default text. Default text. Default text. Default text. Default text. Default text. Default text. Default text. Default text. 

\begin{equation}
e^{i \pi} = -1
\end{equation}

Default text. Default text. Default text. Default text. Default text. Default text. Default text. Default text. Default text. Default text. Default text. Default text. Default text. Default text. Default text. Default text. Default text. Default text. 
This will result in indentation of the paragraph following the equation. The correct way would be:

Code: Select all

Default text. Default text. Default text. Default text. Default text. Default text. Default text. Default text. Default text. Default text. Default text. Default text. Default text. Default text. Default text. Default text. Default text. Default text. 
%%--------------------
\begin{equation}
e^{i \pi} = -1
\end{equation}
%%--------------------
Default text. Default text. Default text. Default text. Default text. Default text. Default text. Default text. Default text. Default text. Default text. Default text. Default text. Default text. Default text. Default text. Default text. Default text. 
As for figures, they are floating environments, so it is usually sufficient to insert them in between paragraphs and LaTeX will decide where best to place them. You can force it somewhat with:

Code: Select all

%%---------------------
\begin{figure}[!ht]
...
\end{figure}
%%---------------------
but my advice would be to just to insert a figure before or after a paragraph where it is referenced.
ofers
Posts: 2
Joined: Wed Jul 25, 2007 4:50 pm

Re: Indentation of new paragraphs

Post by ofers »

Thank you.
Yet this is not a good solution, because of several reasons:
1. it forces you to make a distinction between a new paragraph that is after an equation, say, and a paragraph that is after another paragraph.
The point is that after the equation/figure it IS a new paragraph, I just don't want it to be indented because there is no need for it.

2. With figures it is even worse. Suppose I take your suggestion and write

text 1.
%
\begin{figure}
...
\end{figure}
%
text 2.

text2 is a new paragraph - it is not a continuation of text1. But since latex will put this float somewhere else, it will cause text2 to appear right after text1, as it belongs to the same paragraph.


What is really needed is a package that knows automatically to indent only after another paragraph. Not after equation, figure, in the beginning of a page etc.
Looking at various text books, I see that people try to achieve this effect sometimes, apparently manually, but most of the time they are inconsistent. This shows me that this is a problem that many people have.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Indentation of new paragraphs

Post by localghost »

Just insert a switch between the mentioned parts of your source code.

Code: Select all

…
\begin{equation}
  …
\end{equation}

\noindent
…
But, as the other suggestions, you have to that after every environment where you don't want the indentation.
Post Reply