2

I'm writing a Cheatsheet with a lot of formulas and having paragraphs indent is just wasting space and doesn't look good at all, so I want to disable autoindentation. But sometimes I still want indentation in some cases (which aren't rare, but still rarer than I would type \noindent without any changes).

So far I've found this question, which in both answers says to use

\setlength{\parindent}{0pt}

But this prevents me from using \indent when I want it. So the actual questions would be. Is there a way for latex to default to \noindent and then use \indent when necessary?

Edit: I'd also like to add that I'm still very new to typesetting, so if what I'm asking for is bad practice, please let me know, and if possible, why.

  • 1
    Welcome to TeX.SX! Instead of \indent use \hspace*{20pt} (no space after it. – egreg Jun 24 '17 at 20:41
  • 1
    Comment aside: it's better to load the parskip package, which sets \arindent to 0pt AND adds some vertical skip between paragraphs, taking care of the vertical spacing in lists. – Bernard Jun 24 '17 at 20:45

1 Answers1

2

The following code saves the original meaning of \indent and redefines it. Inside a group it sets \parindent to the original value and calls the saved \indent:

\let\SavedIndent\indent
\protected\def\indent{%
  \begingroup
    \parindent=\the\parindent
    \SavedIndent
  \endgroup
}
\setlength{\parindent}{0pt}

Thus, like the original \indent the redefined indent starts a new paragraph if it is called in vertical mode. But it will not set the space in horizontal mode like the original.

Heiko Oberdiek
  • 271,626