6

I'm using titlesec package and a document class ABNT Class which follows a Brazilian standard for document development. So far I've managed to follow the Brazilian Computer Association guidelines for making a scientific article (which is my real objective, for further reuse), however using both the abnt class and the titlesec package breaks document indentation, as each paragraph had a fixed indentation which titlesec could not manage, adding [noindentafter]{titlesec} produces no results, so I've decided to force document's whole indentation by using setspace and using the following code

\setlength{\parindent}{1.25cm}

To prevent first paragraph's indentation (which is required by this scientific article model), I've to use \noindent after \section{}, \subsection{} and \subsubsection which is really annoying, is there any way to automatically embed \noindent to the end of the section function call? this would be as simple as \section{*}\noindent

Edit: I'm providing a MWS for further checking

\documentclass[12pt,a4paper]{abnt}

\usepackage{setspace,titlesec,setspace}
\usepackage[utf8]{inputenc} 
\titleformat{\section}{\fontsize{13.5pt}{12pt}\selectfont\bfseries}{\thesection}{0.75cm}{}[]
\renewcommand{\thesection}{\arabic{section}.}
\setlength{\parindent}{1.25cm}
\titlespacing*{\section} {0pt}{0pt}{0pt}

\begin{document} 
\section{Lorem Ipsum}
This first paragraph is indented, consectetuer adipiscing elit. Etiam lobortis facilisis sem.
Nullam nec mi et neque pharetra sollicitudin. 

This paragraph is also indented, ultricies vel, semper in, velit. Ut porttitor. Praesent in
sapien. 

\section{Pellentesque Placerat}\noindent
This first paragraph is using noindented, praesent in
sapien. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. 

This paragraph is indented, ultricies vel, semper in, velit. Ut porttitor. Praesent in
sapien. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Duis fringilla tristique neque.
Sed interdum libero ut metus. 
\end{document}
Stefan Pinnow
  • 29,535
  • Have you tried \titlespacing*{\section}{left margin space}{vertical space before}{vertical space after}? According to the manual this kills the indentation after the sectioning unit. – guillem Jun 29 '12 at 05:55
  • I'm currently using \titlespacing*{\section} {0pt}{0pt}{0pt} but like I said before, the whole document indentation was broken, and using this has no result as well (the expected result), if there is any way to embed \noindent this serves me well. I think that \titlespacing works on title and not exactly after it, I need a text which is non indented in the first paragraph, moreover the subsequent paragraphs doesn't follow this rule

    at first glance I thought of \titleformat{\section}{}{}{}{}[insertingindentationhere] however it does not produce the result I need

    – richard_ba Jun 29 '12 at 06:11
  • 1
    Welcome to TeX.sx! The standard LaTeX approach automatically adds \noindent after sections. Please add a minimal working example (MWE) that illustrates your problem. – Joseph Wright Jun 29 '12 at 06:17
  • Perhaps the abnt package requires the babel package with brazilian/portuguese option?. I recall having similar indentation problems using the babel package with the spanish option. – guillem Jun 29 '12 at 06:46
  • Take a look here, it may help. – Jellby Jun 29 '12 at 07:25
  • looking at abnt.cls (not on ctan, but easily enough found by a google grope), i see no particular reason that this should be happening (note, this is from reading the code -- i don't even speak portuguese, let alone the brazilian version, to read docs). we really need that min example... – wasteofspace Jun 29 '12 at 08:47
  • The standard section commands all automatically suppress indentation before the first paragraph (note they do not do it by inserting \noindent which would mess up vertical spacing, and interfere with the prevention of a page break after the heading. Thus we need a minimal example to see why this is not happening in your case. – David Carlisle Jun 29 '12 at 09:07
  • Also If titlesec is using the standard latex \@startsection then it is best not to use 0pt lengths, Standard latex sectioning uses the sign of the length as a switch to suppress or allow indentation but 0 of course doesn't really have a sign so it depends on the details of the exact test used. Better to use small positive (or negative) values. – David Carlisle Jun 29 '12 at 09:17
  • @RicardoBarrosDuarte: No, you should post code that reflects the output you posted as an image. That way every member of the community can take that code, compile it locally, and figure out what's going on. That makes your problem universally negotiable. – Werner Jun 29 '12 at 19:50
  • I've edited the question providing the MWE – richard_ba Jun 29 '12 at 20:11

1 Answers1

12

It's quite strange that the model requires both ABNT and no indentation after a section title.

setspace and titlesec are not needed. Rather you have to revert the modification made by indentfirst, which is loaded by abnt.cls. The following document shows how:

\documentclass[12pt,a4paper]{abnt}

\makeatletter
% package indentfirst says \let\@afterindentfalse\@afterindenttrue
% and we revert this modification, reinstating the original definitio
% of \@afterindentfalse
\def\@afterindentfalse{\let\if@afterindent\iffalse}
\makeatother


\begin{document}
\section{Lorem Ipsum}
This first paragraph is \emph{NOT} indented, consectetuer adipiscing elit. 
Etiam lobortis facilisis sem. Nullam nec mi et neque pharetra sollicitudin.

This paragraph is indented, ultricies vel, semper in, velit. Ut porttitor. 
Praesent in sapien.

\section*{Pellentesque Placerat}
This first paragraph is \emph{NOT} indented, praesent in
sapien. Lorem ipsum dolor sit amet, consectetuer adipiscing elit.

This paragraph is indented, ultricies vel, semper in, velit. Ut porttitor. 
Praesent in sapien. Lorem ipsum dolor sit amet, consectetuer adipiscing 
elit. Duis fringilla tristique neque. Sed interdum libero ut metus.

\end{document}
egreg
  • 1,121,712