[Tex/LaTex] Indenting a single paragraph in a document of no indentation

indentation

I have several paragraphs of text in a LaTeX document. In my preamble I have \setlength{\parindent}{0pt}, but now I have a need to indent a single paragraph for emphasis.

I am wondering if there a more efficient way of doing this than:

     This paragraph is not indented.
\setlength{\parindent}{15pt}
     Here is my indented paragraph.
\setlength{\parindent}{0pt}
     And we're back to no indentation.

I feel as though there should be a simpler way to do this. Had I not changed the length in my preamble the document would by default indent all the paragraphs, but I could turn this off a single paragraph by using \noindent at the start. Why doesn't \indent work in the opposite way, and revert that paragraph to the default indentation?

Best Answer

I don't think that using indentation "for emphasis" is a good idea. I prefer indented paragraphs and zero paragraph skip, but I know that somebody has different opinions.

However, I believe that one should either using indentation always (with the usual exceptions, for instance after section titles) or never.

If you really want to confuse your reader ;-), here's a way. Note that \indent just adds an empty box of width \parindent, so if you set the parameter to zero, nothing will be visible. The trick is to reset \parindent locally, the closing additional brace will reset it to zero.

\documentclass{article}
\setlength{\parindent}{0pt}
\newcommand{\forceindent}{\leavevmode{\parindent=1em\indent}}

\begin{document}

This is not indented.

\forceindent This is indented.

This is not indented.

\end{document}

enter image description here

Note. Thanks to Frank Mittelbach for having spotted a problem in the simpler solution without \leavevmode that would deliver the \everypar tokens inside a group. With \leavevmode there will be two "indent boxes", one of zero width, followed by what's possibly inserted by \everypar and then the new indent box.

Another possibility could be to not doing anything inside a group:

\newcommand{\forceindent}{\parindent=1em\indent\parindent=0pt\relax}