7

I am trying to do something like the following:

enter image description here

Does anyone have an example of a technique on how to do this? It needs to be centered in the middle of the paper like the $$ $$ environment and it would be a bonus if it can be labelled and referred to later on.

Werner
  • 603,163
masfenix
  • 1,429
  • A “real world” example might help: how to manage the text that stands for the usual variables depends on its nature; is it long? Is it just two lines to be centered with respect to each other? – egreg Sep 29 '13 at 10:03

1 Answers1

7

You can set the text inside a regular \parbox:

enter image description here

\documentclass{article}
\newcommand{\textbox}[3][c]{\parbox[#1]{#2}{\strut#3\strut}}
\begin{document}
\begin{equation}
  \left\{\textbox{2cm}{Here is some regular text}\right\} =
    \left\{\textbox{2cm}{Here is some more regular text}\right\} +
    \left\{\textbox{3cm}{This is the last piece of text in the equation}\right\} \label{eqn:myeqn}
\end{equation}
See~(\ref{eqn:myeqn}).
\end{document}

\parbox[<valign>]{<width>}{<stuff>} sets <stuff> in a paragraph box of width <width> and aligned vertically according to <valign> (top, centered or bottom). The use of \struts at the start/end tries to rectify the spacing problem associated with boxing. As reference, see How to keep a constant \baselineskip when using minipages (or \parboxes)?.

The idea behind using a macro called \textbox is an attempt to promote typesetting consistency.

Werner
  • 603,163