# Little indentation despite \noindent after tabu custom-environment

this question is about a (to me) mysterious little indent (looks like an ordinary blank...) after a custom-environment using the tabu-environment.

\documentclass[a4paper, 11pt]{scrbook}
\usepackage{blindtext}
\usepackage[cm]{fullpage}

\usepackage{tabu, booktabs}

\newenvironment{texttab}[1]{
\par\centering
\begin{tabu} to 0.9\textwidth {#1} \toprule \rowfont{\bfseries}}
{\end{tabu}\par\noindent}

\begin{document}
\section{TEST}
\blindtext
%
\begin{texttab}{X[l,2] X[l,2] X[l,3]}
Test1   &   Test2   &   Test3   \\ \midrule
Test1   &   Test2   &   Test3   \\
Test1   &   Test2   &   Test3   \\ \bottomrule
\end{texttab}
%
HERE HAPPENS INDENT\blindtext
\end{document}


Following the answers from similar questions I put % into the blank lines and \noindent works fine here. However, there is this little blank-like indentation of the paragraph after the table.

I figured out that I can make it disappear when adding a % after the \end part in the text, so:

<table content> \\ \bottomrule
\end{texttab}% (!)
%
NOINDENT THIS TIME...


Please explain; how is this? Can I somehow include the solution into the definition of the environment or is it necessary to put that % everytime I use this environment?

The reason that the newline after the environment acts as a space is because you have used \noindent which is prematurely putting TeX in horizontal mode so as always in that mode ends of lines produce word spaces.

You can counteract that by going

            {\end{tabu}\par\noindent\ignorespacesafterend}


But this is really the wrong way to do things, having \noindent there means that you can not have a blank line after the environment or you get a spurious white paragraph. Note you needed % before HERE

All LaTeX display environments handle suppressing indentation, just use

\documentclass[a4paper, 11pt]{scrbook}
\usepackage{blindtext}
\usepackage[cm]{fullpage}

\usepackage{tabu, booktabs}

\newenvironment{texttab}[1]{
\begin{center}%
\begin{tabu} to 0.9\textwidth {#1} \toprule \rowfont{\bfseries}}
{\end{tabu}\end{center}}

\begin{document}
\section{TEST}
\blindtext
%
\begin{texttab}{X[l,2] X[l,2] X[l,3]}
Test1   &   Test2   &   Test3   \\ \midrule
Test1   &   Test2   &   Test3   \\
Test1   &   Test2   &   Test3   \\ \bottomrule
\end{texttab}
%
HERE HAPPENS INDENT\blindtext
\end{document}


Then you will get no indentation for HERE if there is no blank line before it, but if you do have a blank line because in some cases you want to start a paragraph there, you will get indentation.

• Hmm, I already had a solution using center-environment, however, when I use longtabu there comes this problem with spacing which I tried to avoid by using \centering. It seems I have to use center or place that ominous %, which is, as you say, not a "nice way"...? – LCsa Aug 16 '13 at 11:14
• @LCsa You can use a list environment with the vertical spacing sent to 0 rather than the default center environment (ie set \parsep, \partopsep to 0pt) – David Carlisle Aug 16 '13 at 11:30
• I don't understand... Why a list-environment? – LCsa Aug 16 '13 at 18:58
• the list environment is mis-named, it is not (just) for making lists it is the generic latex display environment base, in particular for handling this indentation issue, center, flushright, verbatim, tabbing are all (triv)list environments see tex.stackexchange.com/questions/5661/… and tex.stackexchange.com/questions/89633/… – David Carlisle Aug 16 '13 at 20:29

Somewhere inside tabu there is a sporadic space or a missing \ignorespaces or \ignorespacesafterend

Adding \ignorespaces right after \end{texttab} seems to work

• Well, this has the same effect as the %... Any idea about a solution to embed in the definition of the environment (preamble)? I tried to place \noindent at various places there - to no avail. – LCsa Aug 16 '13 at 8:51
• No idea, \noindent will never work as it is not indentation that is the problem. – daleif Aug 16 '13 at 9:15
• It is the \noindent that is causing the space to appear:-) – David Carlisle Aug 16 '13 at 9:25