6

I am having an issue where the first paragraph is being indented after a section heading. For instance

\section{My Section}\label{sec:my-section}
This is my section, and I have no idea why it's being indented

I am using the article class:

\documentclass[10pt]{article}

I have narrowed the issue down to this snippet of code:

\makeatletter
\renewcommand\section{\@startsection {section}{1}{0mm} % name, level, indent
                               {3pt} % before skip
                               {3pt} % after skip
                               {\normalfont\bfseries}}
\makeatother

These are the packages being imported:

\usepackage{float,latexsym,longtable,color}
\usepackage[pdftex]{graphics,graphicx}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{setspace}
\usepackage[small,compact]{titlesec}
\usepackage{bm}
\usepackage{fancyhdr}
\usepackage{hangcaption}
\usepackage{amsbsy}
\usepackage{floatflt}
\usepackage{epsfig}
\usepackage{wrapfig}            % wrap figures/tables in text
\usepackage{subfigure}          % subcaptions for subfigures
\usepackage{threeparttable}     % tables with footnotes
\usepackage{dcolumn,multirow}   % decimal-aligned tabular math columns
\usepackage{booktabs}
\usepackage{nomencl}            % nomenclature package
\usepackage{lscape}
\usepackage{times}
\usepackage[colorlinks=true, linkcolor=DarkBlue, citecolor=DarkBlue, urlcolor=DarkBlue]{hyperref}
\usepackage{array}
\usepackage{caption}
\usepackage[table]{xcolor}
\usepackage{import}
\usepackage{datetime}
\usepackage{flafter}
\usepackage{enumitem} % Better control over lists
8
  • 1
    to indent or not to indent is usually set in the document class. which class is being used? May 30, 2012 at 22:24
  • @Marco this isn't a duplicate: Ed wants to get rid of the behaviour. The linked question ask for how to get the effect.
    – Alan Munn
    May 30, 2012 at 22:26
  • The article class is being used. I did search for a similar question. However, my understanding was that not-indenting was the standard behavior unless set otherwise. Since I did not (knowingly) set this behavior, I was wondering where it might come from.
    – Emily
    May 30, 2012 at 22:26
  • 2
    I don't get the asserted behavior. Are you doing some settings with \titlespacing?
    – egreg
    May 30, 2012 at 22:29
  • @AlanMunn: You are right. Sorry for confusing May 30, 2012 at 22:31

2 Answers 2

9

With this code you are precisely telling TeX to indent after section titles.

\makeatletter
\renewcommand\section{\@startsection {section}{1}{0mm} % name, level, indent
                               {3pt} % before skip
                               {3pt} % after skip
                               {\normalfont\bfseries}}
\makeatother

The parameter "before skip" should be negative for having no indentation:

\makeatletter
\renewcommand\section{\@startsection {section}{1}{0mm} % name, level, indent
                               {-3pt} % before skip
                               {3pt} % after skip
                               {\normalfont\bfseries}}
\makeatother

However, it's not a good idea to have fixed spacing around section titles, which don't leave flexibility to the page. Probably

\makeatletter
\renewcommand\section{\@startsection {section}{1}{0mm} % name, level, indent
                               {-3pt plus -2pt minus -1pt} % before skip
                               {3pt plus 1pt} % after skip
                               {\normalfont\bfseries}}
\makeatother

would be a better choice (albeit too tight, in my opinion).

Notice that LaTeX will "change sign" to the specified glue, so it's not a negative vertical spacing.


You would get a very similar result without tampering with low level commands with

\usepackage[tiny,compact]{titlesec}

so my advice is to remove the \@startsection code, as the one provided by titlesec is safer.

3
  • Thanks, that worked! I'm trying to update some old templates that have a whole lot of \vspace thrown around. It's a long process...
    – Emily
    May 30, 2012 at 23:00
  • 1
    @EdGorcenski You should also trim the list of packages. For example epsfig is obsolete and should not be used in new documents; also subfigure is and its new version is called subfig. hyperref should come last of those packages. I've added a comment that will be of interest to you.
    – egreg
    May 30, 2012 at 23:01
  • Yes, I agree. That is the next step in the process :) I am already using the titlesec package, but for various reasons, I do need the ability to finely control section heading spacing. So the manual code will have to remain, although at least now I can change it once and have it translate across the document.
    – Emily
    May 30, 2012 at 23:05
7

You have

    {3pt} % before skip

ltsect.dtx says

 \item[beforeskip:] Absolute value = skip to leave above the heading.
                If negative, then paragraph indent of text following
                heading is suppressed.

So if you want to suppress indentation it has to be {-3pt} not {3pt}

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .