8

I want to put an equation number to the right of a quote (the environment) as if it was an equation. I have looked at Equations with only text in them, How can I make LaTeX number my quotes and How do I label text with equation number. So far I have this MWE but it is not exactly what i'm looking for:

\documentclass{article}
\usepackage{blindtext}
\newcommand\IdeaOne[1]{%
  \begin{equation}\parbox{.85\textwidth}{#1}\end{equation}}
\makeatletter
\newenvironment{IdeaTwo}{%
  \list{}{\rightmargin\leftmargin}%
  \let\orig@item\item
  \def\item{
\orig@item[]\refstepcounter{equation}
\def\item{\hfill(\theequation)\orig@item[]\refstepcounter{equation}}}}
  {\hfill(\theequation)\endlist}
\makeatother
\begin{document}
\section{Normal text, quote and equation}
\blindtext\begin{quote}\blindtext\end{quote}\begin{equation}E=mc^2\end{equation}
\section{IdeaOne}
\IdeaOne{\blindtext}
\section{IdeaTwo}
\begin{IdeaTwo}
  \blindtext
\end{IdeaTwo}
\end{document}

The IdeaOne is pretty close but not exactly and I have to specify the size of the parbox manually. IdeaTwo gets the margins right but does not put the equation number like I want it. Does anyone know how to fix either of the two ideas?

I want to do this for a philosoohy text where some text is important and will be refered to like an equation in math text but the text is longer than one line (else I could use \begin{equation}\text{...}\end{equation}. Maybe somebody has some idea for a different approach.

7

Assuming that these numbered quote environments are at the top level and not nested in other list environments, you can exploit the fact that, unless your equation numbers are too wide, they will fit in the available white space; in case they are wider for fitting, you should redefine quote in the first place.

\documentclass{article}
\usepackage{blindtext}

\newsavebox\ideabox
\newenvironment{idea}
  {\begin{equation}
   \begin{lrbox}{\ideabox}
   \begin{minipage}{\dimexpr\columnwidth-2\leftmargini}
   \setlength{\leftmargini}{0pt}%
   \begin{quote}}
  {\end{quote}
   \end{minipage}
   \end{lrbox}\makebox[0pt]{\usebox{\ideabox}}
   \end{equation}}

\begin{document}
\begin{quote}\blindtext\end{quote}\begin{equation}E=mc^2\end{equation}

\begin{idea}
  \blindtext
\end{idea}
\end{document}

The “equationed” quote is typeset in a zero width box, so the equation number will not force a shift to the left.

enter image description here

  • Sadly I found a problem with this solution: Try \blindtext\begin{idea}\blindtext\end{idea}\blindtext to see that the vertical space around the idea is messed up (much smaler than with \blindtext\begin{quote}\blindtext\end{quote}\blindtext or \blindtext\begin{equation}\parbox{\whatever}{\blindtext}\end{equation}\blindtext). – Lucas Oct 2 '14 at 10:57
  • 1
    @lucas You shouldn't do \par before idea and \blindtext adds a final par. – egreg Oct 2 '14 at 10:59

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.