2

vertical spacing is witchcraft, as far as I can tell. I have put in everything that I could think of that could possibly force the explain environment contents to be tightly vertically spaced. It works in the main text. The macros themselves inside the explain environment are working, too. alas, the environment definition itself does not when inside the table. huh?

\documentclass{article}

\usepackage{setspace}

\newenvironment{explain}{%
  \medskip\par%
  \renewcommand{\baselinestretch}{0.1}
  \setstretch{0.1}
  \large\mbox{X}\footnotesize
  }{%
}

\setstretch{0.1}


\begin{document}

\begin{table}

\begin{explain}
  This fails. This is the time. This is the time. This is the time. This is the time. This is the time. This is the time. This is the time. This is the time. This is the time. This is the time.
\end{explain}

\end{table}

\begin{table}

  \renewcommand{\baselinestretch}{0.1}
  \setstretch{0.1}
  \large\mbox{Y}\footnotesize
  This works.  This is the time. This is the time. This is the time. This is the time. This is the time. This is the time. This is the time. This is the time. This is the time. This is the time.


\end{table}



\begin{explain}
  This works.  This is the time.  This is the time. This is the time. This is the time. This is the time. This is the time. This is the time. This is the time. This is the time. This is the time.
\end{explain}

\end{document}

what did I do wrong (this time)??

1
  • try ending the environment with \par. Mar 17 '14 at 19:09
5

The line spacing of a paragraph is done, when TeX breaks the paragraph into lines. This happens at the end of the paragraph.

In the case of the question, environment explain uses \setstretch{0.1} and \footnotesize. At the end of the environment, the paragraph has not yet ended, but the environment does. Therefore the local settings of the environment are lost and the paragraph end by the next empty line uses the settings that are active after (= before, = outside) the environment.

As Barbara Beeton said in her comment, \par in the end part helps (if it is ok, if the environment ends the paragraph).

\newenvironment{explain}{%
  \par
  \medskip
  ... \footnotesize
}{%
  \par
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.