5

I created my own environment and it in/for a KOMA-class.

It works fine, except that the first paragraph after it has an indentation. It want it to have no indentation at all, which is why I use false- for the class.

How can I set that indentation to zero?

Screenshot

enter image description here

MWE

\documentclass[
11pt,
a4paper,
]
{scrartcl}

\usepackage{ lmodern, blindtext }

\usepackage[T1]{fontenc} \usepackage[utf8]{inputenc}

\usepackage{ multicol, blindtext, }

\newenvironment{teaser}{\vspace{0ex}\par\raggedright\sffamily}{% \par% \rule{0.8\columnwidth}{1pt}\par \vspace{2ex}% }

\listfiles

\begin{document} \begin{center}\huge Title stuff \end{center}

\begin{multicols*}{2} \section{Word}

\begin{teaser} Stuff. Word, some text to fill the void. Here is a longer sentence, quite the long one. \end{teaser}% % How do I have to define the new environment \verb|teaser| so that the first paragraph after it has no indentation?

Words words words words words words words words words words words words words. Words words words words. \end{multicols*} \end{document}

henry
  • 6,594

1 Answers1

5

Use \@afterheading, which is what LaTeX does after section titles.

\documentclass{article}

\usepackage{multicol}

\makeatletter \newenvironment{teaser} {% \par\raggedright\sffamily } {% \par \rule{0.8\columnwidth}{1pt}\par\addvspace{2ex}% @afterheading } \makeatother

\begin{document}

\begin{center}\huge Title stuff \end{center}

\begin{multicols*}{2} \section{Word}

\begin{teaser} Stuff. Word, some text to fill the void. Here is a longer sentence, quite the long one. \end{teaser}

How do I have to define the new environment \verb|teaser| so that the first paragraph after it has no indentation?

Words words words words words words words words words words words words words. Words words words words. \end{multicols*}

\end{document}

enter image description here

egreg
  • 1,121,712
  • Thought I would try your code without \makeatletter & \makeatother, but it breaks. Why does Ulrike's code https://tex.stackexchange.com/questions/587108/how-can-i-create-a-new-environment-and-make-the-first-paragraph-after-it-without?noredirect=1#comment1475173_587108 work then? :) – henry Mar 13 '21 at 11:38
  • 1
    @henry Because she proposes \csname @afterheading\endcsname and with this it's immaterial whether the code is between \makeatletter and \makeatother or not. Is there something against \makeatletter? You're accessing an internal function of LaTeX, so you mark the code for making it clear. – egreg Mar 13 '21 at 11:44
  • Oh, there is not! I was just curious and broadening my LaTeX knowledge in order to once again go googling for it in 3 months when I forgot what was what (when I go through my document). ;) – henry Mar 13 '21 at 12:02