# Defining My Own Display Environment

I would like to define an environment for displaying content, similar to display math mode or perhaps resembling the figure environment.

I can get as far as centring the contents as in this MWE:

\documentclass[12pt]{article}
\usepackage[margin=1.8cm]{geometry}
\geometry{a4paper}
\usepackage[parfill]{parskip}

\newenvironment{displayme}{\begin{center}}{\end{center}}

\begin{document}

Hello there!

\begin{displayme}
Hi
\end{displayme}

Hi!

\end{document}


But of course display math mode adds nice spacing around the equation with (I think) abovedisplayskip and belowdisplayskip but I'm not sure exactly how display math mode is defined and what values it uses where and so on and so forth.

Can it be replicated?

• the standard latex text display environments such as center, quote etc already add vertical space (topsep or partpsep, depending) do you need your environment to us ethe math settings abovedisplayskip ? – David Carlisle Nov 21 '18 at 20:08

You can define displayme to be similar to $...$ but also put its contents inside a tabular. The result is that the display will be in text mode.

\documentclass{article}

\newenvironment{displayme}
{$\begin{tabular}{@{}c@{}}} { \end{tabular}$}

\begin{document}

Hello there!
\begin{displayme}
Hi
\end{displayme}
Hi!

\end{document}


Note: Display math equations should form part of your paragraph style/flow and therefore should form part of the sentence structure. As such, it's rare to have it preceded by a blank line.