%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % Copyright (c) 2013 - Michiel Helvensteijn - www.mhelvens.net % % % % http://latex-noindentafter.googlecode.com % % % % This work may be distributed and/or modified under the % % conditions of the LaTeX Project Public License, either % % version 1.3 of this license or (at your option) any later % % version. The latest version of this license is in % % http://www.latex-project.org/lppl.txt % % and version 1.3 or later is part of all distributions of % % LaTeX version 2005/12/01 or later. % % % % This work has the LPPL maintenance status `maintained'. % % % % The Current Maintainer of this work is Michiel Helvensteijn. % % % % This work consists of the files noindentafter.tex and noindentafter.sty. % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \documentclass[a4paper]{packagedoc} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Setup % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \NoIndentAfterEnv{latex-example-show} \NoIndentAfterCmd{\describemacro} \moretexcs{% NoIndentAfterThis,NoIndentAfterEnv,NoIndentAfterCmd } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Global Changes % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \changes{0.0.1}{2013/08/02} {initial version} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{document} % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \maketitle %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \section{Introduction} % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Some people prefer certain LaTeX environments ---such as |itemize| or |theorem|--- never to be followed by an indented paragraph. It is of course possible to manually add the |\noindent| command to each occurrence, but it's easy to forget to do this. Also, all those |\noindent| commands leave your \TeX{} code just a little bit more chaotic and more burdensome to read. There are a number of solutions floating around, but many of them are not particularly robust, or only work in specific cases. The |noindentafter| package provides a few simple commands which can be used to patch existing macros and environments. They work as expected in all cases I've encountered. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \section{Usage} % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \noindent\DescribeMacro{\NoIndentAfterThis} % This is the most primitive macro offered by the package. It forces a paragraph break and suppresses indentation for whatever follows: \begin{latex-example-show} Lorem ipsum dolor sit amet, consectetur adipiscing elit. \NoIndentAfterThis Pellentesque hendrerit volutpat feugiat. Ut purus leo, pulvinar sit amet vehicula non, pulvinar eu lacus. Curabitur id mollis ligula. \end{latex-example-show} \pagebreak % Hack to make the footnote appear on page 1. \describemacro{\NoIndentAfterEnv}{\marg{environment}} This is probably the command most people will want to use. The \meta{environment} argument should contain an environment name. After using this command, any paragraph following such an environment will remain unindented. \begin{latex-example-show} Lorem ipsum dolor sit amet, consectetur adipiscing elit. \begin{itemize} \item First Item \item Second Item \end{itemize} Pellentesque hendrerit volutpat feugiat. Ut purus leo, pulvinar sit amet vehicula non, pulvinar eu lacus. Curabitur id mollis ligula. \NoIndentAfterEnv{itemize} Vestibulum id erat venenatis, facilisis enim non, consectetur felis. Quisque iaculis eu arcu non pretium. \begin{itemize} \item Third Item \item Fourth Item \end{itemize} Curabitur est elit, posuere pulvinar laoreet sed, varius id mi. Nam lobortis elit nec mauris condimentum gravida. \end{latex-example-show} You'll probably want to use these commands in the document preamble but, as you can see, you don't really have to. \needspace{10\baselineskip} Note that using the |\NoIndentAfterEnv| command on your own environment is not the same as adding |\NoIndentAfterThis| to the end of it: \begin{latex-example-show} \newenvironment{test}{\itshape}{\NoIndentAfterThis} \begin{test} Lorem ipsum dolor sit amet, consectetur adipiscing elit. \end{test} Pellentesque hendrerit volutpat feugiat. Ut purus leo, pulvinar sit amet vehicula non, pulvinar eu lacus. Curabitur id mollis ligula. \end{latex-example-show} |\NoIndentAfterEnv| works because it bypasses the group that surrounds every \LaTeX{} environment (and localizes declarations). \describemacro{\NoIndentAfterCmd}{\marg{command}} Finally, you may also patch command sequences using the |\NoIndentAfterCmd| command. There may not be many situations where this is useful, but for me, there is at least one: \begin{latex-example-show} Lorem ipsum dolor sit amet, consectetur adipiscing elit: \[ 1 + 1 = 2 \] Pellentesque hendrerit volutpat feugiat. Ut purus leo: \NoIndentAfterCmd \] \[ 2 + 2 = 4 \] Vestibulum id erat venenatis, facilisis enim non, consectetur felis. \end{latex-example-show} Note that braces around the \meta{command} argument are optional, as always when an argument in \TeX{} consists of only a single token. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \section{Acknowledgements} % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% I had been looking for a solution like this for quite a while. I came up with a number of hacks that workedin some situations but not in others. Eventually I asked a question on \url{http://tex.stackexchange.com}: \begin{itemize} \item \url{http://tex.stackexchange.com/questions/112404} \end{itemize} I received two excellent answers -- one from cgnieder and one from lockstep. This package is based on the technique proposed by cgnieder, as it is simpler and more generally applicable. Still, the answer by lockstep is definitely worth a read. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \end{document} % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%