Here's a version of the formula environment that works in LyX. \newcounter{formula} \newenvironment{Formula}% {% \begin{list}{\theformula}% {% \setlength{\labelwidth}{\leftmargin - \labelsep}% \let\olditem=\item% \renewcommand{\item}{\refstepcounter{formula}\olditem}% \renewcommand{\makelabel}[1]{(##1)\hfil}% }% } {% \end{list} } %End Formula environment
Note that this does not include the optional argument for creating a cross-reference, since that would not make so much sense in LyX. (The crossref would not appear in the references menu.) The issue in getting the formula environment to work in LyX is this. As I originally designed the environment (see my previous note), it was a one-item list. If you wanted more than one formula, you had to use the environment multiple times. But, in LyX, if you have successive Formula environments, where these are defined as List_Environments, they are treated as a /single/ Formula environment with multiple items. Wrong result, since LyX will then output a bunch of \item commands, whereas what we wanted was a bunch of \begin{Formula} commands. If you instead use "LatexType Environment", then you get a single environment with multiple paragraphs. (I've filed an enhancement request to resolve this issue.) The obvious thing to do would seem to be this: \newenvironment{Formula}[1][xxx]% {% \begin{list}{\theformula}% {% \setlength{\labelwidth}{\leftmargin - \labelsep}% \renewcommand{\makelabel}[1]{\refstepcounter{formula}(##1)\hfil}% }% } {% \end{list} } %End Formula environment So we're now stepping the counter /inside/ the \makelabel command, which is called by \item, so the counter gets stepped each time. Unfortunately, this simply doesn't work, because \refstepcounter doesn't seem to do what it's meant to do here. The solution that does work is the one above, where we redefine the \item command to step the counter there. Here's a layout, for those who are interested: Style Formula Margin First_Dynamic LatexType List_Environment LatexName Formula NextNoIndent 1 LabelSep xxxxxx LeftMargin MMM ParSkip 0.4 ItemSep 0.2 TopSep 0.7 BottomSep 0.7 ParSep 0.3 Align Block AlignPossible Block, Left LabelType Counter LabelCounter formula LabelString "(\arabic{formula})" LabelFont Shape Up Series Bold EndFont #define the environment Preamble \usepackage{calc} \usepackage{prettyref} \newcounter{formula} \newenvironment{Formula}% {% \begin{list}{\theformula}% {% \setlength{\labelwidth}{\leftmargin - \labelsep}% \let\olditem=\item% \renewcommand{\item}{\refstepcounter{formula}\olditem}% \renewcommand{\makelabel}[1]{(##1)\hfil}% }% } {% \end{list} } %End Formula environment \newrefformat{For}{(\ref{#1})} EndPreamble End Richard Heck