Kai Johannes Keller schrieb:

> Is it possible to have both (framed equations with and without number) in one
> environment?


things get complicated ... ;-)

> Is it possible to make the frames (or anything to distinguish framed and
> unframed equations) visible in LyX?

seems to be a problem with the preview package, because it
doesn't realize the redefinition of the math environments.

Angus, do you have an idea?

Attached a new addons.inc, which works for me with your
example file. But this solution needs package varwidth.sty,
available from ftp.dante.de. The problem is, that LaTeX
predefines the boxwidth with 0.6\textwidth, which is too
much for short math expressions.

next time, please send _minimal_ example files, means
kill all unimportant stuff from the preamble.

Herbert

# Extended textclass definition file. 
# Author : Herbert Voss <[EMAIL PROTECTED]> 20030809
# 
#===================================================================
# Style FramedEquation - Herbert Voss 20030809
#===================================================================
Style FramedEquation
  Margin                Static
  LatexType             Command
  LatexName             framedEquation
  Font
    Shape               Normal
    Color               blue
  EndFont
  Preamble
  \usepackage{varwidth}
  \newsavebox{\ggbox}
  \let\OldEquation\equation
  \let\OldEndEquation\endequation
  \let\OldEqn\[
  \let\OldEqn\]
  \def\restoreEquation{%
    \let\equation\OldEquation
    \let\endequation\OldEndEquation
    \let\[\OldEqn
    \let\]\OldEqn
  }
  \def\framedEquation#1{%
    \def\equation{%
      $$\refstepcounter{equation}%
      \begin{lrbox}{\ggbox}%
        $\displaystyle%
    }%
    \def\endequation{%
      $\end{lrbox}%
      \fbox{\usebox{\ggbox}}%
      \eqno [EMAIL PROTECTED]@ignoretrue%
    }%
    \def\[{%
      \begin{lrbox}{\ggbox}%
        \begin{varwidth}{\linewidth}
          \relax\ifmmode
            [EMAIL PROTECTED]
          \else
            \ifvmode
              \nointerlineskip
              \makebox[.1\linewidth]%
            \fi
            $$%%$$ BRACE MATCH HACK
          \fi%
    }%
    \def\]{%
      \relax\ifmmode
        \ifinner
          [EMAIL PROTECTED]
        \else
          $$%%$$ BRACE MATCH HACK
        \fi
      [EMAIL PROTECTED]
      \ignorespaces
      \end{varwidth}
      \end{lrbox}%
      \centerline{\fbox{\usebox{\ggbox}}}%
    }%
    #1%
    \restoreEquation%
  }
  EndPreamble
End


#LyX 1.3 created this file. For more info see http://www.lyx.org/
\lyxformat 221
\textclass book
\language ngerman
\inputencoding auto
\fontscheme default
\graphics default
\paperfontsize default
\spacing single 
\papersize Default
\paperpackage a4
\use_geometry 1
\use_amsmath 1
\use_natbib 1
\use_numerical_citations 0
\paperorientation portrait
\leftmargin 2cm
\rightmargin 2cm
\secnumdepth 2
\tocdepth 3
\paragraph_separation skip
\defskip medskip
\quotes_language english
\quotes_times 2
\papercolumns 1
\papersides 2
\paperpagestyle default

\layout Standard

If there's a number for the equation, the frame is displayed in dvi:
\layout FramedEquation


\begin_inset Formula \begin{equation}
\omega_{K}(\vec{v})=\sum_{i=1}^{3}K^{i}\cdot v^{i}=\vec{K}\cdot\vec{v}\equiv 
P\label{eq1}\end{equation}

\end_inset 


\layout Standard

But without number, there's no frame:
\layout FramedEquation


\begin_inset Formula \[
\alpha=\sum_{k=0}^{\infty}\beta_{k}\]

\end_inset 


\the_end

Reply via email to