I want the text inside a \section{} tag to be unindented, how do I accomplish this? I have tried \noindent and \parindent0pt{text} and neither one seems to affect the text inside a section.
- 15,156
- 11
2 Answers
It is not clear from your question whether you want the paragraph indentation to be zero for all paragraphs or if you only want the section headings to be unindented. If the former, use
\setlength\parindent{0em}
to set the indentation to zero for all paragraphs.
What \documentclass are you using? In the report and book classes, which I use most often, the section headings are not indented.
- 223,288
- 66
Below I have defined SpecialSection which will disable the \parindent and adds a blank line in between paragraphs. It has been applied to the second section in the image below:

Notes:
- Please do note that manually setting
\parskipis considered a "deadly sin" as per Too much whitespace before lists when changing the \parskip length. But, in this case I am not sure that theparskippackage has an option to enable/disable it.
Code:
\documentclass{article}
\usepackage{lipsum}
\usepackage{letltxmacro}
\LetLtxMacro\OldSection{\section}%
%% Handle case where the \SpecialSection is the LAST section in the document
\newcommand*{\EndGroupAtEndDocumentIfNeeded}{}%
\AtEndDocument{\EndGroupAtEndDocumentIfNeeded}%
\newcommand{\SpecialSection}[2][]{%
\section[#1]{#2}%
\begingroup%
\vspace{-\baselineskip}%
\setlength{\parindent}{0pt}%
\setlength{\parskip}{\baselineskip}%
\def\EndGroupAtEndDocumentIfNeeded{\endgroup}%
\def\section{%
\endgroup%
\def\EndGroupAtEndDocumentIfNeeded{}%
\let\section\OldSection%
\OldSection%
}%
}
\newcommand{\TestText}{%
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur sed mattis turpis. Nam id mauris non lectus cursus tincidunt quis nec tortor.
Praesent tempor eleifend felis, in convallis dui imperdiet quis. Vestibulum felis risus, hendrerit nec tempor eget, pulvinar vitae eros. Vestibulum non facilisis purus.
Nulla eu sagittis elit. Suspendisse ac erat vitae nulla porta molestie ac non sapien. Ut nec venenatis ipsum, ut sagittis enim. Sed mollis urna sed odio fermentum, eget ultrices nisi tempor.
}%
\begin{document}
\section{Normal Section}
\TestText
\SpecialSection{Section that has no parindent}
\TestText
\section{Another Normal Section}
\TestText
\end{document}
- 223,288
\documentclass{...}and ending with\end{document}. – Martin Schröder Oct 19 '14 at 21:56